1/*! For license information please see main.32f6ad45.js.LICENSE.txt */ 2(()=>{var e={4:(e,t,s)=>{"use strict";var a=s(853),n=s(43),l=s(950);function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function o(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(s=t.return),e=t.return}while(e)}return 3===t.tag?s:null}function c(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function d(e){if(31===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function u(e){if(o(e)!==e)throw Error(r(188))}function m(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=m(e)))return t;e=e.sibling}return null}var h=Object.assign,x=Symbol.for("react.element"),p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),y=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),D=Symbol.for("react.lazy");Symbol.for("react.scope");var _=Symbol.for("react.activity");Symbol.for("react.legacy_hidden"),Symbol.for("react.tracing_marker");var S=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var E=Symbol.iterator;function A(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=E&&e[E]||e["@@iterator"])?e:null}var F=Symbol.for("react.client.reference");function T(e){if(null==e)return null;if("function"===typeof e)return e.$$typeof===F?null:e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case f:return"Fragment";case b:return"Profiler";case v:return"StrictMode";case w:return"Suspense";case C:return"SuspenseList";case _:return"Activity"}if("object"===typeof e)switch(e.$$typeof){case g:return"Portal";case y:return e.displayName||"Context";case j:return(e._context.displayName||"Context")+".Consumer";case N:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case k:return null!==(t=e.displayName||null)?t:T(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return T(e(t))}catch(s){}}return null}var z=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},R=[],L=-1;function I(e){return{current:e}}function O(e){0>L||(e.current=R[L],R[L]=null,L--)}function U(e,t){L++,R[L]=e.current,e.current=t}var H,W,V=I(null),q=I(null),$=I(null),G=I(null);function K(e,t){switch(U($,t),U(q,e),U(V,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?fu(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=vu(t=fu(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}O(V),U(V,e)}function Y(){O(V),O(q),O($)}function J(e){null!==e.memoizedState&&U(G,e);var t=V.current,s=vu(t,e.type);t!==s&&(U(q,e),U(V,s))}function Q(e){q.current===e&&(O(V),O(q)),G.current===e&&(O(G),dm._currentValue=B)}function X(e){if(void 0===H)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||"",W=-1<s.stack.indexOf("\n at")?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+H+e+W}var Z=!1;function ee(e,t){if(!e||Z)return"";Z=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(n){var a=n}Reflect.construct(e,[],s)}else{try{s.call()}catch(l){a=l}e.call(s.prototype)}}else{try{throw Error()}catch(r){a=r}(s=e())&&"function"===typeof s.catch&&s.catch(function(){})}}catch(i){if(i&&a&&"string"===typeof i.stack)return[i.stack,a.stack]}
vendor: 5,731 bytes, line 2
2return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=a.DetermineComponentFrameRoot(),r=l[0],i=l[1];if(r&&i){var o=r.split("\n"),c=i.split("\n");for(n=a=0;a<o.length&&!o[a].includes("DetermineComponentFrameRoot");)a++;for(;n<c.length&&!c[n].includes("DetermineComponentFrameRoot");)n++;if(a===o.length||n===c.length)for(a=o.length-1,n=c.length-1;1<=a&&0<=n&&o[a]!==c[n];)n--;for(;1<=a&&0<=n;a--,n--)if(o[a]!==c[n]){if(1!==a||1!==n)do{if(a--,0>--n||o[a]!==c[n]){var d="\n"+o[a].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}}while(1<=a&&0<=n);break}}}finally{Z=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?X(s):""}function te(e,t){switch(e.tag){case 26:case 27:case 5:return X(e.type);case 16:return X("Lazy");case 13:return e.child!==t&&null!==t?X("Suspense Fallback"):X("Suspense");case 19:return X("SuspenseList");case 0:case 15:return ee(e.type,!1);case 11:return ee(e.type.render,!1);case 1:return ee(e.type,!0);case 31:return X("Activity");default:return""}}function se(e){try{var t="",s=null;do{t+=te(e,s),s=e,e=e.return}while(e);return t}catch(a){return"\nError generating stack: "+a.message+"\n"+a.stack}}var ae=Object.prototype.hasOwnProperty,ne=a.unstable_scheduleCallback,le=a.unstable_cancelCallback,re=a.unstable_shouldYield,ie=a.unstable_requestPaint,oe=a.unstable_now,ce=a.unstable_getCurrentPriorityLevel,de=a.unstable_ImmediatePriority,ue=a.unstable_UserBlockingPriority,me=a.unstable_NormalPriority,he=a.unstable_LowPriority,xe=a.unstable_IdlePriority,pe=a.log,ge=a.unstable_setDisableYieldValue,fe=null,ve=null;function be(e){if("function"===typeof pe&&ge(e),ve&&"function"===typeof ve.setStrictMode)try{ve.setStrictMode(fe,e)}catch(t){}}var je=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(ye(e)/Ne|0)|0},ye=Math.log,Ne=Math.LN2;var we=256,Ce=262144,ke=4194304;function De(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _e(e,t,s){var a=e.pendingLanes;if(0===a)return 0;var n=0,l=e.suspendedLanes,r=e.pingedLanes;e=e.warmLanes;var i=134217727&a;return 0!==i?0!==(a=i&~l)?n=De(a):0!==(r&=i)?n=De(r):s||0!==(s=i&~e)&&(n=De(s)):0!==(i=a&~l)?n=De(i):0!==r?n=De(r):s||0!==(s=a&~e)&&(n=De(s)),0===n?0:0!==t&&t!==n&&0===(t&l)&&((l=n&-n)>=(s=t&-t)||32===l&&0!==(4194048&s))?t:n}function Se(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Ee(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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+5e3;default:return-1}}function Ae(){var e=ke;return 0===(62914560&(ke<<=1))&&(ke=4194304),e}function Fe(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function Te(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ze(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-je(t);e.entangledLanes|=t,e.entanglements[a]=1073741824|e.entanglements[a]|261930&s}function Me(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var a=31-je(s),n=1<<a;n&t|e[a]&t&&(e[a]|=t),s&=~n}}function Pe(e,t){var s=t&-t;return 0!==((s=0!==(42&s)?1:Be(s))&(e.suspendedLanes|t))?0:s}function Be(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Re(e){return 2<(e&=-e)?8<e?0!==(134217727&e)?32:268435456:8:2}function Le(){var e=P.p;return 0!==e?e:void 0===(e=window.event)?32:Dm(e.type)}function Ie(e,t){var s=P.p;try{return P.p=e,t()}finally{P.p=s}}var Oe=Math.random().toString(36).slice(2),Ue="__reactFiber$"+Oe,He="__reactProps$"+Oe,We="__reactContainer$"+Oe,Ve="__reactEvents$"+Oe,qe="__reactListeners$"+Oe,$e="__reactHandles$"+Oe,Ge="__reactResources$"+Oe,Ke="__reactMarker$"+Oe;function Ye(e){delete e[Ue],delete e[He],delete e[Ve],delete e[qe],delete e[$e]}function Je(e){var t=e[Ue];if(t)return t;for(var s=e.parentNode;s;){if(t=s[We]||s[Ue]){if(s=t.alternate,null!==t.child||null!==s&&null!==s.child)for(e=Bu(e);null!==e;){if(s=e[Ue])return s;e=Bu(e)}return t}s=(e=s).parentNode}return null}function Qe(e){if(e=e[Ue]||e[We]){var t=e.tag;if(5===t||6===t||13===t||31===t||26===t||27===t||3===t)return e}return null}function Xe(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(r(33))}function Ze(e){var t=e[Ge];return t||(t=e[Ge]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function et(e){e[Ke]=!0}var tt=new Set,st={};function at(e,t){nt(e,t),nt(e+"Capture",t)}function nt(e,t){for(st[e]=t,e=0;e<t.length;e++)tt.add(t[e])}var lt=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
2037D\\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]*$"),rt={},it={};function ot(e,t,s){if(n=t,ae.call(it,n)||!ae.call(rt,n)&&(lt.test(n)?it[n]=!0:(rt[n]=!0,0)))if(null===s)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var a=t.toLowerCase().slice(0,5);if("data-"!==a&&"aria-"!==a)return void e.removeAttribute(t)}e.setAttribute(t,""+s)}var n}function ct(e,t,s){if(null===s)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+s)}}function dt(e,t,s,a){if(null===a)e.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(s)}e.setAttributeNS(t,s,""+a)}}function ut(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function mt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ht(e){if(!e._valueTracker){var t=mt(e)?"checked":"value";e._valueTracker=function(e,t,s){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&"undefined"!==typeof a&&"function"===typeof a.get&&"function"===typeof a.set){var n=a.get,l=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(e){s=""+e,l.call(this,e)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return s},setValue:function(e){s=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e,t,""+e[t])}}function xt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),a="";return e&&(a=mt(e)?e.checked?"true":"false":e.value),(e=a)!==s&&(t.setValue(e),!0)}function pt(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var gt=/[\n"\\]/g;function ft(e){return e.replace(gt,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function vt(e,t,s,a,n,l,r,i){e.name="",null!=r&&"function"!==typeof r&&"symbol"!==typeof r&&"boolean"!==typeof r?e.type=r:e.removeAttribute("type"),null!=t?"number"===r?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ut(t)):e.value!==""+ut(t)&&(e.value=""+ut(t)):"submit"!==r&&"reset"!==r||e.removeAttribute("value"),null!=t?jt(e,r,ut(t)):null!=s?jt(e,r,ut(s)):null!=a&&e.removeAttribute("value"),null==n&&null!=l&&(e.defaultChecked=!!l),null!=n&&(e.checked=n&&"function"!==typeof n&&"symbol"!==typeof n),null!=i&&"function"!==typeof i&&"symbol"!==typeof i&&"boolean"!==typeof i?e.name=""+ut(i):e.removeAttribute("name")}function bt(e,t,s,a,n,l,r,i){if(null!=l&&"function"!==typeof l&&"symbol"!==typeof l&&"boolean"!==typeof l&&(e.type=l),null!=t||null!=s){if(!("submit"!==l&&"reset"!==l||void 0!==t&&null!==t))return void ht(e);s=null!=s?""+ut(s):"",t=null!=t?""+ut(t):s,i||t===e.value||(e.value=t),e.defaultValue=t}a="function"!==typeof(a=null!=a?a:n)&&"symbol"!==typeof a&&!!a,e.checked=i?e.checked:!!a,e.defaultChecked=!!a,null!=r&&"function"!==typeof r&&"symbol"!==typeof r&&"boolean"!==typeof r&&(e.name=r),ht(e)}function jt(e,t,s){"number"===t&&pt(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function yt(e,t,s,a){if(e=e.options,t){t={};for(var n=0;n<s.length;n++)t["$"+s[n]]=!0;for(s=0;s<e.length;s++)n=t.hasOwnProperty("$"+e[s].value),e[s].selected!==n&&(e[s].selected=n),n&&a&&(e[s].defaultSelected=!0)}else{for(s=""+ut(s),t=null,n=0;n<e.length;n++){if(e[n].value===s)return e[n].selected=!0,void(a&&(e[n].defaultSelected=!0));null!==t||e[n].disabled||(t=e[n])}null!==t&&(t.selected=!0)}}function Nt(e,t,s){null==t||((t=""+ut(t))!==e.value&&(e.value=t),null!=s)?e.defaultValue=null!=s?""+ut(s):"":e.defaultValue!==t&&(e.defaultValue=t)}
vendor: 4,421 bytes, line 2
2function wt(e,t,s,a){if(null==t){if(null!=a){if(null!=s)throw Error(r(92));if(z(a)){if(1<a.length)throw Error(r(93));a=a[0]}s=a}null==s&&(s=""),t=s}s=ut(t),e.defaultValue=s,(a=e.textContent)===s&&""!==a&&null!==a&&(e.value=a),ht(e)}function Ct(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&3===s.nodeType)return void(s.nodeValue=t)}e.textContent=t}var kt=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Dt(e,t,s){var a=0===t.indexOf("--");null==s||"boolean"===typeof s||""===s?a?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":a?e.setProperty(t,s):"number"!==typeof s||0===s||kt.has(t)?"float"===t?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function _t(e,t,s){if(null!=t&&"object"!==typeof t)throw Error(r(62));if(e=e.style,null!=s){for(var a in s)!s.hasOwnProperty(a)||null!=t&&t.hasOwnProperty(a)||(0===a.indexOf("--")?e.setProperty(a,""):"float"===a?e.cssFloat="":e[a]="");for(var n in t)a=t[n],t.hasOwnProperty(n)&&s[n]!==a&&Dt(e,n,a)}else for(var l in t)t.hasOwnProperty(l)&&Dt(e,l,t[l])}function St(e){if(-1===e.indexOf("-"))return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Et=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode
2-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),At=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ft(e){return At.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Tt(){}var zt=null;function Mt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Pt=null,Bt=null;function Rt(e){var t=Qe(e);if(t&&(e=t.stateNode)){var s=e[He]||null;e:switch(e=t.stateNode,t.type){case"input":if(vt(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,"radio"===s.type&&null!=t){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+ft(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var a=s[t];if(a!==e&&a.form===e.form){var n=a[He]||null;if(!n)throw Error(r(90));vt(a,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name)}}for(t=0;t<s.length;t++)(a=s[t]).form===e.form&&xt(a)}break e;case"textarea":Nt(e,s.value,s.defaultValue);break e;case"select":null!=(t=s.value)&&yt(e,!!s.multiple,t,!1)}}}var Lt=!1;function It(e,t,s){if(Lt)return e(t,s);Lt=!0;try{return e(t)}finally{if(Lt=!1,(null!==Pt||null!==Bt)&&(Zc(),Pt&&(t=Pt,e=Bt,Bt=Pt=null,Rt(t),e)))for(t=0;t<e.length;t++)Rt(e[t])}}function Ot(e,t){var s=e.stateNode;if(null===s)return null;var a=s[He]||null;if(null===a)return null;s=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(a=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!a;break e;default:e=!1}if(e)return null;if(s&&"function"!==typeof s)throw Error(r(231,t,typeof s));return s}var Ut=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),Ht=!1;if(Ut)try{var Wt={};Object.defineProperty(Wt,"passive",{get:function(){Ht=!0}}),window.addEventListener("test",Wt,Wt),window.removeEventListener("test",Wt,Wt)}catch(Qm){Ht=!1}var Vt=null,qt=null,$t=null;function Gt(){if($t)return $t;var e,t,s=qt,a=s.length,n="value"in Vt?Vt.value:Vt.textContent,l=n.length;for(e=0;e<a&&s[e]===n[e];e++);var r=a-e;for(t=1;t<=r&&s[a-t]===n[l-t];t++);return $t=n.slice(e,1<t?1-t:void 0)}function Kt(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Yt(){return!0}function Jt(){return!1}function Qt(e){function t(t,s,a,n,l){for(var r in this._reactName=t,this._targetInst=a,this.type=s,this.nativeEvent=n,this.target=l,this.currentTarget=null,e)e.hasOwnProperty(r)&&(t=e[r],this[r]=t?t(n):n[r]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?Yt:Jt,this.isPropagationStopped=Jt,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Yt)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Yt)},persist:function(){},isPersistent:Yt}),t}var Xt,Zt,es,ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ss=Qt(ts),as=h({},ts,{view:0,detail:0}),ns=Qt(as),ls=h({},as,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gs,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.from
vendor: 4,404 bytes, line 2
2Element===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==es&&(es&&"mousemove"===e.type?(Xt=e.screenX-es.screenX,Zt=e.screenY-es.screenY):Zt=Xt=0,es=e),Xt)},movementY:function(e){return"movementY"in e?e.movementY:Zt}}),rs=Qt(ls),is=Qt(h({},ls,{dataTransfer:0})),os=Qt(h({},as,{relatedTarget:0})),cs=Qt(h({},ts,{animationName:0,elapsedTime:0,pseudoElement:0})),ds=Qt(h({},ts,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),us=Qt(h({},ts,{data:0})),ms={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hs={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xs={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ps(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=xs[e])&&!!t[e]}function gs(){return ps}var fs=Qt(h({},as,{key:function(e){if(e.key){var t=ms[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Kt(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?hs[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gs,charCode:function(e){return"keypress"===e.type?Kt(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Kt(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),vs=Qt(h({},ls,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),bs=Qt(h({},as,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gs})),js=Qt(h({},ts,{propertyName:0,elapsedTime:0,pseudoElement:0})),ys=Qt(h({},ls,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Ns=Qt(h({},ts,{newState:0,oldState:0})),ws=[9,13,27,32],Cs=Ut&&"CompositionEvent"in window,ks=null;Ut&&"documentMode"in document&&(ks=document.documentMode);var Ds=Ut&&"TextEvent"in window&&!ks,_s=Ut&&(!Cs||ks&&8<ks&&11>=ks),Ss=String.fromCharCode(32),Es=!1;function As(e,t){switch(e){case"keyup":return-1!==ws.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fs(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Ts=!1;var zs={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ms(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!zs[e.type]:"textarea"===t}function Ps(e,t,s,a){Pt?Bt?Bt.push(a):Bt=[a]:Pt=a,0<(t=au(t,"onChange")).length&&(s=new ss("onChange","change",null,s,a),e.push({event:s,listeners:t}))}var Bs=null,Rs=null;function Ls(e){Yd(e,0)}function Is(e){if(xt(Xe(e)))return e}function Os(e,t){if("change"===e)return t}var Us=!1;if(Ut){var Hs;if(Ut){var Ws="oninput"in document;if(!Ws){var Vs=document.createElement("div");Vs.setAttribute("oninput","return;"),Ws="function"===typeof Vs.oninput}Hs=Ws}else Hs=!1;Us=Hs&&(!document.documentMode||9<document.documentMode)}function qs(){Bs&&(Bs.detachEvent("onpropertychange",$s),Rs=Bs=null)}function $s(e){if("value"===e.propertyName&&Is(Rs)){var t=[];Ps(t,Rs,e,Mt(e)),It(Ls,t)}}function Gs(e,t,s){"focusin"===e?(qs(),Rs=s,(Bs=t).attachEvent("onpropertychange",$s)):"focusout"===e&&qs()}function Ks(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Is(Rs)}function Ys(e,t){if("click"===e)return Is(t)}function Js(e,t){if("input"===e||"change"===e)return Is(t)}var Qs="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t};function Xs(e,t){if(Qs(e,t))return!0;
vendor: 4,633 bytes, line 2
2if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;for(a=0;a<s.length;a++){var n=s[a];if(!ae.call(t,n)||!Qs(e[n],t[n]))return!1}return!0}function Zs(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ea(e,t){var s,a=Zs(e);for(e=0;a;){if(3===a.nodeType){if(s=e+a.textContent.length,e<=t&&s>=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Zs(a)}}function ta(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ta(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function sa(e){for(var t=pt((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var s="string"===typeof t.contentWindow.location.href}catch(a){s=!1}if(!s)break;t=pt((e=t.contentWindow).document)}return t}function aa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var na=Ut&&"documentMode"in document&&11>=document.documentMode,la=null,ra=null,ia=null,oa=!1;function ca(e,t,s){var a=s.window===s?s.document:9===s.nodeType?s:s.ownerDocument;oa||null==la||la!==pt(a)||("selectionStart"in(a=la)&&aa(a)?a={start:a.selectionStart,end:a.selectionEnd}:a={anchorNode:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset},ia&&Xs(ia,a)||(ia=a,0<(a=au(ra,"onSelect")).length&&(t=new ss("onSelect","select",null,t,s),e.push({event:t,listeners:a}),t.target=la)))}function da(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var ua={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionrun:da("Transition","TransitionRun"),transitionstart:da("Transition","TransitionStart"),transitioncancel:da("Transition","TransitionCancel"),transitionend:da("Transition","TransitionEnd")},ma={},ha={};function xa(e){if(ma[e])return ma[e];if(!ua[e])return e;var t,s=ua[e];for(t in s)if(s.hasOwnProperty(t)&&t in ha)return ma[e]=s[t];return e}Ut&&(ha=document.createElement("div").style,"AnimationEvent"in window||(delete ua.animationend.animation,delete ua.animationiteration.animation,delete ua.animationstart.animation),"TransitionEvent"in window||delete ua.transitionend.transition);var pa=xa("animationend"),ga=xa("animationiteration"),fa=xa("animationstart"),va=xa("transitionrun"),ba=xa("transitionstart"),ja=xa("transitioncancel"),ya=xa("transitionend"),Na=new Map,wa="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ca(e,t){Na.set(e,t),at(t,[e])}wa.push("scrollEnd");var ka="function"===typeof reportError?reportError:function(e){if("object"===typeof window&&"function"===typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"===typeof e&&null!==e&&"string"===typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"===typeof process&&"function"===typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},Da=[],_a=0,Sa=0;function Ea(){for(var e=_a,t=Sa=_a=0;t<e;){var s=Da[t];Da[t++]=null;var a=Da[t];Da[t++]=null;var n=Da[t];Da[t++]=null;var l=Da[t];if(Da[t++]=null,null!==a&&null!==n){var r=a.pending;null===r?n.next=n:(n.next=r.next,r.next=n),a.pending=n}0!==l&&za(s,n,l)}}function Aa(e,t,s,a){Da[_a++]=e,Da[_a++]=t,Da[_a++]=s,Da[_a++]=a,Sa|=a,e.lanes|=a,null!==(e=e.alternate)&&(e.lanes|=a)}function Fa(e,t,s,a){return Aa(e,t,s,a),Ma(e)}function Ta(e,t){return Aa(e,null,null,t),Ma(e)}function za(e,t,s){e.lanes|=s;var a=e.alternate;null!==a&&(a.lanes|=s);for(var n=!1,l=e.return;null!==l;
vendor: 17,038 bytes, line 2
2)l.childLanes|=s,null!==(a=l.alternate)&&(a.childLanes|=s),22===l.tag&&(null===(e=l.stateNode)||1&e._visibility||(n=!0)),e=l,l=l.return;return 3===e.tag?(l=e.stateNode,n&&null!==t&&(n=31-je(s),null===(a=(e=l.hiddenUpdates)[n])?e[n]=[t]:a.push(t),t.lane=536870912|s),l):null}function Ma(e){if(50<Vc)throw Vc=0,qc=null,Error(r(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Pa={};function Ba(e,t,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ra(e,t,s,a){return new Ba(e,t,s,a)}function La(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Ia(e,t){var s=e.alternate;return null===s?((s=Ra(e.tag,t,e.key,e.mode)).elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=65011712&e.flags,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function Oa(e,t){e.flags&=65011714;var s=e.alternate;return null===s?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ua(e,t,s,a,n,l){var i=0;if(a=e,"function"===typeof e)La(e)&&(i=1);else if("string"===typeof e)i=function(e,t,s){if(1===s||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!==typeof t.precedence||"string"!==typeof t.href||""===t.href)break;return!0;case"link":if("string"!==typeof t.rel||"string"!==typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"===typeof t.precedence&&null==e);case"script":if(t.async&&"function"!==typeof t.async&&"symbol"!==typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"===typeof t.src)return!0}return!1}(e,s,V.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case _:return(e=Ra(31,s,t,n)).elementType=_,e.lanes=l,e;case f:return Ha(s.children,n,l,t);case v:i=8,n|=24;break;case b:return(e=Ra(12,s,t,2|n)).elementType=b,e.lanes=l,e;case w:return(e=Ra(13,s,t,n)).elementType=w,e.lanes=l,e;case C:return(e=Ra(19,s,t,n)).elementType=C,e.lanes=l,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case y:i=10;break e;case j:i=9;break e;case N:i=11;break e;case k:i=14;break e;case D:i=16,a=null;break e}i=29,s=Error(r(130,null===e?"null":typeof e,"")),a=null}return(t=Ra(i,s,t,n)).elementType=e,t.type=a,t.lanes=l,t}function Ha(e,t,s,a){return(e=Ra(7,e,a,t)).lanes=s,e}function Wa(e,t,s){return(e=Ra(6,e,null,t)).lanes=s,e}function Va(e){var t=Ra(18,null,null,0);return t.stateNode=e,t}function qa(e,t,s){return(t=Ra(4,null!==e.children?e.children:[],e.key,t)).lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var $a=new WeakMap;function Ga(e,t){if("object"===typeof e&&null!==e){var s=$a.get(e);return void 0!==s?s:(t={value:e,source:t,stack:se(t)},$a.set(e,t),t)}return{value:e,source:t,stack:se(t)}}var Ka=[],Ya=0,Ja=null,Qa=0,Xa=[],Za=0,en=null,tn=1,sn="";function an(e,t){Ka[Ya++]=Qa,Ka[Ya++]=Ja,Ja=e,Qa=t}function nn(e,t,s){Xa[Za++]=tn,Xa[Za++]=sn,Xa[Za++]=en,en=e;var a=tn;e=sn;var n=32-je(a)-1;a&=~(1<<n),s+=1;var l=32-je(t)+n;if(30<l){var r=n-n%5;l=(a&(1<<r)-1).toString(32),a>>=r,n-=r,tn=1<<32-je(t)+n|s<<n|a,sn=l+e}else tn=1<<l|s<<n|a,sn=e}function ln(e){null!==e.return&&(an(e,1),nn(e,1,0))}function rn(e){for(;e===Ja;)Ja=Ka[--Ya],Ka[Ya]=null,Qa=Ka[--Ya],Ka[Ya]=null;for(;e===en;)en=Xa[--Za],Xa[Za]=null,sn=Xa[--Za],Xa[Za]=null,tn=Xa[--Za],Xa[Za]=null}function on(e,t){Xa[Za++]=tn,Xa[Za++]=sn,Xa[Za++]=en,tn=t.id,sn=t.overflow,en=e}var cn=null,dn=null,un=!1,mn=null,hn=!1,xn=Error(r(519));function pn(e){throw yn(Ga(Error(r(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),xn}function gn(e){var t=e.stateNode,s=e.type,a=e.memoizedProps;switch(t[Ue]=e,t[He]=a,s){case"dialog":Jd("cancel",t),Jd("close",t);break;case"iframe":case"object":case"embed":Jd("load",t);break;case"video":case"audio":for(s=0;s<Gd.length;s++)Jd(Gd[s],t);break;case"source":Jd("error",t);break;case"img":case"image":case"link":Jd("error",t),Jd("load",t);break;case"details":Jd("toggle",t);break;case"input":Jd("invalid",t),bt(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":Jd("invalid",t);break;case"textarea":Jd("invalid",t),wt(t,a.value,a.defaultValue,a.children)}"string"!==typeof(s=a.children)&&"number"!==typeof s&&"bigint"!==typeof s||t.textContent===""+s||!0===a.suppressHydrationWarning||cu(t.textContent,s)?(null!=a.popover&&(Jd("beforetoggle",t),Jd("toggle",t)),null!=a.onScroll&&Jd("scroll",t),null!=a.onScrollEnd&&Jd("scrollend",t),null!=a.onClick&&(t.onclick=Tt),t=!0):t=!1,t||pn(e,!0)}function fn(e){for(cn=e.return;cn;)switch(cn.tag){case 5:case 31:case 13:return void(hn=!1);case 27:case 3:return void(hn=!0);default:cn=cn.return}}function vn(e){if(e!==cn)return!1;if(!un)return fn(e),un=!0,!1;var t,s=e.tag;if((t=3!==s&&27!==s)&&((t=5===s)&&(t=!("form"!==(t=e.type)&&"button"!==t)||bu(e.type,e.memoizedProps)),t=!t),t&&dn&&pn(e),fn(e),13===s){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));dn=Pu(e)}else if(31===s){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));dn=Pu(e)}else 27===s?(s=dn,Du(e.type)?(e=Mu,Mu=null,dn=e):dn=s):dn=cn?zu(e.stateNode.nextSibling):null;return!0}function bn(){dn=cn=null,un=!1}function jn(){var e=mn;return null!==e&&(null===Ac?Ac=e:Ac.push.apply(Ac,e),mn=null),e}function yn(e){null===mn?mn=[e]:mn.push(e)}var Nn=I(null),wn=null,Cn=null;function kn(e,t,s){U(Nn,t._currentValue),t._currentValue=s}function Dn(e){e._currentValue=Nn.current,O(Nn)}function _n(e,t,s){for(;null!==e;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==a&&(a.childLanes|=t)):null!==a&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===s)break;e=e.return}}function Sn(e,t,s,a){var n=e.child;for(null!==n&&(n.return=e);null!==n;){var l=n.dependencies;if(null!==l){var i=n.child;l=l.firstContext;e:for(;null!==l;){var o=l;l=n;for(var c=0;c<t.length;c++)if(o.context===t[c]){l.lanes|=s,null!==(o=l.alternate)&&(o.lanes|=s),_n(l.return,s,e),a||(i=null);break e}l=o.next}}else if(18===n.tag){if(null===(i=n.return))throw Error(r(341));i.lanes|=s,null!==(l=i.alternate)&&(l.lanes|=s),_n(i,s,e),i=null}else i=n.child;if(null!==i)i.return=n;else for(i=n;null!==i;){if(i===e){i=null;break}if(null!==(n=i.sibling)){n.return=i.return,i=n;break}i=i.return}n=i}}function En(e,t,s,a){e=null;for(var n=t,l=!1;null!==n;){if(!l)if(0!==(524288&n.flags))l=!0;else if(0!==(262144&n.flags))break;if(10===n.tag){var i=n.alternate;if(null===i)throw Error(r(387));if(null!==(i=i.memoizedProps)){var o=n.type;Qs(n.pendingProps.value,i.value)||(null!==e?e.push(o):e=[o])}}else if(n===G.current){if(null===(i=n.alternate))throw Error(r(387));i.memoizedState.memoizedState!==n.memoizedState.memoizedState&&(null!==e?e.push(dm):e=[dm])}n=n.return}null!==e&&Sn(t,e,s,a),t.flags|=262144}function An(e){for(e=e.firstContext;null!==e;){if(!Qs(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fn(e){wn=e,Cn=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Tn(e){return Mn(wn,e)}function zn(e,t){return null===wn&&Fn(e),Mn(e,t)}function Mn(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},null===Cn){if(null===e)throw Error(r(308));Cn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Cn=Cn.next=t;return s}var Pn="undefined"!==typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Bn=a.unstable_scheduleCallback,Rn=a.unstable_NormalPriority,Ln={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function In(){return{controller:new Pn,data:new Map,refCount:0}}function On(e){e.refCount--,0===e.refCount&&Bn(Rn,function(){e.controller.abort()})}var Un=null,Hn=0,Wn=0,Vn=null;function qn(){if(0===--Hn&&null!==Un){null!==Vn&&(Vn.status="fulfilled");var e=Un;Un=null,Wn=0,Vn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var $n=M.S;M.S=function(e,t){zc=oe(),"object"===typeof t&&null!==t&&"function"===typeof t.then&&function(e,t){if(null===Un){var s=Un=[];Hn=0,Wn=Hd(),Vn={status:"pending",value:void 0,then:function(e){s.push(e)}}}Hn++,t.then(qn,qn)}(0,t),null!==$n&&$n(e,t)};var Gn=I(null);function Kn(){var e=Gn.current;return null!==e?e:xc.pooledCache}function Yn(e,t){U(Gn,null===t?Gn.current:t.pool)}function Jn(){var e=Kn();return null===e?null:{parent:Ln._currentValue,pool:e}}var Qn=Error(r(460)),Xn=Error(r(474)),Zn=Error(r(542)),el={then:function(){}};function tl(e){return"fulfilled"===(e=e.status)||"rejected"===e}function sl(e,t,s){switch(void 0===(s=e[s])?e.push(t):s!==t&&(t.then(Tt,Tt),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw rl(e=t.reason),e;default:if("string"===typeof t.status)t.then(Tt,Tt);else{if(null!==(e=xc)&&100<e.shellSuspendCounter)throw Error(r(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var s=t;s.status="fulfilled",s.value=e}},function(e){if("pending"===t.status){var s=t;s.status="rejected",s.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw rl(e=t.reason),e}throw nl=t,Qn}}function al(e){try{return(0,e._init)(e._payload)}catch(t){if(null!==t&&"object"===typeof t&&"function"===typeof t.then)throw nl=t,Qn;throw t}}var nl=null;function ll(){if(null===nl)throw Error(r(459));var e=nl;return nl=null,e}function rl(e){if(e===Qn||e===Zn)throw Error(r(483))}var il=null,ol=0;function cl(e){var t=ol;return ol+=1,null===il&&(il=[]),sl(il,e,t)}function dl(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function ul(e,t){if(t.$$typeof===x)throw Error(r(525));throw e=Object.prototype.toString.call(t),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ml(e){function t(t,s){if(e){var a=t.deletions;null===a?(t.deletions=[s],t.flags|=16):a.push(s)}}function s(s,a){if(!e)return null;for(;null!==a;)t(s,a),a=a.sibling;return null}function a(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function n(e,t){return(e=Ia(e,t)).index=0,e.sibling=null,e}function l(t,s,a){return t.index=a,e?null!==(a=t.alternate)?(a=a.index)<s?(t.flags|=67108866,s):a:(t.flags|=67108866,s):(t.flags|=1048576,s)}function i(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function o(e,t,s,a){return null===t||6!==t.tag?((t=Wa(s,e.mode,a)).return=e,t):((t=n(t,s)).return=e,t)}function c(e,t,s,a){var l=s.type;return l===f?u(e,t,s.props.children,a,s.key):null!==t&&(t.elementType===l||"object"===typeof l&&null!==l&&l.$$typeof===D&&al(l)===t.type)?(dl(t=n(t,s.props),s),t.return=e,t):(dl(t=Ua(s.type,s.key,s.props,null,e.mode,a),s),t.return=e,t)}function d(e,t,s,a){return null===t||4!==t.tag||t.stateNode.containerInfo!==s.containerInfo||t.stateNode.implementation!==s.implementation?((t=qa(s,e.mode,a)).return=e,t):((t=n(t,s.children||[])).return=e,t)}function u(e,t,s,a,l){return null===t||7!==t.tag?((t=Ha(s,e.mode,a,l)).return=e,t):((t=n(t,s)).return=e,t)}function m(e,t,s){if("string"===typeof t&&""!==t||"number"===typeof t||"bigint"===typeof t)return(t=Wa(""+t,e.mode,s)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case p:return dl(s=Ua(t.type,t.key,t.props,null,e.mode,s),t),s.return=e,s;case g:return(t=qa(t,e.mode,s)).return=e,t;case D:return m(e,t=al(t),s)}if(z(t)||A(t))return(t=Ha(t,e.mode,s,null)).return=e,t;if("function"===typeof t.then)return m(e,cl(t),s);if(t.$$typeof===y)return m(e,zn(e,t),s);ul(e,t)}return null}function h(e,t,s,a){var n=null!==t?t.key:null;if("string"===typeof s&&""!==s||"number"===typeof s||"bigint"===typeof s)return null!==n?null:o(e,t,""+s,a);if("object"===typeof s&&null!==s){switch(s.$$typeof){case p:return s.key===n?c(e,t,s,a):null;case g:return s.key===n?d(e,t,s,a):null;case D:return h(e,t,s=al(s),a)}if(z(s)||A(s))return null!==n?null:u(e,t,s,a,null);if("function"===typeof s.then)return h(e,t,cl(s),a);if(s.$$typeof===y)return h(e,t,zn(e,s),a);ul(e,s)}return null}function x(e,t,s,a,n){if("string"===typeof a&&""!==a||"number"===typeof a||"bigint"===typeof a)return o(t,e=e.get(s)||null,""+a,n);if("object"===typeof a&&null!==a){switch(a.$$typeof){case p:return c(t,e=e.get(null===a.key?s:a.key)||null,a,n);case g:return d(t,e=e.get(null===a.key?s:a.key)||null,a,n);case D:return x(e,t,s,a=al(a),n)}if(z(a)||A(a))return u(t,e=e.get(s)||null,a,n,null);if("function"===typeof a.then)return x(e,t,s,cl(a),n);if(a.$$typeof===y)return x(e,t,s,zn(t,a),n);ul(t,a)}return null}function v(o,c,d,u){if("object"===typeof d&&null!==d&&d.type===f&&null===d.key&&(d=d.props.children),"object"===typeof d&&null!==d){switch(d.$$typeof){case p:e:{for(var b=d.key;null!==c;){if(c.key===b){if((b=d.type)===f){if(7===c.tag){s(o,c.sibling),(u=n(c,d.props.children)).return=o,o=u;break e}}else if(c.elementType===b||"object"===typeof b&&null!==b&&b.$$typeof===D&&al(b)===c.type){s(o,c.sibling),dl(u=n(c,d.props),d),u.return=o,o=u;break e}s(o,c);break}t(o,c),c=c.sibling}d.type===f?((u=Ha(d.props.children,o.mode,u,d.key)).return=o,o=u):(dl(u=Ua(d.type,d.key,d.props,null,o.mode,u),d),u.return=o,o=u)}return i(o);case g:e:{for(b=d.key;null!==c;){if(c.key===b){if(4===c.tag&&c.stateNode.containerInfo===d.containerInfo&&c.stateNode.implementation===d.implementation){s(o,c.sibling),(u=n(c,d.children||[])).return=o,o=u;break e}s(o,c);break}t(o,c),c=c.sibling}(u=qa(d,o.mode,u)).return=o,o=u}return i(o);case D:return v(o,c,d=al(d),u)}if(z(d))return function(n,r,i,o){for(var c=null,d=null,u=r,p=r=0,g=null;null!==u&&p<i.length;p++){u.index>p?(g=u,u=null):g=u.sibling;var f=h(n,u,i[p],o);if(null===f){null===u&&(u=g);break}e&&u&&null===f.alternate&&t(n,u),r=l(f,r,p),null===d?c=f:d.sibling=f,d=f,u=g}if(p===i.length)return s(n,u),un&&an(n,p),c;if(null===u){for(;p<i.length;p++)null!==(u=m(n,i[p],o))&&(r=l(u,r,p),null===d?c=u:d.sibling=u,d=u);return un&&an(n,p),c}for(u=a(u);p<i.length;p++)null!==(g=x(u,n,p,i[p],o))&&(e&&null!==g.alternate&&u.delete(null===g.key?p:g.key),r=l(g,r,p),null===d?c=g:d.sibling=g,d=g);return e&&u.forEach(function(e){return t(n,e)}),un&&an(n,p),c}(o,c,d,u);if(A(d)){if("function"!==typeof(b=A(d)))throw Error(r(150));return function(n,i,o,c){if(null==o)throw Error(r(151));for(var d=null,u=null,p=i,g=i=0,f=null,v=o.next();null!==p&&!v.done;g++,v=o.next()){p.index>g?(f=p,p=null):f=p.sibling;var b=h(n,p,v.value,c);if(null===b){null===p&&(p=f);break}e&&p&&null===b.alternate&&t(n,p),i=l(b,i,g),null===u?d=b:u.sibling=b,u=b,p=f}if(v.done)return s(n,p),un&&an(n,g),d;if(null===p){for(;!v.done;g++,v=o.next())null!==(v=m(n,v.value,c))&&(i=l(v,i,g),null===u?d=v:u.sibling=v,u=v);return un&&an(n,g),d}for(p=a(p);!v.done;g++,v=o.next())null!==(v=x(p,n,g,v.value,c))&&(e&&null!==v.alternate&&p.delete(null===v.key?g:v.key),i=l(v,i,g),null===u?d=v:u.sibling=v,u=v);return e&&p.forEach(function(e){return t(n,e)}),un&&an(n,g),d}(o,c,d=b.call(d),u)}if("function"===typeof d.then)return v(o,c,cl(d),u);if(d.$$typeof===y)return v(o,c,zn(o,d),u);ul(o,d)}return"string"===typeof d&&""!==d||"number"===typeof d||"bigint"===typeof d?(d=""+d,null!==c&&6===c.tag?(s(o,c.sibling),(u=n(c,d)).return=o,o=u):(s(o,c),(u=Wa(d,o.mode,u)).return=o,o=u),i(o)):s(o,c)}return function(e,t,s,a){try{ol=0;var n=v(e,t,s,a);return il=null,n}catch(r){if(r===Qn||r===Zn)throw r;var l=Ra(29,r,null,e.mode);return l.lanes=a,l.return=e,l}}}var hl=ml(!0),xl=ml(!1),pl=!1;function gl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fl(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function vl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function bl(e,t,s){var a=e.updateQueue;if(null===a)return null;if(a=a.shared,0!==(2&hc)){var n=a.pending;return null===n?t.next=t:(t.next=n.next,n.next=t),a.pending=t,t=Ma(e),za(e,null,s),t}return Aa(e,a,t,s),Ma(e)}
vendor: 8,796 bytes, line 2
2function jl(e,t,s){if(null!==(t=t.updateQueue)&&(t=t.shared,0!==(4194048&s))){var a=t.lanes;s|=a&=e.pendingLanes,t.lanes=s,Me(e,s)}}function yl(e,t){var s=e.updateQueue,a=e.alternate;if(null!==a&&s===(a=a.updateQueue)){var n=null,l=null;if(null!==(s=s.firstBaseUpdate)){do{var r={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};null===l?n=l=r:l=l.next=r,s=s.next}while(null!==s);null===l?n=l=t:l=l.next=t}else n=l=t;return s={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:l,shared:a.shared,callbacks:a.callbacks},void(e.updateQueue=s)}null===(e=s.lastBaseUpdate)?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var Nl=!1;function wl(){if(Nl){if(null!==Vn)throw Vn}}function Cl(e,t,s,a){Nl=!1;var n=e.updateQueue;pl=!1;var l=n.firstBaseUpdate,r=n.lastBaseUpdate,i=n.shared.pending;if(null!==i){n.shared.pending=null;var o=i,c=o.next;o.next=null,null===r?l=c:r.next=c,r=o;var d=e.alternate;null!==d&&((i=(d=d.updateQueue).lastBaseUpdate)!==r&&(null===i?d.firstBaseUpdate=c:i.next=c,d.lastBaseUpdate=o))}if(null!==l){var u=n.baseState;for(r=0,d=c=o=null,i=l;;){var m=-536870913&i.lane,x=m!==i.lane;if(x?(gc&m)===m:(a&m)===m){0!==m&&m===Wn&&(Nl=!0),null!==d&&(d=d.next={lane:0,tag:i.tag,payload:i.payload,callback:null,next:null});e:{var p=e,g=i;m=t;var f=s;switch(g.tag){case 1:if("function"===typeof(p=g.payload)){u=p.call(f,u,m);break e}u=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null===(m="function"===typeof(p=g.payload)?p.call(f,u,m):p)||void 0===m)break e;u=h({},u,m);break e;case 2:pl=!0}}null!==(m=i.callback)&&(e.flags|=64,x&&(e.flags|=8192),null===(x=n.callbacks)?n.callbacks=[m]:x.push(m))}else x={lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===d?(c=d=x,o=u):d=d.next=x,r|=m;if(null===(i=i.next)){if(null===(i=n.shared.pending))break;i=(x=i).next,x.next=null,n.lastBaseUpdate=x,n.shared.pending=null}}null===d&&(o=u),n.baseState=o,n.firstBaseUpdate=c,n.lastBaseUpdate=d,null===l&&(n.shared.lanes=0),Cc|=r,e.lanes=r,e.memoizedState=u}}function kl(e,t){if("function"!==typeof e)throw Error(r(191,e));e.call(t)}function Dl(e,t){var s=e.callbacks;if(null!==s)for(e.callbacks=null,e=0;e<s.length;e++)kl(s[e],t)}var _l=I(null),Sl=I(0);function El(e,t){U(Sl,e=Nc),U(_l,t),Nc=e|t.baseLanes}function Al(){U(Sl,Nc),U(_l,_l.current)}function Fl(){Nc=Sl.current,O(_l),O(Sl)}var Tl=I(null),zl=null;function Ml(e){var t=e.alternate;U(Il,1&Il.current),U(Tl,e),null===zl&&(null===t||null!==_l.current||null!==t.memoizedState)&&(zl=e)}function Pl(e){U(Il,Il.current),U(Tl,e),null===zl&&(zl=e)}function Bl(e){22===e.tag?(U(Il,Il.current),U(Tl,e),null===zl&&(zl=e)):Rl()}function Rl(){U(Il,Il.current),U(Tl,Tl.current)}function Ll(e){O(Tl),zl===e&&(zl=null),O(Il)}var Il=I(0);function Ol(e){for(var t=e;null!==t;){if(13===t.tag){var s=t.memoizedState;if(null!==s&&(null===(s=s.dehydrated)||Fu(s)||Tu(s)))return t}else if(19!==t.tag||"forwards"!==t.memoizedProps.revealOrder&&"backwards"!==t.memoizedProps.revealOrder&&"unstable_legacy-backwards"!==t.memoizedProps.revealOrder&&"together"!==t.memoizedProps.revealOrder){if(null!==t.child){t.child.return=t,t=t.child;continue}}else if(0!==(128&t.flags))return t;if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ul=0,Hl=null,Wl=null,Vl=null,ql=!1,$l=!1,Gl=!1,Kl=0,Yl=0,Jl=null,Ql=0;function Xl(){throw Error(r(321))}function Zl(e,t){if(null===t)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Qs(e[s],t[s]))return!1;return!0}function er(e,t,s,a,n,l){return Ul=l,Hl=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=null===e||null===e.memoizedState?pi:gi,Gl=!1,l=s(a,n),Gl=!1,$l&&(l=sr(t,s,a,n)),tr(e),l}function tr(e){M.H=xi;var t=null!==Wl&&null!==Wl.next;if(Ul=0,Vl=Wl=Hl=null,ql=!1,Yl=0,Jl=null,t)throw Error(r(300));null===e||Ti||null!==(e=e.dependencies)&&An(e)&&(Ti=!0)}function sr(e,t,s,a){Hl=e;var n=0;do{if($l&&(Jl=null),Yl=0,$l=!1,25<=n)throw Error(r(301));if(n+=1,Vl=Wl=null,null!=e.updateQueue){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,null!=l.memoCache&&(l.memoCache.index=0)}M.H=fi,l=t(s,a)}while($l);return l}function ar(){var e=M.H,t=e.useState()[0];return t="function"===typeof t.then?cr(t):t,e=e.useState()[0],(null!==Wl?Wl.memoizedState:null)!==e&&(Hl.flags|=1024),t}function nr(){var e=0!==Kl;return Kl=0,e}function lr(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function rr(e){if(ql){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}ql=!1}Ul=0,Vl=Wl=Hl=null,$l=!1,Yl=Kl=0,Jl=null}function ir(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Vl?Hl.memoizedState=Vl=e:Vl=Vl.next=e,Vl}function or(){if(null===Wl){var e=Hl.alternate;e=null!==e?e.memoizedState:null}else e=Wl.next;var t=null===Vl?Hl.memoizedState:Vl.next;if(null!==t)Vl=t,Wl=e;else{if(null===e){if(null===Hl.alternate)throw Error(r(467));throw Error(r(310))}e={memoizedState:(Wl=e).memoizedState,baseState:Wl.baseState,baseQueue:Wl.baseQueue,queue:Wl.queue,next:null},null===Vl?Hl.memoizedState=Vl=e:Vl=Vl.next=e}return Vl}function cr(e){var t=Yl;return Yl+=1,null===Jl&&(Jl=[]),e=sl(Jl,e,t),t=Hl,null===(null===Vl?t.memoizedState:Vl.next)&&(t=t.alternate,M.H=null===t||null===t.memoizedState?pi:gi),e}function dr(e){if(null!==e&&"object"===typeof e){if("function"===typeof e.then)return cr(e);if(e.$$typeof===y)return Tn(e)}throw Error(r(438,String(e)))}function ur(e){var t=null,s=Hl.updateQueue;if(null!==s&&(t=s.memoCache),null==t){var a=Hl.alternate;null!==a&&(null!==(a=a.updateQueue)&&(null!=(a=a.memoCache)&&(t={data:a.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===s&&(s={lastEffect:null,events:null,stores:null,memoCache:null},Hl.updateQueue=s),s.memoCache=t,void 0===(s=t.data[t.index]))for(s=t.data[t.index]=Array(e),a=0;a<e;a++)s[a]=S;return t.index++,s}function mr(e,t){return"function"===typeof t?t(e):t}function hr(e){return xr(or(),Wl,e)}function xr(e,t,s){var a=e.queue;if(null===a)throw Error(r(311));a.lastRenderedReducer=s;var n=e.baseQueue,l=a.pending;if(null!==l){if(null!==n){var i=n.next;n.next=l.next,l.next=i}t.baseQueue=n=l,a.pending=null}if(l=e.baseState,null===n)e.memoizedState=l;else{var o=i=null,c=null,d=t=n.next,u=!1;do{var m=-536870913&d.lane;if(m!==d.lane?(gc&m)===m:(Ul&m)===m){var h=d.revertLane;if(0===h)null!==c&&(c=c.next={lane:0,revertLane:0,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),m===Wn&&(u=!0);else{if((Ul&h)===h){d=d.next,h===Wn&&(u=!0);continue}m={lane:0,revertLane:d.revertLane,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},null===c?(o=c=m,i=l):c=c.next=m,Hl.lanes|=h,Cc|=h}m=d.action,Gl&&s(l,m),l=d.hasEagerState?d.eagerState:s(l,m)}else h={lane:m,revertLane:d.revertLane,gesture:d.gesture,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},null===c?(o=c=h,i=l):c=c.next=h,Hl.lanes|=m,Cc|=m;d=d.next}while(null!==d&&d!==t);if(null===c?i=l:c.next=o,!Qs(l,e.memoizedState)&&(Ti=!0,u&&null!==(s=Vn)))throw s;e.memoizedState=l,e.baseState=i,e.baseQueue=c,a.lastRenderedState=l}return null===n&&(a.lanes=0),[e.memoizedState,a.dispatch]}function pr(e){var t=or(),s=t.queue;if(null===s)throw Error(r(311));s.lastRenderedReducer=e;var a=s.dispatch,n=s.pending,l=t.memoizedState;if(null!==n){s.pending=null;var i=n=n.next;do{l=e(l,i.action),i=i.next}while(i!==n);Qs(l,t.memoizedState)||(Ti=!0),t.memoizedState=l,null===t.baseQueue&&(t.baseState=l),s.lastRenderedState=l}return[l,a]}function gr(e,t,s){var a=Hl,n=or(),l=un;if(l){if(void 0===s)throw Error(r(407));s=s()}else s=t();var i=!Qs((Wl||n).memoizedState,s);if(i&&(n.memoizedState=s,Ti=!0),n=n.queue,Ur(br.bind(null,a,n,e),[e]),n.getSnapshot!==t||i||null!==Vl&&1&Vl.memoizedState.tag){if(a.flags|=2048,Br(9,{destroy:void 0},vr.bind(null,a,n,s,t),null),null===xc)throw Error(r(349));l||0!==(127&Ul)||fr(a,t,s)}return s}function fr(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},null===(t=Hl.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Hl.updateQueue=t,t.stores=[e]):null===(s=t.stores)?t.stores=[e]:s.push(e)}function vr(e,t,s,a){t.value=s,t.getSnapshot=a,jr(t)&&yr(e)}function br(e,t,s){return s(function(){jr(t)&&yr(e)})}function jr(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Qs(e,s)}catch(a){return!0}}function yr(e){var t=Ta(e,2);null!==t&&Kc(t,e,2)}function Nr(e){var t=ir();if("function"===typeof e){var s=e;if(e=s(),Gl){be(!0);try{s()}finally{be(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:e},t}function wr(e,t,s,a){return e.baseState=s,xr(e,Wl,"function"===typeof a?a:mr)}
vendor: 6,875 bytes, line 2
2function Cr(e,t,s,a,n){if(ui(e))throw Error(r(485));if(null!==(e=t.action)){var l={payload:n,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){l.listeners.push(e)}};null!==M.T?s(!0):l.isTransition=!1,a(l),null===(s=t.pending)?(l.next=t.pending=l,kr(t,l)):(l.next=s.next,t.pending=s.next=l)}}function kr(e,t){var s=t.action,a=t.payload,n=e.state;if(t.isTransition){var l=M.T,r={};M.T=r;try{var i=s(n,a),o=M.S;null!==o&&o(r,i),Dr(e,t,i)}catch(c){Sr(e,t,c)}finally{null!==l&&null!==r.types&&(l.types=r.types),M.T=l}}else try{Dr(e,t,l=s(n,a))}catch(d){Sr(e,t,d)}}function Dr(e,t,s){null!==s&&"object"===typeof s&&"function"===typeof s.then?s.then(function(s){_r(e,t,s)},function(s){return Sr(e,t,s)}):_r(e,t,s)}function _r(e,t,s){t.status="fulfilled",t.value=s,Er(t),e.state=s,null!==(t=e.pending)&&((s=t.next)===t?e.pending=null:(s=s.next,t.next=s,kr(e,s)))}function Sr(e,t,s){var a=e.pending;if(e.pending=null,null!==a){a=a.next;do{t.status="rejected",t.reason=s,Er(t),t=t.next}while(t!==a)}e.action=null}function Er(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ar(e,t){return t}function Fr(e,t){if(un){var s=xc.formState;if(null!==s){e:{var a=Hl;if(un){if(dn){t:{for(var n=dn,l=hn;8!==n.nodeType;){if(!l){n=null;break t}if(null===(n=zu(n.nextSibling))){n=null;break t}}n="F!"===(l=n.data)||"F"===l?n:null}if(n){dn=zu(n.nextSibling),a="F!"===n.data;break e}}pn(a)}a=!1}a&&(t=s[0])}}return(s=ir()).memoizedState=s.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ar,lastRenderedState:t},s.queue=a,s=oi.bind(null,Hl,a),a.dispatch=s,a=Nr(!1),l=di.bind(null,Hl,!1,a.queue),n={state:t,dispatch:null,action:e,pending:null},(a=ir()).queue=n,s=Cr.bind(null,Hl,n,l,s),n.dispatch=s,a.memoizedState=e,[t,s,!1]}function Tr(e){return zr(or(),Wl,e)}function zr(e,t,s){if(t=xr(e,t,Ar)[0],e=hr(mr)[0],"object"===typeof t&&null!==t&&"function"===typeof t.then)try{var a=cr(t)}catch(r){if(r===Qn)throw Zn;throw r}else a=t;var n=(t=or()).queue,l=n.dispatch;return s!==t.memoizedState&&(Hl.flags|=2048,Br(9,{destroy:void 0},Mr.bind(null,n,s),null)),[a,l,e]}function Mr(e,t){e.action=t}function Pr(e){var t=or(),s=Wl;if(null!==s)return zr(t,s,e);or(),t=t.memoizedState;var a=(s=or()).queue.dispatch;return s.memoizedState=e,[t,a,!1]}function Br(e,t,s,a){return e={tag:e,create:s,deps:a,inst:t,next:null},null===(t=Hl.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Hl.updateQueue=t),null===(s=t.lastEffect)?t.lastEffect=e.next=e:(a=s.next,s.next=e,e.next=a,t.lastEffect=e),e}function Rr(){return or().memoizedState}function Lr(e,t,s,a){var n=ir();Hl.flags|=e,n.memoizedState=Br(1|t,{destroy:void 0},s,void 0===a?null:a)}function Ir(e,t,s,a){var n=or();a=void 0===a?null:a;var l=n.memoizedState.inst;null!==Wl&&null!==a&&Zl(a,Wl.memoizedState.deps)?n.memoizedState=Br(t,l,s,a):(Hl.flags|=e,n.memoizedState=Br(1|t,l,s,a))}function Or(e,t){Lr(8390656,8,e,t)}function Ur(e,t){Ir(2048,8,e,t)}function Hr(e){var t=or().memoizedState;return function(e){Hl.flags|=4;var t=Hl.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Hl.updateQueue=t,t.events=[e];else{var s=t.events;null===s?t.events=[e]:s.push(e)}}({ref:t,nextImpl:e}),function(){if(0!==(2&hc))throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Wr(e,t){return Ir(4,2,e,t)}function Vr(e,t){return Ir(4,4,e,t)}function qr(e,t){if("function"===typeof t){e=e();var s=t(e);return function(){"function"===typeof s?s():t(null)}}if(null!==t&&void 0!==t)return e=e(),t.current=e,function(){t.current=null}}function $r(e,t,s){s=null!==s&&void 0!==s?s.concat([e]):null,Ir(4,4,qr.bind(null,t,e),s)}function Gr(){}function Kr(e,t){var s=or();t=void 0===t?null:t;var a=s.memoizedState;return null!==t&&Zl(t,a[1])?a[0]:(s.memoizedState=[e,t],e)}function Yr(e,t){var s=or();t=void 0===t?null:t;var a=s.memoizedState;if(null!==t&&Zl(t,a[1]))return a[0];if(a=e(),Gl){be(!0);try{e()}finally{be(!1)}}return s.memoizedState=[a,t],a}function Jr(e,t,s){return void 0===s||0!==(1073741824&Ul)&&0===(261930&gc)?e.memoizedState=t:(e.memoizedState=s,e=Gc(),Hl.lanes|=e,Cc|=e,s)}function Qr(e,t,s,a){return Qs(s,t)?s:null!==_l.current?(e=Jr(e,s,a),Qs(e,t)||(Ti=!0),e):0===(42&Ul)||0!==(1073741824&Ul)&&0===(261930&gc)?(Ti=!0,e.memoizedState=s):(e=Gc(),Hl.lanes|=e,Cc|=e,t)}function Xr(e,t,s,a,n){var l=P.p;P.p=0!==l&&8>l?l:8;var r=M.T,i={};M.T=i,di(e,!1,t,s);try{var o=n(),c=M.S;if(null!==c&&c(i,o),null!==o&&"object"===typeof o&&"function"===typeof o.then)ci(e,t,function(e,t){var s=[],a={status:"pending",value:null,reason:null,then:function(e){s.push(e)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var e=0;e<s.length;e++)(0,s[e])(t)},function(e){for(a.status="rejected",a.reason=e,e=0;e<s.length;e++)(0,s[e])(void 0)}),a}(o,a),$c());else ci(e,t,a,$c())}catch(d){ci(e,t,{then:function(){},status:"rejected",reason:d},$c())}finally{P.p=l,null!==r&&null!==i.types&&(r.types=i.types),M.T=r}}function Zr(){}function ei(e,t,s,a){if(5!==e.tag)throw Error(r(476));var n=ti(e).queue;Xr(e,n,t,B,null===s?Zr:function(){return si(e),s(a)})}function ti(e){var t=e.memoizedState;if(null!==t)return t;var s={};return(t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:B},next:null}).next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:s},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function si(e){var t=ti(e);null===t.next&&(t=e.alternate.memoizedState),ci(e,t.next.queue,{},$c())}function ai(){return Tn(dm)}function ni(){return or().memoizedState}function li(){return or().memoizedState}function ri(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var s=$c(),a=bl(t,e=vl(s),s);return null!==a&&(Kc(a,t,s),jl(a,t,s)),t={cache:In()},void(e.payload=t)}t=t.return}}function ii(e,t,s){var a=$c();s={lane:a,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ui(e)?mi(t,s):null!==(s=Fa(e,t,s,a))&&(Kc(s,e,a),hi(s,t,a))}function oi(e,t,s){ci(e,t,s,$c())}function ci(e,t,s,a){var n={lane:a,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(ui(e))mi(t,n);else{var l=e.alternate;if(0===e.lanes&&(null===l||0===l.lanes)&&null!==(l=t.lastRenderedReducer))try{var r=t.lastRenderedState,i=l(r,s);if(n.hasEagerState=!0,n.eagerState=i,Qs(i,r))return Aa(e,t,n,0),null===xc&&Ea(),!1}catch(o){}if(null!==(s=Fa(e,t,n,a)))return Kc(s,e,a),hi(s,t,a),!0}return!1}function di(e,t,s,a){if(a={lane:2,revertLane:Hd(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ui(e)){if(t)throw Error(r(479))}else null!==(t=Fa(e,s,a,2))&&Kc(t,e,2)}function ui(e){var t=e.alternate;return e===Hl||null!==t&&t===Hl}function mi(e,t){$l=ql=!0;var s=e.pending;
2null===s?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function hi(e,t,s){if(0!==(4194048&s)){var a=t.lanes;s|=a&=e.pendingLanes,t.lanes=s,Me(e,s)}}var xi={readContext:Tn,use:dr,useCallback:Xl,useContext:Xl,useEffect:Xl,useImperativeHandle:Xl,useLayoutEffect:Xl,useInsertionEffect:Xl,useMemo:Xl,useReducer:Xl,useRef:Xl,useState:Xl,useDebugValue:Xl,useDeferredValue:Xl,useTransition:Xl,useSyncExternalStore:Xl,useId:Xl,useHostTransitionStatus:Xl,useFormState:Xl,useActionState:Xl,useOptimistic:Xl,useMemoCache:Xl,useCacheRefresh:Xl};xi.useEffectEvent=Xl;var pi={readContext:Tn,use:dr,useCallback:function(e,t){return ir().memoizedState=[e,void 0===t?null:t],e},useContext:Tn,useEffect:Or,useImperativeHandle:function(e,t,s){s=null!==s&&void 0!==s?s.concat([e]):null,Lr(4194308,4,qr.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Lr(4194308,4,e,t)},useInsertionEffect:function(e,t){Lr(4,2,e,t)},useMemo:function(e,t){var s=ir();t=void 0===t?null:t;var a=e();if(Gl){be(!0);try{e()}finally{be(!1)}}return s.memoizedState=[a,t],a},useReducer:function(e,t,s){var a=ir();if(void 0!==s){var n=s(t);if(Gl){be(!0);try{s(t)}finally{be(!1)}}}else n=t;return a.memoizedState=a.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=ii.bind(null,Hl,e),[a.memoizedState,e]},useRef:function(e){return e={current:e},ir().memoizedState=e},useState:function(e){var t=(e=Nr(e)).queue,s=oi.bind(null,Hl,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:Gr,useDeferredValue:function(e,t){return Jr(ir(),e,t)},useTransition:function(){var e=Nr(!1);return e=Xr.bind(null,Hl,e.queue,!0,!1),ir().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var a=Hl,n=ir();if(un){if(void 0===s)throw Error(r(407));s=s()}else{if(s=t(),null===xc)throw Error(r(349));0!==(127&gc)||fr(a,t,s)}n.memoizedState=s;var l={value:s,getSnapshot:t};return n.queue=l,Or(br.bind(null,a,l,e),[e]),a.flags|=2048,Br(9,{destroy:void 0},vr.bind(null,a,l,s,t),null),s},useId:function(){var e=ir(),t=xc.identifierPrefix;if(un){var s=sn;t="_"+t+"R_"+(s=(tn&~(1<<32-je(tn)-1)).toString(32)+s),0<(s=Kl++)&&(t+="H"+s.toString(32)),t+="_"}else t="_"+t+"r_"+(s=Ql++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ai,useFormState:Fr,useActionState:Fr,useOptimistic:function(e){var t=ir();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=di.bind(null,Hl,!0,s),s.dispatch=t,[e,t]},useMemoCache:ur,useCacheRefresh:function(){return ir().memoizedState=ri.bind(null,Hl)},useEffectEvent:function(e){var t=ir(),s={impl:e};return t.memoizedState=s,function(){if(0!==(2&hc))throw Error(r(440));return s.impl.apply(void 0,arguments)}}},gi={readContext:Tn,use:dr,useCallback:Kr,useContext:Tn,useEffect:Ur,useImperativeHandle:$r,useInsertionEffect:Wr,useLayoutEffect:Vr,useMemo:Yr,useReducer:hr,useRef:Rr,useState:function(){return hr(mr)},useDebugValue:Gr,useDeferredValue:function(e,t){return Qr(or(),Wl.memoizedState,e,t)},useTransition:function(){var e=hr(mr)[0],t=or().memoizedState;return["boolean"===typeof e?e:cr(e),t]},useSyncExternalStore:gr,useId:ni,useHostTransitionStatus:ai,useFormState:Tr,useActionState:Tr,useOptimistic:function(e,t){return wr(or(),0,e,t)},useMemoCache:ur,useCacheRefresh:li};gi.useEffectEvent=Hr;var fi={readContext:Tn,use:dr,useCallback:Kr,useContext:Tn,useEffect:Ur,useImperativeHandle:$r,useInsertionEffect:Wr,useLayoutEffect:Vr,useMemo:Yr,useReducer:pr,useRef:Rr,useState:function(){return pr(mr)},useDebugValue:Gr,useDeferredValue:function(e,t){var s=or();return null===Wl?Jr(s,e,t):Qr(s,Wl.memoizedState,e,t)},useTransition:function(){var e=pr(mr)[0],t=or().memoizedState;return["boolean"===typeof e?e:cr(e),t]},useSyncExternalStore:gr,useId:ni,useHostTransitionStatus:ai,useFormState:Pr,useActionState:Pr,useOptimistic:function(e,t){var s=or();return null!==Wl?wr(s,0,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:ur,useCacheRefresh:li};function vi(e,t,s,a){s=null===(s=s(a,t=e.memoizedState))||void 0===s?t:h({},t,s),e.memoizedState=s,0===e.lanes&&(e.updateQueue.baseState=s)}fi.useEffectEvent=Hr;var bi={enqueueSetState:function(e,t,s){e=e._reactInternals;var a=$c(),n=vl(a);n.payload=t,void 0!==s&&null!==s&&(n.callback=s),null!==(t=bl(e,n,a))&&(Kc(t,e,a),jl(t,e,a))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var a=$c(),n=vl(a);n.tag=1,n.payload=t,void 0!==s&&null!==s&&(n.callback=s),null!==(t=bl(e,n,a))&&(Kc(t,e,a),jl(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=$c(),a=vl(s);a.tag=2,void 0!==t&&null!==t&&(a.callback=t),null!==(t=bl(e,a,s))&&(Kc(t,e,s),jl(t,e,s))}};function ji(e,t,s,a,n,l,r){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(a,l,r):!t.prototype||!t.prototype.isPureReactComponent||(!Xs(s,a)||!Xs(n,l))}function yi(e,t,s,a){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(s,a),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(s,a),t.state!==e&&bi.enqueueReplaceState(t,t.state,null)}function Ni(e,t){var s=t;if("ref"in t)for(var a in s={},t)"ref"!==a&&(s[a]=t[a]);if(e=e.defaultProps)for(var n in s===t&&(s=h({},s)),e)void 0===s[n]&&(s[n]=e[n]);return s}function wi(e){ka(e)}function Ci(e){console.error(e)}function ki(e){ka(e)}function Di(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function _i(e,t,s){try{(0,e.onCaughtError)(s.value,{componentStack:s.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Si(e,t,s){return(s=vl(s)).tag=3,s.payload={element:null},s.callback=function(){Di(e,t)},s}function Ei(e){return(e=vl(e)).tag=3,e}function Ai(e,t,s,a){var n=s.type.getDerivedStateFromError;if("function"===typeof n){var l=a.value;e.payload=function(){return n(l)},e.callback=function(){_i(t,s,a)}}
2var r=s.stateNode;null!==r&&"function"===typeof r.componentDidCatch&&(e.callback=function(){_i(t,s,a),"function"!==typeof n&&(null===Bc?Bc=new Set([this]):Bc.add(this));var e=a.stack;this.componentDidCatch(a.value,{componentStack:null!==e?e:""})})}var Fi=Error(r(461)),Ti=!1;function zi(e,t,s,a){t.child=null===e?xl(t,null,s,a):hl(t,e.child,s,a)}function Mi(e,t,s,a,n){s=s.render;var l=t.ref;if("ref"in a){var r={};for(var i in a)"ref"!==i&&(r[i]=a[i])}else r=a;return Fn(t),a=er(e,t,s,r,l,n),i=nr(),null===e||Ti?(un&&i&&ln(t),t.flags|=1,zi(e,t,a,n),t.child):(lr(e,t,n),ao(e,t,n))}function Pi(e,t,s,a,n){if(null===e){var l=s.type;return"function"!==typeof l||La(l)||void 0!==l.defaultProps||null!==s.compare?((e=Ua(s.type,null,a,t,t.mode,n)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=l,Bi(e,t,l,a,n))}if(l=e.child,!no(e,n)){var r=l.memoizedProps;if((s=null!==(s=s.compare)?s:Xs)(r,a)&&e.ref===t.ref)return ao(e,t,n)}return t.flags|=1,(e=Ia(l,a)).ref=t.ref,e.return=t,t.child=e}function Bi(e,t,s,a,n){if(null!==e){var l=e.memoizedProps;if(Xs(l,a)&&e.ref===t.ref){if(Ti=!1,t.pendingProps=a=l,!no(e,n))return t.lanes=e.lanes,ao(e,t,n);0!==(131072&e.flags)&&(Ti=!0)}}return Wi(e,t,s,a,n)}function Ri(e,t,s,a){var n=a.children,l=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===a.mode){if(0!==(128&t.flags)){if(l=null!==l?l.baseLanes|s:s,null!==e){for(a=t.child=e.child,n=0;null!==a;)n=n|a.lanes|a.childLanes,a=a.sibling;a=n&~l}else a=0,t.child=null;return Ii(e,t,l,s,a)}if(0===(536870912&s))return a=t.lanes=536870912,Ii(e,t,null!==l?l.baseLanes|s:s,s,a);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Yn(0,null!==l?l.cachePool:null),null!==l?El(t,l):Al(),Bl(t)}else null!==l?(Yn(0,l.cachePool),El(t,l),Rl(),t.memoizedState=null):(null!==e&&Yn(0,null),Al(),Rl());return zi(e,t,n,s),t.child}function Li(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ii(e,t,s,a,n){var l=Kn();return l=null===l?null:{parent:Ln._currentValue,pool:l},t.memoizedState={baseLanes:s,cachePool:l},null!==e&&Yn(0,null),Al(),Bl(t),null!==e&&En(e,t,a,!0),t.childLanes=n,null}function Oi(e,t){return(t=Xi({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Ui(e,t,s){return hl(t,e.child,null,s),(e=Oi(t,t.pendingProps)).flags|=2,Ll(t),t.memoizedState=null,e}function Hi(e,t){var s=t.ref;if(null===s)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!==typeof s&&"object"!==typeof s)throw Error(r(284));null!==e&&e.ref===s||(t.flags|=4194816)}}function Wi(e,t,s,a,n){return Fn(t),s=er(e,t,s,a,void 0,n),a=nr(),null===e||Ti?(un&&a&&ln(t),t.flags|=1,zi(e,t,s,n),t.child):(lr(e,t,n),ao(e,t,n))}function Vi(e,t,s,a,n,l){return Fn(t),t.updateQueue=null,s=sr(t,a,s,n),tr(e),a=nr(),null===e||Ti?(un&&a&&ln(t),t.flags|=1,zi(e,t,s,l),t.child):(lr(e,t,l),ao(e,t,l))}function qi(e,t,s,a,n){if(Fn(t),null===t.stateNode){var l=Pa,r=s.contextType;"object"===typeof r&&null!==r&&(l=Tn(r)),l=new s(a,l),t.memoizedState=null!==l.state&&void 0!==l.state?l.state:null,l.updater=bi,t.stateNode=l,l._reactInternals=t,(l=t.stateNode).props=a,l.state=t.memoizedState,l.refs={},gl(t),r=s.contextType,l.context="object"===typeof r&&null!==r?Tn(r):Pa,l.state=t.memoizedState,"function"===typeof(r=s.getDerivedStateFromProps)&&(vi(t,s,r,a),l.state=t.memoizedState),"function"===typeof s.getDerivedStateFromProps||"function"===typeof l.getSnapshotBeforeUpdate||"function"!==typeof l.UNSAFE_componentWillMount&&"function"!==typeof l.componentWillMount||(r=l.state,"function"===typeof l.componentWillMount&&l.componentWillMount(),"function"===typeof l.UNSAFE_componentWillMount&&l.UNSAFE_componentWillMount(),r!==l.state&&bi.enqueueReplaceState(l,l.state,null),Cl(t,a,l,n),wl(),l.state=t.memoizedState),"function"===typeof l.componentDidMount&&(t.flags|=4194308),a=!0}else if(null===e){l=t.stateNode;var i=t.memoizedProps,o=Ni(s,i);l.props=o;var c=l.context,d=s.contextType;r=Pa,"object"===typeof d&&null!==d&&(r=Tn(d));var u=s.getDerivedStateFromProps;d="function"===typeof u||"function"===typeof l.getSnapshotBeforeUpdate,i=t.pendingProps!==i,d||"function"!==typeof l.UNSAFE_componentWillReceiveProps&&"function"!==typeof l.componentWillReceiveProps||(i||c!==r)&&yi(t,l,a,r),pl=!1;var m=t.memoizedState;l.state=m,Cl(t,a,l,n),wl(),c=t.memoizedState,i||m!==c||pl?("function"===typeof u&&(vi(t,s,u,a),c=t.memoizedState),(o=pl||ji(t,s,o,a,m,c,r))?(d||"function"!==typeof l.UNSAFE_componentWillMount&&"function"!==typeof l.componentWillMount||("function"===typeof l.componentWillMount&&l.componentWillMount(),"function"===typeof l.UNSAFE_componentWillMount&&l.UNSAFE_componentWillMount()),"function"===typeof l.componentDidMount&&(t.flags|=4194308)):("function"===typeof l.componentDidMount&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=c),l.props=a,l.state=c,l.context=r,a=o):("function"===typeof l.componentDidMount&&(t.flags|=4194308),a=!1)}else{l=t.stateNode,fl(e,t),d=Ni(s,r=t.memoizedProps),l.props=d,u=t.pendingProps,m=l.context,c=s.contextType,o=Pa,"object"===typeof c&&null!==c&&(o=Tn(c)),(c="function"===typeof(i=s.getDerivedStateFromProps)||"function"===typeof l.getSnapshotBeforeUpdate)||"function"!==typeof l.UNSAFE_componentWillReceiveProps&&"function"!==typeof l.componentWillReceiveProps||(r!==u||m!==o)&&yi(t,l,a,o),pl=!1,m=t.memoizedState,l.state=m,Cl(t,a,l,n),wl();var h=t.memoizedState;r!==u||m!==h||pl||null!==e&&null!==e.dependencies&&An(e.dependencies)?("function"===typeof i&&(vi(t,s,i,a),h=t.memoizedState),(d=pl||ji(t,s,d,a,m,h,o)||null!==e&&null!==e.dependencies&&An(e.dependencies))?(c||"function"!==typeof l.UNSAFE_componentWillUpdate&&"function"!==typeof l.componentWillUpdate||("function"===typeof l.componentWillUpdate&&l.componentWillUpdate(a,h,o),"function"===typeof l.UNSAFE_componentWillUpdate&&l.UNSAFE_componentWillUpdate(a,h,o)),"function"===typeof l.componentDidUpdate&&(t.flags|=4),"function"===typeof l.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof l.componentDidUpdate||r===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),"function"!==typeof l.getSnapshotBeforeUpdate||r===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=h),l.props=a,l.state=h,l.context=o,a=d):("function"!==typeof l.componentDidUpdate||r===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),"function"!==typeof l.getSnapshotBeforeUpdate||r===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),a=!1)}return l=a,Hi(e,t),a=0!==(128&t.flags),l||a?(l=t.stateNode,s=a&&"function"!==typeof s.getDerivedStateFromError?null:l.render(),t.flags|=1,null!==e&&a?(t.child=hl(t,e.child,null,n),t.child=hl(t,null,s,n)):zi(e,t,s,n),t.memoizedState=l.state,e=t.child):e=ao(e,t,n),e}function $i(e,t,s,a){return bn(),t.flags|=256,zi(e,t,s,a),t.child}var Gi={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ki(e){return{baseLanes:e,cachePool:Jn()}}function Yi(e,t,s){return e=null!==e?e.childLanes&~s:0,t&&(e|=_c),e}function Ji(e,t,s){var a,n=t.pendingProps,l=!1,i=0!==(128&t.flags);if((a=i)||(a=(null===e||null!==e.memoizedState)&&0!==(2&Il.current)),a&&(l=!0,t.flags&=-129),a=0!==(32&t.flags),t.flags&=-33,null===e){if(un){if(l?Ml(t):Rl(),(e=dn)?null!==(e=null!==(e=Au(e,hn))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==en?{id:tn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},(s=Va(e)).return=t,t.child=s,cn=t,dn=null):e=null,null===e)throw pn(t);return Tu(e)?t.lanes=32:t.lanes=536870912,null}var o=n.children;return n=n.fallback,l?(Rl(),o=Xi({mode:"hidden",children:o},l=t.mode),n=Ha(n,l,s,null),o.return=t,n.return=t,o.sibling=n,t.child=o,(n=t.child).memoizedState=Ki(s),n.childLanes=Yi(e,a,s),t.memoizedState=Gi,Li(null,n)):(Ml(t),Qi(t,o))}var c=e.memoizedState;if(null!==c&&null!==(o=c.dehydrated)){if(i)256&t.flags?(Ml(t),t.flags&=-257,t=Zi(e,t,s)):null!==t.memoizedState?(Rl(),t.child=e.child,t.flags|=128,t=null):(Rl(),o=n.fallback,l=t.mode,n=Xi({mode:"visible",children:n.children},l),(o=Ha(o,l,s,null)).flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,hl(t,e.child,null,s),(n=t.child).memoizedState=Ki(s),n.childLanes=Yi(e,a,s),t.memoizedState=Gi,t=Li(null,n));else if(Ml(t),Tu(o)){if(a=o.nextSibling&&o.nextSibling.dataset)var d=a.dgst;a=d,(n=Error(r(419))).stack="",n.digest=a,yn({value:n,source:null,stack:null}),t=Zi(e,t,s)}else if(Ti||En(e,t,s,!1),a=0!==(s&e.childLanes),Ti||a){if(null!==(a=xc)&&(0!==(n=Pe(a,s))&&n!==c.retryLane))throw c.retryLane=n,Ta(e,n),Kc(a,e,n),Fi;Fu(o)||rd(),t=Zi(e,t,s)}else Fu(o)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,dn=zu(o.nextSibling),cn=t,un=!0,mn=null,hn=!1,null!==e&&on(t,e),(t=Qi(t,n.children)).flags|=4096);return t}return l?(Rl(),o=n.fallback,l=t.mode,d=(c=e.child).sibling,(n=Ia(c,{mode:"hidden",children:n.children})).subtreeFlags=65011712&c.subtreeFlags,null!==d?o=Ia(d,o):(o=Ha(o,l,s,null)).flags|=2,o.return=t,n.return=t,n.sibling=o,t.child=n,Li(null,n),n=t.child,null===(o=e.child.memoizedState)?o=Ki(s):(null!==(l=o.cachePool)?(c=Ln._currentValue,l=l.parent!==c?{parent:c,pool:c}
vendor: 4,443 bytes, line 2
2:l):l=Jn(),o={baseLanes:o.baseLanes|s,cachePool:l}),n.memoizedState=o,n.childLanes=Yi(e,a,s),t.memoizedState=Gi,Li(e.child,n)):(Ml(t),e=(s=e.child).sibling,(s=Ia(s,{mode:"visible",children:n.children})).return=t,s.sibling=null,null!==e&&(null===(a=t.deletions)?(t.deletions=[e],t.flags|=16):a.push(e)),t.child=s,t.memoizedState=null,s)}function Qi(e,t){return(t=Xi({mode:"visible",children:t},e.mode)).return=e,e.child=t}function Xi(e,t){return(e=Ra(22,e,null,t)).lanes=0,e}function Zi(e,t,s){return hl(t,e.child,null,s),(e=Qi(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function eo(e,t,s){e.lanes|=t;var a=e.alternate;null!==a&&(a.lanes|=t),_n(e.return,t,s)}function to(e,t,s,a,n,l){var r=e.memoizedState;null===r?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:s,tailMode:n,treeForkCount:l}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=a,r.tail=s,r.tailMode=n,r.treeForkCount=l)}function so(e,t,s){var a=t.pendingProps,n=a.revealOrder,l=a.tail;a=a.children;var r=Il.current,i=0!==(2&r);if(i?(r=1&r|2,t.flags|=128):r&=1,U(Il,r),zi(e,t,a,s),a=un?Qa:0,!i&&null!==e&&0!==(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&eo(e,s,t);else if(19===e.tag)eo(e,s,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(n){case"forwards":for(s=t.child,n=null;null!==s;)null!==(e=s.alternate)&&null===Ol(e)&&(n=s),s=s.sibling;null===(s=n)?(n=t.child,t.child=null):(n=s.sibling,s.sibling=null),to(t,!1,n,s,l,a);break;case"backwards":case"unstable_legacy-backwards":for(s=null,n=t.child,t.child=null;null!==n;){if(null!==(e=n.alternate)&&null===Ol(e)){t.child=n;break}e=n.sibling,n.sibling=s,s=n,n=e}to(t,!0,s,null,l,a);break;case"together":to(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function ao(e,t,s){if(null!==e&&(t.dependencies=e.dependencies),Cc|=t.lanes,0===(s&t.childLanes)){if(null===e)return null;if(En(e,t,s,!1),0===(s&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(r(153));if(null!==t.child){for(s=Ia(e=t.child,e.pendingProps),t.child=s,s.return=t;null!==e.sibling;)e=e.sibling,(s=s.sibling=Ia(e,e.pendingProps)).return=t;s.sibling=null}return t.child}function no(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!An(e))}function lo(e,t,s){if(null!==e)if(e.memoizedProps!==t.pendingProps)Ti=!0;else{if(!no(e,s)&&0===(128&t.flags))return Ti=!1,function(e,t,s){switch(t.tag){case 3:K(t,t.stateNode.containerInfo),kn(0,Ln,e.memoizedState.cache),bn();break;case 27:case 5:J(t);break;case 4:K(t,t.stateNode.containerInfo);break;case 10:kn(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,Pl(t),null;break;case 13:var a=t.memoizedState;if(null!==a)return null!==a.dehydrated?(Ml(t),t.flags|=128,null):0!==(s&t.child.childLanes)?Ji(e,t,s):(Ml(t),null!==(e=ao(e,t,s))?e.sibling:null);Ml(t);break;case 19:var n=0!==(128&e.flags);if((a=0!==(s&t.childLanes))||(En(e,t,s,!1),a=0!==(s&t.childLanes)),n){if(a)return so(e,t,s);t.flags|=128}if(null!==(n=t.memoizedState)&&(n.rendering=null,n.tail=null,n.lastEffect=null),U(Il,Il.current),a)break;return null;case 22:return t.lanes=0,Ri(e,t,s,t.pendingProps);case 24:kn(0,Ln,e.memoizedState.cache)}return ao(e,t,s)}(e,t,s);Ti=0!==(131072&e.flags)}else Ti=!1,un&&0!==(1048576&t.flags)&&nn(t,Qa,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=al(t.elementType),t.type=e,"function"!==typeof e){if(void 0!==e&&null!==e){var n=e.$$typeof;if(n===N){t.tag=11,t=Mi(null,t,e,a,s);break e}if(n===k){t.tag=14,t=Pi(null,t,e,a,s);break e}}throw t=T(e)||e,Error(r(306,t,""))}La(e)?(a=Ni(e,a),t.tag=1,t=qi(null,t,e,a,s)):(t.tag=0,t=Wi(null,t,e,a,s))}return t;case 0:return Wi(e,t,t.type,t.pendingProps,s);case 1:return qi(e,t,a=t.type,n=Ni(a,t.pendingProps),s);case 3:e:{if(K(t,t.stateNode.containerInfo),null===e)throw Error(r(387));a=t.pendingProps;var l=t.memoizedState;n=l.element,fl(e,t),Cl(t,a,null,s);var i=t.memoizedState;if(a=i.cache,kn(0,Ln,a),a!==l.cache&&Sn(t,[Ln],s,!0),wl(),a=i.element,l.isDehydrated){if(l={element:a,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=l,t.memoizedState=l,256&t.flags){t=$i(e,t,a,s);break e}if(a!==n){yn(n=Ga(Error(r(424)),t)),t=$i(e,t,a,s);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;
vendor: 11,494 bytes, line 2
2else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(dn=zu(e.firstChild),cn=t,un=!0,mn=null,hn=!0,s=xl(t,null,a,s),t.child=s;s;)s.flags=-3&s.flags|4096,s=s.sibling}else{if(bn(),a===n){t=ao(e,t,s);break e}zi(e,t,a,s)}t=t.child}return t;case 26:return Hi(e,t),null===e?(s=qu(t.type,null,t.pendingProps,null))?t.memoizedState=s:un||(s=t.type,e=t.pendingProps,(a=gu($.current).createElement(s))[Ue]=t,a[He]=e,mu(a,s,e),et(a),t.stateNode=a):t.memoizedState=qu(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return J(t),null===e&&un&&(a=t.stateNode=Ru(t.type,t.pendingProps,$.current),cn=t,hn=!0,n=dn,Du(t.type)?(Mu=n,dn=zu(a.firstChild)):dn=n),zi(e,t,t.pendingProps.children,s),Hi(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&un&&((n=a=dn)&&(null!==(a=function(e,t,s,a){for(;1===e.nodeType;){var n=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(a){if(!e[Ke])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(l=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(l!==n.rel||e.getAttribute("href")!==(null==n.href||""===n.href?null:n.href)||e.getAttribute("crossorigin")!==(null==n.crossOrigin?null:n.crossOrigin)||e.getAttribute("title")!==(null==n.title?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((l=e.getAttribute("src"))!==(null==n.src?null:n.src)||e.getAttribute("type")!==(null==n.type?null:n.type)||e.getAttribute("crossorigin")!==(null==n.crossOrigin?null:n.crossOrigin))&&l&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var l=null==n.name?null:""+n.name;if("hidden"===n.type&&e.getAttribute("name")===l)return e}if(null===(e=zu(e.nextSibling)))break}return null}(a,t.type,t.pendingProps,hn))?(t.stateNode=a,cn=t,dn=zu(a.firstChild),hn=!1,n=!0):n=!1),n||pn(t)),J(t),n=t.type,l=t.pendingProps,i=null!==e?e.memoizedProps:null,a=l.children,bu(n,l)?a=null:null!==i&&bu(n,i)&&(t.flags|=32),null!==t.memoizedState&&(n=er(e,t,ar,null,null,s),dm._currentValue=n),Hi(e,t),zi(e,t,a,s),t.child;case 6:return null===e&&un&&((e=s=dn)&&(null!==(s=function(e,t,s){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!s)return null;if(null===(e=zu(e.nextSibling)))return null}return e}(s,t.pendingProps,hn))?(t.stateNode=s,cn=t,dn=null,e=!0):e=!1),e||pn(t)),null;case 13:return Ji(e,t,s);case 4:return K(t,t.stateNode.containerInfo),a=t.pendingProps,null===e?t.child=hl(t,null,a,s):zi(e,t,a,s),t.child;case 11:return Mi(e,t,t.type,t.pendingProps,s);case 7:return zi(e,t,t.pendingProps,s),t.child;case 8:case 12:return zi(e,t,t.pendingProps.children,s),t.child;case 10:return a=t.pendingProps,kn(0,t.type,a.value),zi(e,t,a.children,s),t.child;case 9:return n=t.type._context,a=t.pendingProps.children,Fn(t),a=a(n=Tn(n)),t.flags|=1,zi(e,t,a,s),t.child;case 14:return Pi(e,t,t.type,t.pendingProps,s);case 15:return Bi(e,t,t.type,t.pendingProps,s);case 19:return so(e,t,s);case 31:return function(e,t,s){var a=t.pendingProps,n=0!==(128&t.flags);if(t.flags&=-129,null===e){if(un){if("hidden"===a.mode)return e=Oi(t,a),t.lanes=536870912,Li(null,e);if(Pl(t),(e=dn)?null!==(e=null!==(e=Au(e,hn))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==en?{id:tn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},(s=Va(e)).return=t,t.child=s,cn=t,dn=null):e=null,null===e)throw pn(t);return t.lanes=536870912,null}return Oi(t,a)}var l=e.memoizedState;if(null!==l){var i=l.dehydrated;if(Pl(t),n)if(256&t.flags)t.flags&=-257,t=Ui(e,t,s);else{if(null===t.memoizedState)throw Error(r(558));t.child=e.child,t.flags|=128,t=null}else if(Ti||En(e,t,s,!1),n=0!==(s&e.childLanes),Ti||n){if(null!==(a=xc)&&0!==(i=Pe(a,s))&&i!==l.retryLane)throw l.retryLane=i,Ta(e,i),Kc(a,e,i),Fi;rd(),t=Ui(e,t,s)}else e=l.treeContext,dn=zu(i.nextSibling),cn=t,un=!0,mn=null,hn=!1,null!==e&&on(t,e),(t=Oi(t,a)).flags|=4096;return t}return(e=Ia(e.child,{mode:a.mode,children:a.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,s);case 22:return Ri(e,t,s,t.pendingProps);case 24:return Fn(t),a=Tn(Ln),null===e?(null===(n=Kn())&&(n=xc,l=In(),n.pooledCache=l,l.refCount++,null!==l&&(n.pooledCacheLanes|=s),n=l),t.memoizedState={parent:a,cache:n},gl(t),kn(0,Ln,n)):(0!==(e.lanes&s)&&(fl(e,t),Cl(t,null,null,s),wl()),n=e.memoizedState,l=t.memoizedState,n.parent!==a?(n={parent:a,cache:a},t.memoizedState=n,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=n),kn(0,Ln,a)):(a=l.cache,kn(0,Ln,a),a!==n.cache&&Sn(t,[Ln],s,!0))),zi(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function ro(e){e.flags|=4}function io(e,t,s,a,n){if((t=0!==(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&n)===n)if(e.stateNode.complete)e.flags|=8192;else{if(!ad())throw nl=el,Xn;e.flags|=8192}}else e.flags&=-16777217}function oo(e,t){if("stylesheet"!==t.type||0!==(4&t.state.loading))e.flags&=-16777217;else if(e.flags|=16777216,!nm(t)){if(!ad())throw nl=el,Xn;e.flags|=8192}}function co(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Ae():536870912,e.lanes|=t,Sc|=t)}function uo(e,t){if(!un)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;null!==t;)null!==t.alternate&&(s=t),t=t.sibling;null===s?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var a=null;null!==s;)null!==s.alternate&&(a=s),s=s.sibling;null===a?t||null===e.tail?e.tail=null:e.tail.sibling=null:a.sibling=null}}function mo(e){var t=null!==e.alternate&&e.alternate.child===e.child,s=0,a=0;if(t)for(var n=e.child;null!==n;)s|=n.lanes|n.childLanes,a|=65011712&n.subtreeFlags,a|=65011712&n.flags,n.return=e,n=n.sibling;else for(n=e.child;null!==n;)s|=n.lanes|n.childLanes,a|=n.subtreeFlags,a|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=a,e.childLanes=s,t}function ho(e,t,s){var a=t.pendingProps;switch(rn(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return mo(t),null;case 3:return s=t.stateNode,a=null,null!==e&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Dn(Ln),Y(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),null!==e&&null!==e.child||(vn(t)?ro(t):null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,jn())),mo(t),null;case 26:var n=t.type,l=t.memoizedState;return null===e?(ro(t),null!==l?(mo(t),oo(t,l)):(mo(t),io(t,n,0,0,s))):l?l!==e.memoizedState?(ro(t),mo(t),oo(t,l)):(mo(t),t.flags&=-16777217):((e=e.memoizedProps)!==a&&ro(t),mo(t),io(t,n,0,0,s)),null;case 27:if(Q(t),s=$.current,n=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==a&&ro(t);else{if(!a){if(null===t.stateNode)throw Error(r(166));return mo(t),null}e=V.current,vn(t)?gn(t):(e=Ru(n,a,s),t.stateNode=e,ro(t))}return mo(t),null;case 5:if(Q(t),n=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==a&&ro(t);else{if(!a){if(null===t.stateNode)throw Error(r(166));return mo(t),null}if(l=V.current,vn(t))gn(t);else{var i=gu($.current);switch(l){case 1:l=i.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:l=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":l=i.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":l=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":(l=i.createElement("div")).innerHTML="<script><\/script>",l=l.removeChild(l.firstChild);break;case"select":l="string"===typeof a.is?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?l.multiple=!0:a.size&&(l.size=a.size);break;default:l="string"===typeof a.is?i.createElement(n,{is:a.is}):i.createElement(n)}}l[Ue]=t,l[He]=a;e:for(i=t.child;null!==i;){if(5===i.tag||6===i.tag)l.appendChild(i.stateNode);else if(4!==i.tag&&27!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;null===i.sibling;){if(null===i.return||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=l;e:switch(mu(l,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&ro(t)}}return mo(t),io(t,t.type,null===e||e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==a&&ro(t);else{if("string"!==typeof a&&null===t.stateNode)throw Error(r(166));if(e=$.current,vn(t)){if(e=t.stateNode,s=t.memoizedProps,a=null,null!==(n=cn))switch(n.tag){case 27:case 5:a=n.memoizedProps}e[Ue]=t,(e=!!(e.nodeValue===s||null!==a&&!0===a.suppressHydrationWarning||cu(e.nodeValue,s)))||pn(t,!0)}else(e=gu(e).createTextNode(a))[Ue]=t,t.stateNode=e}return mo(t),null;case 31:if(s=t.memoizedState,null===e||null!==e.memoizedState){if(a=vn(t),null!==s){if(null===e){if(!a)throw Error(r(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(r(557));e[Ue]=t}else bn(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;mo(t),e=!1}else s=jn(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return 256&t.flags?(Ll(t),t):(Ll(t),null);if(0!==(128&t.flags))throw Error(r(558))}return mo(t),null;case 13:if(a=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(n=vn(t),null!==a&&null!==a.dehydrated){if(null===e){if(!n)throw Error(r(318));if(!(n=null!==(n=t.memoizedState)?n.dehydrated:null))throw Error(r(317));n[Ue]=t}else bn(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;mo(t),n=!1}else n=jn(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return 256&t.flags?(Ll(t),t):(Ll(t),null)}return Ll(t),0!==(128&t.flags)?(t.lanes=s,t):(s=null!==a,e=null!==e&&null!==e.memoizedState,s&&(n=null,null!==(a=t.child).alternate&&null!==a.alternate.memoizedState&&null!==a.alternate.memoizedState.cachePool&&(n=a.alternate.memoizedState.cachePool.pool),l=null,null!==a.memoizedState&&null!==a.memoizedState.cachePool&&(l=a.memoizedState.cachePool.pool),l!==n&&(a.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),co(t,t.updateQueue),mo(t),null);case 4:return Y(),null===e&&Zd(t.stateNode.containerInfo),mo(t),null;case 10:return Dn(t.type),mo(t),null;case 19:if(O(Il),null===(a=t.memoizedState))return mo(t),null;if(n=0!==(128&t.flags),null===(l=a.rendering))if(n)uo(a,!1);else{if(0!==wc||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(l=Ol(e))){for(t.flags|=128,uo(a,!1),e=l.updateQueue,t.updateQueue=e,co(t,e),t.subtreeFlags=0,e=s,s=t.child;null!==s;)Oa(s,e),s=s.sibling;return U(Il,1&Il.current|2),un&&an(t,a.treeForkCount),t.child}e=e.sibling}null!==a.tail&&oe()>Mc&&(t.flags|=128,n=!0,uo(a,!1),t.lanes=4194304)}else{if(!n)if(null!==(e=Ol(l))){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,co(t,e),uo(a,!0),null===a.tail&&"hidden"===a.tailMode&&!l.alternate&&!un)return mo(t),null}else 2*oe()-a.renderingStartTime>Mc&&536870912!==s&&(t.flags|=128,n=!0,uo(a,!1),t.lanes=4194304);a.isBackwards?(l.sibling=t.child,t.child=l):(null!==(e=a.last)?e.sibling=l:t.child=l,a.last=l)}return null!==a.tail?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=oe(),e.sibling=null,s=Il.current,U(Il,n?1&s|2:1&s),un&&an(t,a.treeForkCount),e):(mo(t),null);case 22:case 23:return Ll(t),Fl(),a=null!==t.memoizedState,null!==e?null!==e.memoizedState!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?0!==(536870912&s)&&0===(128&t.flags)&&(mo(t),6&t.subtreeFlags&&(t.flags|=8192)):mo(t),null!==(s=t.updateQueue)&&co(t,
vendor: 4,152 bytes, line 2
2s.retryQueue),s=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(s=e.memoizedState.cachePool.pool),a=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(a=t.memoizedState.cachePool.pool),a!==s&&(t.flags|=2048),null!==e&&O(Gn),null;case 24:return s=null,null!==e&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Dn(Ln),mo(t),null;case 25:case 30:return null}throw Error(r(156,t.tag))}function xo(e,t){switch(rn(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Dn(Ln),Y(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return Q(t),null;case 31:if(null!==t.memoizedState){if(Ll(t),null===t.alternate)throw Error(r(340));bn()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Ll(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(r(340));bn()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return O(Il),null;case 4:return Y(),null;case 10:return Dn(t.type),null;case 22:case 23:return Ll(t),Fl(),null!==e&&O(Gn),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return Dn(Ln),null;default:return null}}function po(e,t){switch(rn(t),t.tag){case 3:Dn(Ln),Y();break;case 26:case 27:case 5:Q(t);break;case 4:Y();break;case 31:null!==t.memoizedState&&Ll(t);break;case 13:Ll(t);break;case 19:O(Il);break;case 10:Dn(t.type);break;case 22:case 23:Ll(t),Fl(),null!==e&&O(Gn);break;case 24:Dn(Ln)}}function go(e,t){try{var s=t.updateQueue,a=null!==s?s.lastEffect:null;if(null!==a){var n=a.next;s=n;do{if((s.tag&e)===e){a=void 0;var l=s.create,r=s.inst;a=l(),r.destroy=a}s=s.next}while(s!==n)}}catch(i){wd(t,t.return,i)}}function fo(e,t,s){try{var a=t.updateQueue,n=null!==a?a.lastEffect:null;if(null!==n){var l=n.next;a=l;do{if((a.tag&e)===e){var r=a.inst,i=r.destroy;if(void 0!==i){r.destroy=void 0,n=t;var o=s,c=i;try{c()}catch(d){wd(n,o,d)}}}a=a.next}while(a!==l)}}catch(d){wd(t,t.return,d)}}function vo(e){var t=e.updateQueue;if(null!==t){var s=e.stateNode;try{Dl(t,s)}catch(a){wd(e,e.return,a)}}}function bo(e,t,s){s.props=Ni(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(a){wd(e,t,a)}}function jo(e,t){try{var s=e.ref;if(null!==s){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;default:a=e.stateNode}"function"===typeof s?e.refCleanup=s(a):s.current=a}}catch(n){wd(e,t,n)}}function yo(e,t){var s=e.ref,a=e.refCleanup;if(null!==s)if("function"===typeof a)try{a()}catch(n){wd(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"===typeof s)try{s(null)}catch(l){wd(e,t,l)}else s.current=null}function No(e){var t=e.type,s=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&a.focus();break e;case"img":s.src?a.src=s.src:s.srcSet&&(a.srcset=s.srcSet)}}catch(n){wd(e,e.return,n)}}function wo(e,t,s){try{var a=e.stateNode;!function(e,t,s,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var n=null,l=null,i=null,o=null,c=null,d=null,u=null;for(x in s){var m=s[x];if(s.hasOwnProperty(x)&&null!=m)switch(x){case"checked":case"value":break;case"defaultValue":c=m;default:a.hasOwnProperty(x)||du(e,t,x,null,a,m)}}for(var h in a){var x=a[h];if(m=s[h],a.hasOwnProperty(h)&&(null!=x||null!=m))switch(h){case"type":l=x;break;case"name":n=x;break;case"checked":d=x;break;case"defaultChecked":u=x;break;case"value":i=x;break;case"defaultValue":o=x;break;case"children":case"dangerouslySetInnerHTML":if(null!=x)throw Error(r(137,t));break;default:x!==m&&du(e,t,h,x,a,m)}}return void vt(e,i,o,c,d,u,l,n);case"select":for(l in x=i=o=h=null,s)if(c=s[l],s.hasOwnProperty(l)&&null!=c)switch(l){case"value":break;case"multiple":x=c;default:a.hasOwnProperty(l)||du(e,t,l,null,a,c)}for(n in a)if(l=a[n],c=s[n],a.hasOwnProperty(n)&&(null!=l||null!=c))switch(n){case"value":h=l;break;case"defaultValue":o=l;break;case"multiple":i=l;default:l!==c&&du(e,t,n,l,a,c)}return t=o,s=i,a=x,void(null!=h?yt(e,!!s,h,!1):!!a!==!!s&&(null!=t?yt(e,!!s,t,!0):yt(e,!!s,s?[]:"",!1))
vendor: 30,617 bytes, line 2
2);case"textarea":for(o in x=h=null,s)if(n=s[o],s.hasOwnProperty(o)&&null!=n&&!a.hasOwnProperty(o))switch(o){case"value":case"children":break;default:du(e,t,o,null,a,n)}for(i in a)if(n=a[i],l=s[i],a.hasOwnProperty(i)&&(null!=n||null!=l))switch(i){case"value":h=n;break;case"defaultValue":x=n;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=n)throw Error(r(91));break;default:n!==l&&du(e,t,i,n,a,l)}return void Nt(e,h,x);case"option":for(var p in s)if(h=s[p],s.hasOwnProperty(p)&&null!=h&&!a.hasOwnProperty(p))if("selected"===p)e.selected=!1;else du(e,t,p,null,a,h);for(c in a)if(h=a[c],x=s[c],a.hasOwnProperty(c)&&h!==x&&(null!=h||null!=x))if("selected"===c)e.selected=h&&"function"!==typeof h&&"symbol"!==typeof h;else du(e,t,c,h,a,x);return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var g in s)h=s[g],s.hasOwnProperty(g)&&null!=h&&!a.hasOwnProperty(g)&&du(e,t,g,null,a,h);for(d in a)if(h=a[d],x=s[d],a.hasOwnProperty(d)&&h!==x&&(null!=h||null!=x))switch(d){case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(r(137,t));break;default:du(e,t,d,h,a,x)}return;default:if(St(t)){for(var f in s)h=s[f],s.hasOwnProperty(f)&&void 0!==h&&!a.hasOwnProperty(f)&&uu(e,t,f,void 0,a,h);for(u in a)h=a[u],x=s[u],!a.hasOwnProperty(u)||h===x||void 0===h&&void 0===x||uu(e,t,u,h,a,x);return}}for(var v in s)h=s[v],s.hasOwnProperty(v)&&null!=h&&!a.hasOwnProperty(v)&&du(e,t,v,null,a,h);for(m in a)h=a[m],x=s[m],!a.hasOwnProperty(m)||h===x||null==h&&null==x||du(e,t,m,h,a,x)}(a,e.type,s,t),a[He]=t}catch(n){wd(e,e.return,n)}}function Co(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&Du(e.type)||4===e.tag}function ko(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Co(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&Du(e.type))continue e;if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Do(e,t,s){var a=e.tag;if(5===a||6===a)e=e.stateNode,t?(9===s.nodeType?s.body:"HTML"===s.nodeName?s.ownerDocument.body:s).insertBefore(e,t):((t=9===s.nodeType?s.body:"HTML"===s.nodeName?s.ownerDocument.body:s).appendChild(e),null!==(s=s._reactRootContainer)&&void 0!==s||null!==t.onclick||(t.onclick=Tt));else if(4!==a&&(27===a&&Du(e.type)&&(s=e.stateNode,t=null),null!==(e=e.child)))for(Do(e,t,s),e=e.sibling;null!==e;)Do(e,t,s),e=e.sibling}function _o(e,t,s){var a=e.tag;if(5===a||6===a)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(4!==a&&(27===a&&Du(e.type)&&(s=e.stateNode),null!==(e=e.child)))for(_o(e,t,s),e=e.sibling;null!==e;)_o(e,t,s),e=e.sibling}function So(e){var t=e.stateNode,s=e.memoizedProps;try{for(var a=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);mu(t,a,s),t[Ue]=e,t[He]=s}catch(l){wd(e,e.return,l)}}var Eo=!1,Ao=!1,Fo=!1,To="function"===typeof WeakSet?WeakSet:Set,zo=null;function Mo(e,t,s){var a=s.flags;switch(s.tag){case 0:case 11:case 15:Ko(e,s),4&a&&go(5,s);break;case 1:if(Ko(e,s),4&a)if(e=s.stateNode,null===t)try{e.componentDidMount()}catch(r){wd(s,s.return,r)}else{var n=Ni(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){wd(s,s.return,i)}}64&a&&vo(s),512&a&&jo(s,s.return);break;case 3:if(Ko(e,s),64&a&&null!==(e=s.updateQueue)){if(t=null,null!==s.child)switch(s.child.tag){case 27:case 5:case 1:t=s.child.stateNode}try{Dl(e,t)}catch(r){wd(s,s.return,r)}}break;case 27:null===t&&4&a&&So(s);case 26:case 5:Ko(e,s),null===t&&4&a&&No(s),512&a&&jo(s,s.return);break;case 12:Ko(e,s);break;case 31:Ko(e,s),4&a&&Oo(e,s);break;case 13:Ko(e,s),4&a&&Uo(e,s),64&a&&(null!==(e=s.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var s=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==s.readyState)t();else{var a=function(){t(),s.removeEventListener("DOMContentLoaded",a)};s.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}(e,s=_d.bind(null,s))));break;case 22:if(!(a=null!==s.memoizedState||Eo)){t=null!==t&&null!==t.memoizedState||Ao,n=Eo;var l=Ao;Eo=a,(Ao=t)&&!l?Jo(e,s,0!==(8772&s.subtreeFlags)):Ko(e,s),Eo=n,Ao=l}break;case 30:break;default:Ko(e,s)}}function Po(e){var t=e.alternate;null!==t&&(e.alternate=null,Po(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&Ye(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Bo=null,Ro=!1;function Lo(e,t,s){for(s=s.child;null!==s;)Io(e,t,s),s=s.sibling}function Io(e,t,s){if(ve&&"function"===typeof ve.onCommitFiberUnmount)try{ve.onCommitFiberUnmount(fe,s)}catch(l){}switch(s.tag){case 26:Ao||yo(s,t),Lo(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode).parentNode.removeChild(s);break;case 27:Ao||yo(s,t);var a=Bo,n=Ro;Du(s.type)&&(Bo=s.stateNode,Ro=!1),Lo(e,t,s),Lu(s.stateNode),Bo=a,Ro=n;break;case 5:Ao||yo(s,t);case 6:if(a=Bo,n=Ro,Bo=null,Lo(e,t,s),Ro=n,null!==(Bo=a))if(Ro)try{(9===Bo.nodeType?Bo.body:"HTML"===Bo.nodeName?Bo.ownerDocument.body:Bo).removeChild(s.stateNode)}catch(r){wd(s,t,r)}else try{Bo.removeChild(s.stateNode)}catch(r){wd(s,t,r)}break;case 18:null!==Bo&&(Ro?(_u(9===(e=Bo).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,s.stateNode),Vm(e)):_u(Bo,s.stateNode));break;case 4:a=Bo,n=Ro,Bo=s.stateNode.containerInfo,Ro=!0,Lo(e,t,s),Bo=a,Ro=n;break;case 0:case 11:case 14:case 15:fo(2,s,t),Ao||fo(4,s,t),Lo(e,t,s);break;case 1:Ao||(yo(s,t),"function"===typeof(a=s.stateNode).componentWillUnmount&&bo(s,t,a)),Lo(e,t,s);break;case 21:Lo(e,t,s);break;case 22:Ao=(a=Ao)||null!==s.memoizedState,Lo(e,t,s),Ao=a;break;default:Lo(e,t,s)}}function Oo(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Vm(e)}catch(s){wd(t,t.return,s)}}}function Uo(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Vm(e)}catch(s){wd(t,t.return,s)}}function Ho(e,t){var s=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new To),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new To),t;default:throw Error(r(435,e.tag))}}(e);t.forEach(function(t){if(!s.has(t)){s.add(t);var a=Sd.bind(null,e,t);t.then(a,a)}})}function Wo(e,t){var s=t.deletions;if(null!==s)for(var a=0;a<s.length;a++){var n=s[a],l=e,i=t,o=i;e:for(;null!==o;){switch(o.tag){case 27:if(Du(o.type)){Bo=o.stateNode,Ro=!1;break e}break;case 5:Bo=o.stateNode,Ro=!1;break e;case 3:case 4:Bo=o.stateNode.containerInfo,Ro=!0;break e}o=o.return}if(null===Bo)throw Error(r(160));Io(l,i,n),Bo=null,Ro=!1,null!==(l=n.alternate)&&(l.return=null),n.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)qo(t,e),t=t.sibling}var Vo=null;function qo(e,t){var s=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Wo(t,e),$o(e),4&a&&(fo(3,e,e.return),go(3,e),fo(5,e,e.return));break;case 1:Wo(t,e),$o(e),512&a&&(Ao||null===s||yo(s,s.return)),64&a&&Eo&&(null!==(e=e.updateQueue)&&(null!==(a=e.callbacks)&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===s?a:s.concat(a))));break;case 26:var n=Vo;if(Wo(t,e),$o(e),512&a&&(Ao||null===s||yo(s,s.return)),4&a){var l=null!==s?s.memoizedState:null;if(a=e.memoizedState,null===s)if(null===a)if(null===e.stateNode){e:{a=e.type,s=e.memoizedProps,n=n.ownerDocument||n;t:switch(a){case"title":(!(l=n.getElementsByTagName("title")[0])||l[Ke]||l[Ue]||"http://www.w3.org/2000/svg"===l.namespaceURI||l.hasAttribute("itemprop"))&&(l=n.createElement(a),n.head.insertBefore(l,n.querySelector("head > title"))),mu(l,a,s),l[Ue]=e,et(l),a=l;break e;case"link":var i=sm("link","href",n).get(a+(s.href||""));if(i)for(var o=0;o<i.length;o++)if((l=i[o]).getAttribute("href")===(null==s.href||""===s.href?null:s.href)&&l.getAttribute("rel")===(null==s.rel?null:s.rel)&&l.getAttribute("title")===(null==s.title?null:s.title)&&l.getAttribute("crossorigin")===(null==s.crossOrigin?null:s.crossOrigin)){i.splice(o,1);break t}mu(l=n.createElement(a),a,s),n.head.appendChild(l);break;case"meta":if(i=sm("meta","content",n).get(a+(s.content||"")))for(o=0;o<i.length;o++)if((l=i[o]).getAttribute("content")===(null==s.content?null:""+s.content)&&l.getAttribute("name")===(null==s.name?null:s.name)&&l.getAttribute("property")===(null==s.property?null:s.property)&&l.getAttribute("http-equiv")===(null==s.httpEquiv?null:s.httpEquiv)&&l.getAttribute("charset")===(null==s.charSet?null:s.charSet)){i.splice(o,1);break t}mu(l=n.createElement(a),a,s),n.head.appendChild(l);break;default:throw Error(r(468,a))}l[Ue]=e,et(l),a=l}e.stateNode=a}else am(n,e.type,e.stateNode);else e.stateNode=Qu(n,a,e.memoizedProps);else l!==a?(null===l?null!==s.stateNode&&(s=s.stateNode).parentNode.removeChild(s):l.count--,null===a?am(n,e.type,e.stateNode):Qu(n,a,e.memoizedProps)):null===a&&null!==e.stateNode&&wo(e,e.memoizedProps,s.memoizedProps)}break;case 27:Wo(t,e),$o(e),512&a&&(Ao||null===s||yo(s,s.return)),null!==s&&4&a&&wo(e,e.memoizedProps,s.memoizedProps);break;case 5:if(Wo(t,e),$o(e),512&a&&(Ao||null===s||yo(s,s.return)),32&e.flags){n=e.stateNode;try{Ct(n,"")}catch(p){wd(e,e.return,p)}}4&a&&null!=e.stateNode&&wo(e,n=e.memoizedProps,null!==s?s.memoizedProps:n),1024&a&&(Fo=!0);break;case 6:if(Wo(t,e),$o(e),4&a){if(null===e.stateNode)throw Error(r(162));a=e.memoizedProps,s=e.stateNode;try{s.nodeValue=a}catch(p){wd(e,e.return,p)}}break;case 3:if(tm=null,n=Vo,Vo=Uu(t.containerInfo),Wo(t,e),Vo=n,$o(e),4&a&&null!==s&&s.memoizedState.isDehydrated)try{Vm(t.containerInfo)}catch(p){wd(e,e.return,p)}Fo&&(Fo=!1,Go(e));break;case 4:a=Vo,Vo=Uu(e.stateNode.containerInfo),Wo(t,e),$o(e),Vo=a;break;case 12:default:Wo(t,e),$o(e);break;case 31:case 19:Wo(t,e),$o(e),4&a&&(null!==(a=e.updateQueue)&&(e.updateQueue=null,Ho(e,a)));break;case 13:Wo(t,e),$o(e),8192&e.child.flags&&null!==e.memoizedState!==(null!==s&&null!==s.memoizedState)&&(Tc=oe()),4&a&&(null!==(a=e.updateQueue)&&(e.updateQueue=null,Ho(e,a)));break;case 22:n=null!==e.memoizedState;var c=null!==s&&null!==s.memoizedState,d=Eo,u=Ao;if(Eo=d||n,Ao=u||c,Wo(t,e),Ao=u,Eo=d,$o(e),8192&a)e:for(t=e.stateNode,t._visibility=n?-2&t._visibility:1|t._visibility,n&&(null===s||c||Eo||Ao||Yo(e)),s=null,t=e;;){if(5===t.tag||26===t.tag){if(null===s){c=s=t;try{if(l=c.stateNode,n)"function"===typeof(i=l.style).setProperty?i.setProperty("display","none","important"):i.display="none";else{o=c.stateNode;var m=c.memoizedProps.style,h=void 0!==m&&null!==m&&m.hasOwnProperty("display")?m.display:null;o.style.display=null==h||"boolean"===typeof h?"":(""+h).trim()}}catch(p){wd(c,c.return,p)}}}else if(6===t.tag){if(null===s){c=t;try{c.stateNode.nodeValue=n?"":c.memoizedProps}catch(p){wd(c,c.return,p)}}}else if(18===t.tag){if(null===s){c=t;try{var x=c.stateNode;n?Su(x,!0):Su(c.stateNode,!1)}catch(p){wd(c,c.return,p)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}4&a&&(null!==(a=e.updateQueue)&&(null!==(s=a.retryQueue)&&(a.retryQueue=null,Ho(e,s))));case 30:case 21:}}function $o(e){var t=e.flags;if(2&t){try{for(var s,a=e.return;null!==a;){if(Co(a)){s=a;break}a=a.return}if(null==s)throw Error(r(160));switch(s.tag){case 27:var n=s.stateNode;_o(e,ko(e),n);break;case 5:var l=s.stateNode;32&s.flags&&(Ct(l,""),s.flags&=-33),_o(e,ko(e),l);break;case 3:case 4:var i=s.stateNode.containerInfo;Do(e,ko(e),i);break;default:throw Error(r(161))}}catch(o){wd(e,e.return,o)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Go(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;Go(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function Ko(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Mo(e,t.alternate,t),t=t.sibling}function Yo(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:fo(4,t,t.return),Yo(t);break;case 1:yo(t,t.return);var s=t.stateNode;"function"===typeof s.componentWillUnmount&&bo(t,t.return,s),Yo(t);break;case 27:Lu(t.stateNode);case 26:case 5:yo(t,t.return),Yo(t);break;case 22:null===t.memoizedState&&Yo(t);break;default:Yo(t)}e=e.sibling}}function Jo(e,t,s){for(s=s&&0!==(8772&t.subtreeFlags),t=t.child;null!==t;){var a=t.alternate,n=e,l=t,r=l.flags;switch(l.tag){case 0:case 11:case 15:Jo(n,l,s),go(4,l);break;case 1:if(Jo(n,l,s),"function"===typeof(n=(a=l).stateNode).componentDidMount)try{n.componentDidMount()}catch(c){wd(a,a.return,c)}if(null!==(n=(a=l).updateQueue)){var i=a.stateNode;try{var o=n.shared.hiddenCallbacks;if(null!==o)for(n.shared.hiddenCallbacks=null,n=0;n<o.length;n++)kl(o[n],i)}catch(c){wd(a,a.return,c)}}s&&64&r&&vo(l),jo(l,l.return);break;case 27:So(l);case 26:case 5:Jo(n,l,s),s&&null===a&&4&r&&No(l),jo(l,l.return);break;case 12:Jo(n,l,s);break;case 31:Jo(n,l,s),s&&4&r&&Oo(n,l);break;case 13:Jo(n,l,s),s&&4&r&&Uo(n,l);break;case 22:null===l.memoizedState&&Jo(n,l,s),jo(l,l.return);break;case 30:break;default:Jo(n,l,s)}t=t.sibling}}function Qo(e,t){var s=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(s=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==s&&(null!=e&&e.refCount++,null!=s&&On(s))}function Xo(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&On(e))}function Zo(e,t,s,a){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)ec(e,t,s,a),t=t.sibling}function ec(e,t,s,a){var n=t.flags;switch(t.tag){case 0:case 11:case 15:Zo(e,t,s,a),2048&n&&go(9,t);break;case 1:case 31:case 13:default:Zo(e,t,s,a);break;case 3:Zo(e,t,s,a),2048&n&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&On(e)));break;case 12:if(2048&n){Zo(e,t,s,a),e=t.stateNode;try{var l=t.memoizedProps,r=l.id,i=l.onPostCommit;"function"===typeof i&&i(r,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(o){wd(t,t.return,o)}}else Zo(e,t,s,a);break;case 23:break;case 22:l=t.stateNode,r=t.alternate,null!==t.memoizedState?2&l._visibility?Zo(e,t,s,a):sc(e,t):2&l._visibility?Zo(e,t,s,a):(l._visibility|=2,tc(e,t,s,a,0!==(10256&t.subtreeFlags)||!1)),2048&n&&Qo(r,t);break;case 24:Zo(e,t,s,a),2048&n&&Xo(t.alternate,t)}}function tc(e,t,s,a,n){for(n=n&&(0!==(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var l=e,r=t,i=s,o=a,c=r.flags;switch(r.tag){case 0:case 11:case 15:tc(l,r,i,o,n),go(8,r);break;case 23:break;case 22:var d=r.stateNode;null!==r.memoizedState?2&d._visibility?tc(l,r,i,o,n):sc(l,r):(d._visibility|=2,tc(l,r,i,o,n)),n&&2048&c&&Qo(r.alternate,r);break;case 24:tc(l,r,i,o,n),n&&2048&c&&Xo(r.alternate,r);break;default:tc(l,r,i,o,n)}t=t.sibling}}function sc(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var s=e,a=t,n=a.flags;switch(a.tag){case 22:sc(s,a),2048&n&&Qo(a.alternate,a);break;case 24:sc(s,a),2048&n&&Xo(a.alternate,a);break;default:sc(s,a)}t=t.sibling}}var ac=8192;function nc(e,t,s){if(e.subtreeFlags&ac)for(e=e.child;null!==e;)lc(e,t,s),e=e.sibling}function lc(e,t,s){switch(e.tag){case 26:nc(e,t,s),e.flags&ac&&null!==e.memoizedState&&function(e,t,s,a){if("stylesheet"===s.type&&("string"!==typeof a.media||!1!==matchMedia(a.media).matches)&&0===(4&s.state.loading)){if(null===s.instance){var n=$u(a.href),l=t.querySelector(Gu(n));if(l)return null!==(t=l._p)&&"object"===typeof t&&"function"===typeof t.then&&(e.count++,e=rm.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=l,void et(l);l=t.ownerDocument||t,a=Ku(a),(n=Iu.get(n))&&Zu(a,n),et(l=l.createElement("link"));var r=l;r._p=new Promise(function(e,t){r.onload=e,r.onerror=t}),mu(l,"link",a),s.instance=l}null===e.stylesheets&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&0===(3&s.state.loading)&&(e.count++,s=rm.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}(s,Vo,e.memoizedState,e.memoizedProps);break;case 5:default:nc(e,t,s);break;case 3:case 4:var a=Vo;Vo=Uu(e.stateNode.containerInfo),nc(e,t,s),Vo=a;break;case 22:null===e.memoizedState&&(null!==(a=e.alternate)&&null!==a.memoizedState?(a=ac,ac=16777216,nc(e,t,s),ac=a):nc(e,t,s))}}function rc(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function ic(e){var t=e.deletions;if(0!==(16&e.flags)){if(null!==t)for(var s=0;s<t.length;s++){var a=t[s];zo=a,dc(a,e)}rc(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)oc(e),e=e.sibling}function oc(e){switch(e.tag){case 0:case 11:case 15:ic(e),2048&e.flags&&fo(9,e,e.return);break;case 3:case 12:default:ic(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,cc(e)):ic(e)}}function cc(e){var t=e.deletions;if(0!==(16&e.flags)){if(null!==t)for(var s=0;s<t.length;s++){var a=t[s];zo=a,dc(a,e)}rc(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:fo(8,t,t.return),cc(t);break;case 22:2&(s=t.stateNode)._visibility&&(s._visibility&=-3,cc(t));break;default:cc(t)}e=e.sibling}}function dc(e,t){for(;null!==zo;){var s=zo;switch(s.tag){case 0:case 11:case 15:fo(8,s,t);break;case 23:case 22:if(null!==s.memoizedState&&null!==s.memoizedState.cachePool){var a=s.memoizedState.cachePool.pool;null!=a&&a.refCount++}break;case 24:On(s.memoizedState.cache)}if(null!==(a=s.child))a.return=s,zo=a;else e:for(s=e;null!==zo;){var n=(a=zo).sibling,l=a.return;if(Po(a),a===s){zo=null;break e}if(null!==n){n.return=l,zo=n;break e}zo=l}}}var uc={getCacheForType:function(e){var t=Tn(Ln),s=t.data.get(e);return void 0===s&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return Tn(Ln).controller.signal}},mc="function"===typeof WeakMap?WeakMap:Map,hc=0,xc=null,pc=null,gc=0,fc=0,vc=null,bc=!1,jc=!1,yc=!1,Nc=0,wc=0,Cc=0,kc=0,Dc=0,_c=0,Sc=0,Ec=null,Ac=null,Fc=!1,Tc=0,zc=0,Mc=1/0,Pc=null,Bc=null,Rc=0,Lc=null,Ic=null,Oc=0,Uc=0,Hc=null,Wc=null,Vc=0,qc=null;function $c(){return 0!==(2&hc)&&0!==gc?gc&-gc:null!==M.T?Hd():Le()}function Gc(){if(0===_c)if(0===(536870912&gc)||un){var e=Ce;0===(3932160&(Ce<<=1))&&(Ce=262144),_c=e}else _c=536870912;return null!==(e=Tl.current)&&(e.flags|=32),_c}function Kc(e,t,s){(e!==xc||2!==fc&&9!==fc)&&null===e.cancelPendingCommit||(td(e,0),Xc(e,gc,_c,!1)),Te(e,s),0!==(2&hc)&&e===xc||(e===xc&&(0===(2&hc)&&(kc|=s),4===wc&&Xc(e,gc,_c,!1)),Pd(e))}function Yc(e,t,s){if(0!==(6&hc))throw Error(r(327));for(var a=!s&&0===(127&t)&&0===(t&e.expiredLanes)||Se(e,t),n=a?function(e,t){var s=hc;hc|=2;var a=nd(),n=ld();xc!==e||gc!==t?(Pc=null,Mc=oe()+500,td(e,t)):jc=Se(e,t);e:for(;;)try{if(0!==fc&&null!==pc){t=pc;var l=vc;t:switch(fc){case 1:fc=0,vc=null,md(e,t,l,1);break;case 2:case 9:if(tl(l)){fc=0,vc=null,ud(t);break}t=function(){2!==fc&&9!==fc||xc!==e||(fc=7),Pd(e)},l.then(t,t);break e;case 3:fc=7;break e;case 4:fc=5;break e;case 7:tl(l)?(fc=0,vc=null,ud(t)):(fc=0,vc=null,md(e,t,l,7));break;case 5:var i=null;switch(pc.tag){case 26:i=pc.memoizedState;case 5:case 27:var o=pc;if(i?nm(i):o.stateNode.complete){fc=0,vc=null;var c=o.sibling;if(null!==c)pc=c;else{var d=o.return;null!==d?(pc=d,hd(d)):pc=null}break t}}fc=0,vc=null,md(e,t,l,5);break;case 6:fc=0,vc=null,md(e,t,l,6);break;case 8:ed(),wc=6;break e;default:throw Error(r(462))}}cd();break}catch(u){sd(e,u)}return Cn=wn=null,M.H=a,M.A=n,hc=s,null!==pc?0:(xc=null,gc=0,Ea(),wc)}(e,t):id(e,t,!0),l=a;;){if(0===n){jc&&!a&&Xc(e,t,0,!1);break}if(s=e.current.alternate,!l||Qc(s)){if(2===n){if(l=t,e.errorRecoveryDisabledLanes&l)var i=0;else i=0!==(i=-536870913&e.pendingLanes)?i:536870912&i?536870912:0;if(0!==i){t=i;e:{var o=e;n=Ec;var c=o.current.memoizedState.isDehydrated;if(c&&(td(o,i).flags|=256),2!==(i=id(o,i,!1))){if(yc&&!c){o.errorRecoveryDisabledLanes|=l,kc|=l,n=4;break e}l=Ac,Ac=n,null!==l&&(null===Ac?Ac=l:Ac.push.apply(Ac,l))}n=i}if(l=!1,2!==n)continue}}if(1===n){td(e,0),Xc(e,t,0,!0);break}e:{switch(a=e,l=n){case 0:case 1:throw Error(r(345));case 4:if((4194048&t)!==t)break;case 6:Xc(a,t,_c,!bc);break e;case 2:Ac=null;break;case 3:case 5:break;default:throw Error(r(329))}if((62914560&t)===t&&10<(n=Tc+300-oe())){if(Xc(a,t,_c,!bc),0!==_e(a,0,!0))break e;Oc=t,a.timeoutHandle=yu(Jc.bind(null,a,s,Ac,Pc,Fc,t,_c,kc,Sc,bc,l,"Throttled",-0,0),n)}else Jc(a,s,Ac,Pc,Fc,t,_c,kc,Sc,bc,l,null,-0,0)}break}n=id(e,t,!1),l=!1}Pd(e)}function Jc(e,t,s,a,n,l,r,i,o,c,d,u,m,h){if(e.timeoutHandle=-1,8192&(u=t.subtreeFlags)||16785408===(16785408&u)){lc(t,l,u={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tt});var x=(62914560&l)===l?Tc-oe():(4194048&l)===l?zc-oe():0;if(null!==(x=function(e,t){return e.stylesheets&&0===e.count&&om(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var a=setTimeout(function(){if(e.stylesheets&&om(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===lm&&(lm=62500*function(){if("function"===typeof performance.getEntriesByType){for(var e=0,t=0,s=performance.getEntriesByType("resource"),a=0;a<s.length;a++){var n=s[a],l=n.transferSize,r=n.initiatorType,i=n.duration;if(l&&i&&hu(r)){for(r=0,i=n.responseEnd,a+=1;a<s.length;a++){var o=s[a],c=o.startTime;if(c>i)break;var d=o.transferSize,u=o.initiatorType;d&&hu(u)&&(r+=d*((o=o.responseEnd)<i?1:(i-c)/(o-c)))}if(--a,t+=8*(l+r)/(n.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"===typeof(e=navigator.connection.downlink)?e:5}());var n=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&om(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>lm?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}(u,x)))return Oc=l,e.cancelPendingCommit=x(pd.bind(null,e,t,l,s,a,n,r,i,o,d,u,null,m,h)),void Xc(e,l,r,!c)}pd(e,t,l,s,a,n,r,i,o)}function Qc(e){for(var t=e;;){var s=t.tag;if((0===s||11===s||15===s)&&16384&t.flags&&(null!==(s=t.updateQueue)&&null!==(s=s.stores)))for(var a=0;a<s.length;a++){var n=s[a],l=n.getSnapshot;n=n.value;try{if(!Qs(l(),n))return!1}catch(r){return!1}}if(s=t.child,16384&t.subtreeFlags&&null!==s)s.return=t,t=s;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Xc(e,t,s,a){t&=~Dc,t&=~kc,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var n=t;0<n;){var l=31-je(n),r=1<<l;a[l]=-1,n&=~r}0!==s&&ze(e,s,t)}function Zc(){return 0!==(6&hc)||(Bd(0,!1),!1)}function ed(){if(null!==pc){if(0===fc)var e=pc.return;else Cn=wn=null,rr(e=pc),il=null,ol=0,e=pc;for(;null!==e;)po(e.alternate,e),e=e.return;pc=null}}function td(e,t){var s=e.timeoutHandle;-1!==s&&(e.timeoutHandle=-1,Nu(s)),null!==(s=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,s()),Oc=0,ed(),xc=e,pc=s=Ia(e.current,null),gc=t,fc=0,vc=null,bc=!1,jc=Se(e,t),yc=!1,Sc=_c=Dc=kc=Cc=wc=0,Ac=Ec=null,Fc=!1,0!==(8&t)&&(t|=32&t);var a=e.entangledLanes;if(0!==a)for(e=e.entanglements,a&=t;0<a;){var n=31-je(a),l=1<<n;t|=e[n],a&=~l}return Nc=t,Ea(),s}function sd(e,t){Hl=null,M.H=xi,t===Qn||t===Zn?(t=ll(),fc=3):t===Xn?(t=ll(),fc=4):fc=t===Fi?8:null!==t&&"object"===typeof t&&"function"===typeof t.then?6:1,vc=t,null===pc&&(wc=1,Di(e,Ga(t,e.current)))}function ad(){var e=Tl.current;return null===e||((4194048&gc)===gc?null===zl:((62914560&gc)===gc||0!==(536870912&gc))&&e===zl)}function nd(){var e=M.H;return M.H=xi,null===e?xi:e}function ld(){var e=M.A;return M.A=uc,e}function rd(){wc=4,bc||(4194048&gc)!==gc&&null!==Tl.current||(jc=!0),0===(134217727&Cc)&&0===(134217727&kc)||null===xc||Xc(xc,gc,_c,!1)}function id(e,t,s){var a=hc;hc|=2;var n=nd(),l=ld();xc===e&&gc===t||(Pc=null,td(e,t)),t=!1;var r=wc;e:for(;;)try{if(0!==fc&&null!==pc){var i=pc,o=vc;switch(fc){case 8:ed(),r=6;break e;case 3:case 2:case 9:case 6:null===Tl.current&&(t=!0);var c=fc;if(fc=0,vc=null,md(e,i,o,c),s&&jc){r=0;break e}break;default:c=fc,fc=0,vc=null,md(e,i,o,c)}}od(),r=wc;break}catch(d){sd(e,d)}return t&&e.shellSuspendCounter++,Cn=wn=null,hc=a,M.H=n,M.A=l,null===pc&&(xc=null,gc=0,Ea()),r}function od(){for(;null!==pc;)dd(pc)}function cd(){for(;null!==pc&&!re();)dd(pc)}function dd(e){var t=lo(e.alternate,e,Nc);e.memoizedProps=e.pendingProps,null===t?hd(e):pc=t}function ud(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Vi(s,t,t.pendingProps,t.type,void 0,gc);break;case 11:t=Vi(s,t,t.pendingProps,t.type.render,t.ref,gc);break;case 5:rr(t);default:po(s,t),t=lo(s,t=pc=Oa(t,Nc),Nc)}e.memoizedProps=e.pendingProps,null===t?hd(e):pc=t}function md(e,t,s,a){Cn=wn=null,rr(t),il=null,ol=0;var n=t.return;try{if(function(e,t,s,a,n){if(s.flags|=32768,null!==a&&"object"===typeof a&&"function"===typeof a.then){if(null!==(t=s.alternate)&&En(t,s,n,!0),null!==(s=Tl.current)){switch(s.tag){case 31:case 13:return null===zl?rd():null===s.alternate&&0===wc&&(wc=3),s.flags&=-257,s.flags|=65536,s.lanes=n,a===el?s.flags|=16384:(null===(t=s.updateQueue)?s.updateQueue=new Set([a]):t.add(a),Cd(e,a,n)),!1;case 22:return s.flags|=65536,a===el?s.flags|=16384:(null===(t=s.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},s.updateQueue=t):null===(s=t.retryQueue)?t.retryQueue=new Set([a]):s.add(a),Cd(e,a,n)),!1}throw Error(r(435,s.tag))}return Cd(e,a,n),rd(),!1}if(un)return null!==(t=Tl.current)?(0===(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=n,a!==xn&&yn(Ga(e=Error(r(422),{cause:a}),s))):(a!==xn&&yn(Ga(t=Error(r(423),{cause:a}),s)),(e=e.current.alternate).flags|=65536,n&=-n,e.lanes|=n,a=Ga(a,s),yl(e,n=Si(e.stateNode,a,n)),4!==wc&&(wc=2)),!1;var l=Error(r(520),{cause:a});if(l=Ga(l,s),null===Ec?Ec=[l]:Ec.push(l),4!==wc&&(wc=2),null===t)return!0;a=Ga(a,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=n&-n,s.lanes|=e,yl(s,e=Si(s.stateNode,a,e)),!1;case 1:if(t=s.type,l=s.stateNode,0===(128&s.flags)&&("function"===typeof t.getDerivedStateFromError||null!==l&&"function"===typeof l.componentDidCatch&&(null===Bc||!Bc.has(l))))return s.flags|=65536,n&=-n,s.lanes|=n,Ai(n=Ei(n),e,s,a),yl(s,n),!1}s=s.return}while(null!==s);return!1}(e,n,t,s,gc))return wc=1,Di(e,Ga(s,e.current)),void(pc=null)}catch(l){if(null!==n)throw pc=n,l;return wc=1,Di(e,Ga(s,e.current)),void(pc=null)}32768&t.flags?(un||1===a?e=!0:jc||0!==(536870912&gc)?e=!1:(bc=e=!0,(2===a||9===a||3===a||6===a)&&(null!==(a=Tl.current)&&13===a.tag&&(a.flags|=16384))),xd(t,e)):hd(t)}function hd(e){var t=e;do{if(0!==(32768&t.flags))return void xd(t,bc);e=t.return;var s=ho(t.alternate,t,Nc);if(null!==s)return void(pc=s);if(null!==(t=t.sibling))return void(pc=t);pc=t=e}while(null!==t);0===wc&&(wc=5)}function xd(e,t){do{var s=xo(e.alternate,e);if(null!==s)return s.flags&=32767,void(pc=s);if(null!==(s=e.return)&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&null!==(e=e.sibling))return void(pc=e);pc=e=s}while(null!==e);wc=6,pc=null}function pd(e,t,s,a,n,l,i,o,c){e.cancelPendingCommit=null;do{jd()}while(0!==Rc);if(0!==(6&hc))throw Error(r(327));if(null!==t){if(t===e.current)throw Error(r(177));if(l=t.lanes|t.childLanes,function(e,t,s,a,n,l){var r=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var i=e.entanglements,o=e.expirationTimes,c=e.hiddenUpdates;for(s=r&~s;0<s;){var d=31-je(s),u=1<<d;i[d]=0,o[d]=-1;var m=c[d];if(null!==m)for(c[d]=null,d=0;d<m.length;d++){var h=m[d];null!==h&&(h.lane&=-536870913)}s&=~u}0!==a&&ze(e,a,0),0!==l&&0===n&&0!==e.tag&&(e.suspendedLanes|=l&~(r&~t))}(e,s,l|=Sa,i,o,c),e===xc&&(pc=xc=null,gc=0),Ic=t,Lc=e,Oc=s,Uc=l,Hc=n,Wc=a,0!==(10256&t.subtreeFlags)||0!==(10256&t.flags)?(e.callbackNode=null,e.callbackPriority=0,ne(me,function(){return yd(),null})):(e.callbackNode=null,e.callbackPriority=0),a=0!==(13878&t.flags),0!==(13878&t.subtreeFlags)||a){a=M.T,M.T=null,n=P.p,P.p=2,i=hc,hc|=4;try{!function(e,t){if(e=e.containerInfo,xu=bm,aa(e=sa(e))){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{var a=(s=(s=e.ownerDocument)&&s.defaultView||window).getSelection&&s.getSelection();if(a&&0!==a.rangeCount){s=a.anchorNode;var n=a.anchorOffset,l=a.focusNode;a=a.focusOffset;try{s.nodeType,l.nodeType}catch(g){s=null;break e}var i=0,o=-1,c=-1,d=0,u=0,m=e,h=null;t:for(;;){for(var x;m!==s||0!==n&&3!==m.nodeType||(o=i+n),m!==l||0!==a&&3!==m.nodeType||(c=i+a),3===m.nodeType&&(i+=m.nodeValue.length),null!==(x=m.firstChild);)h=m,m=x;for(;;){if(m===e)break t;if(h===s&&++d===n&&(o=i),h===l&&++u===a&&(c=i),null!==(x=m.nextSibling))break;h=(m=h).parentNode}m=x}s=-1===o||-1===c?null:{start:o,end:c}}else s=null}s=s||{start:0,end:0}}else s=null;for(pu={focusedElem:e,selectionRange:s},bm=!1,zo=t;null!==zo;)if(e=(t=zo).child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,zo=e;else for(;null!==zo;){switch(l=(t=zo).alternate,e=t.flags,t.tag){case 0:if(0!==(4&e)&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(s=0;s<e.length;s++)(n=e[s]).ref.impl=n.nextImpl;break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(0!==(1024&e)&&null!==l){e=void 0,s=t,n=l.memoizedProps,l=l.memoizedState,a=s.stateNode;try{var p=Ni(s.type,n);e=a.getSnapshotBeforeUpdate(p,l),a.__reactInternalSnapshotBeforeUpdate=e}catch(f){wd(s,s.return,f)}}break;case 3:if(0!==(1024&e))if(9===(s=(e=t.stateNode.containerInfo).nodeType))Eu(e);else if(1===s)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Eu(e);break;default:e.textContent=""}break;default:if(0!==(1024&e))throw Error(r(163))}if(null!==(e=t.sibling)){e.return=t.return,zo=e;break}zo=t.return}}(e,t)}finally{hc=i,P.p=n,M.T=a}}Rc=1,gd(),fd(),vd()}}function gd(){if(1===Rc){Rc=0;var e=Lc,t=Ic,s=0!==(13878&t.flags);if(0!==(13878&t.subtreeFlags)||s){s=M.T,M.T=null;var a=P.p;P.p=2;var n=hc;hc|=4;try{qo(t,e);var l=pu,r=sa(e.containerInfo),i=l.focusedElem,o=l.selectionRange;if(r!==i&&i&&i.ownerDocument&&ta(i.ownerDocument.documentElement,i)){if(null!==o&&aa(i)){var c=o.start,d=o.end;if(void 0===d&&(d=c),"selectionStart"in i)i.selectionStart=c,i.selectionEnd=Math.min(d,i.value.length);else{var u=i.ownerDocument||document,m=u&&u.defaultView||window;if(m.getSelection){var h=m.getSelection(),x=i.textContent.length,p=Math.min(o.start,x),g=void 0===o.end?p:Math.min(o.end,x);!h.extend&&p>g&&(r=g,g=p,p=r);var f=ea(i,p),v=ea(i,g);
2if(f&&v&&(1!==h.rangeCount||h.anchorNode!==f.node||h.anchorOffset!==f.offset||h.focusNode!==v.node||h.focusOffset!==v.offset)){var b=u.createRange();b.setStart(f.node,f.offset),h.removeAllRanges(),p>g?(h.addRange(b),h.extend(v.node,v.offset)):(b.setEnd(v.node,v.offset),h.addRange(b))}}}}for(u=[],h=i;h=h.parentNode;)1===h.nodeType&&u.push({element:h,left:h.scrollLeft,top:h.scrollTop});for("function"===typeof i.focus&&i.focus(),i=0;i<u.length;i++){var j=u[i];j.element.scrollLeft=j.left,j.element.scrollTop=j.top}}bm=!!xu,pu=xu=null}finally{hc=n,P.p=a,M.T=s}}e.current=t,Rc=2}}function fd(){if(2===Rc){Rc=0;var e=Lc,t=Ic,s=0!==(8772&t.flags);if(0!==(8772&t.subtreeFlags)||s){s=M.T,M.T=null;var a=P.p;P.p=2;var n=hc;hc|=4;try{Mo(e,t.alternate,t)}finally{hc=n,P.p=a,M.T=s}}Rc=3}}function vd(){if(4===Rc||3===Rc){Rc=0,ie();var e=Lc,t=Ic,s=Oc,a=Wc;0!==(10256&t.subtreeFlags)||0!==(10256&t.flags)?Rc=5:(Rc=0,Ic=Lc=null,bd(e,e.pendingLanes));var n=e.pendingLanes;if(0===n&&(Bc=null),Re(s),t=t.stateNode,ve&&"function"===typeof ve.onCommitFiberRoot)try{ve.onCommitFiberRoot(fe,t,void 0,128===(128&t.current.flags))}catch(o){}if(null!==a){t=M.T,n=P.p,P.p=2,M.T=null;try{for(var l=e.onRecoverableError,r=0;r<a.length;r++){var i=a[r];l(i.value,{componentStack:i.stack})}}finally{M.T=t,P.p=n}}0!==(3&Oc)&&jd(),Pd(e),n=e.pendingLanes,0!==(261930&s)&&0!==(42&n)?e===qc?Vc++:(Vc=0,qc=e):Vc=0,Bd(0,!1)}}function bd(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,On(t)))}function jd(){return gd(),fd(),vd(),yd()}function yd(){if(5!==Rc)return!1;var e=Lc,t=Uc;Uc=0;var s=Re(Oc),a=M.T,n=P.p;try{P.p=32>s?32:s,M.T=null,s=Hc,Hc=null;var l=Lc,i=Oc;if(Rc=0,Ic=Lc=null,Oc=0,0!==(6&hc))throw Error(r(331));var o=hc;if(hc|=4,oc(l.current),ec(l,l.current,i,s),hc=o,Bd(0,!1),ve&&"function"===typeof ve.onPostCommitFiberRoot)try{ve.onPostCommitFiberRoot(fe,l)}catch(c){}return!0}finally{P.p=n,M.T=a,bd(e,t)}}function Nd(e,t,s){t=Ga(s,t),null!==(e=bl(e,t=Si(e.stateNode,t,2),2))&&(Te(e,2),Pd(e))}function wd(e,t,s){if(3===e.tag)Nd(e,e,s);else for(;null!==t;){if(3===t.tag){Nd(t,e,s);break}if(1===t.tag){var a=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof a.componentDidCatch&&(null===Bc||!Bc.has(a))){e=Ga(s,e),null!==(a=bl(t,s=Ei(2),2))&&(Ai(s,a,t,e),Te(a,2),Pd(a));break}}t=t.return}}function Cd(e,t,s){var a=e.pingCache;if(null===a){a=e.pingCache=new mc;var n=new Set;a.set(t,n)}else void 0===(n=a.get(t))&&(n=new Set,a.set(t,n));n.has(s)||(yc=!0,n.add(s),e=kd.bind(null,e,t,s),t.then(e,e))}function kd(e,t,s){var a=e.pingCache;null!==a&&a.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,xc===e&&(gc&s)===s&&(4===wc||3===wc&&(62914560&gc)===gc&&300>oe()-Tc?0===(2&hc)&&td(e,0):Dc|=s,Sc===gc&&(Sc=0)),Pd(e)}function Dd(e,t){0===t&&(t=Ae()),null!==(e=Ta(e,t))&&(Te(e,t),Pd(e))}function _d(e){var t=e.memoizedState,s=0;null!==t&&(s=t.retryLane),Dd(e,s)}function Sd(e,t){var s=0;switch(e.tag){case 31:case 13:var a=e.stateNode,n=e.memoizedState;null!==n&&(s=n.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(r(314))}null!==a&&a.delete(t),Dd(e,s)}var Ed=null,Ad=null,Fd=!1,Td=!1,zd=!1,Md=0;function Pd(e){e!==Ad&&null===e.next&&(null===Ad?Ed=Ad=e:Ad=Ad.next=e),Td=!0,Fd||(Fd=!0,Cu(function(){0!==(6&hc)?ne(de,Rd):Ld()}))}function Bd(e,t){if(!zd&&Td){zd=!0;do{for(var s=!1,a=Ed;null!==a;){if(!t)if(0!==e){var n=a.pendingLanes;if(0===n)var l=0;else{var r=a.suspendedLanes,i=a.pingedLanes;l=(1<<31-je(42|e)+1)-1,l=201326741&(l&=n&~(r&~i))?201326741&l|1:l?2|l:0}0!==l&&(s=!0,Ud(a,l))}else l=gc,0===(3&(l=_e(a,a===xc?l:0,null!==a.cancelPendingCommit||-1!==a.timeoutHandle)))||Se(a,l)||(s=!0,Ud(a,l));a=a.next}}while(s);zd=!1}}function Rd(){Ld()}function Ld(){Td=Fd=!1;var e=0;0!==Md&&function(){var e=window.event;if(e&&"popstate"===e.type)return e!==ju&&(ju=e,!0);return ju=null,!1}()&&(e=Md);for(var t=oe(),s=null,a=Ed;null!==a;){var n=a.next,l=Id(a,t);0===l?(a.next=null,null===s?Ed=n:s.next=n,null===n&&(Ad=s)):(s=a,(0!==e||0!==(3&l))&&(Td=!0)),a=n}0!==Rc&&5!==Rc||Bd(e,!1),0!==Md&&(Md=0)}function Id(e,t){for(var s=e.suspendedLanes,a=e.pingedLanes,n=e.expirationTimes,l=-62914561&e.pendingLanes;0<l;){var r=31-je(l),i=1<<r,o=n[r];-1===o?0!==(i&s)&&0===(i&a)||(n[r]=Ee(i,t)):o<=t&&(e.expiredLanes|=i),l&=~i}if(s=gc,s=_e(e,e===(t=xc)?s:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),a=e.callbackNode,0===s||e===t&&(2===fc||9===fc)||null!==e.cancelPendingCommit)return null!==a&&null!==a&&le(a),e.callbackNode=null,e.callbackPriority=0;if(0===(3&s)||Se(e,s)){if((t=s&-s)===e.callbackPriority)return t;switch(null!==a&&le(a),Re(s)){case 2:case 8:s=ue;break;case 32:default:s=me;break;case 268435456:s=xe}return a=Od.bind(null,e),s=ne(s,a),e.callbackPriority=t,e.callbackNode=s,t}return null!==a&&null!==a&&le(a),e.callbackPriority=2,e.callbackNode=null,2}function Od(e,t){if(0!==Rc&&5!==Rc)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(jd()&&e.callbackNode!==s)return null;var a=gc;return 0===(a=_e(e,e===xc?a:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Yc(e,a,t),Id(e,oe()),null!=e.callbackNode&&e.callbackNode===s?Od.bind(null,e):null)}function Ud(e,t){if(jd())return null;Yc(e,t,!0)}function Hd(){if(0===Md){var e=Wn;0===e&&(e=we,0===(261888&(we<<=1))&&(we=256)),Md=e}return Md}function Wd(e){return null==e||"symbol"===typeof e||"boolean"===typeof e?null:"function"===typeof e?e:Ft(""+e)}function Vd(e,t){var s=t.ownerDocument.createElement("input");
vendor: 5,018 bytes, line 2
2return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}for(var qd=0;qd<wa.length;qd++){var $d=wa[qd];Ca($d.toLowerCase(),"on"+($d[0].toUpperCase()+$d.slice(1)))}Ca(pa,"onAnimationEnd"),Ca(ga,"onAnimationIteration"),Ca(fa,"onAnimationStart"),Ca("dblclick","onDoubleClick"),Ca("focusin","onFocus"),Ca("focusout","onBlur"),Ca(va,"onTransitionRun"),Ca(ba,"onTransitionStart"),Ca(ja,"onTransitionCancel"),Ca(ya,"onTransitionEnd"),nt("onMouseEnter",["mouseout","mouseover"]),nt("onMouseLeave",["mouseout","mouseover"]),nt("onPointerEnter",["pointerout","pointerover"]),nt("onPointerLeave",["pointerout","pointerover"]),at("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),at("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),at("onBeforeInput",["compositionend","keypress","textInput","paste"]),at("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),at("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),at("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Kd=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gd));function Yd(e,t){t=0!==(4&t);for(var s=0;s<e.length;s++){var a=e[s],n=a.event;a=a.listeners;e:{var l=void 0;if(t)for(var r=a.length-1;0<=r;r--){var i=a[r],o=i.instance,c=i.currentTarget;if(i=i.listener,o!==l&&n.isPropagationStopped())break e;l=i,n.currentTarget=c;try{l(n)}catch(d){ka(d)}n.currentTarget=null,l=o}else for(r=0;r<a.length;r++){if(o=(i=a[r]).instance,c=i.currentTarget,i=i.listener,o!==l&&n.isPropagationStopped())break e;l=i,n.currentTarget=c;try{l(n)}catch(d){ka(d)}n.currentTarget=null,l=o}}}}function Jd(e,t){var s=t[Ve];void 0===s&&(s=t[Ve]=new Set);var a=e+"__bubble";s.has(a)||(eu(t,e,2,!1),s.add(a))}function Qd(e,t,s){var a=0;t&&(a|=4),eu(s,e,a,t)}var Xd="_reactListening"+Math.random().toString(36).slice(2);function Zd(e){if(!e[Xd]){e[Xd]=!0,tt.forEach(function(t){"selectionchange"!==t&&(Kd.has(t)||Qd(t,!1,e),Qd(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Xd]||(t[Xd]=!0,Qd("selectionchange",!1,t))}}function eu(e,t,s,a){switch(Dm(t)){case 2:var n=jm;break;case 8:n=ym;break;default:n=Nm}s=n.bind(null,t,s,e),n=void 0,!Ht||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(n=!0),a?void 0!==n?e.addEventListener(t,s,{capture:!0,passive:n}):e.addEventListener(t,s,!0):void 0!==n?e.addEventListener(t,s,{passive:n}):e.addEventListener(t,s,!1)}function tu(e,t,s,a,n){var l=a;if(0===(1&t)&&0===(2&t)&&null!==a)e:for(;;){if(null===a)return;var r=a.tag;if(3===r||4===r){var i=a.stateNode.containerInfo;if(i===n)break;if(4===r)for(r=a.return;null!==r;){var c=r.tag;if((3===c||4===c)&&r.stateNode.containerInfo===n)return;r=r.return}for(;null!==i;){if(null===(r=Je(i)))return;if(5===(c=r.tag)||6===c||26===c||27===c){a=l=r;continue e}i=i.parentNode}}a=a.return}It(function(){var a=l,n=Mt(s),r=[];e:{var i=Na.get(e);if(void 0!==i){var c=ss,d=e;switch(e){case"keypress":if(0===Kt(s))break e;case"keydown":case"keyup":c=fs;break;case"focusin":d="focus",c=os;break;case"focusout":d="blur",c=os;break;case"beforeblur":case"afterblur":c=os;break;case"click":if(2===s.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=rs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=is;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=bs;break;case pa:case ga:case fa:c=cs;break;case ya:c=js;break;case"scroll":case"scrollend":c=ns;break;case"wheel":c=ys;break;case"copy":case"cut":case"paste":c=ds;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=vs;break;case"toggle":case"beforetoggle":c=Ns}var u=0!==(4&t),m=!u&&("scroll"===e||"scrollend"===e),h=u?null!==i?i+"Capture":null:i;u=[];for(var x,p=a;null!==p;){var g=p;if(x=g.stateNode,5!==(g=g.tag)&&26!==g&&27!==g||null===x||null===h||null!=(g=Ot(p,h))&&u.push(su(p,g,x)),m)break;p=p.return}0<u.length&&(i=new c(i,d,null,s,n),r.push({event:i,listeners:u}))}}if(0===(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(i="mouseover"===e||"pointerover"===e)||s===zt||!(d=s.relatedTarget||s.fromElement)||!Je(d)&&!d[We])&&(c||i)&&(i=n.window===n?n:(i=n.ownerDocument)?i.defaultView||i.parentWindow:window,c?(c=a,null!==(d=(d=s.relatedTarget||s.toElement)?Je(d):null)&&(m=o(d),u=d.tag,d!==m||5!==u&&27!==u&&6!==u)&&(d=null)):(c=null,d=a),c!==d)
vendor: 4,642 bytes, line 2
2){if(u=rs,g="onMouseLeave",h="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=vs,g="onPointerLeave",h="onPointerEnter",p="pointer"),m=null==c?i:Xe(c),x=null==d?i:Xe(d),(i=new u(g,p+"leave",c,s,n)).target=m,i.relatedTarget=x,g=null,Je(n)===a&&((u=new u(h,p+"enter",d,s,n)).target=x,u.relatedTarget=m,g=u),m=g,c&&d)e:{for(u=nu,p=d,x=0,g=h=c;g;g=u(g))x++;g=0;for(var f=p;f;f=u(f))g++;for(;0<x-g;)h=u(h),x--;for(;0<g-x;)p=u(p),g--;for(;x--;){if(h===p||null!==p&&h===p.alternate){u=h;break e}h=u(h),p=u(p)}u=null}else u=null;null!==c&&lu(r,i,c,u,!1),null!==d&&null!==m&&lu(r,m,d,u,!0)}if("select"===(c=(i=a?Xe(a):window).nodeName&&i.nodeName.toLowerCase())||"input"===c&&"file"===i.type)var v=Os;else if(Ms(i))if(Us)v=Js;else{v=Ks;var b=Gs}else!(c=i.nodeName)||"input"!==c.toLowerCase()||"checkbox"!==i.type&&"radio"!==i.type?a&&St(a.elementType)&&(v=Os):v=Ys;switch(v&&(v=v(e,a))?Ps(r,v,s,n):(b&&b(e,i,a),"focusout"===e&&a&&"number"===i.type&&null!=a.memoizedProps.value&&jt(i,"number",i.value)),b=a?Xe(a):window,e){case"focusin":(Ms(b)||"true"===b.contentEditable)&&(la=b,ra=a,ia=null);break;case"focusout":ia=ra=la=null;break;case"mousedown":oa=!0;break;case"contextmenu":case"mouseup":case"dragend":oa=!1,ca(r,s,n);break;case"selectionchange":if(na)break;case"keydown":case"keyup":ca(r,s,n)}var j;if(Cs)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Ts?As(e,s)&&(y="onCompositionEnd"):"keydown"===e&&229===s.keyCode&&(y="onCompositionStart");y&&(_s&&"ko"!==s.locale&&(Ts||"onCompositionStart"!==y?"onCompositionEnd"===y&&Ts&&(j=Gt()):(qt="value"in(Vt=n)?Vt.value:Vt.textContent,Ts=!0)),0<(b=au(a,y)).length&&(y=new us(y,e,null,s,n),r.push({event:y,listeners:b}),j?y.data=j:null!==(j=Fs(s))&&(y.data=j))),(j=Ds?function(e,t){switch(e){case"compositionend":return Fs(t);case"keypress":return 32!==t.which?null:(Es=!0,Ss);case"textInput":return(e=t.data)===Ss&&Es?null:e;default:return null}}(e,s):function(e,t){if(Ts)return"compositionend"===e||!Cs&&As(e,t)?(e=Gt(),$t=qt=Vt=null,Ts=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return _s&&"ko"!==t.locale?null:t.data}}(e,s))&&(0<(y=au(a,"onBeforeInput")).length&&(b=new us("onBeforeInput","beforeinput",null,s,n),r.push({event:b,listeners:y}),b.data=j)),function(e,t,s,a,n){if("submit"===t&&s&&s.stateNode===n){var l=Wd((n[He]||null).action),r=a.submitter;r&&null!==(t=(t=r[He]||null)?Wd(t.formAction):r.getAttribute("formAction"))&&(l=t,r=null);var i=new ss("action","action",null,a,n);e.push({event:i,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(0!==Md){var e=r?Vd(n,r):new FormData(n);ei(s,{pending:!0,data:e,method:n.method,action:l},null,e)}}else"function"===typeof l&&(i.preventDefault(),e=r?Vd(n,r):new FormData(n),ei(s,{pending:!0,data:e,method:n.method,action:l},l,e))},currentTarget:n}]})}}(r,e,a,s,n)}Yd(r,t)})}function su(e,t,s){return{instance:e,listener:t,currentTarget:s}}function au(e,t){for(var s=t+"Capture",a=[];null!==e;){var n=e,l=n.stateNode;if(5!==(n=n.tag)&&26!==n&&27!==n||null===l||(null!=(n=Ot(e,s))&&a.unshift(su(e,n,l)),null!=(n=Ot(e,t))&&a.push(su(e,n,l))),3===e.tag)return a;e=e.return}return[]}function nu(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function lu(e,t,s,a,n){for(var l=t._reactName,r=[];null!==s&&s!==a;){var i=s,o=i.alternate,c=i.stateNode;if(i=i.tag,null!==o&&o===a)break;5!==i&&26!==i&&27!==i||null===c||(o=c,n?null!=(c=Ot(s,l))&&r.unshift(su(s,c,o)):n||null!=(c=Ot(s,l))&&r.push(su(s,c,o))),s=s.return}0!==r.length&&e.push({event:t,listeners:r})}var ru=/\r\n?/g,iu=/\u0000|\uFFFD/g;function ou(e){return("string"===typeof e?e:""+e).replace(ru,"\n").replace(iu,"")}function cu(e,t){return t=ou(t),ou(e)===t}function du(e,t,s,a,n,l){switch(s){case"children":"string"===typeof a?"body"===t||"textarea"===t&&""===a||Ct(e,a):("number"===typeof a||"bigint"===typeof a)&&"body"!==t&&Ct(e,""+a);break;case"className":ct(e,"class",a);break;case"tabIndex":ct(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":ct(e,s,a);break;case"style":_t(e,a,l);break;case"data":if("object"!==t){ct(e,"data",a);break}case"src":case"href":if(""===a&&("a"!==t||"href"!==s)){e.removeAttribute(s);break}if(null==a||"function"===typeof a||"symbol"===typeof a||"boolean"===typeof a){e.removeAttribute(s);break}
2a=Ft(""+a),e.setAttribute(s,a);break;case"action":case"formAction":if("function"===typeof a){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}if("function"===typeof l&&("formAction"===s?("input"!==t&&du(e,t,"name",n.name,n,null),du(e,t,"formEncType",n.formEncType,n,null),du(e,t,"formMethod",n.formMethod,n,null),du(e,t,"formTarget",n.formTarget,n,null)):(du(e,t,"encType",n.encType,n,null),du(e,t,"method",n.method,n,null),du(e,t,"target",n.target,n,null))),null==a||"symbol"===typeof a||"boolean"===typeof a){e.removeAttribute(s);break}a=Ft(""+a),e.setAttribute(s,a);break;case"onClick":null!=a&&(e.onclick=Tt);break;case"onScroll":null!=a&&Jd("scroll",e);break;case"onScrollEnd":null!=a&&Jd("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=a){if("object"!==typeof a||!("__html"in a))throw Error(r(61));if(null!=(s=a.__html)){if(null!=n.children)throw Error(r(60));e.innerHTML=s}}break;case"multiple":e.multiple=a&&"function"!==typeof a&&"symbol"!==typeof a;break;case"muted":e.muted=a&&"function"!==typeof a&&"symbol"!==typeof a;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==a||"function"===typeof a||"boolean"===typeof a||"symbol"===typeof a){e.removeAttribute("xlink:href");break}s=Ft(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":null!=a&&"function"!==typeof a&&"symbol"!==typeof a?e.setAttribute(s,""+a):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&"function"!==typeof a&&"symbol"!==typeof a?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":!0===a?e.setAttribute(s,""):!1!==a&&null!=a&&"function"!==typeof a&&"symbol"!==typeof a?e.setAttribute(s,a):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":null!=a&&"function"!==typeof a&&"symbol"!==typeof a&&!isNaN(a)&&1<=a?e.setAttribute(s,a):e.removeAttribute(s);break;case"rowSpan":case"start":null==a||"function"===typeof a||"symbol"===typeof a||isNaN(a)?e.removeAttribute(s):e.setAttribute(s,a);break;case"popover":Jd("beforetoggle",e),Jd("toggle",e),ot(e,"popover",a);break;case"xlinkActuate":dt(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":dt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":dt(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":dt(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":dt(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":dt(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":dt(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":dt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":dt(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":ot(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<s.length)||"o"!==s[0]&&"O"!==s[0]||"n"!==s[1]&&"N"!==s[1])&&ot(e,s=Et.get(s)||s,a)}}function uu(e,t,s,a,n,l){switch(s){case"style":_t(e,a,l);break;case"dangerouslySetInnerHTML":if(null!=a){if("object"!==typeof a||!("__html"in a))throw Error(r(61));if(null!=(s=a.__html)){if(null!=n.children)throw Error(r(60));e.innerHTML=s}}break;case"children":"string"===typeof a?Ct(e,a):("number"===typeof a||"bigint"===typeof a)&&Ct(e,""+a);break;case"onScroll":null!=a&&Jd("scroll",e);break;case"onScrollEnd":null!=a&&Jd("scrollend",e);break;case"onClick":null!=a&&(e.onclick=Tt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:st.hasOwnProperty(s)||("o"!==s[0]||"n"!==s[1]||(n=s.endsWith("Capture"),t=s.slice(2,n?s.length-7:void 0),"function"===typeof(l=null!=(l=e[He]||null)?l[s]:null)&&e.removeEventListener(t,l,n),"function"!==typeof a)?s in e?e[s]=a:!0===a?e.setAttribute(s,""):ot(e,s,a):("function"!==typeof l&&null!==l&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,a,n)))}}
vendor: 4,441 bytes, line 2
2function mu(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Jd("error",e),Jd("load",e);var a,n=!1,l=!1;for(a in s)if(s.hasOwnProperty(a)){var i=s[a];if(null!=i)switch(a){case"src":n=!0;break;case"srcSet":l=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:du(e,t,a,i,s,null)}}return l&&du(e,t,"srcSet",s.srcSet,s,null),void(n&&du(e,t,"src",s.src,s,null));case"input":Jd("invalid",e);var o=a=i=l=null,c=null,d=null;for(n in s)if(s.hasOwnProperty(n)){var u=s[n];if(null!=u)switch(n){case"name":l=u;break;case"type":i=u;break;case"checked":c=u;break;case"defaultChecked":d=u;break;case"value":a=u;break;case"defaultValue":o=u;break;case"children":case"dangerouslySetInnerHTML":if(null!=u)throw Error(r(137,t));break;default:du(e,t,n,u,s,null)}}return void bt(e,a,o,c,d,i,l,!1);case"select":for(l in Jd("invalid",e),n=i=a=null,s)if(s.hasOwnProperty(l)&&null!=(o=s[l]))switch(l){case"value":a=o;break;case"defaultValue":i=o;break;case"multiple":n=o;default:du(e,t,l,o,s,null)}return t=a,s=i,e.multiple=!!n,void(null!=t?yt(e,!!n,t,!1):null!=s&&yt(e,!!n,s,!0));case"textarea":for(i in Jd("invalid",e),a=l=n=null,s)if(s.hasOwnProperty(i)&&null!=(o=s[i]))switch(i){case"value":n=o;break;case"defaultValue":l=o;break;case"children":a=o;break;case"dangerouslySetInnerHTML":if(null!=o)throw Error(r(91));break;default:du(e,t,i,o,s,null)}return void wt(e,n,l,a);case"option":for(c in s)if(s.hasOwnProperty(c)&&null!=(n=s[c]))if("selected"===c)e.selected=n&&"function"!==typeof n&&"symbol"!==typeof n;else du(e,t,c,n,s,null);return;case"dialog":Jd("beforetoggle",e),Jd("toggle",e),Jd("cancel",e),Jd("close",e);break;case"iframe":case"object":Jd("load",e);break;case"video":case"audio":for(n=0;n<Gd.length;n++)Jd(Gd[n],e);break;case"image":Jd("error",e),Jd("load",e);break;case"details":Jd("toggle",e);break;case"embed":case"source":case"link":Jd("error",e),Jd("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(d in s)if(s.hasOwnProperty(d)&&null!=(n=s[d]))switch(d){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:du(e,t,d,n,s,null)}return;default:if(St(t)){for(u in s)s.hasOwnProperty(u)&&(void 0!==(n=s[u])&&uu(e,t,u,n,s,void 0));return}}for(o in s)s.hasOwnProperty(o)&&(null!=(n=s[o])&&du(e,t,o,n,s,null))}function hu(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var xu=null,pu=null;function gu(e){return 9===e.nodeType?e:e.ownerDocument}function fu(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function vu(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function bu(e,t){return"textarea"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"bigint"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ju=null;var yu="function"===typeof setTimeout?setTimeout:void 0,Nu="function"===typeof clearTimeout?clearTimeout:void 0,wu="function"===typeof Promise?Promise:void 0,Cu="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof wu?function(e){return wu.resolve(null).then(e).catch(ku)}:yu;function ku(e){setTimeout(function(){throw e})}function Du(e){return"head"===e}function _u(e,t){var s=t,a=0;do{var n=s.nextSibling;if(e.removeChild(s),n&&8===n.nodeType)if("/$"===(s=n.data)||"/&"===s){if(0===a)return e.removeChild(n),void Vm(t);a--}else if("$"===s||"$?"===s||"$~"===s||"$!"===s||"&"===s)a++;else if("html"===s)Lu(e.ownerDocument.documentElement);else if("head"===s){Lu(s=e.ownerDocument.head);for(var l=s.firstChild;l;){var r=l.nextSibling,i=l.nodeName;l[Ke]||"SCRIPT"===i||"STYLE"===i||"LINK"===i&&"stylesheet"===l.rel.toLowerCase()||s.removeChild(l),l=r}}else"body"===s&&Lu(e.ownerDocument.body);s=n}while(s);Vm(t)}function Su(e,t){var s=e;e=0;do{var a=s.nextSibling;if(1===s.nodeType?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",""===s.getAttribute("style")&&s.removeAttribute("style")):3===s.nodeType&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),a&&8===a.nodeType)if("/$"===(s=a.data)){if
vendor: 10,747 bytes, line 2
2(0===e)break;e--}else"$"!==s&&"$?"!==s&&"$~"!==s&&"$!"!==s||e++;s=a}while(s)}function Eu(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Eu(s),Ye(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===s.rel.toLowerCase())continue}e.removeChild(s)}}function Au(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=zu(e.nextSibling)))return null}return e}function Fu(e){return"$?"===e.data||"$~"===e.data}function Tu(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function zu(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"$~"===t||"&"===t||"F!"===t||"F"===t)break;if("/$"===t||"/&"===t)return null}}return e}var Mu=null;function Pu(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var s=e.data;if("/$"===s||"/&"===s){if(0===t)return zu(e.nextSibling);t--}else"$"!==s&&"$!"!==s&&"$?"!==s&&"$~"!==s&&"&"!==s||t++}e=e.nextSibling}return null}function Bu(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var s=e.data;if("$"===s||"$!"===s||"$?"===s||"$~"===s||"&"===s){if(0===t)return e;t--}else"/$"!==s&&"/&"!==s||t++}e=e.previousSibling}return null}function Ru(e,t,s){switch(t=gu(s),e){case"html":if(!(e=t.documentElement))throw Error(r(452));return e;case"head":if(!(e=t.head))throw Error(r(453));return e;case"body":if(!(e=t.body))throw Error(r(454));return e;default:throw Error(r(451))}}function Lu(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ye(e)}var Iu=new Map,Ou=new Set;function Uu(e){return"function"===typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Hu=P.d;P.d={f:function(){var e=Hu.f(),t=Zc();return e||t},r:function(e){var t=Qe(e);null!==t&&5===t.tag&&"form"===t.type?si(t):Hu.r(e)},D:function(e){Hu.D(e),Vu("dns-prefetch",e,null)},C:function(e,t){Hu.C(e,t),Vu("preconnect",e,t)},L:function(e,t,s){Hu.L(e,t,s);var a=Wu;if(a&&e&&t){var n='link[rel="preload"][as="'+ft(t)+'"]';"image"===t&&s&&s.imageSrcSet?(n+='[imagesrcset="'+ft(s.imageSrcSet)+'"]',"string"===typeof s.imageSizes&&(n+='[imagesizes="'+ft(s.imageSizes)+'"]')):n+='[href="'+ft(e)+'"]';var l=n;switch(t){case"style":l=$u(e);break;case"script":l=Yu(e)}Iu.has(l)||(e=h({rel:"preload",href:"image"===t&&s&&s.imageSrcSet?void 0:e,as:t},s),Iu.set(l,e),null!==a.querySelector(n)||"style"===t&&a.querySelector(Gu(l))||"script"===t&&a.querySelector(Ju(l))||(mu(t=a.createElement("link"),"link",e),et(t),a.head.appendChild(t)))}},m:function(e,t){Hu.m(e,t);var s=Wu;if(s&&e){var a=t&&"string"===typeof t.as?t.as:"script",n='link[rel="modulepreload"][as="'+ft(a)+'"][href="'+ft(e)+'"]',l=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=Yu(e)}if(!Iu.has(l)&&(e=h({rel:"modulepreload",href:e},t),Iu.set(l,e),null===s.querySelector(n))){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Ju(l)))return}mu(a=s.createElement("link"),"link",e),et(a),s.head.appendChild(a)}}},X:function(e,t){Hu.X(e,t);var s=Wu;if(s&&e){var a=Ze(s).hoistableScripts,n=Yu(e),l=a.get(n);l||((l=s.querySelector(Ju(n)))||(e=h({src:e,async:!0},t),(t=Iu.get(n))&&em(e,t),et(l=s.createElement("script")),mu(l,"link",e),s.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(n,l))}},S:function(e,t,s){Hu.S(e,t,s);var a=Wu;if(a&&e){var n=Ze(a).hoistableStyles,l=$u(e);t=t||"default";var r=n.get(l);if(!r){var i={loading:0,preload:null};if(r=a.querySelector(Gu(l)))i.loading=5;else{e=h({rel:"stylesheet",href:e,"data-precedence":t},s),(s=Iu.get(l))&&Zu(e,s);var o=r=a.createElement("link");et(o),mu(o,"link",e),o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),o.addEventListener("load",function(){i.loading|=1}),o.addEventListener("error",function(){i.loading|=2}),i.loading|=4,Xu(r,t,a)}r={type:"stylesheet",instance:r,count:1,state:i},n.set(l,r)}}},M:function(e,t){Hu.M(e,t);var s=Wu;if(s&&e){var a=Ze(s).hoistableScripts,n=Yu(e),l=a.get(n);l||((l=s.querySelector(Ju(n)))||(e=h({src:e,async:!0,type:"module"},t),(t=Iu.get(n))&&em(e,t),et(l=s.createElement("script")),mu(l,"link",e),s.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(n,l))}}};var Wu="undefined"===typeof document?null:document;function Vu(e,t,s){var a=Wu;if(a&&"string"===typeof t&&t){var n=ft(t);n='link[rel="'+e+'"][href="'+n+'"]',"string"===typeof s&&(n+='[crossorigin="'+s+'"]'),Ou.has(n)||(Ou.add(n),e={rel:e,crossOrigin:s,href:t},null===a.querySelector(n)&&(mu(t=a.createElement("link"),"link",e),et(t),a.head.appendChild(t)))}}function qu(e,t,s,a){var n,l,i,o,c=(c=$.current)?Uu(c):null;if(!c)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return"string"===typeof s.precedence&&"string"===typeof s.href?(t=$u(s.href),(a=(s=Ze(c).hoistableStyles).get(t))||(a={type:"style",instance:null,count:0,state:null},s.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===s.rel&&"string"===typeof s.href&&"string"===typeof s.precedence){e=$u(s.href);var d=Ze(c).hoistableStyles,u=d.get(e);if(u||(c=c.ownerDocument||c,u={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,u),(d=c.querySelector(Gu(e)))&&!d._p&&(u.instance=d,u.state.loading=5),Iu.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Iu.set(e,s),d||(n=c,l=e,i=s,o=u.state,n.querySelector('link[rel="preload"][as="style"]['+l+"]")?o.loading=1:(l=n.createElement("link"),o.preload=l,l.addEventListener("load",function(){return o.loading|=1}),l.addEventListener("error",function(){return o.loading|=2}),mu(l,"link",i),et(l),n.head.appendChild(l))))),t&&null===a)throw Error(r(528,""));return u}if(t&&null!==a)throw Error(r(529,""));return null;case"script":return t=s.async,"string"===typeof(s=s.src)&&t&&"function"!==typeof t&&"symbol"!==typeof t?(t=Yu(s),(a=(s=Ze(c).hoistableScripts).get(t))||(a={type:"script",instance:null,count:0,state:null},s.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function $u(e){return'href="'+ft(e)+'"'}function Gu(e){return'link[rel="stylesheet"]['+e+"]"}function Ku(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Yu(e){return'[src="'+ft(e)+'"]'}function Ju(e){return"script[async]"+e}function Qu(e,t,s){if(t.count++,null===t.instance)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+ft(s.href)+'"]');if(a)return t.instance=a,et(a),a;var n=h({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return et(a=(e.ownerDocument||e).createElement("style")),mu(a,"style",n),Xu(a,s.precedence,e),t.instance=a;case"stylesheet":n=$u(s.href);var l=e.querySelector(Gu(n));if(l)return t.state.loading|=4,t.instance=l,et(l),l;a=Ku(s),(n=Iu.get(n))&&Zu(a,n),et(l=(e.ownerDocument||e).createElement("link"));var i=l;return i._p=new Promise(function(e,t){i.onload=e,i.onerror=t}),mu(l,"link",a),t.state.loading|=4,Xu(l,s.precedence,e),t.instance=l;case"script":return l=Yu(s.src),(n=e.querySelector(Ju(l)))?(t.instance=n,et(n),n):(a=s,(n=Iu.get(l))&&em(a=h({},s),n),et(n=(e=e.ownerDocument||e).createElement("script")),mu(n,"link",a),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(r(443,t.type))}else"stylesheet"===t.type&&0===(4&t.state.loading)&&(a=t.instance,t.state.loading|=4,Xu(a,s.precedence,e));return t.instance}function Xu(e,t,s){for(var a=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,l=n,r=0;r<a.length;r++){var i=a[r];if(i.dataset.precedence===t)l=i;else if(l!==n)break}l?l.parentNode.insertBefore(e,l.nextSibling):(t=9===s.nodeType?s.head:s).insertBefore(e,t.firstChild)}function Zu(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function em(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var tm=null;function sm(e,t,s){if(null===tm){var a=new Map,n=tm=new Map;n.set(s,a)}else(a=(n=tm).get(s))||(a=new Map,n.set(s,a));if(a.has(e))return a;for(a.set(e,null),s=s.getElementsByTagName(e),n=0;n<s.length;n++){var l=s[n];if(!(l[Ke]||l[Ue]||"link"===e&&"stylesheet"===l.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==l.namespaceURI){var r=l.getAttribute(t)||"";r=e+r;var i=a.get(r);i?i.push(l):a.set(r,[l])}}return a}function am(e,t,s){(e=e.ownerDocument||e).head.insertBefore(s,"title"===t?e.querySelector("head > title"):null)}function nm(e){return"stylesheet"!==e.type||0!==(3&e.state.loading)}var lm=0;function rm(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)om(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var im=null;function om(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,im=new Map,t.forEach(cm,e),im=null,rm.call(e))}function cm(e,t){if(!(4&t.state.loading)){var s=im.get(e);if(s)var a=s.get(null);else{s=new Map,im.set(e,s);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<n.length;l++){var r=n[l];"LINK"!==r.nodeName&&"not all"===r.getAttribute("media")||(s.set(r.dataset.precedence,r),a=r)}a&&s.set(null,a)}r=(n=t.instance).getAttribute("data-precedence"),(l=s.get(r)||a)===a&&s.set(null,n),s.set(r,n),this.count++,a=rm.bind(this),n.addEventListener("load",a),n.addEventListener("error",a),l?l.parentNode.insertBefore(n,l.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(n,e.firstChild),t.state.loading|=4}}var dm={$$typeof:y,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function um(e,t,s,a,n,l,r,i,o){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Fe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fe(0),this.hiddenUpdates=Fe(null),this.identifierPrefix=a,this.onUncaughtError=n,this.onCaughtError=l,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}
vendor: 4,639 bytes, line 2
2function mm(e,t,s,a,n,l,r,i,o,c,d,u){return e=new um(e,t,s,r,o,c,d,u,i),t=1,!0===l&&(t|=24),l=Ra(3,null,null,t),e.current=l,l.stateNode=e,(t=In()).refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:a,isDehydrated:s,cache:t},gl(l),e}function hm(e){return e?e=Pa:Pa}function xm(e,t,s,a,n,l){n=hm(n),null===a.context?a.context=n:a.pendingContext=n,(a=vl(t)).payload={element:s},null!==(l=void 0===l?null:l)&&(a.callback=l),null!==(s=bl(e,a,t))&&(Kc(s,0,t),jl(s,e,t))}function pm(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var s=e.retryLane;e.retryLane=0!==s&&s<t?s:t}}function gm(e,t){pm(e,t),(e=e.alternate)&&pm(e,t)}function fm(e){if(13===e.tag||31===e.tag){var t=Ta(e,67108864);null!==t&&Kc(t,0,67108864),gm(e,67108864)}}function vm(e){if(13===e.tag||31===e.tag){var t=$c(),s=Ta(e,t=Be(t));null!==s&&Kc(s,0,t),gm(e,t)}}var bm=!0;function jm(e,t,s,a){var n=M.T;M.T=null;var l=P.p;try{P.p=2,Nm(e,t,s,a)}finally{P.p=l,M.T=n}}function ym(e,t,s,a){var n=M.T;M.T=null;var l=P.p;try{P.p=8,Nm(e,t,s,a)}finally{P.p=l,M.T=n}}function Nm(e,t,s,a){if(bm){var n=wm(a);if(null===n)tu(e,t,a,Cm,s),Pm(e,a);else if(function(e,t,s,a,n){switch(t){case"focusin":return Sm=Bm(Sm,e,t,s,a,n),!0;case"dragenter":return Em=Bm(Em,e,t,s,a,n),!0;case"mouseover":return Am=Bm(Am,e,t,s,a,n),!0;case"pointerover":var l=n.pointerId;return Fm.set(l,Bm(Fm.get(l)||null,e,t,s,a,n)),!0;case"gotpointercapture":return l=n.pointerId,Tm.set(l,Bm(Tm.get(l)||null,e,t,s,a,n)),!0}return!1}(n,e,t,s,a))a.stopPropagation();else if(Pm(e,a),4&t&&-1<Mm.indexOf(e)){for(;null!==n;){var l=Qe(n);if(null!==l)switch(l.tag){case 3:if((l=l.stateNode).current.memoizedState.isDehydrated){var r=De(l.pendingLanes);if(0!==r){var i=l;for(i.pendingLanes|=2,i.entangledLanes|=2;r;){var o=1<<31-je(r);i.entanglements[1]|=o,r&=~o}Pd(l),0===(6&hc)&&(Mc=oe()+500,Bd(0,!1))}}break;case 31:case 13:null!==(i=Ta(l,2))&&Kc(i,0,2),Zc(),gm(l,2)}if(null===(l=wm(a))&&tu(e,t,a,Cm,s),l===n)break;n=l}null!==n&&a.stopPropagation()}else tu(e,t,a,null,s)}}function wm(e){return km(e=Mt(e))}var Cm=null;function km(e){if(Cm=null,null!==(e=Je(e))){var t=o(e);if(null===t)e=null;else{var s=t.tag;if(13===s){if(null!==(e=c(t)))return e;e=null}else if(31===s){if(null!==(e=d(t)))return e;e=null}else if(3===s){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Cm=e,null}function Dm(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ce()){case de:return 2;case ue:return 8;case me:case he:return 32;case xe:return 268435456;default:return 32}default:return 32}}var _m=!1,Sm=null,Em=null,Am=null,Fm=new Map,Tm=new Map,zm=[],Mm="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Pm(e,t){switch(e){case"focusin":case"focusout":Sm=null;break;case"dragenter":case"dragleave":Em=null;break;case"mouseover":case"mouseout":Am=null;break;case"pointerover":case"pointerout":Fm.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tm.delete(t.pointerId)}}function Bm(e,t,s,a,n,l){return null===e||e.nativeEvent!==l?(e={blockedOn:t,domEventName:s,eventSystemFlags:a,nativeEvent:l,targetContainers:[n]},null!==t&&(null!==(t=Qe(t))&&fm(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,null!==n&&-1===t.indexOf(n)&&t.push(n),e)}function Rm(e){var t=Je(e.target);if(null!==t){var s=o(t);
vendor: 4,998 bytes, line 2
2if(null!==s)if(13===(t=s.tag)){if(null!==(t=c(s)))return e.blockedOn=t,void Ie(e.priority,function(){vm(s)})}else if(31===t){if(null!==(t=d(s)))return e.blockedOn=t,void Ie(e.priority,function(){vm(s)})}else if(3===t&&s.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===s.tag?s.stateNode.containerInfo:null)}e.blockedOn=null}function Lm(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var s=wm(e.nativeEvent);if(null!==s)return null!==(t=Qe(s))&&fm(t),e.blockedOn=s,!1;var a=new(s=e.nativeEvent).constructor(s.type,s);zt=a,s.target.dispatchEvent(a),zt=null,t.shift()}return!0}function Im(e,t,s){Lm(e)&&s.delete(t)}function Om(){_m=!1,null!==Sm&&Lm(Sm)&&(Sm=null),null!==Em&&Lm(Em)&&(Em=null),null!==Am&&Lm(Am)&&(Am=null),Fm.forEach(Im),Tm.forEach(Im)}function Um(e,t){e.blockedOn===t&&(e.blockedOn=null,_m||(_m=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Om)))}var Hm=null;function Wm(e){Hm!==e&&(Hm=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Hm===e&&(Hm=null);for(var t=0;t<e.length;t+=3){var s=e[t],a=e[t+1],n=e[t+2];if("function"!==typeof a){if(null===km(a||s))continue;break}var l=Qe(s);null!==l&&(e.splice(t,3),t-=3,ei(l,{pending:!0,data:n,method:s.method,action:a},a,n))}}))}function Vm(e){function t(t){return Um(t,e)}null!==Sm&&Um(Sm,e),null!==Em&&Um(Em,e),null!==Am&&Um(Am,e),Fm.forEach(t),Tm.forEach(t);for(var s=0;s<zm.length;s++){var a=zm[s];a.blockedOn===e&&(a.blockedOn=null)}for(;0<zm.length&&null===(s=zm[0]).blockedOn;)Rm(s),null===s.blockedOn&&zm.shift();if(null!=(s=(e.ownerDocument||e).$$reactFormReplay))for(a=0;a<s.length;a+=3){var n=s[a],l=s[a+1],r=n[He]||null;if("function"===typeof l)r||Wm(s);else if(r){var i=null;if(l&&l.hasAttribute("formAction")){if(n=l,r=l[He]||null)i=r.formAction;else if(null!==km(n))continue}else i=r.action;"function"===typeof i?s[a+1]=i:(s.splice(a,3),a-=3),Wm(s)}}}function qm(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return n=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==n&&(n(),n=null),a||setTimeout(s,20)}function s(){if(!a&&!navigation.transition){var e=navigation.currentEntry;e&&null!=e.url&&navigation.navigate(e.url,{state:e.getState(),info:"react-transition",history:"replace"})}}if("object"===typeof navigation){var a=!1,n=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),null!==n&&(n(),n=null)}}}function $m(e){this._internalRoot=e}function Gm(e){this._internalRoot=e}Gm.prototype.render=$m.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(r(409));xm(t.current,$c(),e,t,null,null)},Gm.prototype.unmount=$m.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;xm(e.current,2,null,e,null,null),Zc(),t[We]=null}},Gm.prototype.unstable_scheduleHydration=function(e){if(e){var t=Le();e={blockedOn:null,target:e,priority:t};for(var s=0;s<zm.length&&0!==t&&t<zm[s].priority;s++);zm.splice(s,0,e),0===s&&Rm(e)}};var Km=n.version;if("19.2.3"!==Km)throw Error(r(527,Km,"19.2.3"));P.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"===typeof e.render)throw Error(r(188));throw e=Object.keys(e).join(","),Error(r(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=o(e)))throw Error(r(188));return t!==e?null:e}for(var s=e,a=t;;){var n=s.return;if(null===n)break;var l=n.alternate;if(null===l){if(null!==(a=n.return)){s=a;continue}break}if(n.child===l.child){for(l=n.child;l;){if(l===s)return u(n),e;if(l===a)return u(n),t;l=l.sibling}throw Error(r(188))}if(s.return!==a.return)s=n,a=l;else{for(var i=!1,c=n.child;c;){if(c===s){i=!0,s=n,a=l;break}if(c===a){i=!0,a=n,s=l;break}c=c.sibling}if(!i){for(c=l.child;c;){if(c===s){i=!0,s=l,a=n;break}if(c===a){i=!0,a=l,s=n;break}c=c.sibling}if(!i)throw Error(r(189))}}if(s.alternate!==a)throw Error(r(190))}if(3!==s.tag)throw Error(r(188));return s.stateNode.current===s?e:t}(t),e=null===(e=null!==e?m(e):null)?null:e.stateNode};var Ym={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.3"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Jm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jm.isDisabled&&Jm.supportsFiber)try{fe=Jm.inject(Ym),ve=Jm}catch(Xm){}}t.createRoot=function(e,t){if(!i(e))throw Error(r(299));var s=!1,a="",n=wi,l=Ci,o=ki;return null!==t&&void 0!==t&&(!0===t.unstable_strictMode&&(s=!0),void 0!==t.identifierPrefix&&(a=t.identifierPrefix),void 0!==t.onUncaughtError&&(n=t.onUncaughtError),void 0!==t.onCaughtError&&(l=t.onCaughtError),void 0!==t.onRecoverableError&&(o=t.onRecoverableError)),t=mm(e,1,!1,null,0,s,a,null,
2n,l,o,qm),e[We]=t.current,Zd(e),new $m(t)},t.hydrateRoot=function(e,t,s){if(!i(e))throw Error(r(299));var a=!1,n="",l=wi,o=Ci,c=ki,d=null;return null!==s&&void 0!==s&&(!0===s.unstable_strictMode&&(a=!0),void 0!==s.identifierPrefix&&(n=s.identifierPrefix),void 0!==s.onUncaughtError&&(l=s.onUncaughtError),void 0!==s.onCaughtError&&(o=s.onCaughtError),void 0!==s.onRecoverableError&&(c=s.onRecoverableError),void 0!==s.formState&&(d=s.formState)),(t=mm(e,1,!0,t,0,a,n,d,l,o,c,qm)).context=hm(null),s=t.current,(n=vl(a=Be(a=$c()))).callback=null,bl(s,n,a),s=a,t.current.lanes=s,Te(t,s),Pd(t),e[We]=t.current,Zd(e),new Gm(t)},t.version="19.2.3"},43:(e,t,s)=>{"use strict";e.exports=s(288)},288:(e,t)=>{"use strict";var s=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),x=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,f={};function v(e,t,s){this.props=e,this.context=t,this.refs=f,this.updater=s||p}function b(){}function j(e,t,s){this.props=e,this.context=t,this.refs=f,this.updater=s||p}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=v.prototype;var y=j.prototype=new b;y.constructor=j,g(y,v.prototype),y.isPureReactComponent=!0;var N=Array.isArray;function w(){}var C={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function D(e,t,a){var n=a.ref;return{$$typeof:s,type:e,key:t,ref:void 0!==n?n:null,props:a}}function _(e){return"object"===typeof e&&null!==e&&e.$$typeof===s}var S=/\/+/g;function E(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function A(e,t,n,l,r){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var o,c,d=!1;if(null===e)d=!0;else switch(i){case"bigint":case"string":case"number":d=!0;break;case"object":switch(e.$$typeof){case s:case a:d=!0;break;case m:return A((d=e._init)(e._payload),t,n,l,r)}}if(d)return r=r(e),d=""===l?"."+E(e,0):l,N(r)?(n="",null!=d&&(n=d.replace(S,"$&/")+"/"),A(r,t,n,"",function(e){return e})):null!=r&&(_(r)&&(o=r,c=n+(null==r.key||e&&e.key===r.key?"":(""+r.key).replace(S,"$&/")+"/")+d,r=D(o.type,c,o.props)),t.push(r)),1;d=0;var u,h=""===l?".":l+":";if(N(e))for(var p=0;p<e.length;p++)d+=A(l=e[p],t,n,i=h+E(l,p),r);else if("function"===typeof(p=null===(u=e)||"object"!==typeof u?null:"function"===typeof(u=x&&u[x]||u["@@iterator"])?u:null))for(e=p.call(e),p=0;!(l=e.next()).done;)d+=A(l=l.value,t,n,i=h+E(l,p++),r);else if("object"===i){if("function"===typeof e.then)return A(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"===typeof e.status?e.then(w,w):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,n,l,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return d}function F(e,t,s){if(null==e)return e;var a=[],n=0;return A(e,a,"","",function(e){return t.call(s,e,n++)}),a}function T(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var z="function"===typeof reportError?reportError:function(e){if("object"===typeof window&&"function"===typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"===typeof e&&null!==e&&"string"===typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"===typeof process&&"function"===typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)}
vendor: 2,365 bytes, line 2
2,M={map:F,forEach:function(e,t,s){F(e,function(){t.apply(this,arguments)},s)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!_(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};t.Activity=h,t.Children=M,t.Component=v,t.Fragment=n,t.Profiler=r,t.PureComponent=j,t.StrictMode=l,t.Suspense=d,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},t.cache=function(e){return function(){return e.apply(null,arguments)}},t.cacheSignal=function(){return null},t.cloneElement=function(e,t,s){if(null===e||void 0===e)throw Error("The argument must be a React element, but you passed "+e+".");var a=g({},e.props),n=e.key;if(null!=t)for(l in void 0!==t.key&&(n=""+t.key),t)!k.call(t,l)||"key"===l||"__self"===l||"__source"===l||"ref"===l&&void 0===t.ref||(a[l]=t[l]);var l=arguments.length-2;if(1===l)a.children=s;else if(1<l){for(var r=Array(l),i=0;i<l;i++)r[i]=arguments[i+2];a.children=r}return D(e.type,n,a)},t.createContext=function(e){return(e={$$typeof:o,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:i,_context:e},e},t.createElement=function(e,t,s){var a,n={},l=null;if(null!=t)for(a in void 0!==t.key&&(l=""+t.key),t)k.call(t,a)&&"key"!==a&&"__self"!==a&&"__source"!==a&&(n[a]=t[a]);var r=arguments.length-2;if(1===r)n.children=s;else if(1<r){for(var i=Array(r),o=0;o<r;o++)i[o]=arguments[o+2];n.children=i}if(e&&e.defaultProps)for(a in r=e.defaultProps)void 0===n[a]&&(n[a]=r[a]);return D(e,l,n)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=_,t.lazy=function(e){return{$$typeof:m,_payload:{_status:-1,_result:e},_init:T}},t.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=C.T,s={};C.T=s;try{var a=e(),n=C.S;null!==n&&n(s,a),"object"===typeof a&&null!==a&&"function"===typeof a.then&&a.then(w,z)}catch(l){z(l)}finally{null!==t&&null!==s.types&&(t.types=s.types),C.T=t}},t.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},t.use=function(e){return C.H.use(e)},t.useActionState=function(e,t,s){return C.H.useActionState(e,t,s
2)},t.useCallback=function(e,t){return C.H.useCallback(e,t)},t.useContext=function(e){return C.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return C.H.useEffect(e,t)},t.useEffectEvent=function(e){return C.H.useEffectEvent(e)},t.useId=function(){return C.H.useId()},t.useImperativeHandle=function(e,t,s){return C.H.useImperativeHandle(e,t,s)},t.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return C.H.useMemo(e,t)},t.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},t.useReducer=function(e,t,s){return C.H.useReducer(e,t,s)},t.useRef=function(e){return C.H.useRef(e)},t.useState=function(e){return C.H.useState(e)},t.useSyncExternalStore=function(e,t,s){return C.H.useSyncExternalStore(e,t,s)},t.useTransition=function(){return C.H.useTransition()},t.version="19.2.3"},324:e=>{e.exports=function(e,t,s,a){var n=s?s.call(a,e,t):void 0;if(void 0!==n)return!!n;if(e===t)return!0;if("object"!==typeof e||!e||"object"!==typeof t||!t)return!1;var l=Object.keys(e),r=Object.keys(t);if(l.length!==r.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(t),o=0;o<l.length;o++){var c=l[o];if(!i(c))return!1;var d=e[c],u=t[c];if(!1===(n=s?s.call(a,d,u,c):void 0)||void 0===n&&d!==u)return!1}return!0}},330:(e,t,s)=>{"use strict";var a=s(43);var n="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},l=a.useState,r=a.useEffect,i=a.useLayoutEffect,o=a.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!n(e,s)}catch(a){return!0}}var d="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(e,t){return t()}:function(e,t){var s=t(),a=l({inst:{value:s,getSnapshot:t}}),n=a[0].inst,d=a[1];return i(function(){n.value=s,n.getSnapshot=t,c(n)&&d({inst:n})},[e,s,t]),r(function(){return c(n)&&d({inst:n}),e(function(){c(n)&&d({inst:n})})},[e]),o(s),s};t.useSyncExternalStore=void 0!==a.useSyncExternalStore?a.useSyncExternalStore:d},366:e=>{var t="undefined"!==typeof Element,s="function"===typeof Map,a="function"===typeof Set,n="function"===typeof ArrayBuffer&&!!ArrayBuffer.isView;function l(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var i,o,c,d;if(Array.isArray(e)){if((i=e.length)!=r.length)return!1;for(o=i;0!==o--;)if(!l(e[o],r[o]))return!1;return!0}if(s&&e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(d=e.entries();!(o=d.next()).done;)if(!r.has(o.value[0]))return!1;for(d=e.entries();!(o=d.next()).done;)if(!l(o.value[1],r.get(o.value[0])))return!1;return!0}if(a&&e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(d=e.entries();!(o=d.next()).done;)if(!r.has(o.value[0]))return!1;return!0}if(n&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if((i=e.length)!=r.length)return!1;for(o=i;0!==o--;)if(e[o]!==r[o])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"===typeof e.valueOf&&"function"===typeof r.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString&&"function"===typeof e.toString&&"function"===typeof r.toString)return e.toString()===r.toString();if((i=(c=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(o=i;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,c[o]))return!1;if(t&&e instanceof Element)return!1;for(o=i;0!==o--;)if(("_owner"!==c[o]&&"__v"!==c[o]&&"__o"!==c[o]||!e.$$typeof)&&!l(e[c[o]],r[c[o]]))return!1;return!0}return e!==e&&r!==r}e.exports=function(e,t){try{return l(e,t)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}}},391:(e,t,s)=>{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=s(4)},443:(e,t,s)=>{"use strict";e.exports=s(717)},461:(e,t,s)=>{"use strict";e.exports=s(330)},495:e=>{function t(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(s=>{const a=e[s],n=typeof a;"object"!==n&&"function"!==n||Object.isFrozen(a)||t(a)}),e}class s{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function n(e){const t=Object.create(null);for(const l in e)t[l]=e[l];for(var s=arguments.length,a=new Array(s>1?s-1:0),n=1;n<s;n++)a[n-1]=arguments[n];return a.forEach(function(e){for(const s in e)t[s]=e[s]}),t}const l=e=>!!e.scope;
2class r{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=a(e)}openNode(e){if(!l(e))return;const t=((e,t)=>{let{prefix:s}=t;if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const t=e.split(".");return["".concat(s).concat(t.shift()),...t.map((e,t)=>"".concat(e).concat("_".repeat(t+1)))].join(" ")}return"".concat(s).concat(e)})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){l(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+='<span class="'.concat(e,'">')}}const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={children:[]};return Object.assign(t,e),t};class o{constructor(){this.rootNode=i(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=i({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"===typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){"string"!==typeof e&&e.children&&(e.children.every(e=>"string"===typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{o._collapse(e)}))}}class c extends o{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const s=e.root;t&&(s.scope="language:".concat(t)),this.add(s)}toHTML(){return new r(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(e){return e?"string"===typeof e?e:e.source:null}function u(e){return x("(?=",e,")")}function m(e){return x("(?:",e,")*")}function h(e){return x("(?:",e,")?")}function x(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.map(e=>d(e)).join("")}function p(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const a=function(e){const t=e[e.length-1];return"object"===typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(t);return"("+(a.capture?"":"?:")+t.map(e=>d(e)).join("|")+")"}function g(e){return new RegExp(e.toString()+"|").exec("").length-1}const f=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function v(e,t){let{joinWith:s}=t,a=0;return e.map(e=>{a+=1;const t=a;let s=d(e),n="";for(;s.length>0;){const e=f.exec(s);if(!e){n+=s;break}n+=s.substring(0,e.index),s=s.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?n+="\\"+String(Number(e[1])+t):(n+=e[0],"("===e[0]&&a++)}return n}).map(e=>"(".concat(e,")")).join(s)}const b="[a-zA-Z]\\w*",j="[a-zA-Z_]\\w*",y="\\b\\d+(\\.\\d+)?",N="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",w="\\b(0b[01]+)",C={begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[C]},D={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[C]},_=function(e,t){const s=n({scope:"comment",begin:e,end:t,contains:[]},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{});s.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});
2const a=p("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return s.contains.push({begin:x(/[ ]+/,"(",a,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},S=_("//","$"),E=_("/\\*","\\*/"),A=_("#","$"),F={scope:"number",begin:y,relevance:0},T={scope:"number",begin:N,relevance:0},z={scope:"number",begin:w,relevance:0},M={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[C,{begin:/\[/,end:/\]/,relevance:0,contains:[C]}]},P={scope:"title",begin:b,relevance:0},B={scope:"title",begin:j,relevance:0},R={begin:"\\.\\s*"+j,relevance:0};var L=Object.freeze({__proto__:null,APOS_STRING_MODE:k,BACKSLASH_ESCAPE:C,BINARY_NUMBER_MODE:z,BINARY_NUMBER_RE:w,COMMENT:_,C_BLOCK_COMMENT_MODE:E,C_LINE_COMMENT_MODE:S,C_NUMBER_MODE:T,C_NUMBER_RE:N,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:A,IDENT_RE:b,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:R,NUMBER_MODE:F,NUMBER_RE:y,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:D,REGEXP_MODE:M,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=/^#![ ]*\//;return e.binary&&(e.begin=x(t,/.*\b/,e.binary,/\b.*/)),n({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:P,UNDERSCORE_IDENT_RE:j,UNDERSCORE_TITLE_MODE:B});function I(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function O(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function U(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=I,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function H(e,t){Array.isArray(e.illegal)&&(e.illegal=p(...e.illegal))}function W(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function V(e,t){void 0===e.relevance&&(e.relevance=1)}const q=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const s=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=s.keywords,e.begin=x(s.beforeMatch,u(s.begin)),e.starts={relevance:0,contains:[Object.assign(s,{endsParent:!0})]},e.relevance=0,delete s.beforeMatch},$=["of","and","for","in","not","or","if","then","parent","list","value"];function G(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"keyword";const a=Object.create(null);return"string"===typeof e?n(s,e.split(" ")):Array.isArray(e)?n(s,e):Object.keys(e).forEach(function(s){Object.assign(a,G(e[s],t,s))}),a;function n(e,s){t&&(s=s.map(e=>e.toLowerCase())),s.forEach(function(t){const s=t.split("|");a[s[0]]=[e,K(s[0],s[1])]})}}function K(e,t){return t?Number(t):function(e){return $.includes(e.toLowerCase())}(e)?0:1}const Y={},J=e=>{console.error(e)},Q=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];console.log("WARN: ".concat(e),...s)},X=(e,t)=>{Y["".concat(e,"/").concat(t)]||(console.log("Deprecated as of ".concat(e,". ").concat(t)),Y["".concat(e,"/").concat(t)]=!0)},Z=new Error;function ee(e,t,s){let{key:a}=s,n=0;const l=e[a],r={},i={};for(let o=1;o<=t.length;o++)i[o+n]=l[o],r[o+n]=!0,n+=g(t[o-1]);e[a]=i,e[a]._emit=r,e[a]._multi=!0}function te(e){!function(e){e.scope&&"object"===typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"===typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"===typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw J("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Z;if("object"!==typeof e.beginScope||null===e.beginScope)throw J("beginScope must be object"),Z;ee(e,e.begin,{key:"beginScope"}),e.begin=v(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw J("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Z;if("object"!==typeof e.endScope||null===e.endScope)throw J("endScope must be object"),Z;ee(e,e.end,{key:"endScope"}),e.end=v(e.end,{joinWith:""})}}(e)}function se(e){function t(t,s){return new RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(s?"g":""))}class s{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=g(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=t(v(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const s=t.findIndex((e,t)=>t>0&&void 0!==e),a=this.matchIndexes[s];return t.splice(0,s),Object.assign(t,a)}}class a{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new s;
vendor: 8,430 bytes, line 2
2return this.rules.slice(e).forEach(e=>{let[s,a]=e;return t.addRule(s,a)}),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let s=t.exec(e);if(this.resumingScanAtSamePosition())if(s&&s.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,s=t.exec(e)}return s&&(this.regexIndex+=s.position+1,this.regexIndex===this.count&&this.considerAll()),s}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=n(e.classNameAliases||{}),function s(l,r){const i=l;if(l.isCompiled)return i;[O,W,te,q].forEach(e=>e(l,r)),e.compilerExtensions.forEach(e=>e(l,r)),l.__beforeBegin=null,[U,H,V].forEach(e=>e(l,r)),l.isCompiled=!0;let o=null;return"object"===typeof l.keywords&&l.keywords.$pattern&&(l.keywords=Object.assign({},l.keywords),o=l.keywords.$pattern,delete l.keywords.$pattern),o=o||/\w+/,l.keywords&&(l.keywords=G(l.keywords,e.case_insensitive)),i.keywordPatternRe=t(o,!0),r&&(l.begin||(l.begin=/\B|\b/),i.beginRe=t(i.begin),l.end||l.endsWithParent||(l.end=/\B|\b/),l.end&&(i.endRe=t(i.end)),i.terminatorEnd=d(i.end)||"",l.endsWithParent&&r.terminatorEnd&&(i.terminatorEnd+=(l.end?"|":"")+r.terminatorEnd)),l.illegal&&(i.illegalRe=t(l.illegal)),l.contains||(l.contains=[]),l.contains=[].concat(...l.contains.map(function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return n(e,{variants:null},t)}));if(e.cachedVariants)return e.cachedVariants;if(ae(e))return n(e,{starts:e.starts?n(e.starts):null});if(Object.isFrozen(e))return n(e);return e}("self"===e?l:e)})),l.contains.forEach(function(e){s(e,i)}),l.starts&&s(l.starts,r),i.matcher=function(e){const t=new a;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(i),i}(e)}function ae(e){return!!e&&(e.endsWithParent||ae(e.starts))}class ne extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const le=a,re=n,ie=Symbol("nomatch"),oe=function(e){const a=Object.create(null),n=Object.create(null),l=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let d={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:c};function g(e){return d.noHighlightRe.test(e)}function f(e,t,s){let a="",n="";"object"===typeof t?(a=e,s=t.ignoreIllegals,n=t.language):(X("10.7.0","highlight(lang, code, ...args) has been deprecated."),X("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),n=e,a=t),void 0===s&&(s=!0);const l={code:a,language:n};D("before:highlight",l);const r=l.result?l.result:v(l.language,l.code,s);return r.code=l.code,D("after:highlight",r),r}function v(e,t,n,l){const o=Object.create(null);function c(e,t){return e.keywords[t]}function u(){if(!_.keywords)return void E.addText(A);let e=0;_.keywordPatternRe.lastIndex=0;let t=_.keywordPatternRe.exec(A),s="";for(;t;){s+=A.substring(e,t.index);const a=C.case_insensitive?t[0].toLowerCase():t[0],n=c(_,a);if(n){const[e,l]=n;if(E.addText(s),s="",o[a]=(o[a]||0)+1,o[a]<=7&&(F+=l),e.startsWith("_"))s+=t[0];else{const s=C.classNameAliases[e]||e;h(t[0],s)}}else s+=t[0];e=_.keywordPatternRe.lastIndex,t=_.keywordPatternRe.exec(A)}s+=A.substring(e),E.addText(s)}function m(){null!=_.subLanguage?function(){if(""===A)return;let e=null;if("string"===typeof _.subLanguage){if(!a[_.subLanguage])return void E.addText(A);e=v(_.subLanguage,A,!0,S[_.subLanguage]),S[_.subLanguage]=e._top}else e=b(A,_.subLanguage.length?_.subLanguage:null);_.relevance>0&&(F+=e.relevance),E.__addSublanguage(e._emitter,e.language)}():u(),A=""}function h(e,t){""!==e&&(E.startScope(t),E.addText(e),E.endScope())}function x(e,t){let s=1;const a=t.length-1;for(;s<=a;){if(!e._emit[s]){s++;continue}const a=C.classNameAliases[e[s]]||e[s],n=t[s];a?h(n,a):(A=n,u(),A=""),s++}}function p(e,t){return e.scope&&"string"===typeof e.scope&&E.openNode(C.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(h(A,C.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),A=""):e.beginScope._multi&&(x(e.beginScope,t),A="")),_=Object.create(e,{parent:{value:_}}),_}function g(e,t,a){let n=function(e,t){const s=e&&e.exec(t);return s&&0===s.index}(e.endRe,a);if(n){if(e["on:end"]){const a=new s(e);e["on:end"](t,a),a.isMatchIgnored&&(n=!1)}if(n){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return g(e.parent,t,a)}function f(e){return 0===_.matcher.regexIndex?(A+=e[0],1):(M=!0,0)}function j(e){const s=e[0],a=t.substring(e.index),n=g(_,e,a);if(!n)return ie;const l=_;_.endScope&&_.endScope._wrap?(m(),h(s,_.endScope._wrap)):_.endScope&&_.endScope._multi?(m(),x(_.endScope,e)):l.skip?A+=s:(l.returnEnd||l.excludeEnd||(A+=s),m(),l.excludeEnd&&(A=s));do{_.scope&&E.closeNode(),_.skip||_.subLanguage||(F+=_.relevance),_=_.parent}while(_!==n.parent);return n.starts&&p(n.starts,e),l.returnEnd?0:s.length}let y={};function N(a,l){const i=l&&l[0];if(A+=a,null==i)return m(),0;if("begin"===y.type&&"end"===l.type&&y.index===l.index&&""===i){if(A+=t.slice(l.index,l.index+1),!r){const t=new Error("0 width match regex (".concat(e,")"));throw t.languageName=e,t.badRule=y.rule,t}return 1}if(y=l,"begin"===l.type)return function(e){const t=e[0],a=e.rule,n=new s(a),l=[a.__beforeBegin,a["on:begin"]];for(const s of l)if(s&&(s(e,n),n.isMatchIgnored))return f(t);return a.skip?A+=t:(a.excludeBegin&&(A+=t),m(),a.returnBegin||a.excludeBegin||(A=t)),p(a,e),a.returnBegin?0:t.length}(l);if("illegal"===l.type&&!n){const e=new Error('Illegal lexeme "'+i+'" for mode "'+(_.scope||"<unnamed>")+'"');throw e.mode=_,e}if("end"===l.type){const e=j(l);if(e!==ie)return e}if("illegal"===l.type&&""===i)return A+="\n",1;if(z>1e5&&z>3*l.index){throw new Error("potential infinite loop, way more iterations than matches")}return A+=i,i.length}const C=w(e);if(!C)throw J(i.replace("{}",e)),new Error('Unknown language: "'+e+'"');const k=se(C);let D="",_=l||k;const S={},E=new d.__emitter(d);!function(){const e=[];for(let t=_;t!==C;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>E.openNode(e))}();let A="",F=0,T=0,z=0,M=!1;try{if(C.__emitTokens)C.__emitTokens(t,E);else{for(_.matcher.considerAll();;){z++,M?M=!1:_.matcher.considerAll(),_.matcher.lastIndex=T;const e=_.matcher.exec(t);if(!e)break;const s=N(t.substring(T,e.index),e);T=e.index+s}N(t.substring(T))}return E.finalize(),D=E.toHTML(),{language:e,value:D,relevance:F,illegal:!1,_emitter:E,_top:_}}catch(P){if(P.message&&P.message.includes("Illegal"))return{language:e,value:le(t),illegal:!0,relevance:0,_illegalBy:{message:P.message,index:T,context:t.slice(T-100,T+100),mode:P.mode,resultSoFar:D},_emitter:E};if(r)return{language:e,value:le(t),illegal:!1,relevance:0,errorRaised:P,_emitter:E,_top:_};throw P}}function b(e,t){t=t||d.languages||Object.keys(a);const s=function(e){const t={value:le(e),illegal:!1,relevance:0,_top:o,_emitter:new d.__emitter(d)};return t._emitter.addText(e),t}(e),n=t.filter(w).filter(k).map(t=>v(t,e,!1));n.unshift(s);const l=n.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(w(e.language).supersetOf===t.language)return 1;if(w(t.language).supersetOf===e.language)return-1}return 0}),[r,i]=l,c=r;return c.secondBest=i,c}function j(e){let t=null;const s=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const s=d.languageDetectRe.exec(t);if(s){const t=w(s[1]);return t||(Q(i.replace("{}",s[1])),Q("Falling back to no-highlight mode for this block.",e)),t?s[1]:"no-highlight"}return t.split(/\s+/).find(e=>g(e)||w(e))}(e);if(g(s))return;if(D("before:highlightElement",{el:e,language:s}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>
20&&(d.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),d.throwUnescapedHTML)){throw new ne("One of your code blocks includes unescaped HTML.",e.innerHTML)}t=e;const a=t.textContent,l=s?f(a,{language:s,ignoreIllegals:!0}):b(a);e.innerHTML=l.value,e.dataset.highlighted="yes",function(e,t,s){const a=t&&n[t]||s;e.classList.add("hljs"),e.classList.add("language-".concat(a))}(e,s,l.language),e.result={language:l.language,re:l.relevance,relevance:l.relevance},l.secondBest&&(e.secondBest={language:l.secondBest.language,relevance:l.secondBest.relevance}),D("after:highlightElement",{el:e,result:l,text:a})}let y=!1;function N(){if("loading"===document.readyState)return y||window.addEventListener("DOMContentLoaded",function(){N()},!1),void(y=!0);document.querySelectorAll(d.cssSelector).forEach(j)}function w(e){return e=(e||"").toLowerCase(),a[e]||a[n[e]]}function C(e,t){let{languageName:s}=t;"string"===typeof e&&(e=[e]),e.forEach(e=>{n[e.toLowerCase()]=s})}function k(e){const t=w(e);return t&&!t.disableAutodetect}function D(e,t){const s=e;l.forEach(function(e){e[s]&&e[s](t)})}Object.assign(e,{highlight:f,highlightAuto:b,highlightAll:N,highlightElement:j,highlightBlock:function(e){return X("10.7.0","highlightBlock will be removed entirely in v12.0"),X("10.7.0","Please use highlightElement now."),j(e)},configure:function(e){d=re(d,e)},initHighlighting:()=>{N(),X("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){N(),X("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(t,s){let n=null;try{n=s(e)}catch(l){if(J("Language definition for '{}' could not be registered.".replace("{}",t)),!r)throw l;J(l),n=o}n.name||(n.name=t),a[t]=n,n.rawDefinition=s.bind(null,e),n.aliases&&C(n.aliases,{languageName:t})},unregisterLanguage:function(e){delete a[e];for(const t of Object.keys(n))n[t]===e&&delete n[t]},listLanguages:function(){return Object.keys(a)},getLanguage:w,registerAliases:C,autoDetection:k,inherit:re,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),l.push(e)},removePlugin:function(e){const t=l.indexOf(e);-1!==t&&l.splice(t,1)}}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString="11.11.1",e.regex={concat:x,lookahead:u,either:p,optional:h,anyNumberOfTimes:m};for(const s in L)"object"===typeof L[s]&&t(L[s]);return Object.assign(e,L),e},ce=oe({});ce.newInstance=()=>oe({}),e.exports=ce,ce.HighlightJS=ce,ce.default=ce},579:(e,t,s)=>{"use strict";e.exports=s(799)},672:(e,t,s)=>{"use strict";var a=s(43);function n(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var r={d:{f:l,r:function(){throw Error(n(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},i=Symbol.for("react.portal");var o=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){return"font"===e?"":"string"===typeof t?"use-credentials"===t?t:"":void 0}t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,t.createPortal=function(e,t){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(n(299));return function(e,t,s){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:i,key:null==a?null:""+a,children:e,containerInfo:t,implementation:s}}(e,t,null,s)},t.flushSync=function(e){var t=o.T,s=r.p;try{if(o.T=null,r.p=2,e)return e()}finally{o.T=t,r.p=s,r.d.f()}},t.preconnect=function(e,t){"string"===typeof e&&(t?t="string"===typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:t=null,r.d.C(e,t))},t.prefetchDNS=function(e){"string"===typeof e&&r.d.D(e)},t.preinit=function(e,t){if("string"===typeof e&&t&&"string"===typeof t.as){var s=t.as,a=c(s,t.crossOrigin),n="string"===typeof t.integrity?t.integrity:void 0,l="string"===typeof t.fetchPriority?t.fetchPriority:void 0;"style"===s?r.d.S(e,"string"===typeof t.precedence?t.precedence:void 0,{crossOrigin:a,integrity:n,fetchPriority:l}):"script"===s&&r.d.X(e,{crossOrigin:a,integrity:n,fetchPriority:l,nonce:"string"===typeof t.nonce?t.nonce:void 0})}},t.preinitModule=function(e,t){if("string"===typeof e)if("object"===typeof t&&null!==t){if(null==t.as||"script"===t.as){var s=c(t.as,t.crossOrigin);r.d.M(e,{crossOrigin:s,integrity:"string"===typeof t.integrity?t.integrity:void 0,nonce:"string"===typeof t.nonce?t.nonce:void 0})}}else null==t&&r.d.M(e)},t.preload=function(e,t){if("string"===typeof e&&"object"===typeof t&&null!==t&&"string"===typeof t.as){var s=t.as,a=c(s,t.crossOrigin);r.d.L(e,s,{crossOrigin:a,integrity:"string"===typeof t.integrity?t.integrity:void 0,nonce:"string"===typeof t.nonce?t.nonce:void 0,type:"string"===typeof t.type?t.type:void 0,fetchPriority:"string"===typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"str
2ing"===typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"===typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"===typeof t.imageSizes?t.imageSizes:void 0,media:"string"===typeof t.media?t.media:void 0})}},t.preloadModule=function(e,t){if("string"===typeof e)if(t){var s=c(t.as,t.crossOrigin);r.d.m(e,{as:"string"===typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:s,integrity:"string"===typeof t.integrity?t.integrity:void 0})}else r.d.m(e)},t.requestFormReset=function(e){r.d.r(e)},t.unstable_batchedUpdates=function(e,t){return e(t)},t.useFormState=function(e,t,s){return o.H.useFormState(e,t,s)},t.useFormStatus=function(){return o.H.useHostTransitionStatus()},t.version="19.2.3"},717:(e,t,s)=>{"use strict";var a=s(43),n=s(461);var l="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},r=n.useSyncExternalStore,i=a.useRef,o=a.useEffect,c=a.useMemo,d=a.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,s,a,n){var u=i(null);if(null===u.current){var m={hasValue:!1,value:null};u.current=m}else m=u.current;u=c(function(){function e(e){if(!o){if(o=!0,r=e,e=a(e),void 0!==n&&m.hasValue){var t=m.value;if(n(t,e))return i=t}return i=e}if(t=i,l(r,e))return t;var s=a(e);return void 0!==n&&n(t,s)?(r=e,t):(r=e,i=s)}var r,i,o=!1,c=void 0===s?null:s;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,s,a,n]);var h=r(e,u[0],u[1]);return o(function(){m.hasValue=!0,m.value=h},[h]),d(h),h}},740:e=>{"use strict";e.exports=function(e,t,s,a,n,l,r,i){if(!e){var o;if(void 0===t)o=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[s,a,n,l,r,i],d=0;(o=new Error(t.replace(/%s/g,function(){return c[d++]}))).name="Invariant Violation"}throw o.framesToPop=1,o}}},799:(e,t)=>
2{"use strict";var s=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function n(e,t,a){var n=null;if(void 0!==a&&(n=""+a),void 0!==t.key&&(n=""+t.key),"key"in t)for(var l in a={},t)"key"!==l&&(a[l]=t[l]);else a=t;return t=a.ref,{$$typeof:s,type:e,key:n,ref:void 0!==t?t:null,props:a}}t.Fragment=a,t.jsx=n,t.jsxs=n},853:(e,t,s)=>{"use strict";e.exports=s(896)},896:(e,t)=>{"use strict";function s(e,t){var s=e.length;e.push(t);e:for(;0<s;){var a=s-1>>>1,n=e[a];if(!(0<l(n,t)))break e;e[a]=t,e[s]=n,s=a}}function a(e){return 0===e.length?null:e[0]}function n(e){if(0===e.length)return null;var t=e[0],s=e.pop();if(s!==t){e[0]=s;e:for(var a=0,n=e.length,r=n>>>1;a<r;){var i=2*(a+1)-1,o=e[i],c=i+1,d=e[c];if(0>l(o,s))c<n&&0>l(d,o)?(e[a]=d,e[c]=s,a=c):(e[a]=o,e[i]=s,a=i);else{if(!(c<n&&0>l(d,s)))break e;e[a]=d,e[c]=s,a=c}}}return t}function l(e,t){var s=e.sortIndex-t.sortIndex;return 0!==s?s:e.id-t.id}if(t.unstable_now=void 0,"object"===typeof performance&&"function"===typeof performance.now){var r=performance;t.unstable_now=function(){return r.now()}}else{var i=Date,o=i.now();t.unstable_now=function(){return i.now()-o}}var c=[],d=[],u=1,m=null,h=3,x=!1,p=!1,g=!1,f=!1,v="function"===typeof setTimeout?setTimeout:null,b="function"===typeof clearTimeout?clearTimeout:null,j="undefined"!==typeof setImmediate?setImmediate:null;function y(e){for(var t=a(d);null!==t;){if(null===t.callback)n(d);else{if(!(t.startTime<=e))break;n(d),t.sortIndex=t.expirationTime,s(c,t)}t=a(d)}}function N(e){if(g=!1,y(e),!p)if(null!==a(c))p=!0,C||(C=!0,w());else{var t=a(d);null!==t&&T(N,t.startTime-e)}}var w,C=!1,k=-1,D=5,_=-1;function S(){return!!f||!(t.unstable_now()-_<D)}function E(){if(f=!1,C){var e=t.unstable_now();_=e;var s=!0;try{e:{p=!1,g&&(g=!1,b(k),k=-1),x=!0;var l=h;try{t:{for(y(e),m=a(c);null!==m&&!(m.expirationTime>e&&S());){var r=m.callback;if("function"===typeof r){m.callback=null,h=m.priorityLevel;var i=r(m.expirationTime<=e);if(e=t.unstable_now(),"function"===typeof i){m.callback=i,y(e),s=!0;break t}m===a(c)&&n(c),y(e)}else n(c);m=a(c)}if(null!==m)s=!0;else{var o=a(d);null!==o&&T(N,o.startTime-e),s=!1}}break e}finally{m=null,h=l,x=!1}s=void 0}}finally{s?w():C=!1}}}if("function"===typeof j)w=function(){j(E)};else if("undefined"!==typeof MessageChannel){var A=new MessageChannel,F=A.port2;A.port1.onmessage=E,w=function(){F.postMessage(null)}}else w=function(){v(E,0)};function T(e,s){k=v(function(){e(t.unstable_now())},s)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var s=h;h=t;try{return e()}finally{h=s}},t.unstable_requestPaint=function(){f=!0},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var s=h;h=e;try{return t()}finally{h=s}},t.unstable_scheduleCallback=function(e,n,l){var r=t.unstable_now();switch("object"===typeof l&&null!==l?l="number"===typeof(l=l.delay)&&0<l?r+l:r:l=r,e){case 1:var i=-1;break;case 2:i=250;break;case 5:i=1073741823;break;case 4:i=1e4;break;default:i=5e3}return e={id:u++,callback:n,priorityLevel:e,startTime:l,expirationTime:i=l+i,sortIndex:-1},l>r?(e.sortIndex=l,s(d,e),null===a(c)&&e===a(d)&&(g?(b(k),k=-1):g=!0,T(N,l-r))):(e.sortIndex=i,s(c,e),p||x||(p=!0,C||(C=!0,w()))),e},t.unstable_shouldYield=S,t.unstable_wrapCallback=function(e){var t=h;return function(){var s=h;h=t;try{return e.apply(this,arguments)}finally{h=s}}}},950:(e,t,s)=>{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=s(672)}},t={};function s(a){var n=t[a];if(void 0!==n)return n.exports;var l=t[a]={exports:{}};return e[a](l,l.exports,s),l.exports}s.n=e=>
2{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;s.t=function(a,n){if(1&n&&(a=this(a)),8&n)return a;if("object"===typeof a&&a){if(4&n&&a.__esModule)return a;if(16&n&&"function"===typeof a.then)return a}var l=Object.create(null);s.r(l);var r={};e=e||[null,t({}),t([]),t(t)];for(var i=2&n&&a;("object"==typeof i||"function"==typeof i)&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach(e=>r[e]=()=>a[e]);return r.default=()=>a,s.d(l,r),l}})(),s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0,(()=>{"use strict";var e={};s.r(e),s.d(e,{hasBrowserEnv:()=>on,hasStandardBrowserEnv:()=>dn,hasStandardBrowserWebWorkerEnv:()=>un,navigator:()=>cn,origin:()=>mn});var t=s(43),a=s.t(t,2),n=s(391);function l(e,t){if(null==e)return{};var s,a,n=function(e,t){if(null==e)return{};var s={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;s[a]=e[a]}return s}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)s=l[a],-1===t.indexOf(s)&&{}.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t||"default");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==r(t)?t:t+""}function o(e,t,s){return(t=i(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function c(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function d(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?c(Object(s),!0).forEach(function(t){o(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):c(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}const u=["sri"],m=["page"],h=["page","matches"],x=["onClick","discover","prefetch","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],p=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],g=["discover","fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"];var f="popstate";function v(){return k(function(e,t){let{pathname:s,search:a,hash:n}=e.location;return N("",{pathname:s,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){return"string"===typeof t?t:w(t)},null,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}function b(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}function j(e,t){if(!e){"undefined"!==typeof console&&console.warn(t);try{throw new Error(t)}catch(s){}}}function y(e,t){return{usr:e.state,key:e.key,idx:t}}function N(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3?arguments[3]:void 0;return d(d({pathname:"string"===typeof e?e:e.pathname,search:"",hash:""},"string"===typeof t?C(t):t),{},{state:s,key:t&&t.key||a||Math.random().toString(36).substring(2,10)})}function w(e){let{pathname:t="/",search:s="",hash:a=""}=e;return s&&"?"!==s&&(t+="?"===s.charAt(0)?s:"?"+s),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function C(e){let t={};if(e){let s=e.indexOf("#");s>=0&&(t.hash=e.substring(s),e=e.substring(0,s));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function k(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{window:n=document.defaultView,v5Compat:l=!1}=a,r=n.history,i="POP",o=null,c=u();function u(){return(r.state||{idx:null}).idx}function m(){i="POP";let e=u(),t=null==e?null:e-c;c=e,o&&o({action:i,location:x.location,delta:t})}function h(e){return D(e)}null==c&&(c=0,r.replaceState(d(d({},r.state),{},{idx:c}),""));let x={get action(){return i},get location(){return e(n,r)},listen(e){if(o)throw new Error("A history only accepts one active listener");return n.addEventListener(f,m),o=e,()=>{n.removeEventListener(f,m),o=null}},createHref:e=>t(n,e),createURL:h,encodeLocation(e){let t=h(e);return{pathname:t.pathname,search:t.search,hash:t.hash}}
2,push:function(e,t){i="PUSH";let a=N(x.location,e,t);s&&s(a,e),c=u()+1;let d=y(a,c),m=x.createHref(a);try{r.pushState(d,"",m)}catch(h){if(h instanceof DOMException&&"DataCloneError"===h.name)throw h;n.location.assign(m)}l&&o&&o({action:i,location:x.location,delta:1})},replace:function(e,t){i="REPLACE";let a=N(x.location,e,t);s&&s(a,e),c=u();let n=y(a,c),d=x.createHref(a);r.replaceState(n,"",d),l&&o&&o({action:i,location:x.location,delta:0})},go:e=>r.go(e)};return x}function D(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s="http://localhost";"undefined"!==typeof window&&(s="null"!==window.location.origin?window.location.origin:window.location.href),b(s,"No window.location.(origin|href) available to create URL");let a="string"===typeof e?e:w(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=s+a),new URL(a,s)}new WeakMap;function _(e,t){return S(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",!1)}function S(e,t,s,a){let n=W(("string"===typeof t?C(t):t).pathname||"/",s);if(null==n)return null;let l=E(e);!function(e){e.sort((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let s=e.length===t.length&&e.slice(0,-1).every((e,s)=>e===t[s]);return s?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)))}(l);let r=null;for(let i=0;null==r&&i<l.length;++i){let e=H(n);r=I(l[i],e,a)}return r}function E(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=function(e,l){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n,i=arguments.length>3?arguments[3]:void 0,o={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:l,route:e};if(o.relativePath.startsWith("/")){if(!o.relativePath.startsWith(a)&&r)return;b(o.relativePath.startsWith(a),'Absolute route path "'.concat(o.relativePath,'" nested under path "').concat(a,'" is not valid. An absolute child route path must start with the combined path of all its parent routes.')),o.relativePath=o.relativePath.slice(a.length)}let c=Q([a,o.relativePath]),d=s.concat(o);e.children&&e.children.length>0&&(b(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'.concat(c,'".')),E(e.children,t,d,c,r)),(null!=e.path||e.index)&&t.push({path:c,score:L(c,e.index),routesMeta:d})};return e.forEach((e,t)=>{var s;if(""!==e.path&&null!==(s=e.path)&&void 0!==s&&s.includes("?"))for(let a of A(e.path))l(e,t,!0,a);else l(e,t)}),t}function A(e){let t=e.split("/");if(0===t.length)return[];let[s,...a]=t,n=s.endsWith("?"),l=s.replace(/\?$/,"");if(0===a.length)return n?[l,""]:[l];let r=A(a.join("/")),i=[];return i.push(...r.map(e=>""===e?l:[l,e].join("/"))),n&&i.push(...r),i.map(t=>e.startsWith("/")&&""===t?"/":t)}var F=/^:[\w-]+$/,T=3,z=2,M=1,P=10,B=-2,R=e=>"*"===e;function L(e,t){let s=e.split("/"),a=s.length;return s.some(R)&&(a+=B),t&&(a+=z),s.filter(e=>!R(e)).reduce((e,t)=>e+(F.test(t)?T:""===t?M:P),a)}function I(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{routesMeta:a}=e,n={},l="/",r=[];for(let i=0;i<a.length;++i){let e=a[i],o=i===a.length-1,c="/"===l?t:t.slice(l.length)||"/",d=O({path:e.relativePath,caseSensitive:e.caseSensitive,end:o},c),u=e.route;if(!d&&o&&s&&!a[a.length-1].route.index&&(d=O({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!d)return null;
2Object.assign(n,d.params),r.push({params:n,pathname:Q([l,d.pathname]),pathnameBase:X(Q([l,d.pathnameBase])),route:u}),"/"!==d.pathnameBase&&(l=Q([l,d.pathnameBase]))}return r}function O(e,t){"string"===typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[s,a]=U(e.path,e.caseSensitive,e.end),n=t.match(s);if(!n)return null;let l=n[0],r=l.replace(/(.)\/+$/,"$1"),i=n.slice(1),o=a.reduce((e,t,s)=>{let{paramName:a,isOptional:n}=t;if("*"===a){let e=i[s]||"";r=l.slice(0,l.length-e.length).replace(/(.)\/+$/,"$1")}const o=i[s];return e[a]=n&&!o?void 0:(o||"").replace(/%2F/g,"/"),e},{});return{params:o,pathname:l,pathnameBase:r,pattern:e}}function U(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];j("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'.concat(e,'" will be treated as if it were "').concat(e.replace(/\*$/,"/*"),'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "').concat(e.replace(/\*$/,"/*"),'".'));let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,s)=>(a.push({paramName:t,isOptional:null!=s}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?n+="\\/*$":""!==e&&"/"!==e&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function H(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return j(!1,'The URL path "'.concat(e,'" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (').concat(t,").")),e}}function W(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,a=e.charAt(s);return a&&"/"!==a?null:e.slice(s)||"/"}var V=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,q=e=>V.test(e);function $(e,t){let s=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?s.length>1&&s.pop():"."!==e&&s.push(e)}),s.length>1?s.join("/"):"/"}function G(e,t,s,a){return"Cannot include a '".concat(e,"' character in a manually specified `to.").concat(t,"` field [").concat(JSON.stringify(a),"]. Please separate it out to the `to.").concat(s,'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.')}function K(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function Y(e){let t=K(e);return t.map((e,s)=>s===t.length-1?e.pathname:e.pathnameBase)}function J(e,t,s){let a,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"string"===typeof e?a=C(e):(a=d({},e),b(!a.pathname||!a.pathname.includes("?"),G("?","pathname","search",a)),b(!a.pathname||!a.pathname.includes("#"),G("#","pathname","hash",a)),b(!a.search||!a.search.includes("#"),G("#","search","hash",a)));let l,r=""===e||""===a.pathname,i=r?"/":a.pathname;if(null==i)l=s;else{let e=t.length-1;if(!n&&i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}l=e>=0?t[e]:"/"}let o=function(e){let t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",{pathname:a,search:n="",hash:l=""}="string"===typeof e?C(e):e;if(a)if(q(a))t=a;else{if(a.includes("//")){let e=a;a=a.replace(/\/\/+/g,"/"),j(!1,"Pathnames cannot have embedded double slashes - normalizing ".concat(e," -> ").concat(a))}t=a.startsWith("/")?$(a.substring(1),"/"):$(a,s)}else t=s;return{pathname:t,search:Z(n),hash:ee(l)}}(a,l),c=i&&"/"!==i&&i.endsWith("/"),u=(r||"."===i)&&s.endsWith("/");return o.pathname.endsWith("/")||!c&&!u||(o.pathname+="/"),o}var Q=e=>e.join("/").replace(/\/\/+/g,"/"),X=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Z=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",ee=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";function te(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}function se(e){return e.map(e=>
2e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Symbol("Uninstrumented");Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ae=["POST","PUT","PATCH","DELETE"],ne=(new Set(ae),["GET",...ae]);new Set(ne),Symbol("ResetLoaderData");var le=t.createContext(null);le.displayName="DataRouter";var re=t.createContext(null);re.displayName="DataRouterState";var ie=t.createContext(!1);var oe=t.createContext({isTransitioning:!1});oe.displayName="ViewTransition";var ce=t.createContext(new Map);ce.displayName="Fetchers";var de=t.createContext(null);de.displayName="Await";var ue=t.createContext(null);ue.displayName="Navigation";var me=t.createContext(null);me.displayName="Location";var he=t.createContext({outlet:null,matches:[],isDataRoute:!1});he.displayName="Route";var xe=t.createContext(null);xe.displayName="RouteError";function pe(){return null!=t.useContext(me)}function ge(){return b(pe(),"useLocation() may be used only in the context of a <Router> component."),t.useContext(me).location}var fe="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ve(e){t.useContext(ue).static||t.useLayoutEffect(e)}function be(){let{isDataRoute:e}=t.useContext(he);return e?function(){let{router:e}=Ee("useNavigate"),s=Fe("useNavigate"),a=t.useRef(!1);ve(()=>{a.current=!0});let n=t.useCallback(async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};j(a.current,fe),a.current&&("number"===typeof t?await e.navigate(t):await e.navigate(t,d({fromRouteId:s},n)))},[e,s]);return n}():function(){b(pe(),"useNavigate() may be used only in the context of a <Router> component.");let e=t.useContext(le),{basename:s,navigator:a}=t.useContext(ue),{matches:n}=t.useContext(he),{pathname:l}=ge(),r=JSON.stringify(Y(n)),i=t.useRef(!1);ve(()=>{i.current=!0});let o=t.useCallback(function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(j(i.current,fe),!i.current)return;if("number"===typeof t)return void a.go(t);let o=J(t,JSON.parse(r),l,"path"===n.relative);null==e&&"/"!==s&&(o.pathname="/"===o.pathname?s:Q([s,o.pathname])),(n.replace?a.replace:a.push)(o,n.state,n)},[s,a,r,l,e]);return o}()}t.createContext(null);function je(){let{matches:e}=t.useContext(he),s=e[e.length-1];return s?s.params:{}}function ye(e){let{relative:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{matches:a}=t.useContext(he),{pathname:n}=ge(),l=JSON.stringify(Y(a));return t.useMemo(()=>J(e,JSON.parse(l),n,"path"===s),[e,l,n,s])}function Ne(e,s,a,n,l){b(pe(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=t.useContext(ue),{matches:i}=t.useContext(he),o=i[i.length-1],c=o?o.params:{},u=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let e=h&&h.path||"";Me(u,!h||e.endsWith("*")||e.endsWith("*?"),'You rendered descendant <Routes> (or called `useRoutes()`) at "'.concat(u,'" (under <Route path="').concat(e,'">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won\'t match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="').concat(e,'"> to <Route path="').concat("/"===e?"*":"".concat(e,"/*"),'">.'))}let x,p=ge();if(s){var g;let e="string"===typeof s?C(s):s;b("/"===m||(null===(g=e.pathname)||void 0===g?void 0:g.startsWith(m)),'When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "'.concat(m,'" but pathname "').concat(e.pathname,'" was given in the `location` prop.')),x=e}else x=p;let f=x.pathname||"/",v=f;if("/"!==m){let e=m.replace(/^\//,"").split("/");v="/"+f.replace(/^\//,"").split("/").slice(e.length).join("/")}let y=_(e,{pathname:v});j(h||null!=y,'No routes matched location "'.concat(x.pathname).concat(x.search).concat(x.hash,'" ')),j(null==y||void 0!==y[y.length-1].route.element||void 0!==y[y.length-1].route.Component||void 0!==y[y.length-1].route.lazy,'Matched leaf route at location "'.concat(x.pathname).concat(x.search).concat(x.hash,'" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.'));let N=_e(y&&y.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:Q([m,r.encodeLocation?r.encodeLocation(e.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?m:Q([m,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])})),i,a,n,l);return s&&N?t.createElement(me.Provider,{value:{location:d({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:"POP"}},N):N}function we(){let e=Te(),s=te(e)?"".concat(e.status," ").concat(e.statusText):e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:n},r={padding:"2px 4px",backgroundColor:n},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=t.createElement(t.Fragment,null,t.createElement("p",null,"\ud83d\udcbf Hey developer \ud83d\udc4b"),t.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",t.createElement("code",{style:r},"ErrorBoundary")," or"," ",t.createElement("code",{style:r},"errorElement")," prop on your route.")),t.createElement(t.Fragment,null,t.createElement("h2",null,"Unexpected Application
2Error!"),t.createElement("h3",{style:{fontStyle:"italic"}},s),a?t.createElement("pre",{style:l},a):null,i)}var Ce=t.createElement(we,null),ke=class extends t.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,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return void 0!==this.state.error?t.createElement(he.Provider,{value:this.props.routeContext},t.createElement(xe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function De(e){let{routeContext:s,match:a,children:n}=e,l=t.useContext(le);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),t.createElement(he.Provider,{value:s},n)}function _e(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(null==e){if(!a)return null;if(a.errors)e=a.matches;else{if(0!==s.length||a.initialized||!(a.matches.length>0))return null;e=a.matches}}let l=e,r=null===a||void 0===a?void 0:a.errors;if(null!=r){let e=l.findIndex(e=>e.route.id&&void 0!==(null===r||void 0===r?void 0:r[e.route.id]));b(e>=0,"Could not find a matching route for errors on route IDs: ".concat(Object.keys(r).join(","))),l=l.slice(0,Math.min(l.length,e+1))}let i=!1,o=-1;if(a)for(let t=0;t<l.length;t++){let e=l[t];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(o=t),e.route.id){let{loaderData:t,errors:s}=a,n=e.route.loader&&!t.hasOwnProperty(e.route.id)&&(!s||void 0===s[e.route.id]);if(e.route.lazy||n){i=!0,l=o>=0?l.slice(0,o+1):[l[0]];break}}}let c=a&&n?(e,t)=>{var s,l;n(e,{location:a.location,params:null!==(s=null===(l=a.matches)||void 0===l||null===(l=l[0])||void 0===l?void 0:l.params)&&void 0!==s?s:{},unstable_pattern:se(a.matches),errorInfo:t})}:void 0;return l.reduceRight((e,n,d)=>{let u,m=!1,h=null,x=null;a&&(u=r&&n.route.id?r[n.route.id]:void 0,h=n.route.errorElement||Ce,i&&(o<0&&0===d?(Me("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,x=null):o===d&&(m=!0,x=n.route.hydrateFallbackElement||null)));let p=s.concat(l.slice(0,d+1)),g=()=>{let s;return s=u?h:m?x:n.route.Component?t.createElement(n.route.Component,null):n.route.element?n.route.element:e,t.createElement(De,{match:n,routeContext:{outlet:e,matches:p,isDataRoute:null!=a},children:s})};return a&&(n.route.ErrorBoundary||n.route.errorElement||0===d)?t.createElement(ke,{location:a.location,revalidation:a.revalidation,component:h,error:u,children:g(),routeContext:{outlet:null,matches:p,isDataRoute:!0},onError:c}):g()},null)}function Se(e){return"".concat(e," must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.")}function Ee(e){let s=t.useContext(le);return b(s,Se(e)),s}function Ae(e){let s=t.useContext(re);return b(s,Se(e)),s}function Fe(e){let s=function(e){let s=t.useContext(he);return b(s,Se(e)),s}(e),a=s.matches[s.matches.length-1];return b(a.route.id,"".concat(e,' can only be used on routes that contain a unique "id"')),a.route.id}function Te(){var e;let s=t.useContext(xe),a=Ae("useRouteError"),n=Fe("useRouteError");return void 0!==s?s:null===(e=a.errors)||void 0===e?void 0:e[n]}var ze={};function Me(e,t,s){t||ze[e]||(ze[e]=!0,j(!1,s))}var Pe={};function Be(e,t){e||Pe[t]||(Pe[t]=!0,console.warn(t))}a.useOptimistic;t.memo(function(e){let{routes:t,future:s,state:a,unstable_onError:n}=e;return Ne(t,void 0,a,n,s)});function Re(e){let{to:s,replace:a,state:n,relative:l}=e;b(pe(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=t.useContext(ue);j(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=t.useContext(he),{pathname:o}=ge(),c=be(),d=J(s,Y(i),o,"path"===l),u=JSON.stringify(d);return t.useEffect(()=>{c(JSON.parse(u),{replace:a,state:n,relative:l})},[c,u,l,a,n]),null}function Le(e){b(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Ie(e){let{basename:s="/",children:a=null,location:n,navigationType:l="POP",navigator:r,static:i=!1,unstable_useTransitions:o}=e;b(!pe(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=s.replace(/^\/*/,"/"),d=t.useMemo(()=>({basename:c,navigator:r,static:i,unstable_useTransitions:o,future:{}}),[c,r,i,o]);"string"===typeof n&&(n=C(n));
2let{pathname:u="/",search:m="",hash:h="",state:x=null,key:p="default"}=n,g=t.useMemo(()=>{let e=W(u,c);return null==e?null:{location:{pathname:e,search:m,hash:h,state:x,key:p},navigationType:l}},[c,u,m,h,x,p,l]);return j(null!=g,'<Router basename="'.concat(c,'"> is not able to match the URL "').concat(u).concat(m).concat(h,"\" because it does not start with the basename, so the <Router> won't render anything.")),null==g?null:t.createElement(ue.Provider,{value:d},t.createElement(me.Provider,{children:a,value:g}))}function Oe(e){let{children:t,location:s}=e;return Ne(Ue(t),s)}t.Component;function Ue(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=[];return t.Children.forEach(e,(e,n)=>{if(!t.isValidElement(e))return;let l=[...s,n];if(e.type===t.Fragment)return void a.push.apply(a,Ue(e.props.children,l));b(e.type===Le,"[".concat("string"===typeof e.type?e.type:e.type.name,"] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>")),b(!e.props.index||!e.props.children,"An index route cannot have child routes.");let r={id:e.props.id||l.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:!0===e.props.hasErrorBoundary||null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(r.children=Ue(e.props.children,l)),a.push(r)}),a}var He="get",We="application/x-www-form-urlencoded";function Ve(e){return"undefined"!==typeof HTMLElement&&e instanceof HTMLElement}function qe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return new URLSearchParams("string"===typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,s)=>{let a=e[s];return t.concat(Array.isArray(a)?a.map(e=>[s,e]):[[s,a]])},[]))}var $e=null;var Ge=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ke(e){return null==e||Ge.has(e)?e:(j(!1,'"'.concat(e,'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` and will default to "').concat(We,'"')),null)}function Ye(e,t){let s,a,n,l,r;if(Ve(i=e)&&"form"===i.tagName.toLowerCase()){let r=e.getAttribute("action");a=r?W(r,t):null,s=e.getAttribute("method")||He,n=Ke(e.getAttribute("enctype"))||We,l=new FormData(e)}else if(function(e){return Ve(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return Ve(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let r=e.form;if(null==r)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let i=e.getAttribute("formaction")||r.getAttribute("action");if(a=i?W(i,t):null,s=e.getAttribute("formmethod")||r.getAttribute("method")||He,n=Ke(e.getAttribute("formenctype"))||Ke(r.getAttribute("enctype"))||We,l=new FormData(r,e),!function(){if(null===$e)try{new FormData(document.createElement("form"),0),$e=!1}catch(e){$e=!0}return $e}()){let{name:t,type:s,value:a}=e;if("image"===s){let e=t?"".concat(t,"."):"";l.append("".concat(e,"x"),"0"),l.append("".concat(e,"y"),"0")}else t&&l.append(t,a)}}else{if(Ve(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=He,a=null,n=We,r=e}var i;return l&&"text/plain"===n&&(r=l,l=void 0),{action:a,method:s.toLowerCase(),encType:n,formData:l,body:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");"undefined"!==typeof window?window:"undefined"!==typeof globalThis&&globalThis;function Je(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}Symbol("SingleFetchRedirect");function Qe(e,t,s){let a="string"===typeof e?new URL(e,"undefined"===typeof window?"server://singlefetch/":window.location.origin):e;return"/"===a.pathname?a.pathname="_root.".concat(s):t&&"/"===W(a.pathname,t)?a.pathname="".concat(t.replace(/\/$/,""),"/_root.").concat(s):a.pathname="".concat(a.pathname.replace(/\/$/,""),".").concat(s),a}async function Xe(e,t){if(e.id in t)return t[e.id];try{let s=await import(e.module);return t[e.id]=s,s}catch(s){return console.error("Error loading route module `".concat(e.module,"`, reloading page...")),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.
2isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ze(e){return null!=e&&"string"===typeof e.page}function et(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"===typeof e.imageSrcSet&&"string"===typeof e.imageSizes:"string"===typeof e.rel&&"string"===typeof e.href)}function tt(e,t,s,a,n,l){let r=(e,t)=>!s[t]||e.route.id!==s[t].route.id,i=(e,t)=>{var a;return s[t].pathname!==e.pathname||(null===(a=s[t].route.path)||void 0===a?void 0:a.endsWith("*"))&&s[t].params["*"]!==e.params["*"]};return"assets"===l?t.filter((e,t)=>r(e,t)||i(e,t)):"data"===l?t.filter((t,l)=>{let o=a.routes[t.route.id];if(!o||!o.hasLoader)return!1;if(r(t,l)||i(t,l))return!0;if(t.route.shouldRevalidate){var c;let a=t.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:(null===(c=s[0])||void 0===c?void 0:c.params)||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"===typeof a)return a}return!0}):[]}function st(e,t){let{includeHydrateFallback:s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a=e.map(e=>{let a=t.routes[e.route.id];if(!a)return[];let n=[a.module];return a.clientActionModule&&(n=n.concat(a.clientActionModule)),a.clientLoaderModule&&(n=n.concat(a.clientLoaderModule)),s&&a.hydrateFallbackModule&&(n=n.concat(a.hydrateFallbackModule)),a.imports&&(n=n.concat(a.imports)),n}
2).flat(1),[...new Set(a)];var a}function at(e,t){let s=new Set,a=new Set(t);return e.reduce((e,n)=>{if(t&&!Ze(n)&&"script"===n.as&&n.href&&a.has(n.href))return e;let l=JSON.stringify(function(e){let t={},s=Object.keys(e).sort();for(let a of s)t[a]=e[a];return t}(n));return s.has(l)||(s.add(l),e.push({key:l,link:n})),e},[])}function nt(e,t){return"lazy"===e.mode&&!0===t}function lt(){let e=t.useContext(le);return Je(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function rt(){let e=t.useContext(re);return Je(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var it=t.createContext(void 0);function ot(){let e=t.useContext(it);return Je(e,"You must render this element inside a <HydratedRouter> element"),e}function ct(e,t){return s=>{e&&e(s),s.defaultPrevented||t(s)}}function dt(e,t,s){if(s&&!xt)return[e[0]];if(t){let s=e.findIndex(e=>void 0!==t[e.route.id]);return e.slice(0,s+1)}return e}it.displayName="FrameworkContext";function ut(e){let{page:s}=e,a=l(e,m),{router:n}=lt(),r=t.useMemo(()=>_(n.routes,s,n.basename),[n.routes,s,n.basename]);return r?t.createElement(ht,d({page:s,matches:r},a)):null}function mt(e){let{manifest:s,routeModules:a}=ot(),[n,l]=t.useState([]);return t.useEffect(()=>{let t=!1;return async function(e,t,s){return at((await Promise.all(e.map(async e=>{let a=t.routes[e.route.id];if(a){let e=await Xe(a,s);return e.links?e.links():[]}return[]}))).flat(1).filter(et).filter(e=>"stylesheet"===e.rel||"preload"===e.rel).map(e=>"stylesheet"===e.rel?d(d({},e),{},{rel:"prefetch",as:"style"}):d(d({},e),{},{rel:"prefetch"})))}(e,s,a).then(e=>{t||l(e)}),()=>{t=!0}},[e,s,a]),n}function ht(e){let{page:s,matches:a}=e,n=l(e,h),r=ge(),{manifest:i,routeModules:o}=ot(),{basename:c}=lt(),{loaderData:u,matches:m}=rt(),x=t.useMemo(()=>tt(s,a,m,i,r,"data"),[s,a,m,i,r]),p=t.useMemo(()=>tt(s,a,m,i,r,"assets"),[s,a,m,i,r]),g=t.useMemo(()=>{if(s===r.pathname+r.search+r.hash)return[];let e=new Set,t=!1;if(a.forEach(s=>{var a;let n=i.routes[s.route.id];n&&n.hasLoader&&(!x.some(e=>e.route.id===s.route.id)&&s.route.id in u&&null!==(a=o[s.route.id])&&void 0!==a&&a.shouldRevalidate||n.hasClientLoader?t=!0:e.add(s.route.id))}),0===e.size)return[];let n=Qe(s,c,"data");return t&&e.size>0&&n.searchParams.set("_routes",a.filter(t=>e.has(t.route.id)).map(e=>e.route.id).join(",")),[n.pathname+n.search]},[c,u,r,i,x,a,s,o]),f=t.useMemo(()=>st(p,i),[p,i]),v=mt(p);return t.createElement(t.Fragment,null,g.map(e=>t.createElement("link",d({key:e,rel:"prefetch",as:"fetch",href:e},n))),f.map(e=>t.createElement("link",d({key:e,rel:"modulepreload",href:e},n))),v.map(e=>{let{key:s,link:a}=e;return t.createElement("link",d({key:s,nonce:n.nonce},a))}))}var xt=!1;function pt(e){let{manifest:s,serverHandoffString:a,isSpaMode:n,renderMeta:r,routeDiscovery:i,ssr:o}=ot(),{router:c,static:m,staticContext:h}=lt(),{matches:x}=rt(),p=t.useContext(ie),g=nt(i,o);r&&(r.didRenderScripts=!0);let f=dt(x,null,n);t.useEffect(()=>{0},[]);let v=t.useMemo(()=>{var n;if(p)return null;let r=h?"window.__reactRouterContext = ".concat(a,";").concat("window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());"):" ",i=m?"".concat(null!==s.hmr&&void 0!==n&&n.runtime?"import ".concat(JSON.stringify(s.hmr.runtime),";"):"").concat(g?"":"import ".concat(JSON.stringify(s.url)),";\n").concat(f.map((e,t)=>{let a="route".concat(t),n=s.routes[e.route.id];Je(n,"Route ".concat(e.route.id," not found in manifest"));let{clientActionModule:l,clientLoaderModule:r,clientMiddlewareModule:i,hydrateFallbackModule:o,module:c}=n,d=[...l?[{module:l,varName:"".concat(a,"_clientAction")}]:[],...r?[{module:r,varName:"".concat(a,"_clientLoader")}]:[],...i?[{module:i,varName:"".concat(a,"_clientMiddleware")}]:[],...o?[{module:o,varName:"".concat(a,"_HydrateFallback")}]:[],{module:c,varName:"".concat(a,"_main")}];return 1===d.length?"import * as ".concat(a," from ").concat(JSON.stringify(c),";"):[d.map(e=>"import * as ".concat(e.varName,' from "').concat(e.module,'";
2')).join("\n"),"const ".concat(a," = {").concat(d.map(e=>"...".concat(e.varName)).join(","),"};")].join("\n")}).join("\n"),"\n ").concat(g?"window.__reactRouterManifest = ".concat(JSON.stringify(function(e,t){let{sri:s}=e,a=l(e,u),n=new Set(t.state.matches.map(e=>e.route.id)),r=t.state.location.pathname.split("/").filter(Boolean),i=["/"];for(r.pop();r.length>0;)i.push("/".concat(r.join("/"))),r.pop();i.forEach(e=>{let s=_(t.routes,e,t.basename);s&&s.forEach(e=>n.add(e.route.id))});let o=[...n].reduce((e,t)=>Object.assign(e,{[t]:a.routes[t]}),{});return d(d({},a),{},{routes:o,sri:!!s||void 0})}(s,c),null,2),";"):"","\n window.__reactRouterRouteModules = {").concat(f.map((e,t)=>"".concat(JSON.stringify(e.route.id),":route").concat(t)).join(","),"};\n\nimport(").concat(JSON.stringify(s.entry.module),");"):" ";return t.createElement(t.Fragment,null,t.createElement("script",d(d({},e),{},{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:r},type:void 0})),t.createElement("script",d(d({},e),{},{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:i},type:"module",async:!0})))},[]),b=xt||p?[]:(s.entry.imports.concat(st(f,s,{includeHydrateFallback:!0})),[...new Set(j)]);var j;let y="object"===typeof s.sri?s.sri:{};return Be(!p,"The <Scripts /> element is a no-op when using RSC and can be safely removed."),xt||p?null:t.createElement(t.Fragment,null,"object"===typeof s.sri?t.createElement("script",{"rr-importmap":"",type:"importmap",suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:JSON.stringify({integrity:y})}}):null,g?null:t.createElement("link",{rel:"modulepreload",href:s.url,crossOrigin:e.crossOrigin,integrity:y[s.url],suppressHydrationWarning:!0}),t.createElement("link",{rel:"modulepreload",href:s.entry.module,crossOrigin:e.crossOrigin,integrity:y[s.entry.module],suppressHydrationWarning:!0}),b.map(s=>t.createElement("link",{key:s,rel:"modulepreload",href:s,crossOrigin:e.crossOrigin,integrity:y[s],suppressHydrationWarning:!0})),v)}function gt(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return e=>{t.forEach(t=>{"function"===typeof t?t(e):null!=t&&(t.current=e)})}}t.Component;function ft(e){let{error:s,isOutsideRemixApp:a}=e;console.error(s);let n,l=t.createElement("script",{dangerouslySetInnerHTML:{__html:'\n console.log(\n "\ud83d\udcbf Hey developer \ud83d\udc4b. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."\n );\n '}});if(te(s))return t.createElement(vt,{title:"Unhandled Thrown Response!"},t.createElement("h1",{style:{fontSize:"24px"}},s.status," ",s.statusText),l);if(s instanceof Error)0;else{let e=null==s?"Unknown Error":"object"===typeof s&&"toString"in s?s.toString():JSON.stringify(s);new Error(e)}return t.createElement(vt,{title:"Application Error!",isOutsideRemixApp:a},t.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),t.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},n.stack),l)}function vt(e){var s;let{title:a,renderScripts:n,isOutsideRemixApp:l,children:r}=e,{routeModules:i}=ot();return null!==i.root&&void 0!==s&&s.Layout&&!l?r:t.createElement("html",{lang:"en"},t.createElement("head",null,t.createElement("meta",{charSet:"utf-8"}),t.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),t.createElement("title",null,a)),t.createElement("body",null,t.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},r,n?t.createElement(pt,null):null)))}var bt="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;try{bt&&(window.__reactRouterVersion="7.10.1")}catch(G2){}function jt(e){let{basename:s,children:a,unstable_useTransitions:n,window:l}=e,r=t.useRef();null==r.current&&(r.current=v({window:l,v5Compat:!0}));let i=r.current,[o,c]=t.useState({action:i.action,location:i.location}),d=t.useCallback(e=>{!1===n?c(e):t.startTransition(()=>c(e))},[n]);return t.useLayoutEffect(()=>
2i.listen(d),[i,d]),t.createElement(Ie,{basename:s,children:a,location:o.location,navigationType:o.action,navigator:i,unstable_useTransitions:!0===n})}var yt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Nt=t.forwardRef(function(e,s){let a,{onClick:n,discover:r="render",prefetch:i="none",relative:o,reloadDocument:c,replace:u,state:m,target:h,to:p,preventScrollReset:g,viewTransition:f}=e,v=l(e,x),{basename:y,unstable_useTransitions:N}=t.useContext(ue),C="string"===typeof p&&yt.test(p),k=!1;if("string"===typeof p&&C&&(a=p,bt))try{let e=new URL(window.location.href),t=p.startsWith("//")?new URL(e.protocol+p):new URL(p),s=W(t.pathname,y);t.origin===e.origin&&null!=s?p=s+t.search+t.hash:k=!0}catch(G2){j(!1,'<Link to="'.concat(p,'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.'))}let D=function(e){let{relative:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};b(pe(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:n}=t.useContext(ue),{hash:l,pathname:r,search:i}=ye(e,{relative:s}),o=r;return"/"!==a&&(o="/"===r?a:Q([a,r])),n.createHref({pathname:o,search:i,hash:l})}(p,{relative:o}),[_,S,E]=function(e,s){let a=t.useContext(it),[n,l]=t.useState(!1),[r,i]=t.useState(!1),{onFocus:o,onBlur:c,onMouseEnter:d,onMouseLeave:u,onTouchStart:m}=s,h=t.useRef(null);t.useEffect(()=>{if("render"===e&&i(!0),"viewport"===e){let e=new IntersectionObserver(e=>{e.forEach(e=>{i(e.isIntersecting)})},{threshold:.5});return h.current&&e.observe(h.current),()=>{e.disconnect()}}},[e]),t.useEffect(()=>{if(n){let e=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(e)}}},[n]);let x=()=>{l(!0)},p=()=>{l(!1),i(!1)};return a?"intent"!==e?[r,h,{}]:[r,h,{onFocus:ct(o,x),onBlur:ct(c,p),onMouseEnter:ct(d,x),onMouseLeave:ct(u,p),onTouchStart:ct(m,x)}]:[!1,h,{}]}(i,v),A=function(e){let{target:s,replace:a,state:n,preventScrollReset:l,relative:r,viewTransition:i,unstable_useTransitions:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=be(),d=ge(),u=ye(e,{relative:r});return t.useCallback(m=>{if(function(e,t){return 0===e.button&&(!t||"_self"===t)&&!function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)}(m,s)){m.preventDefault();let s=void 0!==a?a:w(d)===w(u),h=()=>c(e,{replace:s,state:n,preventScrollReset:l,relative:r,viewTransition:i});o?t.startTransition(()=>h()):h()}},[d,c,u,a,n,s,e,l,r,i,o])}(p,{replace:u,state:m,target:h,preventScrollReset:g,relative:o,viewTransition:f,unstable_useTransitions:N});let F=t.createElement("a",d(d(d({},v),E),{},{href:a||D,onClick:k||c?n:function(e){n&&n(e),e.defaultPrevented||A(e)},ref:gt(s,S),target:h,"data-discover":C||"render"!==r?void 0:"true"}));return _&&!C?t.createElement(t.Fragment,null,F,t.createElement(ut,{page:D})):F});Nt.displayName="Link";var wt=t.forwardRef(function(e,s){let{"aria-current":a="page",caseSensitive:n=!1,className:r="",end:i=!1,style:o,to:c,viewTransition:u,children:m}=e,h=l(e,p),x=ye(c,{relative:h.relative}),g=ge(),f=t.useContext(re),{navigator:v,basename:j}=t.useContext(ue),y=null!=f&&function(e){let{relative:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.useContext(oe);b(null!=a,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Dt("useViewTransitionState"),l=ye(e,{relative:s});if(!a.isTransitioning)return!1;let r=W(a.currentLocation.pathname,n)||a.currentLocation.pathname,i=W(a.nextLocation.pathname,n)||a.nextLocation.pathname;return null!=O(l.pathname,i)||null!=O(l.pathname,r)}(x)&&!0===u,N=v.encodeLocation?v.encodeLocation(x).pathname:x.pathname,w=g.pathname,C=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;n||(w=w.toLowerCase(),C=C?C.toLowerCase():null,N=N.toLowerCase()),C&&j&&(C=W(C,j)||C);const k="/"!==N&&N.endsWith("/")?N.length-1:N.length;let D,_=w===N||!i&&w.startsWith(N)&&"/"===w.charAt(k),S=null!=C&&(C===N||!i&&C.startsWith(N)&&"/"===C.charAt(N.length)),E={isActive:_,isPending:S,isTransitioning:y},A=_?a:void 0;D="function"===typeof r?r(E):[r,_?"active":null,S?"pending":null,y?"transitioning":null].filter(
2Boolean).join(" ");let F="function"===typeof o?o(E):o;return t.createElement(Nt,d(d({},h),{},{"aria-current":A,className:D,ref:s,style:F,to:c,viewTransition:u}),"function"===typeof m?m(E):m)});wt.displayName="NavLink";var Ct=t.forwardRef((e,s)=>{let{discover:a="render",fetcherKey:n,navigate:r,reloadDocument:i,replace:o,state:c,method:u=He,action:m,onSubmit:h,relative:x,preventScrollReset:p,viewTransition:f}=e,v=l(e,g),{unstable_useTransitions:j}=t.useContext(ue),y=At(),N=function(e){let{relative:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{basename:a}=t.useContext(ue),n=t.useContext(he);b(n,"useFormAction must be used inside a RouteContext");let[l]=n.matches.slice(-1),r=d({},ye(e||".",{relative:s})),i=ge();if(null==e){r.search=i.search;let e=new URLSearchParams(r.search),t=e.getAll("index");if(t.some(e=>""===e)){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let s=e.toString();r.search=s?"?".concat(s):""}}e&&"."!==e||!l.route.index||(r.search=r.search?r.search.replace(/^\?/,"?index&"):"?index");"/"!==a&&(r.pathname="/"===r.pathname?a:Q([a,r.pathname]));return w(r)}(m,{relative:x}),C="get"===u.toLowerCase()?"get":"post",k="string"===typeof m&&yt.test(m);return t.createElement("form",d(d({ref:s,method:C,action:N,onSubmit:i?h:e=>{if(h&&h(e),e.defaultPrevented)return;e.preventDefault();let s=e.nativeEvent.submitter,a=(null===s||void 0===s?void 0:s.getAttribute("formmethod"))||u,l=()=>y(s||e.currentTarget,{fetcherKey:n,method:a,navigate:r,replace:o,state:c,relative:x,preventScrollReset:p,viewTransition:f});j&&!1!==r?t.startTransition(()=>l()):l()}},v),{},{"data-discover":k||"render"!==a?void 0:"true"}))});function kt(e){return"".concat(e," must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.")}function Dt(e){let s=t.useContext(le);return b(s,kt(e)),s}function _t(e){j("undefined"!==typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=t.useRef(qe(e)),a=t.useRef(!1),n=ge(),l=t.useMemo(()=>function(e,t){let s=qe(e);return t&&t.forEach((e,a)=>{s.has(a)||t.getAll(a).forEach(e=>{s.append(a,e)})}),s}(n.search,a.current?null:s.current),[n.search]),r=be(),i=t.useCallback((e,t)=>{const s=qe("function"===typeof e?e(new URLSearchParams(l)):e);a.current=!0,r("?"+s,t)},[r,l]);return[l,i]}Ct.displayName="Form";var St=0,Et=()=>"__".concat(String(++St),"__");function At(){let{router:e}=Dt("useSubmit"),{basename:s}=t.useContext(ue),a=Fe("useRouteId"),n=e.fetch,l=e.navigate;return t.useCallback(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{action:r,method:i,encType:o,formData:c,body:d}=Ye(e,s);if(!1===t.navigate){let e=t.fetcherKey||Et();await n(e,a,t.action||r,{preventScrollReset:t.preventScrollReset,formData:c,body:d,formMethod:t.method||i,formEncType:t.encType||o,flushSync:t.flushSync})}else await l(t.action||r,{preventScrollReset:t.preventScrollReset,formData:c,body:d,formMethod:t.method||i,formEncType:t.encType||o,replace:t.replace,state:t.state,fromRouteId:a,flushSync:t.flushSync,viewTransition:t.viewTransition})},[n,l,s,a])}var Ft=s(366),Tt=s.n(Ft),zt=s(740),Mt=s.n(zt),Pt=s(324),Bt=s.n(Pt);const Rt=["children"],Lt=["children"];var It,Ot,Ut=(e=>(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(Ut||{}),Ht={rel:["amphtml","canonical","alternate"]},Wt={type:["application/ld+json"]},Vt={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"]},qt=Object.values(Ut),$t={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Gt=Object.entries($t).reduce((e,t)=>
2{let[s,a]=t;return e[a]=s,e},{}),Kt="data-rh",Yt="defaultTitle",Jt="defer",Qt="encodeSpecialCharacters",Xt="onChangeClientState",Zt="titleTemplate",es="prioritizeSeoTags",ts=(e,t)=>{for(let s=e.length-1;s>=0;s-=1){const a=e[s];if(Object.prototype.hasOwnProperty.call(a,t))return a[t]}return null},ss=e=>{let t=ts(e,"title");const s=ts(e,Zt);if(Array.isArray(t)&&(t=t.join("")),s&&t)return s.replace(/%s/g,()=>t);const a=ts(e,Yt);return t||a||void 0},as=e=>ts(e,Xt)||(()=>{}),ns=(e,t)=>t.filter(t=>"undefined"!==typeof t[e]).map(t=>t[e]).reduce((e,t)=>d(d({},e),t),{}),ls=(e,t)=>t.filter(e=>"undefined"!==typeof e.base).map(e=>e.base).reverse().reduce((t,s)=>{if(!t.length){const a=Object.keys(s);for(let n=0;n<a.length;n+=1){const l=a[n].toLowerCase();if(-1!==e.indexOf(l)&&s[l])return t.concat(s)}}return t},[]),rs=(e,t,s)=>{const a={};return s.filter(t=>{return!!Array.isArray(t[e])||("undefined"!==typeof t[e]&&(s="Helmet: ".concat(e,' should be of type "Array". Instead found type "').concat(typeof t[e],'"'),console&&"function"===typeof console.warn&&console.warn(s)),!1);var s}).map(t=>t[e]).reverse().reduce((e,s)=>{const n={};s.filter(e=>{let s;const l=Object.keys(e);for(let a=0;a<l.length;a+=1){const n=l[a],r=n.toLowerCase();-1===t.indexOf(r)||"rel"===s&&"canonical"===e[s].toLowerCase()||"rel"===r&&"stylesheet"===e[r].toLowerCase()||(s=r),-1===t.indexOf(n)||"innerHTML"!==n&&"cssText"!==n&&"itemprop"!==n||(s=n)}if(!s||!e[s])return!1;const r=e[s].toLowerCase();return a[s]||(a[s]={}),n[s]||(n[s]={}),!a[s][r]&&(n[s][r]=!0,!0)}).reverse().forEach(t=>e.push(t));const l=Object.keys(n);for(let t=0;t<l.length;t+=1){const e=l[t],s=d(d({},a[e]),n[e]);a[e]=s}return e},[]).reverse()},is=(e,t)=>{if(Array.isArray(e)&&e.length)for(let s=0;s<e.length;s+=1){if(e[s][t])return!0}return!1},cs=e=>Array.isArray(e)?e.join(""):e,ds=(e,t)=>Array.isArray(e)?e.reduce((e,s)=>(((e,t)=>{const s=Object.keys(e);for(let a=0;a<s.length;a+=1)if(t[s[a]]&&t[s[a]].includes(e[s[a]]))return!0;return!1})(s,t)?e.priority.push(s):e.default.push(s),e),{priority:[],default:[]}):{default:e,priority:[]},us=(e,t)=>d(d({},e),{},{[t]:void 0}),ms=["noscript","script","style"],hs=function(e){return!1===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},xs=e=>Object.keys(e).reduce((t,s)=>{const a="undefined"!==typeof e[s]?"".concat(s,'="').concat(e[s],'"'):"".concat(s);return t?"".concat(t," ").concat(a):a},""),ps=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(e).reduce((t,s)=>(t[$t[s]||s]=e[s],t),t)},gs=(e,s)=>s.map((s,a)=>{const n={key:a,[Kt]:!0};return Object.keys(s).forEach(e=>{const t=$t[e]||e;if("innerHTML"===t||"cssText"===t){const e=s.innerHTML||s.cssText;n.dangerouslySetInnerHTML={__html:e}}else n[t]=s[e]}),t.createElement(e,n)}),fs=function(e,s){let a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];switch(e){case"title":return{toComponent:()=>((e,s,a)=>{const n=ps(a,{key:s,[Kt]:!0});return[t.createElement("title",n,s)]})(0,s.title,s.titleAttributes),toString:()=>((e,t,s,a)=>{const n=xs(s),l=cs(t);return n?"<".concat(e," ").concat(Kt,'="true" ').concat(n,">").concat(hs(l,a),"</").concat(e,">"):"<".concat(e," ").concat(Kt,'="true">').concat(hs(l,a),"</").concat(e,">")})(e,s.title,s.titleAttributes,a)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>ps(s),toString:()=>xs(s)};default:return{toComponent:()=>gs(e,s),toString:()=>function(e,t){let s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.reduce((t,a)=>{const n=a,l=Object.keys(n).filter(e=>!("innerHTML"===e||"cssText"===e)).reduce((e,t)=>{const a="undefined"===typeof n[t]?t:"".concat(t,'="').concat(hs(n[t],s),'"');return e?"".concat(e," ").concat(a):a},""),r=n.innerHTML||n.cssText||"",i=-1===ms.indexOf(e);return"".concat(t,"<").concat(e," ").concat(Kt,'="true" ').concat(l).concat(i?"/>":">".concat(r,"</").concat(e,">"))},"")}(e,s,a)}}},vs=e=>{const{baseTag:t,bodyAttributes:s,encode:a=!0,htmlAttributes:n,noscriptTags:l,styleTags:r,title:i="",titleAttributes:o,prioritizeSeoTags:c}=e;let{linkTags:d,metaTags:u,scriptTags:m}=e,h={toComponent:()=>{},toString:()=>""};return c&&({priorityMethods:h,linkTags:d,metaTags:u,scriptTags:m}=(e=>{let{metaTags:t,linkTags:s,scriptTags:a,encode:n}=e;
2const l=ds(t,Vt),r=ds(s,Ht),i=ds(a,Wt);return{priorityMethods:{toComponent:()=>[...gs("meta",l.priority),...gs("link",r.priority),...gs("script",i.priority)],toString:()=>"".concat(fs("meta",l.priority,n)," ").concat(fs("link",r.priority,n)," ").concat(fs("script",i.priority,n))},metaTags:l.default,linkTags:r.default,scriptTags:i.default}})(e)),{priority:h,base:fs("base",t,a),bodyAttributes:fs("bodyAttributes",s,a),htmlAttributes:fs("htmlAttributes",n,a),link:fs("link",d,a),meta:fs("meta",u,a),noscript:fs("noscript",l,a),script:fs("script",m,a),style:fs("style",r,a),title:fs("title",{title:i,titleAttributes:o},a)}},bs=[],js=!("undefined"===typeof window||!window.document||!window.document.createElement),ys=class{constructor(e,t){o(this,"instances",[]),o(this,"canUseDOM",js),o(this,"context",void 0),o(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?bs:this.instances,add:e=>{(this.canUseDOM?bs:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?bs:this.instances).indexOf(e);(this.canUseDOM?bs:this.instances).splice(t,1)}}}),this.context=e,this.canUseDOM=t||!1,t||(e.helmet=vs({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Ns=t.createContext({}),ws=(It=class e extends t.Component{constructor(t){super(t),o(this,"helmetData",void 0),this.helmetData=new ys(this.props.context||{},e.canUseDOM)}render(){return t.createElement(Ns.Provider,{value:this.helmetData.value},this.props.children)}},o(It,"canUseDOM",js),It),Cs=(e,t)=>{const s=document.head||document.querySelector("head"),a=s.querySelectorAll("".concat(e,"[").concat(Kt,"]")),n=[].slice.call(a),l=[];let r;return t&&t.length&&t.forEach(t=>{const s=document.createElement(e);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))if("innerHTML"===e)s.innerHTML=t.innerHTML;else if("cssText"===e)s.styleSheet?s.styleSheet.cssText=t.cssText:s.appendChild(document.createTextNode(t.cssText));else{const a=e,n="undefined"===typeof t[a]?"":t[a];s.setAttribute(e,n)}s.setAttribute(Kt,"true"),n.some((e,t)=>(r=t,s.isEqualNode(e)))?n.splice(r,1):l.push(s)}),n.forEach(e=>{var t;return null===(t=e.parentNode)||void 0===t?void 0:t.removeChild(e)}),l.forEach(e=>s.appendChild(e)),{oldTags:n,newTags:l}},ks=(e,t)=>{const s=document.getElementsByTagName(e)[0];if(!s)return;const a=s.getAttribute(Kt),n=a?a.split(","):[],l=[...n],r=Object.keys(t);for(const i of r){const e=t[i]||"";s.getAttribute(i)!==e&&s.setAttribute(i,e),-1===n.indexOf(i)&&n.push(i);const a=l.indexOf(i);-1!==a&&l.splice(a,1)}for(let i=l.length-1;i>=0;i-=1)s.removeAttribute(l[i]);n.length===l.length?s.removeAttribute(Kt):s.getAttribute(Kt)!==r.join(",")&&s.setAttribute(Kt,r.join(","))},Ds=(e,t)=>{const{baseTag:s,bodyAttributes:a,htmlAttributes:n,linkTags:l,metaTags:r,noscriptTags:i,onChangeClientState:o,scriptTags:c,styleTags:d,title:u,titleAttributes:m}=e;ks("body",a),ks("html",n),((e,t)=>{"undefined"!==typeof e&&document.title!==e&&(document.title=cs(e)),ks("title",t)})(u,m);const h={baseTag:Cs("base",s),linkTags:Cs("link",l),metaTags:Cs("meta",r),noscriptTags:Cs("noscript",i),scriptTags:Cs("script",c),styleTags:Cs("style",d)},x={},p={};Object.keys(h).forEach(e=>{const{newTags:t,oldTags:s}=h[e];t.length&&(x[e]=t),s.length&&(p[e]=h[e].oldTags)}),t&&t(),o(e,x,p)},_s=null,Ss=e=>{_s&&cancelAnimationFrame(_s),e.defer?_s=requestAnimationFrame(()=>{Ds(e,()=>{_s=null})}):(Ds(e),_s=null)},Es=class extends t.Component{constructor(){super(...arguments),o(this,"rendered",!1)}shouldComponentUpdate(e){return!Bt()(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:t}=this.props.context;let s=null;const a=(n=e.get().map(e=>{const t=d({},e.props);return delete t.context,t}),{baseTag:ls(["href"],n),bodyAttributes:ns("bodyAttributes",n),defer:ts(n,Jt),encode:ts(n,Qt),htmlAttributes:ns("htmlAttributes",n),linkTags:rs("link",["rel","href"],n),metaTags:rs("meta",["name","charset","http-equiv","property","itemprop"],n),noscriptTags:rs("noscript",["innerHTML"],n),onChangeClientState:as(n),scriptTags:rs("script",["src","innerHTML"],n),styleTags:rs("style",["cssText"],n),title:ss(n),titleAttributes:ns("titleAttributes",n),prioritizeSeoTags:is(n,es)});var n;ws.canUseDOM?Ss(a):vs&&(s=vs(a)),t(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}},As=(Ot=class extends t.Component{shouldComponentUpdate(e){return!Tt()(us(this.props,"helmetData"),us(e,"helmetData"))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case"script":case"noscript":return{innerHTML:t};case"style":return{cssText:t};default:throw new Error("<".concat(e.type," /> elements are self-closing and can not contain children. Refer to our API for more information."))}}flattenArrayTypeChildren(e,t,s,a){return d(d({},t),{},{[e.type]:[...t[e.type]||[],d(d({},s),this.mapNestedChildrenToProps(e,a))]})}mapObjectTypeChildren(e,t,s,a){switch(e.type){case"title":return d(d({},t),{},{[e.type]:a,titleAttributes:d({},s)});case"body":return d(d({},t),{},{bodyAttributes:d({},s)});case"html":return d(d({},t),{},{htmlAttributes:d({},s)});default:return d(d({},t),{},{[e.type]:d({},s)})}}mapArrayTypeChildrenToProps(e,t){let s=d({},t);return Object.keys(e).forEach(t=>{s=d(d({},s),{},{[t]:e[t]})}),s}
2warnOnInvalidChildren(e,t){return Mt()(qt.some(t=>e.type===t),"function"===typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types ".concat(qt.join(", ")," are allowed. Helmet does not support rendering <").concat(e.type,"> elements. Refer to our API for more information.")),Mt()(!t||"string"===typeof t||Array.isArray(t)&&!t.some(e=>"string"!==typeof e),"Helmet expects a string as a child of <".concat(e.type,">. Did you forget to wrap your children in braces? ( <").concat(e.type,">{``}</").concat(e.type,"> ) Refer to our API for more information.")),!0}mapChildrenToProps(e,s){let a={};return t.Children.forEach(e,e=>{if(!e||!e.props)return;const t=e.props,{children:n}=t,r=l(t,Rt),i=Object.keys(r).reduce((e,t)=>(e[Gt[t]||t]=r[t],e),{});let{type:o}=e;switch("symbol"===typeof o?o=o.toString():this.warnOnInvalidChildren(e,n),o){case"Symbol(react.fragment)":s=this.mapChildrenToProps(n,s);break;case"link":case"meta":case"noscript":case"script":case"style":a=this.flattenArrayTypeChildren(e,a,i,n);break;default:s=this.mapObjectTypeChildren(e,s,i,n)}}),this.mapArrayTypeChildrenToProps(a,s)}render(){const e=this.props,{children:s}=e,a=l(e,Lt);let n=d({},a),{helmetData:r}=a;if(s&&(n=this.mapChildrenToProps(s,n)),r&&!(r instanceof ys)){r=new ys(r.context,!0),delete n.helmetData}return r?t.createElement(Es,d(d({},n),{},{context:r.value})):t.createElement(Ns.Consumer,null,e=>t.createElement(Es,d(d({},n),{},{context:e})))}},o(Ot,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Ot);function Fs(e){if(null==e)throw new TypeError("Cannot destructure "+e)}var Ts=s(950);const zs=["message"];const Ms=Array(12).fill(0),Ps=e=>{let{visible:s,className:a}=e;return t.createElement("div",{className:["sonner-loading-wrapper",a].filter(Boolean).join(" "),"data-visible":s},t.createElement("div",{className:"sonner-spinner"},Ms.map((e,s)=>t.createElement("div",{className:"sonner-loading-bar",key:"spinner-bar-".concat(s)}))))},Bs=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t.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"})),Rs=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},t.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"})),Ls=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t.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"})),Is=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t.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"})),Os=t.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"},t.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));let Us=1;const Hs=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>
2{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:s}=e,a=l(e,zs),n="number"===typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:Us++,r=this.toasts.find(e=>e.id===n),i=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(n)&&this.dismissedToasts.delete(n),r?this.toasts=this.toasts.map(t=>t.id===n?(this.publish(d(d(d({},t),e),{},{id:n,title:s})),d(d(d({},t),e),{},{id:n,dismissible:i,title:s})):t):this.addToast(d(d({title:s},a),{},{dismissible:i,id:n})),n},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create(d(d({},t),{},{message:e})),this.error=(e,t)=>this.create(d(d({},t),{},{message:e,type:"error"})),this.success=(e,t)=>this.create(d(d({},t),{},{type:"success",message:e})),this.info=(e,t)=>this.create(d(d({},t),{},{type:"info",message:e})),this.warning=(e,t)=>this.create(d(d({},t),{},{type:"warning",message:e})),this.loading=(e,t)=>
2this.create(d(d({},t),{},{type:"loading",message:e})),this.promise=(e,s)=>{if(!s)return;let a;void 0!==s.loading&&(a=this.create(d(d({},s),{},{promise:e,type:"loading",message:s.loading,description:"function"!==typeof s.description?s.description:void 0})));const n=Promise.resolve(e instanceof Function?e():e);let l,r=void 0!==a;const i=n.then(async e=>{l=["resolve",e];if(t.isValidElement(e))r=!1,this.create({id:a,type:"default",message:e});else if(Ws(e)&&!e.ok){r=!1;const n="function"===typeof s.error?await s.error("HTTP error! status: ".concat(e.status)):s.error,l="function"===typeof s.description?await s.description("HTTP error! status: ".concat(e.status)):s.description,i="object"===typeof n&&!t.isValidElement(n)?n:{message:n};this.create(d({id:a,type:"error",description:l},i))}else if(e instanceof Error){r=!1;const n="function"===typeof s.error?await s.error(e):s.error,l="function"===typeof s.description?await s.description(e):s.description,i="object"===typeof n&&!t.isValidElement(n)?n:{message:n};this.create(d({id:a,type:"error",description:l},i))}else if(void 0!==s.success){r=!1;const n="function"===typeof s.success?await s.success(e):s.success,l="function"===typeof s.description?await s.description(e):s.description,i="object"===typeof n&&!t.isValidElement(n)?n:{message:n};this.create(d({id:a,type:"success",description:l},i))}}).catch(async e=>{if(l=["reject",e],void 0!==s.error){r=!1;const n="function"===typeof s.error?await s.error(e):s.error,l="function"===typeof s.description?await s.description(e):s.description,i="object"===typeof n&&!t.isValidElement(n)?n:{message:n};this.create(d({id:a,type:"error",description:l},i))}}).finally(()=>{r&&(this.dismiss(a),a=void 0),null==s.finally||s.finally.call(s)}),o=()=>new Promise((e,t)=>i.then(()=>"reject"===l[0]?t(l[1]):e(l[1])).catch(t));return"string"!==typeof a&&"number"!==typeof a?{unwrap:o}:Object.assign(a,{unwrap:o})},this.custom=(e,t)=>{const s=(null==t?void 0:t.id)||Us++;return this.create(d({jsx:e(s),id:s},t)),s},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ws=e=>e&&"object"===typeof e&&"ok"in e&&"boolean"===typeof e.ok&&"status"in e&&"number"===typeof e.status,Vs=(e,t)=>{const s=(null==t?void 0:t.id)||Us++;return Hs.addToast(d(d({title:e},t),{},{id:s})),s},qs=Object.assign(Vs,{success:Hs.success,info:Hs.info,warning:Hs.warning,error:Hs.error,custom:Hs.custom,message:Hs.message,promise:Hs.promise,dismiss:Hs.dismiss,loading:Hs.loading},{getHistory:()=>Hs.toasts,getToasts:()=>Hs.getActiveToasts()});function $s(e){return void 0!==e.label}!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}
vendor: 14,864 bytes, line 2
2("[data-sonner-toaster][dir=ltr],html[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%)}[data-sonner-toaster][dir=rtl],html[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%)}[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:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[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);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[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 rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [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)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [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;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [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);background:var(--normal-bg);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-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[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}[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}[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,0)) translateX(var(--swipe-amount-x,0));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{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{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{from{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-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--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-sonner-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-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-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, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--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-sonner-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-sonner-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]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[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]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[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]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[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]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[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:first-child{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)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{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%)}");
2const Gs=3,Ks=14;function Ys(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter(Boolean).join(" ")}const Js=e=>{var s,a,n,l,r,i,o,c,u;const{invert:m,toast:h,unstyled:x,interacting:p,setHeights:g,visibleToasts:f,heights:v,index:b,toasts:j,expanded:y,removeToast:N,defaultRichColors:w,closeButton:C,style:k,cancelButtonStyle:D,actionButtonStyle:_,className:S="",descriptionClassName:E="",duration:A,position:F,gap:T,expandByDefault:z,classNames:M,icons:P,closeButtonAriaLabel:B="Close toast"}=e,[R,L]=t.useState(null),[I,O]=t.useState(null),[U,H]=t.useState(!1),[W,V]=t.useState(!1),[q,$]=t.useState(!1),[G,K]=t.useState(!1),[Y,J]=t.useState(!1),[Q,X]=t.useState(0),[Z,ee]=t.useState(0),te=t.useRef(h.duration||A||4e3),se=t.useRef(null),ae=t.useRef(null),ne=0===b,le=b+1<=f,re=h.type,ie=!1!==h.dism
vendor: 8,203 bytes, line 2
2issible,oe=h.className||"",ce=h.descriptionClassName||"",de=t.useMemo(()=>v.findIndex(e=>e.toastId===h.id)||0,[v,h.id]),ue=t.useMemo(()=>{var e;return null!=(e=h.closeButton)?e:C},[h.closeButton,C]),me=t.useMemo(()=>h.duration||A||4e3,[h.duration,A]),he=t.useRef(0),xe=t.useRef(0),pe=t.useRef(0),ge=t.useRef(null),[fe,ve]=F.split("-"),be=t.useMemo(()=>v.reduce((e,t,s)=>s>=de?e:e+t.height,0),[v,de]),je=(()=>{const[e,s]=t.useState(document.hidden);return t.useEffect(()=>{const e=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),ye=h.invert||m,Ne="loading"===re;xe.current=t.useMemo(()=>de*T+be,[de,be]),t.useEffect(()=>{te.current=me},[me]),t.useEffect(()=>{H(!0)},[]),t.useEffect(()=>{const e=ae.current;if(e){const t=e.getBoundingClientRect().height;return ee(t),g(e=>[{toastId:h.id,height:t,position:h.position},...e]),()=>g(e=>e.filter(e=>e.toastId!==h.id))}},[g,h.id]),t.useLayoutEffect(()=>{if(!U)return;const e=ae.current,t=e.style.height;e.style.height="auto";const s=e.getBoundingClientRect().height;e.style.height=t,ee(s),g(e=>e.find(e=>e.toastId===h.id)?e.map(e=>e.toastId===h.id?d(d({},e),{},{height:s}):e):[{toastId:h.id,height:s,position:h.position},...e])},[U,h.title,h.description,g,h.id,h.jsx,h.action,h.cancel]);const we=t.useCallback(()=>{V(!0),X(xe.current),g(e=>e.filter(e=>e.toastId!==h.id)),setTimeout(()=>{N(h)},200)},[h,N,g,xe]);t.useEffect(()=>{if(h.promise&&"loading"===re||h.duration===1/0||"loading"===h.type)return;let e;return y||p||je?(()=>{if(pe.current<he.current){const e=(new Date).getTime()-he.current;te.current=te.current-e}pe.current=(new Date).getTime()})():te.current!==1/0&&(he.current=(new Date).getTime(),e=setTimeout(()=>{null==h.onAutoClose||h.onAutoClose.call(h,h),we()},te.current)),()=>clearTimeout(e)},[y,p,h,re,je,we]),t.useEffect(()=>{h.delete&&(we(),null==h.onDismiss||h.onDismiss.call(h,h))},[we,h.delete]);const Ce=h.icon||(null==P?void 0:P[re])||(e=>{switch(e){case"success":return Bs;case"info":return Ls;case"warning":return Rs;case"error":return Is;default:return null}})(re);var ke,De;return t.createElement("li",{tabIndex:0,ref:ae,className:Ys(S,oe,null==M?void 0:M.toast,null==h||null==(s=h.classNames)?void 0:s.toast,null==M?void 0:M.default,null==M?void 0:M[re],null==h||null==(a=h.classNames)?void 0:a[re]),"data-sonner-toast":"","data-rich-colors":null!=(ke=h.richColors)?ke:w,"data-styled":!Boolean(h.jsx||h.unstyled||x),"data-mounted":U,"data-promise":Boolean(h.promise),"data-swiped":Y,"data-removed":W,"data-visible":le,"data-y-position":fe,"data-x-position":ve,"data-index":b,"data-front":ne,"data-swiping":q,"data-dismissible":ie,"data-type":re,"data-invert":ye,"data-swipe-out":G,"data-swipe-direction":I,"data-expanded":Boolean(y||z&&U),"data-testid":h.testId,style:d(d({"--index":b,"--toasts-before":b,"--z-index":j.length-b,"--offset":"".concat(W?Q:xe.current,"px"),"--initial-height":z?"auto":"".concat(Z,"px")},k),h.style),onDragEnd:()=>{$(!1),L(null),ge.current=null},onPointerDown:e=>{2!==e.button&&!Ne&&ie&&(se.current=new Date,X(xe.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&($(!0),ge.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,s;if(G||!ie)return;ge.current=null;const a=Number((null==(e=ae.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),n=Number((null==(t=ae.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),l=(new Date).getTime()-(null==(s=se.current)?void 0:s.getTime()),r="x"===R?a:n,i=Math.abs(r)/l;if(Math.abs(r)>=45||i>.11)return X(xe.current),null==h.onDismiss||h.onDismiss.call(h,h),O("x"===R?a>0?"right":"left":n>0?"down":"up"),we(),void K(!0);var o,c;null==(o=ae.current)||o.style.setProperty("--swipe-amount-x","0px"),null==(c=ae.current)||c.style.setProperty("--swipe-amount-y","0px"),J(!1),$(!1),L(null)},onPointerMove:t=>{var s,a,n;if(!ge.current||!ie)return;if((null==(s=window.getSelection())?void 0:s.toString().length)>0)return;const l=t.clientY-ge.current.y,r=t.clientX-ge.current.x;var i;const o=null!=(i=e.swipeDirections)?i:function(e){const[t,s]=e.split("-"),a=[];return t&&a.push(t),s&&a.push(s),a}(F);!R&&(Math.abs(r)>1||Math.abs(l)>1)&&L(Math.abs(r)>Math.abs(l)?"x":"y");let c={x:0,y:0};const d=e=>1/(1.5+Math.abs(e)/20);if("y"===R){if(o.includes("top")||o.includes("bottom"))if(o.includes("top")&&l<0||o.includes("bottom")&&l>0)c.y=l;else{const e=l*d(l);c.y=Math.abs(e)<Math.abs(l)?e:l}}else if("x"===R&&(o.includes("left")||o.includes("right")))if(o.includes("left")&&r<0||o.includes("right")&&r>0)c.x=r;else{const e=r*d(r);c.x=Math.abs(e)<Math.abs(r)?e:r}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&J(!0),null==(a=ae.current)||a.style.setProperty("--swipe-amount-x","".concat(c.x,"px")),null==(n=ae.current)||n.style.setProperty("--swipe-amount-y","".concat(c.y,"px"))}},ue&&!h.jsx&&"loading"!==re?t.createElement("button",{"aria-label":B,"data-disabled":Ne,"data-close-button":!0,onClick:Ne||!ie?()=>{}:()=>{we(),null==h.onDismiss||h.onDismiss.call(h,h)},className:Ys(null==M?void 0:M.closeButton,null==h||null==(n=h.classNames)?void 0:n.closeButton)},null!=(De=null==P?void 0:P.close)?De:Os):null,(re||h.icon||h.promise)&&null!==h.icon&&(null!==(null==P?void 0:P[re])||h.icon)?t.createElement("div",{"data-icon":"",className:Ys(null==M?void 0:M.icon,null==h||null==(l=h.classNames)?void 0:l.icon)},h.promise||"loading"===h.type&&!h.icon?h.icon||function(){var e,s;return(null==P?void 0:P.loading)?t.createElement("div",{className:Ys(null==M?void 0:M.loader,null==h||null==(s=h.classNames)?void 0:s.loader,"sonner-loader"),"data-visible":"loading"===re},P.loading):t.createElement(Ps,{className:Ys(null==M?void 0:M.loader,null==h||null==(e=h.classNames)?void 0:e.loader),visible:"loading"===re})}():null,"loading"!==h.type?Ce:null):null,t.createElement("div",{"data-content":"",className:Ys(null==M?void 0:M.content,null==h||null==(r=h.classNames)?void 0:r.content)},t.createElement("div",{"data-title":"",className:Ys(null==M?void 0:M.title,null==h||null==(i=h.classNames)?void 0:i.title)},h.jsx?h.jsx:"function"===typeof h.title?h.title():h.title),h.description?t.createElement("div",{"data-description":"",className:Ys(E,ce,null==M?void 0:M.description,null==h||null==(o=h.classNames)?void 0:o.description)},"function"===typeof h.description?h.description():h.description):null),t.isValidElement(h.cancel)?h.cancel:h.cancel&&$s(h.cancel)?t.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||D,onClick:e=>{$s(h.cancel)&&ie&&(null==h.cancel.onClick||h.cancel.onClick.call(h.cancel,e),we())},className:Ys(null==M?void 0:M.cancelButton,null==h||null==(c=h.classNames)?void 0:c.cancelButton)},h.cancel.label):null,t.isValidElement(h.action)?h.action:h.action&&$s(h.action)?t.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||_,onClick:e=>{$s(h.action)&&(null==h.action.onClick||h.action.onClick.call(h.action,e),e.defaultPrevented||we())},className:Ys(null==M?void 0:M.actionButton,null==h||null==(u=h.classNames)?void 0:u.actionButton)},h.action.label):null)};function Qs(){if("undefined"===typeof window)return"ltr";if("undefined"===typeof document)return"ltr";const e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}function Xs(e,t){const s={};return[e,t].forEach((e,t)=>{const a=1===t,n=a?"--mobile-offset":"--offset",l=a?"16px":"24px";function r(e){["top","right","bottom","left"].forEach(t=>{s["".concat(n,"-").concat(t)]="number"===typeof e?"".concat(e,"px"):e})}"number"===typeof e||"string"===typeof e?r(e):"object"===typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?s["".concat(n,"-").concat(t)]=l:s["".concat(n,"-").concat(t)]="number"===typeof e[t]?"".concat(e[t],"px"):e[t]}):r(l)}),s}const Zs=t.forwardRef(function(e,s){const{id:a,invert:n,position:l="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:c,offset:u,mobileOffset:m,theme:h="light",richColors:x,duration:p,style:g,visibleToasts:f=Gs,toastOptions:v,dir:b=Qs(),gap:j=Ks,icons:y,containerAriaLabel:N="Notifications"}
2=e,[w,C]=t.useState([]),k=t.useMemo(()=>a?w.filter(e=>e.toasterId===a):w.filter(e=>!e.toasterId),[w,a]),D=t.useMemo(()=>Array.from(new Set([l].concat(k.filter(e=>e.position).map(e=>e.position)))),[k,l]),[_,S]=t.useState([]),[E,A]=t.useState(!1),[F,T]=t.useState(!1),[z,M]=t.useState("system"!==h?h:"undefined"!==typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),P=t.useRef(null),B=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=t.useRef(null),L=t.useRef(!1),I=t.useCallback(e=>{C(t=>{var s;return(null==(s=t.find(t=>t.id===e.id))?void 0:s.delete)||Hs.dismiss(e.id),t.filter(t=>{let{id:s}=t;return s!==e.id})})},[]);return t.useEffect(()=>Hs.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?d(d({},t),{},{delete:!0}):t))}):setTimeout(()=>{Ts.flushSync(()=>{C(t=>{const s=t.findIndex(t=>t.id===e.id);return-1!==s?[...t.slice(0,s),d(d({},t[s]),e),...t.slice(s+1)]:[e,...t]})})})}),[w]),t.useEffect(()=>{if("system"!==h)return void M(h);if("system"===h&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),"undefined"===typeof window)return;const e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",e=>{let{matches:t}=e;M(t?"dark":"light")})}catch(t){e.addListener(e=>{let{matches:t}=e;try{M(t?"dark":"light")}catch(G2){console.error(G2)}})}},[h]),t.useEffect(()=>{w.length<=1&&A(!1)},[w]),t.useEffect(()=>{const e=e=>{var t;const s=r.every(t=>e[t]||e.code===t);var a;s&&(A(!0),null==(a=P.current)||a.focus());"Escape"!==e.code||document.activeElement!==P.current&&!(null==(t=P.current)?void 0:t.contains(document.activeElement))||A(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]),t.useEffect(()=>{if(P.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,L.current=!1)}},[P.current]),t.createElement("section",{ref:s,"aria-label":"".concat(N," ").concat(B),tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},D.map((s,a)=>{var l;const[r,h]=s.split("-");return k.length?t.createElement("ol",{key:s,dir:"auto"===b?Qs():b,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":z,"data-y-position":r,"data-x-position":h,style:d(d({"--front-toast-height":"".concat((null==(l=_[0])?void 0:l.height)||0,"px"),"--width":"".concat(356,"px"),"--gap":"".concat(j,"px")},g),Xs(u,m)),onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||L.current||(L.current=!0,R.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{F||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||T(!0)},onPointerUp:()=>T(!1)},k.filter(e=>!e.position&&0===a||e.position===s).map((a,l)=>{var r,c;return t.createElement(Js,{key:a.id,icons:y,index:l,toast:a,defaultRichColors:x,duration:null!=(r=null==v?void 0:v.duration)?r:p,className:null==v?void 0:v.className,descriptionClassName:null==v?void 0:v.descriptionClassName,invert:n,visibleToasts:f,closeButton:null!=(c=null==v?void 0:v.closeButton)?c:o,interacting:F,position:s,style:null==v?void 0:v.style,unstyled:null==v?void 0:v.unstyled,classNames:null==v?void 0:v.classNames,cancelButtonStyle:null==v?void 0:v.cancelButtonStyle,actionButtonStyle:null==v?void 0:v.actionButtonStyle,closeButtonAriaLabel:null==v?void 0:v.closeButtonAriaLabel,removeToast:I,toasts:k.filter(e=>e.position==a.position),heights:_.filter(e=>e.position==a.position),setHeights:S,expandByDefault:i,gap:j,expanded:E,swipeDirections:e.swipeDirections})})):null}))});var ea=s(579);const ta=e=>{let t=Object.assign({},(Fs(e),e));return(0,ea.jsx)(Zs,d({theme:"light",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))};function sa(e,t){return function(){return e.apply(t,arguments)}}const{toString:aa}=Object.prototype,{getPrototypeOf:na}=Object,{iterator:la,toStringTag:ra}=Symbol,ia=(oa=Object.create(null),e=>{const t=aa.call(e);return oa[t]||(oa[t]=t.slice(8,-1).toLowerCase())});var oa;const ca=e=>(e=e.toLowerCase(),t=>ia(t)===e),da=e=>t=>typeof t===e,{isArray:ua}=Array,ma=da("undefined");function ha(e){return null!==e&&!ma(e)&&null!==e.constructor&&!ma(e.constructor)&&ga(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const xa=ca("ArrayBuffer");
2const pa=da("string"),ga=da("function"),fa=da("number"),va=e=>null!==e&&"object"===typeof e,ba=e=>{if("object"!==ia(e))return!1;const t=na(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(ra in e)&&!(la in e)},ja=ca("Date"),ya=ca("File"),Na=ca("Blob"),wa=ca("FileList"),Ca=ca("URLSearchParams"),[ka,Da,_a,Sa]=["ReadableStream","Request","Response","Headers"].map(ca);function Ea(e,t){let s,a,{allOwnKeys:n=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),ua(e))for(s=0,a=e.length;s<a;s++)t.call(null,e[s],s,e);else{if(ha(e))return;const a=n?Object.getOwnPropertyNames(e):Object.keys(e),l=a.length;let r;for(s=0;s<l;s++)r=a[s],t.call(null,e[r],r,e)}}function Aa(e,t){if(ha(e))return null;t=t.toLowerCase();const s=Object.keys(e);let a,n=s.length;for(;n-- >0;)if(a=s[n],t===a.toLowerCase())return a;return null}const Fa="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:"undefined"!==typeof window?window:s.g,Ta=e=>!ma(e)&&e!==Fa;const za=(Ma="undefined"!==typeof Uint8Array&&na(Uint8Array),e=>Ma&&e instanceof Ma);var Ma;const Pa=ca("HTMLFormElement"),Ba=(e=>{let{hasOwnProperty:t}=e;return(e,s)=>t.call(e,s)})(Object.prototype),Ra=ca("RegExp"),La=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),a={};Ea(s,(s,n)=>{let l;!1!==(l=t(s,n,e))&&(a[n]=l||s)}),Object.defineProperties(e,a)};const Ia=ca("AsyncFunction"),Oa=((e,t)=>{return e?setImmediate:t?(s="axios@".concat(Math.random()),a=[],Fa.addEventListener("message",e=>{let{source:t,data:n}=e;t===Fa&&n===s&&a.length&&a.shift()()},!1),e=>{a.push(e),Fa.postMessage(s,"*")}):e=>setTimeout(e);var s,a})("function"===typeof setImmediate,ga(Fa.postMessage)),Ua="undefined"!==typeof queueMicrotask?queueMicrotask.bind(Fa):"undefined"!==typeof process&&process.nextTick||Oa,Ha={isArray:ua,isArrayBuffer:xa,isBuffer:ha,isFormData:e=>{let t;return e&&("function"===typeof FormData&&e instanceof FormData||ga(e.append)&&("formdata"===(t=ia(e))||"object"===t&&ga(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&xa(e.buffer),t},isString:pa,isNumber:fa,isBoolean:e=>!0===e||!1===e,isObject:va,isPlainObject:ba,isEmptyObject:e=>{if(!va(e)||ha(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(G2){return!1}},isReadableStream:ka,isRequest:Da,isResponse:_a,isHeaders:Sa,isUndefined:ma,isDate:ja,isFile:ya,isBlob:Na,isRegExp:Ra,isFunction:ga,isStream:e=>va(e)&&ga(e.pipe),isURLSearchParams:Ca,isTypedArray:za,isFileList:wa,forEach:Ea,merge:function e(){const{caseless:t,skipUndefined:s}=Ta(this)&&this||{},a={},n=(n,l)=>{const r=t&&Aa(a,l)||l;ba(a[r])&&ba(n)?a[r]=e(a[r],n):ba(n)?a[r]=e({},n):ua(n)?a[r]=n.slice():s&&ma(n)||(a[r]=n)};for(let l=0,r=arguments.length;l<r;l++)arguments[l]&&Ea(arguments[l],n);return a},extend:function(e,t,s){let{allOwnKeys:a}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Ea(t,(t,a)=>{s&&ga(t)?e[a]=sa(t,s):e[a]=t},{allOwnKeys:a}),e},trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,s,a)=>{e.prototype=Object.create(t.prototype,a),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),s&&Object.assign(e.prototype,s)},toFlatObject:(e,t,s,a)=>{let n,l,r;const i={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),l=n.length;l-- >0;)r=n[l],a&&!a(r,e,t)||i[r]||(t[r]=e[r],i[r]=!0);e=!1!==s&&na(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},kindOf:ia,kindOfTest:ca,endsWith:(e,t,s)=>{e=String(e),(void 0===s||s>e.length)&&(s=e.length),s-=t.length;const a=e.indexOf(t,s);return-1!==a&&a===s},toArray:e=>{if(!e)return null;if(ua(e))return e;let t=e.length;if(!fa(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},forEachEntry:(e,t)=>{const s=(e&&e[la]).call(e);let a;for(;(a=s.next())&&!a.done;){const s=a.value;t.call(e,s[0],s[1])}},matchAll:(e,t)=>
vendor: 4,175 bytes, line 2
2{let s;const a=[];for(;null!==(s=e.exec(t));)a.push(s);return a},isHTMLForm:Pa,hasOwnProperty:Ba,hasOwnProp:Ba,reduceDescriptors:La,freezeMethods:e=>{La(e,(t,s)=>{if(ga(e)&&-1!==["arguments","caller","callee"].indexOf(s))return!1;const a=e[s];ga(a)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")}))})},toObjectSet:(e,t)=>{const s={},a=e=>{e.forEach(e=>{s[e]=!0})};return ua(e)?a(e):a(String(e).split(t)),s},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,s){return t.toUpperCase()+s}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Aa,global:Fa,isContextDefined:Ta,isSpecCompliantForm:function(e){return!!(e&&ga(e.append)&&"FormData"===e[ra]&&e[la])},toJSONObject:e=>{const t=new Array(10),s=(e,a)=>{if(va(e)){if(t.indexOf(e)>=0)return;if(ha(e))return e;if(!("toJSON"in e)){t[a]=e;const n=ua(e)?[]:{};return Ea(e,(e,t)=>{const l=s(e,a+1);!ma(l)&&(n[t]=l)}),t[a]=void 0,n}}return e};return s(e,0)},isAsyncFn:Ia,isThenable:e=>e&&(va(e)||ga(e))&&ga(e.then)&&ga(e.catch),setImmediate:Oa,asap:Ua,isIterable:e=>null!=e&&ga(e[la])};function Wa(e,t,s,a,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),s&&(this.config=s),a&&(this.request=a),n&&(this.response=n,this.status=n.status?n.status:null)}Ha.inherits(Wa,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ha.toJSONObject(this.config),code:this.code,status:this.status}}});const Va=Wa.prototype,qa={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{qa[e]={value:e}}),Object.defineProperties(Wa,qa),Object.defineProperty(Va,"isAxiosError",{value:!0}),Wa.from=(e,t,s,a,n,l)=>{const r=Object.create(Va);Ha.toFlatObject(e,r,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const i=e&&e.message?e.message:"Error",o=null==t&&e?e.code:t;return Wa.call(r,i,o,s,a,n),e&&null==r.cause&&Object.defineProperty(r,"cause",{value:e,configurable:!0}),r.name=e&&e.name||"Error",l&&Object.assign(r,l),r};const $a=Wa;function Ga(e){return Ha.isPlainObject(e)||Ha.isArray(e)}function Ka(e){return Ha.endsWith(e,"[]")?e.slice(0,-2):e}function Ya(e,t,s){return e?e.concat(t).map(function(e,t){return e=Ka(e),!s&&t?"["+e+"]":e}).join(s?".":""):t}const Ja=Ha.toFlatObject(Ha,{},null,function(e){return/^is[A-Z]/.test(e)});const Qa=function(e,t,s){if(!Ha.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const a=(s=Ha.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Ha.isUndefined(t[e])})).metaTokens,n=s.visitor||c,l=s.dots,r=s.indexes,i=(s.Blob||"undefined"!==typeof Blob&&Blob)&&Ha.isSpecCompliantForm(t);if(!Ha.isFunction(n))throw new TypeError("visitor must be a function");function o(e){if(null===e)return"";if(Ha.isDate(e))return e.toISOString();if(Ha.isBoolean(e))return e.toString();if(!i&&Ha.isBlob(e))throw new $a("Blob is not supported. Use a Buffer instead.");return Ha.isArrayBuffer(e)||Ha.isTypedArray(e)?i&&"function"===typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,s,n){let i=e;if(e&&!n&&"object"===typeof e)if(Ha.endsWith(s,"{}"))s=a?s:s.slice(0,-2),e=JSON.stringify(e);else if(Ha.isArray(e)&&function(e){return Ha.isArray(e)&&!e.some(Ga)}(e)||(Ha.isFileList(e)||Ha.endsWith(s,"[]"))&&(i=Ha.toArray(e)))return s=Ka(s),i.forEach(function(e,a){!Ha.isUndefined(e)&&null!==e&&t.append(!0===r?Ya([s],a,l):null===r?s:s+"[]",o(e))}),!1;return!!Ga(e)||(t.append(Ya(n,s,l),o(e)),!1)}const d=[],u=Object.assign(Ja,{defaultVisitor:c,convertValue:o,isVisitable:Ga});if(!Ha.isObject(e))throw new TypeError("data must be an object");return function e(s,a){if(!Ha.isUndefined(s)){if(-1!==d.indexOf(s))throw Error("Circular reference detected in "+a.join("."));
2d.push(s),Ha.forEach(s,function(s,l){!0===(!(Ha.isUndefined(s)||null===s)&&n.call(t,s,Ha.isString(l)?l.trim():l,a,u))&&e(s,a?a.concat(l):[l])}),d.pop()}}(e),t};function Xa(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Za(e,t){this._pairs=[],e&&Qa(e,this,t)}const en=Za.prototype;en.append=function(e,t){this._pairs.push([e,t])},en.toString=function(e){const t=e?function(t){return e.call(this,t,Xa)}:Xa;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const tn=Za;function sn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function an(e,t,s){if(!t)return e;const a=s&&s.encode||sn;Ha.isFunction(s)&&(s={serialize:s});const n=s&&s.serialize;let l;if(l=n?n(t,s):Ha.isURLSearchParams(t)?t.toString():new tn(t,s).toString(a),l){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+l}return e}const nn=class{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!s&&s.synchronous,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ha.forEach(this.handlers,function(t){null!==t&&e(t)})}},ln={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},rn={isBrowser:!0,classes:{URLSearchParams:"undefined"!==typeof URLSearchParams?URLSearchParams:tn,FormData:"undefined"!==typeof FormData?FormData:null,Blob:"undefined"!==typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},on="undefined"!==typeof window&&"undefined"!==typeof document,cn="object"===typeof navigator&&navigator||void 0,dn=on&&(!cn||["ReactNative","NativeScript","NS"].indexOf(cn.product)<0),un="undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"===typeof self.importScripts,mn=on&&window.location.href||"http://localhost",hn=d(d({},e),rn);const xn=function(e){function t(e,s,a,n){let l=e[n++];if("__proto__"===l)return!0;const r=Number.isFinite(+l),i=n>=e.length;if(l=!l&&Ha.isArray(a)?a.length:l,i)return Ha.hasOwnProp(a,l)?a[l]=[a[l],s]:a[l]=s,!r;a[l]&&Ha.isObject(a[l])||(a[l]=[]);return t(e,s,a[l],n)&&Ha.isArray(a[l])&&(a[l]=function(e){const t={},s=Object.keys(e);let a;const n=s.length;let l;for(a=0;a<n;a++)l=s[a],t[l]=e[l];return t}(a[l])),!r}if(Ha.isFormData(e)&&Ha.isFunction(e.entries)){const s={};return Ha.forEachEntry(e,(e,a)=>{t(function(e){return Ha.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),a,s,0)}),s}return null};const pn={transitional:ln,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",a=s.indexOf("application/json")>-1,n=Ha.isObject(e);n&&Ha.isHTMLForm(e)&&(e=new FormData(e));if(Ha.isFormData(e))return a?JSON.stringify(xn(e)):e;if(Ha.isArrayBuffer(e)||Ha.isBuffer(e)||Ha.isStream(e)||Ha.isFile(e)||Ha.isBlob(e)||Ha.isReadableStream(e))return e;if(Ha.isArrayBufferView(e))return e.buffer;if(Ha.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(n){if(s.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Qa(e,new hn.classes.URLSearchParams,d({visitor:function(e,t,s,a){return hn.isNode&&Ha.isBuffer(e)?(this.append(t,e.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((l=Ha.isFileList(e))||s.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Qa(l?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||a?(t.setContentType("application/json",!1),function(e,t,s){if(Ha.isString(e))try{return(t||JSON.parse)(e),Ha.trim(e)}catch(G2){if("SyntaxError"!==G2.name)throw G2}return(s||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||pn.transitional,s=t&&t.forcedJSONParsing,a="json"===this.responseType;if(Ha.isResponse(e)||Ha.isReadableStream(e))return e;if(e&&Ha.isString(e)&&(s&&!this.responseType||a)){const s=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e,this.parseReviver)}catch(G2){if(s){if("SyntaxError"===G2.name)throw $a.from(G2,$a.ERR_BAD_RESPONSE,this,null,this.response);throw G2}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:hn.classes.FormData,Blob:hn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};
vendor: 4,123 bytes, line 2
2Ha.forEach(["delete","get","head","post","put","patch"],e=>{pn.headers[e]={}});const gn=pn,fn=Ha.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),vn=Symbol("internals");function bn(e){return e&&String(e).trim().toLowerCase()}function jn(e){return!1===e||null==e?e:Ha.isArray(e)?e.map(jn):String(e)}function yn(e,t,s,a,n){return Ha.isFunction(a)?a.call(this,t,s):(n&&(t=s),Ha.isString(t)?Ha.isString(a)?-1!==t.indexOf(a):Ha.isRegExp(a)?a.test(t):void 0:void 0)}class Nn{constructor(e){e&&this.set(e)}set(e,t,s){const a=this;function n(e,t,s){const n=bn(t);if(!n)throw new Error("header name must be a non-empty string");const l=Ha.findKey(a,n);(!l||void 0===a[l]||!0===s||void 0===s&&!1!==a[l])&&(a[l||t]=jn(e))}const l=(e,t)=>Ha.forEach(e,(e,s)=>n(e,s,t));if(Ha.isPlainObject(e)||e instanceof this.constructor)l(e,t);else if(Ha.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))l((e=>{const t={};let s,a,n;return e&&e.split("\n").forEach(function(e){n=e.indexOf(":"),s=e.substring(0,n).trim().toLowerCase(),a=e.substring(n+1).trim(),!s||t[s]&&fn[s]||("set-cookie"===s?t[s]?t[s].push(a):t[s]=[a]:t[s]=t[s]?t[s]+", "+a:a)}),t})(e),t);else if(Ha.isObject(e)&&Ha.isIterable(e)){let s,a,n={};for(const t of e){if(!Ha.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[a=t[0]]=(s=n[a])?Ha.isArray(s)?[...s,t[1]]:[s,t[1]]:t[1]}l(n,t)}else null!=e&&n(t,e,s);return this}get(e,t){if(e=bn(e)){const s=Ha.findKey(this,e);if(s){const e=this[s];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=s.exec(e);)t[a[1]]=a[2];return t}(e);if(Ha.isFunction(t))return t.call(this,e,s);if(Ha.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=bn(e)){const s=Ha.findKey(this,e);return!(!s||void 0===this[s]||t&&!yn(0,this[s],s,t))}return!1}delete(e,t){const s=this;let a=!1;function n(e){if(e=bn(e)){const n=Ha.findKey(s,e);!n||t&&!yn(0,s[n],n,t)||(delete s[n],a=!0)}}return Ha.isArray(e)?e.forEach(n):n(e),a}clear(e){const t=Object.keys(this);let s=t.length,a=!1;for(;s--;){const n=t[s];e&&!yn(0,this[n],n,e,!0)||(delete this[n],a=!0)}return a}normalize(e){const t=this,s={};return Ha.forEach(this,(a,n)=>{const l=Ha.findKey(s,n);if(l)return t[l]=jn(a),void delete t[n];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}(n):String(n).trim();r!==n&&delete t[n],t[r]=jn(a),s[r]=!0}),this}concat(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.constructor.concat(this,...t)}toJSON(e){const t=Object.create(null);return Ha.forEach(this,(s,a)=>{null!=s&&!1!==s&&(t[a]=e&&Ha.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(e=>{let[t,s]=e;return t+": "+s}).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e){const t=new this(e);for(var s=arguments.length,a=new Array(s>1?s-1:0),n=1;n<s;n++)a[n-1]=arguments[n];return a.forEach(e=>t.set(e)),t}static accessor(e){const t=(this[vn]=this[vn]={accessors:{}}).accessors,s=this.prototype;function a(e){const a=bn(e);t[a]||(!function(e,t){const s=Ha.toCamelCase(" "+t);["get","set","has"].forEach(a=>{Object.defineProperty(e,a+s,{value:function(e,s,n){return this[a].call(this,t,e,s,n)},configurable:!0})})}(s,e),t[a]=!0)}return Ha.isArray(e)?e.forEach(a):a(e),this}}Nn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ha.reduceDescriptors(Nn.prototype,(e,t)=>{let{value:s}=e,a=t[0].toUpperCase()+t.slice(1);return{get:()=>s,set(e){this[a]=e}}}),Ha.freezeMethods(Nn);const wn=Nn;function Cn(e,t){const s=this||gn,a=t||s,n=wn.from(a.headers);let l=a.data;
2return Ha.forEach(e,function(e){l=e.call(s,l,n.normalize(),t?t.status:void 0)}),n.normalize(),l}function kn(e){return!(!e||!e.__CANCEL__)}function Dn(e,t,s){$a.call(this,null==e?"canceled":e,$a.ERR_CANCELED,t,s),this.name="CanceledError"}Ha.inherits(Dn,$a,{__CANCEL__:!0});const _n=Dn;function Sn(e,t,s){const a=s.config.validateStatus;s.status&&a&&!a(s.status)?t(new $a("Request failed with status code "+s.status,[$a.ERR_BAD_REQUEST,$a.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s)):e(s)}const En=function(e,t){e=e||10;const s=new Array(e),a=new Array(e);let n,l=0,r=0;return t=void 0!==t?t:1e3,function(i){const o=Date.now(),c=a[r];n||(n=o),s[l]=i,a[l]=o;let d=r,u=0;for(;d!==l;)u+=s[d++],d%=e;if(l=(l+1)%e,l===r&&(r=(r+1)%e),o-n<t)return;const m=c&&o-c;return m?Math.round(1e3*u/m):void 0}};const An=function(e,t){let s,a,n=0,l=1e3/t;const r=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();n=l,s=null,a&&(clearTimeout(a),a=null),e(...t)};return[function(){const e=Date.now(),t=e-n;for(var i=arguments.length,o=new Array(i),c=0;c<i;c++)o[c]=arguments[c];t>=l?r(o,e):(s=o,a||(a=setTimeout(()=>{a=null,r(s)},l-t)))},()=>s&&r(s)]},Fn=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,a=0;const n=En(50,250);return An(s=>{const l=s.loaded,r=s.lengthComputable?s.total:void 0,i=l-a,o=n(i);a=l;e({loaded:l,total:r,progress:r?l/r:void 0,bytes:i,rate:o||void 0,estimated:o&&r&&l<=r?(r-l)/o:void 0,event:s,lengthComputable:null!=r,[t?"download":"upload"]:!0})},s)},Tn=(e,t)=>{const s=null!=e;return[a=>t[0]({lengthComputable:s,total:e,loaded:a}),t[1]]},zn=e=>function(){for(var t=arguments.length,s=new Array(t),a=0;a<t;a++)s[a]=arguments[a];return Ha.asap(()=>e(...s))},Mn=hn.hasStandardBrowserEnv?((e,t)=>s=>(s=new URL(s,hn.origin),e.protocol===s.protocol&&e.host===s.host&&(t||e.port===s.port)))(new URL(hn.origin),hn.navigator&&/(msie|trident)/i.test(hn.navigator.userAgent)):()=>!0,Pn=hn.hasStandardBrowserEnv?{write(e,t,s,a,n,l,r){if("undefined"===typeof document)return;const i=["".concat(e,"=").concat(encodeURIComponent(t))];Ha.isNumber(s)&&i.push("expires=".concat(new Date(s).toUTCString())),Ha.isString(a)&&i.push("path=".concat(a)),Ha.isString(n)&&i.push("domain=".concat(n)),!0===l&&i.push("secure"),Ha.isString(r)&&i.push("SameSite=".concat(r)),document.cookie=i.join("; ")},read(e){if("undefined"===typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Bn(e,t,s){let a=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(a||0==s)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Rn=e=>e instanceof wn?d({},e):e;function Ln(e,t){t=t||{};const s={};function a(e,t,s,a){return Ha.isPlainObject(e)&&Ha.isPlainObject(t)?Ha.merge.call({caseless:a},e,t):Ha.isPlainObject(t)?Ha.merge({},t):Ha.isArray(t)?t.slice():t}function n(e,t,s,n){return Ha.isUndefined(t)?Ha.isUndefined(e)?void 0:a(void 0,e,0,n):a(e,t,0,n)}function l(e,t){if(!Ha.isUndefined(t))return a(void 0,t)}function r(e,t){return Ha.isUndefined(t)?Ha.isUndefined(e)?void 0:a(void 0,e):a(void 0,t)}function i(s,n,l){return l in t?a(s,n):l in e?a(void 0,s):void 0}const o={url:l,method:l,data:l,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:i,headers:(e,t,s)=>n(Rn(e),Rn(t),0,!0)};return Ha.forEach(Object.keys(d(d({},e),t)),function(a){const l=o[a]||n,r=l(e[a],t[a],a);Ha.isUndefined(r)&&l!==i||(s[a]=r)}),s}const In=e=>{const t=Ln({},e);let{data:s,withXSRFToken:a,xsrfHeaderName:n,xsrfCookieName:l,headers:r,auth:i}=t;if(t.headers=r=wn.from(r),t.url=an(Bn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&r.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),Ha.isFormData(s))if(hn.hasStandardBrowserEnv||hn.hasStandardBrowserWebWorkerEnv)r.setContentType(void 0);else if(Ha.isFunction(s.getHeaders)){const e=s.getHeaders(),t=["content-type","content-length"];
2Object.entries(e).forEach(e=>{let[s,a]=e;t.includes(s.toLowerCase())&&r.set(s,a)})}if(hn.hasStandardBrowserEnv&&(a&&Ha.isFunction(a)&&(a=a(t)),a||!1!==a&&Mn(t.url))){const e=n&&l&&Pn.read(l);e&&r.set(n,e)}return t},On="undefined"!==typeof XMLHttpRequest&&function(e){return new Promise(function(t,s){const a=In(e);let n=a.data;const l=wn.from(a.headers).normalize();let r,i,o,c,d,{responseType:u,onUploadProgress:m,onDownloadProgress:h}=a;function x(){c&&c(),d&&d(),a.cancelToken&&a.cancelToken.unsubscribe(r),a.signal&&a.signal.removeEventListener("abort",r)}let p=new XMLHttpRequest;function g(){if(!p)return;const a=wn.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());Sn(function(e){t(e),x()},function(e){s(e),x()},{data:u&&"text"!==u&&"json"!==u?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:a,config:e,request:p}),p=null}p.open(a.method.toUpperCase(),a.url,!0),p.timeout=a.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(s(new $a("Request aborted",$a.ECONNABORTED,e,p)),p=null)},p.onerror=function(t){const a=t&&t.message?t.message:"Network Error",n=new $a(a,$a.ERR_NETWORK,e,p);n.event=t||null,s(n),p=null},p.ontimeout=function(){let t=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const n=a.transitional||ln;a.timeoutErrorMessage&&(t=a.timeoutErrorMessage),s(new $a(t,n.clarifyTimeoutError?$a.ETIMEDOUT:$a.ECONNABORTED,e,p)),p=null},void 0===n&&l.setContentType(null),"setRequestHeader"in p&&Ha.forEach(l.toJSON(),function(e,t){p.setRequestHeader(t,e)}),Ha.isUndefined(a.withCredentials)||(p.withCredentials=!!a.withCredentials),u&&"json"!==u&&(p.responseType=a.responseType),h&&([o,d]=Fn(h,!0),p.addEventListener("progress",o)),m&&p.upload&&([i,c]=Fn(m),p.upload.addEventListener("progress",i),p.upload.addEventListener("loadend",c)),(a.cancelToken||a.signal)&&(r=t=>{p&&(s(!t||t.type?new _n(null,e,p):t),p.abort(),p=null)},a.cancelToken&&a.cancelToken.subscribe(r),a.signal&&(a.signal.aborted?r():a.signal.addEventListener("abort",r)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(a.url);f&&-1===hn.protocols.indexOf(f)?s(new $a("Unsupported protocol "+f+":",$a.ERR_BAD_REQUEST,e)):p.send(n||null)})},Un=(e,t)=>{const{length:s}=e=e?e.filter(Boolean):[];if(t||s){let s,a=new AbortController;const n=function(e){if(!s){s=!0,r();const t=e instanceof Error?e:this.reason;a.abort(t instanceof $a?t:new _n(t instanceof Error?t.message:t))}};let l=t&&setTimeout(()=>{l=null,n(new $a("timeout ".concat(t," of ms exceeded"),$a.ETIMEDOUT))},t);const r=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(n):e.removeEventListener("abort",n)}),e=null)};e.forEach(e=>e.addEventListener("abort",n));const{signal:i}=a;return i.unsubscribe=()=>Ha.asap(r),i}};function Hn(e,t){this.v=e,this.k=t}function Wn(e){return function(){return new Vn(e.apply(this,arguments))}}function Vn(e){var t,s;function a(t,s){try{var l=e[t](s),r=l.value,i=r instanceof Hn;Promise.resolve(i?r.v:r).then(function(s){if(i){var o="return"===t?"return":"next";if(!r.k||s.done)return a(o,s);s=e[o](s).value}n(l.done?"return":"normal",s)},function(e){a("throw",e)})}catch(e){n("throw",e)}}function n(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?a(t.key,t.arg):s=null}this._invoke=function(e,n){return new Promise(function(l,r){var i={key:e,arg:n,resolve:l,reject:r,next:null};s?s=s.next=i:(t=s=i,a(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}function qn(e){return new Hn(e,0)}function $n(e){var t={},s=!1;function a(t,a){return s=!0,a=new Promise(function(s){s(e[t](a))}),{done:!1,value:new Hn(a,1)}}return t["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},t.next=function(e){return s?(s=!1,e):a("next",e)},"function"==typeof e.throw&&(t.throw=function(e){if(s)throw s=!1,e;return a("throw",e)}
2),"function"==typeof e.return&&(t.return=function(e){return s?(s=!1,e):a("return",e)}),t}function Gn(e){var t,s,a,n=2;for("undefined"!=typeof Symbol&&(s=Symbol.asyncIterator,a=Symbol.iterator);n--;){if(s&&null!=(t=e[s]))return t.call(e);if(a&&null!=(t=e[a]))return new Kn(t.call(e));s="@@asyncIterator",a="@@iterator"}throw new TypeError("Object is not async iterable")}function Kn(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return Kn=function(e){this.s=e,this.n=e.next},Kn.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var s=this.s.return;return void 0===s?Promise.resolve({value:e,done:!0}):t(s.apply(this.s,arguments))},throw:function(e){var s=this.s.return;return void 0===s?Promise.reject(e):t(s.apply(this.s,arguments))}},new Kn(e)}Vn.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Vn.prototype.next=function(e){return this._invoke("next",e)},Vn.prototype.throw=function(e){return this._invoke("throw",e)},Vn.prototype.return=function(e){return this._invoke("return",e)};const Yn=function*(e,t){let s=e.byteLength;if(!t||s<t)return void(yield e);let a,n=0;for(;n<s;)a=n+t,yield e.slice(n,a),n=a},Jn=function(){var e=Wn(function*(e,t){var s,a=!1,n=!1;try{for(var l,r=Gn(Qn(e));a=!(l=yield qn(r.next())).done;a=!1){const e=l.value;yield*$n(Gn(Yn(e,t)))}}catch(i){n=!0,s=i}finally{try{a&&null!=r.return&&(yield qn(r.return()))}finally{if(n)throw s}}});return function(t,s){return e.apply(this,arguments)}}(),Qn=function(){var e=Wn(function*(e){if(e[Symbol.asyncIterator])return void(yield*$n(Gn(e)));const t=e.getReader();try{for(;;){const{done:e,value:s}=yield qn(t.read());if(e)break;yield s}}finally{yield qn(t.cancel())}});return function(t){return e.apply(this,arguments)}}(),Xn=(e,t,s,a)=>{const n=Jn(e,t);let l,r=0,i=e=>{l||(l=!0,a&&a(e))};return new ReadableStream({async pull(e){try{const{done:t,value:a}=await n.next();if(t)return i(),void e.close();let l=a.byteLength;if(s){let e=r+=l;s(e)}e.enqueue(new Uint8Array(a))}catch(t){throw i(t),t}},cancel:e=>(i(e),n.return())},{highWaterMark:2})},{isFunction:Zn}=Ha,el=(e=>{let{Request:t,Response:s}=e;return{Request:t,Response:s}})(Ha.global),{ReadableStream:tl,TextEncoder:sl}=Ha.global,al=function(e){try{for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];return!!e(...s)}catch(G2){return!1}},nl=e=>{e=Ha.merge.call({skipUndefined:!0},el,e);const{fetch:t,Request:s,Response:a}=e,n=t?Zn(t):"function"===typeof fetch,l=Zn(s),r=Zn(a);if(!n)return!1;const i=n&&Zn(tl),o=n&&("function"===typeof sl?(c=new sl,e=>c.encode(e)):async e=>new Uint8Array(await new s(e).arrayBuffer()));var c;const u=l&&i&&al(()=>{let e=!1;const t=new s(hn.origin,{body:new tl,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),m=r&&i&&al(()=>Ha.isReadableStream(new a("").body)),h={stream:m&&(e=>e.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,s)=>{let a=t&&t[e];if(a)return a.call(t);throw new $a("Response type '".concat(e,"' is not supported"),$a.ERR_NOT_SUPPORT,s)})});const x=async(e,t)=>{const a=Ha.toFiniteNumber(e.getContentLength());return null==a?(async e=>{if(null==e)return 0;if(Ha.isBlob(e))return e.size;if(Ha.isSpecCompliantForm(e)){const t=new s(hn.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Ha.isArrayBufferView(e)||Ha.isArrayBuffer(e)?e.byteLength:(Ha.isURLSearchParams(e)&&(e+=""),Ha.isString(e)?(await o(e)).byteLength:void 0)})(t):a};return async e=>{let{url:n,method:r,data:i,signal:o,cancelToken:c,timeout:p,onDownloadProgress:g,onUploadProgress:f,responseType:v,headers:b,withCredentials:j="same-origin",fetchOptions:y}=In(e),N=t||fetch;v=v?(v+"").toLowerCase():"text";let w=Un([o,c&&c.toAbortSignal()],p),C=null;const k=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let D;try{if(f&&u&&"get"!==r&&"head"!==r&&0!==(D=await x(b,i))){let e,t=new s(n,{method:"POST",body:i,duplex:"half"});if(Ha.isFormData(i)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,s]=Tn(D,Fn(zn(f)));i=Xn(t.body,65536,e,s)}}Ha.isString(j)||(j=j?"include":"omit");const t=l&&"credentials"in s.prototype,o=d(d({},y),{},{signal:w,method:r.toUpperCase(),headers:b.normalize().toJSON(),body:i,duplex:"half",credentials:t?j:void 0});C=l&&new s(n,o);let c=await(l?N(C,y):N(n,o));const p=m&&("stream"===v||"response"===v);if(m&&(g||p&&k)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=Ha.toFiniteNumber(c.headers.get("content-length")),[s,n]=g&&Tn(t,Fn(zn(g),!0))||[];c=new a(Xn(c.body,65536,s,()=>{n&&n(),k&&k()}),e)}v=v||"text";let _=await h[Ha.findKey(h,v)||"text"](c,e);return!p&&k&&k(),await new Promise((t,s)=>{Sn(t,s,{data:_,headers:wn.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:C})})}catch(_){if(k&&k(),_&&"TypeError"===_.name&&/Load failed|fetch/i.test(_.message))throw Object.assign(new $a("Network Error",$a.ERR_NETWORK,e,C),{cause:_.cause||_});throw $a.from(_,_&&_.code,e,C)}}},ll=new Map,rl=e=>{let t=e&&e.env||{};const{fetch:s,Request:a,Response:n}=t,l=[a,n,s];let r,i,o=l.length,c=ll;for(;o--;)r=l[o],i=c.get(r),void 0===i&&c.set(r,i=o?new Map:nl(t)),c=i;return i},il=(rl(),{http:null,xhr:On,fetch:{get:rl}}
2);Ha.forEach(il,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(G2){}Object.defineProperty(e,"adapterName",{value:t})}});const ol=e=>"- ".concat(e),cl=e=>Ha.isFunction(e)||null===e||!1===e;const dl={getAdapter:function(e,t){e=Ha.isArray(e)?e:[e];const{length:s}=e;let a,n;const l={};for(let r=0;r<s;r++){let s;if(a=e[r],n=a,!cl(a)&&(n=il[(s=String(a)).toLowerCase()],void 0===n))throw new $a("Unknown adapter '".concat(s,"'"));if(n&&(Ha.isFunction(n)||(n=n.get(t))))break;l[s||"#"+r]=n}if(!n){const e=Object.entries(l).map(e=>{let[t,s]=e;return"adapter ".concat(t," ")+(!1===s?"is not supported by the environment":"is not available in the build")});let t=s?e.length>1?"since :\n"+e.map(ol).join("\n"):" "+ol(e[0]):"as no adapter specified";throw new $a("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return n},adapters:il};function ul(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _n(null,e)}function ml(e){ul(e),e.headers=wn.from(e.headers),e.data=Cn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return dl.getAdapter(e.adapter||gn.adapter,e)(e).then(function(t){return ul(e),t.data=Cn.call(e,e.transformResponse,t),t.headers=wn.from(t.headers),t},function(t){return kn(t)||(ul(e),t&&t.response&&(t.response.data=Cn.call(e,e.transformResponse,t.response),t.response.headers=wn.from(t.response.headers))),Promise.reject(t)})}const hl="1.13.2",xl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{xl[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const pl={};xl.transitional=function(e,t,s){function a(e,t){return"[Axios v"+hl+"] Transitional option '"+e+"'"+t+(s?". "+s:"")}return(s,n,l)=>{if(!1===e)throw new $a(a(n," has been removed"+(t?" in "+t:"")),$a.ERR_DEPRECATED);return t&&!pl[n]&&(pl[n]=!0,console.warn(a(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(s,n,l)}},xl.spelling=function(e){return(t,s)=>(console.warn("".concat(s," is likely a misspelling of ").concat(e)),!0)};const gl={assertOptions:function(e,t,s){if("object"!==typeof e)throw new $a("options must be an object",$a.ERR_BAD_OPTION_VALUE);const a=Object.keys(e);let n=a.length;for(;n-- >0;){const l=a[n],r=t[l];if(r){const t=e[l],s=void 0===t||r(t,l,e);if(!0!==s)throw new $a("option "+l+" must be "+s,$a.ERR_BAD_OPTION_VALUE);continue}if(!0!==s)throw new $a("Unknown option "+l,$a.ERR_BAD_OPTION)}},validators:xl},fl=gl.validators;class vl{constructor(e){this.defaults=e||{},this.interceptors={request:new nn,response:new nn}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{s.stack?t&&!String(s.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(s.stack+="\n"+t):s.stack=t}catch(G2){}}throw s}}_request(e,t){"string"===typeof e?(t=t||{}).url=e:t=e||{},t=Ln(this.defaults,t);const{transitional:s,paramsSerializer:a,headers:n}=t;void 0!==s&&gl.assertOptions(s,{silentJSONParsing:fl.transitional(fl.boolean),forcedJSONParsing:fl.transitional(fl.boolean),clarifyTimeoutError:fl.transitional(fl.boolean)},!1),null!=a&&(Ha.isFunction(a)?t.paramsSerializer={serialize:a}:gl.assertOptions(a,{encode:fl.function,serialize:fl.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),gl.assertOptions(t,{baseUrl:fl.spelling("baseURL"),withXsrfToken:fl.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let l=n&&Ha.merge(n.common,n[t.method]);
vendor: 2,411 bytes, line 2
2n&&Ha.forEach(["delete","get","head","post","put","patch","common"],e=>{delete n[e]}),t.headers=wn.concat(l,n);const r=[];let i=!0;this.interceptors.request.forEach(function(e){"function"===typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))});const o=[];let c;this.interceptors.response.forEach(function(e){o.push(e.fulfilled,e.rejected)});let d,u=0;if(!i){const e=[ml.bind(this),void 0];for(e.unshift(...r),e.push(...o),d=e.length,c=Promise.resolve(t);u<d;)c=c.then(e[u++],e[u++]);return c}d=r.length;let m=t;for(;u<d;){const e=r[u++],t=r[u++];try{m=e(m)}catch(h){t.call(this,h);break}}try{c=ml.call(this,m)}catch(h){return Promise.reject(h)}for(u=0,d=o.length;u<d;)c=c.then(o[u++],o[u++]);return c}getUri(e){return an(Bn((e=Ln(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}Ha.forEach(["delete","get","head","options"],function(e){vl.prototype[e]=function(t,s){return this.request(Ln(s||{},{method:e,url:t,data:(s||{}).data}))}}),Ha.forEach(["post","put","patch"],function(e){function t(t){return function(s,a,n){return this.request(Ln(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}vl.prototype[e]=t(),vl.prototype[e+"Form"]=t(!0)});const bl=vl;class jl{constructor(e){if("function"!==typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const s=this;this.promise.then(e=>{if(!s._listeners)return;let t=s._listeners.length;for(;t-- >0;)s._listeners[t](e);s._listeners=null}),this.promise.then=e=>{let t;const a=new Promise(e=>{s.subscribe(e),t=e}).then(e);return a.cancel=function(){s.unsubscribe(t)},a},e(function(e,a,n){s.reason||(s.reason=new _n(e,a,n),t(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new jl(function(t){e=t}),cancel:e}}}const yl=jl;const Nl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
2alContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Nl).forEach(e=>{let[t,s]=e;Nl[s]=t});const wl=Nl;const Cl=function e(t){const s=new bl(t),a=sa(bl.prototype.request,s);return Ha.extend(a,bl.prototype,s,{allOwnKeys:!0}),Ha.extend(a,s,null,{allOwnKeys:!0}),a.create=function(s){return e(Ln(t,s))},a}(gn);Cl.Axios=bl,Cl.CanceledError=_n,Cl.CancelToken=yl,Cl.isCancel=kn,Cl.VERSION=hl,Cl.toFormData=Qa,Cl.AxiosError=$a,Cl.Cancel=Cl.CanceledError,Cl.all=function(e){return Promise.all(e)},Cl.spread=function(e){return function(t){return e.apply(null,t)}},Cl.isAxiosError=function(e){return Ha.isObject(e)&&!0===e.isAxiosError},Cl.mergeConfig=Ln,Cl.AxiosHeaders=wn,Cl.formToJSON=e=>xn(Ha.isHTMLForm(e)?new FormData(e):e),Cl.getAdapter=dl.getAdapter,Cl.HttpStatusCode=wl,Cl.default=Cl;const kl=Cl,Dl=kl.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});Dl.interceptors.request.use(e=>{const t=localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer ".concat(t)),e}),Dl.interceptors.response.use(e=>e,e=>{var t;if(401===(null===(t=e.response)||void 0===t?void 0:t.status)){const e="true"===localStorage.getItem("impersonating"),t=localStorage.getItem("original_token"),s=localStorage.getItem("original_user");e&&t&&s?(localStorage.setItem("token",t),localStorage.setItem("user",s),localStorage.removeItem("impersonating"),localStorage.removeItem("original_token"),localStorage.removeItem("original_user"),window.location.href="/users?error=impersonation_failed"):window.location.pathname.includes("/login")||(localStorage.removeItem("token"),localStorage.removeItem("user"),localStorage.removeItem("impersonating"),localStorage.removeItem("original_token"),localStorage.removeItem("original_user"),window.location.href="/login")}return Promise.reject(e)});const _l=Dl,Sl=(0,t.createContext)(),El=e=>{let{children:s}=e;const[a,n]=(0,t.useState)(null),[l,r]=(0,t.useState)(!0),[i,o]=(0,t.useState)(!1);(0,t.useEffect)(()=>{const e=localStorage.getItem("token"),t=localStorage.getItem("user"),s="true"===localStorage.getItem("impersonating");e&&t?(n(JSON.parse(t)),o(s),r(!1)):r(!1)},[]);return(0,ea.jsx)(Sl.Provider,{value:{user:a,login:async(e,t)=>{const s=(await _l.post("/auth/login",{email:e,password:t})).data;if(s.requires_2fa)return{requires_2fa:!0,temp_token:s.temp_token,message:s.message};const{access_token:a,user:l}=s;return localStorage.setItem("token",a),localStorage.setItem("user",JSON.stringify(l)),localStorage.removeItem("impersonating"),localStorage.removeItem("original_token"),localStorage.removeItem("original_user"),n(l),o(!1),l},register:async function(e,t,s,a){let l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const r=localStorage.getItem("nexuscms_ref")||null,i=await _l.post("/auth/register",{email:e,password:t,full_name:s,tenant_name:a,referral_code:r,plan:l}),{access_token:o,user:c}=i.data;return localStorage.setItem("token",o),localStorage.setItem("user",JSON.stringify(c)),localStorage.removeItem("nexuscms_ref"),n(c),c},logout:()=>{localStorage.removeItem("token"),localStorage.removeItem("user"),localStorage.removeItem("impersonating"),localStorage.removeItem("original_token"),localStorage.removeItem("original_user"),n(null),o(!1),window.location.href="/login"},loading:l,verify2FA:async(e,t)=>{const s=await _l.post("/auth/verify-2fa",{temp_token:e,code:t}),{access_token:a,user:l,warning:r}=s.data;return localStorage.setItem("token",a),localStorage.setItem("user",JSON.stringify(l)),n(l),{user:l,warning:r}},isImpersonating:i,startImpersonation:(e,t)=>{const s=localStorage.getItem("token"),a=localStorage.getItem("user");localStorage.setItem("original_token",s),localStorage.setItem("original_user",a),localStorage.setItem("impersonating","true"),localStorage.setItem("token",e),localStorage.setItem("user",JSON.stringify(t)),n(t),o(!0)},stopImpersonation:()=>{const e=localStorage.getItem("original_token"),t=localStorage.getItem("original_user");e&&t&&(localStorage.setItem("token",e),localStorage.setItem("user",t),localStorage.removeItem("impersonating"),localStorage.removeItem("original_token"),localStorage.removeItem("original_user"),n(JSON.parse(t)),o(!1),window.location.href="/users")},setToken:e=>{localStorage.setItem("token",e)},updateUser:e=>{localStorage.setItem("user",JSON.stringify(e)),n(e)}},children:s})},Al=()=>{const e=(0,t.useContext)(Sl);if(!e)throw new Error("useAuth must be used within AuthProvider");return e},Fl={company_name:"Nexus CMS",logo_url:null,favicon_url:null,primary_color:"#4F46E5",secondary_color:"#7C3AED",support_email:"[email protected]",is_reseller:!1,reseller_slug:null},Tl="".concat("","/favicon.png"),zl=["www","app","preview","api","localhost","eu","au","us","ap","staging","dev"],Ml=e=>{if("undefined"===typeof document)return;["icon","shortcut icon","apple-touch-icon"].forEach(t=>{let s=document.querySelector('link[rel="'.concat(t,'"]'));s||(s=document.createElement("link"),s.rel=t,document.head.appendChild(s)),s.href=e})},Pl=(0,t.createContext)({branding:Fl,loading:!0,isReseller:!1,refreshBranding:()=>{}}),Bl=()=>(0,t.useContext)(Pl),Rl=e=>{let{children:s}=e;const[a,n]=(0,t.useState)(Fl),[l,r]=(0,t.useState)(!0),i=()=>{const e=window.location.hostname;if((e=>{const t=(e||"").toLowerCase();if(!t.includes("nexuscms"))return!1;const s=t.split(".");return s.length<=2||3===s.length&&zl.includes(s[0])})(e)){localStorage.removeItem("reseller_slug");return new URLSearchParams(window.location.search).get("reseller")||null}const t=new URLSearchParams(window.location.search).get("reseller");if(t)return localStorage.setItem("reseller_slug",t),t;const s=localStorage.getItem("reseller_slug");if(s)return s;const a=e.split(".");if(e.includes("nexuscms")&&a.length>=3){const e=a[0];if(!zl.includes(e)&&!e.includes("contentfusion"))return e}return null},o=async()=>{r(!0);try{const t=i();if(t){const e=await _l.get("/branding?reseller=".concat(t));e.data&&e.data.is_reseller?(n(d(d({},Fl),e.data)),m(e.data.favicon_url||Tl),e.data.company_name&&(document.title=e.data.company_name)):(u(),n(Fl),m(Tl))}else{const t=window.location.hostname;if(!t.includes("nexuscms")&&!t.includes("localhost")&&!t.includes("preview.emergentagent")&&!t.includes("127.0.0.1"))try{const e=await _l.get("/branding?domain=".concat(t));if(e.data&&e.data.is_reseller&&e.data.company_name)return n(d(d({},Fl),e.data)),m(e.data.favicon_url||Tl),void(e.data.company_name&&(document.title=e.data.company_name))}catch(e){}await c()||(n(Fl),m(Tl))}}catch(t){console.error("Failed to fetch branding:",t),u(),n(Fl),m(Tl)}finally{r(!1)}},c=async()=>
2{if(!("undefined"!==typeof localStorage&&localStorage.getItem("token")||null))return!1;try{var e;const t=await _l.get("/branding/me");if(null!==t&&void 0!==t&&null!==(e=t.data)&&void 0!==e&&e.is_reseller)return n(d(d({},Fl),t.data)),m(t.data.favicon_url||Tl),t.data.company_name&&(document.title=t.data.company_name),!0}catch(G2){}return!1},u=()=>{localStorage.removeItem("reseller_slug")},m=e=>{Ml(e)},h=async()=>{if("undefined"!==typeof localStorage&&localStorage.getItem("token")||null){try{var e;const t=await _l.get("/tenant/branding");null!==t&&void 0!==t&&null!==(e=t.data)&&void 0!==e&&e.favicon_url&&Ml(t.data.favicon_url)}catch(G2){}try{var t;const e=await _l.get("/theme"),s=null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.primary_color;s&&(e=>{if("undefined"===typeof document||!e)return;let t=document.querySelector('meta[name="theme-color"]');t||(t=document.createElement("meta"),t.setAttribute("name","theme-color"),document.head.appendChild(t)),t.setAttribute("content",e)})(s)}catch(G2){}}};return(0,t.useEffect)(()=>{(async()=>{await o(),await h()})()},[]),(0,ea.jsx)(Pl.Provider,{value:{branding:a,loading:l,isReseller:a.is_reseller,refreshBranding:()=>{o(),h()},clearReseller:()=>{u(),n(Fl),document.title="Nexus CMS"}},children:s})},Ll=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,s)=>s?s.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Il=function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter((e,t,s)=>Boolean(e)&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var Ol={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"};const Ul=["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"],Hl=(0,t.forwardRef)((e,s)=>{let{color:a="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:o="",children:c,iconNode:u}=e,m=l(e,Ul);return(0,t.createElement)("svg",d(d(d({ref:s},Ol),{},{width:n,height:n,stroke:a,strokeWidth:i?24*Number(r)/Number(n):r,className:Il("lucide",o)},!c&&!(e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(m)&&{"aria-hidden":"true"}),m),[...u.map(e=>{let[s,a]=e;return(0,t.createElement)(s,a)}),...Array.isArray(c)?c:[c]])}),Wl=["className"],Vl=(e,s)=>{const a=(0,t.forwardRef)((a,n)=>{let{className:r}=a,i=l(a,Wl);return(0,t.createElement)(Hl,d({ref:n,iconNode:s,className:Il("lucide-".concat((o=Ll(e),o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())),"lucide-".concat(e),r)},i));var o});return a.displayName=Ll(e),a},ql=Vl("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),$l=Vl("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"}]]),Gl=Vl("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"}]]),Kl=Vl("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"}]]),Yl=Vl("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]),Jl=Vl("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"}]]),Ql=Vl("map-pin",[["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"}]]),Xl=Vl("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),Zl=Vl("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"}]]),er=Vl("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),tr=Vl("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),sr=Vl("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
2],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ar=Vl("menu",[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]]),nr=Vl("facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]),lr=Vl("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"}]]),rr=Vl("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"}]]),ir=Vl("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"}]]),or=Vl("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"}]]),cr=Vl("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),dr=Vl("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"}]]),ur=["size","className"],mr=e=>{let{size:t=24,className:s=""}=e,a=l(e,ur);return(0,ea.jsx)("svg",d(d({width:t,height:t,viewBox:"0 0 600 530",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:s},a),{},{children:(0,ea.jsx)("path",{d:"M135.72 44.03C202.216 93.951 273.74 195.17 300 249.49c26.262-54.316 97.782-155.54 164.28-205.46C512.26 8.009 590-19.862 590 68.825c0 17.712-10.155 148.79-16.111 170.07-20.703 73.984-96.144 92.854-163.25 81.433 117.3 19.964 147.14 86.092 82.697 152.22-122.39 125.59-175.91-31.511-189.63-71.766-2.514-7.38-3.69-10.832-3.708-7.896-.017-2.936-1.193.516-3.707 7.896-13.714 40.255-67.233 197.36-189.63 71.766-64.444-66.128-34.605-132.26 82.697-152.22-67.108 11.421-142.55-7.449-163.25-81.433C20.15 217.613 10 86.536 10 68.824c0-88.687 77.742-60.816 125.72-24.795z"})}))},hr=Vl("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"}]]);"undefined"===typeof window||!window.document||window.document.createElement;function xr(e,t){let{checkForDefaultPrevented:s=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(a){if(null===e||void 0===e||e(a),!1===s||!a.defaultPrevented)return null===t||void 0===t?void 0:t(a)}}function pr(e,t){if("function"===typeof e)return e(t);null!==e&&void 0!==e&&(e.current=t)}function gr(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return e=>{let s=!1;const a=t.map(t=>{const a=pr(t,e);return s||"function"!=typeof a||(s=!0),a});if(s)return()=>{for(let e=0;e<a.length;e++){const s=a[e];"function"==typeof s?s():pr(t[e],null)}}}}function fr(){for(var e=arguments.length,s=new Array(e),a=0;a<e;a++)s[a]=arguments[a];return t.useCallback(gr(...s),s)}const vr=["children"],br=["scope","children"];function jr(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=[];const n=()=>{const s=a.map(e=>t.createContext(e));return function(a){const n=(null===a||void 0===a?void 0:a[e])||s;return t.useMemo(()=>({["__scope".concat(e)]:d(d({},a),{},{[e]:n})}),[a,n])}};return n.scopeName=e,[function(s,n){const r=t.createContext(n),i=a.length;a=[...a,n];const o=s=>{var a;const{scope:n,children:o}=s,c=l(s,br),d=(null===n||void 0===n||null===(a=n[e])||void 0===a?void 0:a[i])||r,u=t.useMemo(()=>c,Object.values(c));return(0,ea.jsx)(d.Provider,{value:u,children:o})};return o.displayName=s+"Provider",[o,function(a,l){var o;const c=(null===l||void 0===l||null===(o=l[e])||void 0===o?void 0:o[i])||r,d=t.useContext(c);if(d)return d;if(void 0!==n)return n;throw new Error("`".concat(a,"` must be used within `").concat(s,"`"))}]},yr(n,...s)]}function yr(){for(var e=arguments.length,s=new Array(e),a=0;a<e;a++)s[a]=arguments[a];const n=s[0];if(1===s.length)return n;const l=()=>{const e=s.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(s){const a=e.reduce((e,t)=>
2{let{useScope:a,scopeName:n}=t;const l=a(s)["__scope".concat(n)];return d(d({},e),l)},{});return t.useMemo(()=>({["__scope".concat(n.scopeName)]:a}),[a])}};return l.scopeName=n.scopeName,l}var Nr=null!==globalThis&&void 0!==globalThis&&globalThis.document?t.useLayoutEffect:()=>{},wr=a[" useInsertionEffect ".trim().toString()]||Nr;function Cr(e){let{prop:s,defaultProp:a,onChange:n=()=>{},caller:l}=e;const[r,i,o]=function(e){let{defaultProp:s,onChange:a}=e;const[n,l]=t.useState(s),r=t.useRef(n),i=t.useRef(a);return wr(()=>{i.current=a},[a]),t.useEffect(()=>{var e;r.current!==n&&(null===(e=i.current)||void 0===e||e.call(i,n),r.current=n)},[n,r]),[n,l,i]}({defaultProp:a,onChange:n}),c=void 0!==s,d=c?s:r;{const e=t.useRef(void 0!==s);t.useEffect(()=>{const t=e.current;if(t!==c){const e=t?"controlled":"uncontrolled",s=c?"controlled":"uncontrolled";console.warn("".concat(l," is changing from ").concat(e," to ").concat(s,". 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."))}e.current=c},[c,l])}const u=t.useCallback(e=>{if(c){const a=function(e){return"function"===typeof e}(e)?e(s):e;var t;if(a!==s)null===(t=o.current)||void 0===t||t.call(o,a)}else i(e)},[c,s,i,o]);return[d,u]}Symbol("RADIX:SYNC_STATE");const kr=["children"],Dr=["children"];function _r(e){const s=Sr(e),a=t.forwardRef((e,a)=>{const{children:n}=e,r=l(e,kr),i=t.Children.toArray(n),o=i.find(Ar);if(o){const e=o.props.children,n=i.map(s=>s===o?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:s);return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null}))}return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:n}))});return a.displayName="".concat(e,".Slot"),a}function Sr(e){const s=t.forwardRef((e,s)=>{const{children:a}=e,n=l(e,Dr);if(t.isValidElement(a)){const e=function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),l=function(e,t){const s=d({},t);for(const a in t){const n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?s[a]=function(){const e=l(...arguments);return n(...arguments),e}:n&&(s[a]=n):"style"===a?s[a]=d(d({},n),l):"className"===a&&(s[a]=[n,l].filter(Boolean).join(" "))}return d(d({},e),s)}(n,a.props);return a.type!==t.Fragment&&(l.ref=s?gr(s,e):e),t.cloneElement(a,l)}return t.Children.count(a)>1?t.Children.only(null):null});return s.displayName="".concat(e,".SlotClone"),s}var Er=Symbol("radix.slottable");function Ar(e){return t.isValidElement(e)&&"function"===typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Er}const Fr=["asChild"];var Tr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,s)=>{const a=_r("Primitive.".concat(s)),n=t.forwardRef((e,t)=>{const{asChild:n}=e,r=l(e,Fr),i=n?a:s;return"undefined"!==typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ea.jsx)(i,d(d({},r),{},{ref:t}))});return n.displayName="Primitive.".concat(s),d(d({},e),{},{[s]:n})},{});function zr(e,t){e&&Ts.flushSync(()=>e.dispatchEvent(t))}function Mr(e,t,s){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,s)}function Pr(e,t,s){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:s;throw new TypeError("Private element is not present on this object")}function Br(e,t){return e.get(Pr(e,t))}function Rr(e,t,s){return e.set(Pr(e,t),s),s}const Lr=["children"],Ir=["children"];function Or(e){const s=Ur(e),a=t.forwardRef((e,a)=>{const{children:n}=e,r=l(e,Lr),i=t.Children.toArray(n),o=i.find(Vr);if(o){const e=o.props.children,n=i.map(s=>s===o?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:s);return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null}))}return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:n}))});return a.displayName="".concat(e,".Slot"),a}function Ur(e){const s=t.forwardRef((e,s)=>{const{children:a}=e,n=l(e,Ir);if(t.isValidElement(a)){const e=function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),l=function(e,t){const s=d({},t);for(const a in t){const n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?s[a]=function(){const e=l(...arguments);return n(...arguments),e}:n&&(s[a]=n):"style"===a?s[a]=d(d({}
2,n),l):"className"===a&&(s[a]=[n,l].filter(Boolean).join(" "))}return d(d({},e),s)}(n,a.props);return a.type!==t.Fragment&&(l.ref=s?gr(s,e):e),t.cloneElement(a,l)}return t.Children.count(a)>1?t.Children.only(null):null});return s.displayName="".concat(e,".SlotClone"),s}var Hr=Symbol("radix.slottable");var Wr;function Vr(e){return t.isValidElement(e)&&"function"===typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Hr}const qr=["scope","children"];function $r(e){const s=e+"CollectionProvider",[a,n]=jr(s),[r,i]=a(s,{collectionRef:{current:null},itemMap:new Map}),o=e=>{const{scope:s,children:a}=e,n=t.useRef(null),l=t.useRef(new Map).current;return(0,ea.jsx)(r,{scope:s,itemMap:l,collectionRef:n,children:a})};o.displayName=s;const c=e+"CollectionSlot",u=Or(c),m=t.forwardRef((e,t)=>{const{scope:s,children:a}=e,n=fr(t,i(c,s).collectionRef);return(0,ea.jsx)(u,{ref:n,children:a})});m.displayName=c;const h=e+"CollectionItemSlot",x="data-radix-collection-item",p=Or(h),g=t.forwardRef((e,s)=>{const{scope:a,children:n}=e,r=l(e,qr),o=t.useRef(null),c=fr(s,o),u=i(h,a);return t.useEffect(()=>(u.itemMap.set(o,d({ref:o},r)),()=>{u.itemMap.delete(o)})),(0,ea.jsx)(p,d(d({},{[x]:""}),{},{ref:c,children:n}))});return g.displayName=h,[{Provider:o,Slot:m,ItemSlot:g},function(s){const a=i(e+"CollectionConsumer",s);return t.useCallback(()=>{const e=a.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll("[".concat(x,"]")));return Array.from(a.itemMap.values()).sort((e,s)=>t.indexOf(e.ref.current)-t.indexOf(s.ref.current))},[a.collectionRef,a.itemMap])},n]}var Gr=new WeakMap;Wr=new WeakMap,Map;function Kr(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const s=function(e,t){const s=e.length,a=Yr(t),n=a>=0?a:s+a;return n<0||n>=s?-1:n}(e,t);return-1===s?void 0:e[s]}function Yr(e){return e!==e||0===e?0:Math.trunc(e)}var Jr=t.createContext(void 0);function Qr(e){const s=t.useContext(Jr);return e||s||"ltr"}function Xr(e){const s=t.useRef(e);return t.useEffect(()=>{s.current=e}),t.useMemo(()=>function(){for(var e,t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];return null===(e=s.current)||void 0===e?void 0:e.call(s,...a)},[])}const Zr=["disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss"];var ei,ti="dismissableLayer.update",si="dismissableLayer.pointerDownOutside",ai="dismissableLayer.focusOutside",ni=t.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),li=t.forwardRef((e,s)=>{var a;const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:c,onDismiss:u}=e,m=l(e,Zr),h=t.useContext(ni),[x,p]=t.useState(null),g=null!==(a=null===x||void 0===x?void 0:x.ownerDocument)&&void 0!==a?a:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,f]=t.useState({}),v=fr(s,e=>p(e)),b=Array.from(h.layers),[j]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(j),N=x?b.indexOf(x):-1,w=h.layersWithOutsidePointerEventsDisabled.size>0,C=N>=y,k=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===globalThis||void 0===globalThis?void 0:globalThis.document;const a=Xr(e),n=t.useRef(!1),l=t.useRef(()=>{});return t.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let t=function(){oi(si,a,n,{discrete:!0})};const n={originalEvent:e};"touch"===e.pointerType?(s.removeEventListener("click",l.current),l.current=t,s.addEventListener("click",l.current,{once:!0})):t()}else s.removeEventListener("click",l.current);n.current=!1},t=window.setTimeout(()=>{s.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),s.removeEventListener("pointerdown",e),s.removeEventListener("click",l.current)}},[s,a]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,s=[...h.branches].some(e=>e.contains(t));C&&!s&&(null===i||void 0===i||i(e),null===c||void 0===c||c(e),e.defaultPrevented||null===u||void 0===u||u())},g),D=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===globalThis||void 0===globalThis?void 0:globalThis.document;const a=Xr(e),n=t.useRef(!1);return t.useEffect(()=>{const e=e=>{if(e.target&&!n.current){oi(ai,a,{originalEvent:e},{discrete:!1})}};return s.addEventListener("focusin",e),()=>s.removeEventListener("focusin",e)},[s,a]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...h.branches].some(e=>e.contains(t))||(null===o||void 0===o||o(e),null===c||void 0===c||c(e),e.defaultPrevented||null===u||void 0===u||u())},g);return function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===globalThis||void 0===globalThis?void 0:globalThis.document;const a=Xr(e);t.useEffect(()=>{const e=e=>{"Escape"===e.key&&a(e)};return s.addEventListener("keydown",e,{capture:!0}),()=>s.removeEventListener("keydown",e,{capture:!0})},[a,s])}(e=>{N===h.layers.size-1&&(null===r||void 0===r||r(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))},g),t.useEffect(()=>{if(x)return n&&(0===h.layersWithOutsidePointerEventsDisabled.size&&(ei=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(x)),h.layers.add(x),ii(),()=>{n&&1===h.layersWithOutsidePointerEventsDisabled.size&&(g.body.style.pointerEvents=ei)}},[x,g,n,h]),t.useEffect(()=>()=>{x&&(h.layers.delete(x),h.layersWithOutsidePointerEventsDisabled.delete(x),ii())},[x,h]),t.useEffect(()=>{const e=()=>f({});return document.addEventListener(ti,e),()=>document.removeEventListener(ti,e)},[]),(0,ea.jsx)(Tr.div,d(d({},m),{},{ref:v,style:d({pointerEvents:w?C?"auto":"none":void 0},e.style),onFocusCapture:xr(e.onFocusCapture,D.onFocusCapture),onBlurCapture:xr(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:xr(e.onPointerDownCapture,k.onPointerDownCapture)}))});li.displayName="DismissableLayer";var ri=t.forwardRef((e,s)=>{const a=t.useContext(ni),n=t.useRef(null),l=fr(s,n);return t.useEffect(()=>{const e=n.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),(0,ea.jsx)(Tr.div,d(d({},e),{},{ref:l}))});function ii(){const e=new CustomEvent(ti);document.dispatchEvent(e)}function oi(e,t,s,a){let{discrete:n}=a;const l=s.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:s});t&&l.addEventListener(e,t,{once:!0}),n?zr(l,r):l.dispatchEvent(r)}ri.displayName="DismissableLayerBranch";var ci=0;function di(){t.useEffect(()=>{var e,t;const s=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=s[0])&&void 0!==e?e:ui()),document.body.insertAdjacentElement("beforeend",null!==(t=s[1])&&void 0!==t?t:ui()),ci++,()=>{1===ci&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e
2=>e.remove()),ci--}},[])}function ui(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}const mi=["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"];var hi="focusScope.autoFocusOnMount",xi="focusScope.autoFocusOnUnmount",pi={bubbles:!1,cancelable:!0},gi=t.forwardRef((e,s)=>{const{loop:a=!1,trapped:n=!1,onMountAutoFocus:r,onUnmountAutoFocus:i}=e,o=l(e,mi),[c,u]=t.useState(null),m=Xr(r),h=Xr(i),x=t.useRef(null),p=fr(s,e=>u(e)),g=t.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;t.useEffect(()=>{if(n){let e=function(e){if(g.paused||!c)return;const t=e.target;c.contains(t)?x.current=t:ji(x.current,{select:!0})},t=function(e){if(g.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||ji(x.current,{select:!0}))},s=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&ji(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const a=new MutationObserver(s);return c&&a.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),a.disconnect()}}},[n,c,g.paused]),t.useEffect(()=>{if(c){yi.add(g);const t=document.activeElement;if(!c.contains(t)){const s=new CustomEvent(hi,pi);c.addEventListener(hi,m),c.dispatchEvent(s),s.defaultPrevented||(!function(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=document.activeElement;for(const a of e)if(ji(a,{select:t}),document.activeElement!==s)return}((e=fi(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&ji(c))}return()=>{c.removeEventListener(hi,m),setTimeout(()=>{const e=new CustomEvent(xi,pi);c.addEventListener(xi,h),c.dispatchEvent(e),e.defaultPrevented||ji(null!==t&&void 0!==t?t:document.body,{select:!0}),c.removeEventListener(xi,h),yi.remove(g)},0)}}var e},[c,m,h,g]);const f=t.useCallback(e=>{if(!a&&!n)return;if(g.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,s=document.activeElement;if(t&&s){const t=e.currentTarget,[n,l]=function(e){const t=fi(e),s=vi(t,e),a=vi(t.reverse(),e);return[s,a]}(t);n&&l?e.shiftKey||s!==l?e.shiftKey&&s===n&&(e.preventDefault(),a&&ji(l,{select:!0})):(e.preventDefault(),a&&ji(n,{select:!0})):s===t&&e.preventDefault()}},[a,n,g.paused]);return(0,ea.jsx)(Tr.div,d(d({tabIndex:-1},o),{},{ref:p,onKeyDown:f}))});function fi(e){const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function vi(e,t){for(const s of e)if(!bi(s,{upTo:t}))return s}function bi(e,t){let{upTo:s}=t;if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==s&&e===s)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function ji(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&e.focus){const s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}gi.displayName="FocusScope";var yi=function(){let e=[];return{add(t){const s=e[0];t!==s&&(null===s||void 0===s||s.pause()),e=Ni(e,t),e.unshift(t)},remove(t){var s;e=Ni(e,t),null===(s=e[0])||void 0===s||s.resume()}}}();function Ni(e,t){const s=[...e],a=s.indexOf(t);return-1!==a&&s.splice(a,1),s}var wi=a[" useId ".trim().toString()]||(()=>{}),Ci=0;function ki(e){const[s,a]=t.useState(wi());return Nr(()=>{e||a(e=>null!==e&&void 0!==e?e:String(Ci++))},[e]),e||(s?"radix-".concat(s):"")}const Di=["top","right","bottom","left"],_i=Math.min,Si=Math.max,Ei=Math.round,Ai=Math.floor,Fi=e=>({x:e,y:e}),Ti={left:"right",right:"left",bottom:"top",top:"bottom"},zi={start:"end",end:"start"};function Mi(e,t,s){return Si(e,_i(t,s))}function Pi(e,t){return"function"===typeof e?e(t):e}function Bi(e){return e.split("-")[0]}function Ri(e){return e.split("-")[1]}function Li(e){return"x"===e?"y":"x"}function Ii(e){return"y"===e?"height":"width"}const Oi=new Set(["top","bottom"]);function Ui(e){return Oi.has(Bi(e))?"y":"x"}function Hi(e){return Li(Ui(e))}function Wi(e){return e.replace(/start|end/g,e=>zi[e])}const Vi=["left","right"],qi=["right","left"],$i=["top","bottom"],Gi=["bottom","top"];function Ki(e,t,s,a){const n=Ri(e);let l=function(e,t,s){switch(e){case"top":case"bottom":return s?t?qi:Vi:t?Vi:qi;case"left":case"right":return t?$i:Gi;default:return[]}}(Bi(e),"start"===s,a);return n&&(l=l.map(e=>e+"-"+n),t&&(l=l.concat(l.map(Wi)))),l}function Yi(e){return e.replace(/left|right|bottom|top/g,e=>Ti[e])}function Ji(e){return"number"!==typeof e?function(e){return d({top:0,right:0,bottom:0,left:0},e)}(e):{top:e,right:e,bottom:e,left:e}}function Qi(e){const{x:t,y:s,width:a,height:n}=e;return{width:a,height:n,top:s,left:t,right:t+a,bottom:s+n,x:t,y:s}}const Xi=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],Zi=["strategy"],eo=["mainAxis","crossAxis","limiter"],to=["apply"];function so(e,t,s){let{reference:a,floating:n}=e;const l=Ui(t),r=Hi(t),i=Ii(r),o=Bi(t),c="y"===l,d=a.x+a.width/2-n.width/2,u=a.y+a.height/2-n.height/2,m=a[i]/2-n[i]/2;let h;switch(o){case"top":h={x:d,y:a.y-n.height};break;case"bottom":h={x:d,y:a.y+a.height};break;case"right":h={x:a.x+a.width,y:u};break;case"left":h={x:a.x-n.width,y:u};break;default:h={x:a.x,y:a.y}}switch(Ri(t)){case"start":h[r]-=m*(s&&c?-1:1);break;case"end":h[r]+=m*(s&&c?-1:1)}return h}async function ao(e,t){var s;void 0===t&&(t={});const{x:a,y:n,platform:l,rects:r,elements:i,strategy:o}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:m=!1,padding:h=0}=Pi(t,e),x=Ji(h),p=i[m?"floating"===u?"reference":"floating":u],g=Qi(await l.getClippingRect
vendor: 5,019 bytes, line 2
2({element:null==(s=await(null==l.isElement?void 0:l.isElement(p)))||s?p:p.contextElement||await(null==l.getDocumentElement?void 0:l.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:o})),f="floating"===u?{x:a,y:n,width:r.floating.width,height:r.floating.height}:r.reference,v=await(null==l.getOffsetParent?void 0:l.getOffsetParent(i.floating)),b=await(null==l.isElement?void 0:l.isElement(v))&&await(null==l.getScale?void 0:l.getScale(v))||{x:1,y:1},j=Qi(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:f,offsetParent:v,strategy:o}):f);return{top:(g.top-j.top+x.top)/b.y,bottom:(j.bottom-g.bottom+x.bottom)/b.y,left:(g.left-j.left+x.left)/b.x,right:(j.right-g.right+x.right)/b.x}}function no(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function lo(e){return Di.some(t=>e[t]>=0)}const ro=new Set(["left","top"]);function io(){return"undefined"!==typeof window}function oo(e){return mo(e)?(e.nodeName||"").toLowerCase():"#document"}function co(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function uo(e){var t;return null==(t=(mo(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function mo(e){return!!io()&&(e instanceof Node||e instanceof co(e).Node)}function ho(e){return!!io()&&(e instanceof Element||e instanceof co(e).Element)}function xo(e){return!!io()&&(e instanceof HTMLElement||e instanceof co(e).HTMLElement)}function po(e){return!(!io()||"undefined"===typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof co(e).ShadowRoot)}const go=new Set(["inline","contents"]);function fo(e){const{overflow:t,overflowX:s,overflowY:a,display:n}=Eo(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+s)&&!go.has(n)}const vo=new Set(["table","td","th"]);function bo(e){return vo.has(oo(e))}const jo=[":popover-open",":modal"];function yo(e){return jo.some(t=>{try{return e.matches(t)}catch(O1){return!1}})}const No=["transform","translate","scale","rotate","perspective"],wo=["transform","translate","scale","rotate","perspective","filter"],Co=["paint","layout","strict","content"];function ko(e){const t=Do(),s=ho(e)?Eo(e):e;return No.some(e=>!!s[e]&&"none"!==s[e])||!!s.containerType&&"normal"!==s.containerType||!t&&!!s.backdropFilter&&"none"!==s.backdropFilter||!t&&!!s.filter&&"none"!==s.filter||wo.some(e=>(s.willChange||"").includes(e))||Co.some(e=>(s.contain||"").includes(e))}function Do(){return!("undefined"===typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const _o=new Set(["html","body","#document"]);function So(e){return _o.has(oo(e))}function Eo(e){return co(e).getComputedStyle(e)}function Ao(e){return ho(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Fo(e){if("html"===oo(e))return e;const t=e.assignedSlot||e.parentNode||po(e)&&e.host||uo(e);return po(t)?t.host:t}function To(e){const t=Fo(e);return So(t)?e.ownerDocument?e.ownerDocument.body:e.body:xo(t)&&fo(t)?t:To(t)}function zo(e,t,s){var a;void 0===t&&(t=[]),void 0===s&&(s=!0);const n=To(e),l=n===(null==(a=e.ownerDocument)?void 0:a.body),r=co(n);if(l){const e=Mo(r);return t.concat(r,r.visualViewport||[],fo(n)?n:[],e&&s?zo(e):[])}return t.concat(n,zo(n,[],s))}function Mo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Po(e){const t=Eo(e);let s=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const n=xo(e),l=n?e.offsetWidth:s,r=n?e.offsetHeight:a,i=Ei(s)!==l||Ei(a)!==r;return i&&(s=l,a=r),{width:s,height:a,$:i}}function Bo(e){return ho(e)?e:e.contextElement}function Ro(e){const t=Bo(e);if(!xo(t))return Fi(1);const s=t.getBoundingClientRect(),{width:a,height:n,$:l}=Po(t);let r=(l?Ei(s.width):s.width)/a,i=(l?Ei(s.height):s.height)/n;return r&&Number.isFinite(r)||(r=1),i&&Number.isFinite(i)||(i=1),{x:r,y:i}}const Lo=Fi(0);function Io(e){const t=co(e);return Do()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Lo}function Oo(e,t,s,a){void 0===t&&(t=!1),void 0===s&&(s=!1);const n=e.getBoundingClientRect(),l=Bo(e);let r=Fi(1);t&&(a?ho(a)&&(r=Ro(a)):r=Ro(e));const i=function(e,t,s){return void 0===t&&(t=!1),!(!s||t&&s!==co(e))&&t}(l,s,a)?Io(l):Fi(0);let o=(n.left+i.x)/r.x,c=(n.top+i.y)/r.y,d=n.width/r.x,u=n.height/r.y;if(l){const e=co(l),t=a&&ho(a)?co(a):a;let s=e,n=Mo(s);for(;n&&a&&t!==s;){const e=Ro(n),t=n.getBoundingClientRect(),a=Eo(n),l=t.left+(n.clientLeft+parseFloat(a.paddingLeft))*e.x,r=t.top+(n.clientTop+parseFloat(a.paddingTop))*e.y;o*=e.x,c*=e.y,d*=e.x,u*=e.y,o+=l,c+=r,s=co(n),n=Mo(s)}}return Qi({width:d,height:u,x:o,y:c})}function Uo(e,t){const s=Ao(e).scrollLeft;return t?t.left+s:Oo(uo(e)).left+s}function Ho(e,t){const s=e.getBoundingClientRect();return{x:s.left+t.scrollLeft-Uo(e,s),y:s.top+t.scrollTop}}const Wo=new Set(["absolute","fixed"]);function Vo(e,t,s){let a;if("viewport"===t)a=function(e,t){const s=co(e),a=uo(e),n=s.visualVie
vendor: 4,224 bytes, line 2
2wport;let l=a.clientWidth,r=a.clientHeight,i=0,o=0;if(n){l=n.width,r=n.height;const e=Do();(!e||e&&"fixed"===t)&&(i=n.offsetLeft,o=n.offsetTop)}const c=Uo(a);if(c<=0){const e=a.ownerDocument,t=e.body,s=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(s.marginLeft)+parseFloat(s.marginRight)||0,r=Math.abs(a.clientWidth-t.clientWidth-n);r<=25&&(l-=r)}else c<=25&&(l+=c);return{width:l,height:r,x:i,y:o}}(e,s);else if("document"===t)a=function(e){const t=uo(e),s=Ao(e),a=e.ownerDocument.body,n=Si(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Si(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let r=-s.scrollLeft+Uo(e);const i=-s.scrollTop;return"rtl"===Eo(a).direction&&(r+=Si(t.clientWidth,a.clientWidth)-n),{width:n,height:l,x:r,y:i}}(uo(e));else if(ho(t))a=function(e,t){const s=Oo(e,!0,"fixed"===t),a=s.top+e.clientTop,n=s.left+e.clientLeft,l=xo(e)?Ro(e):Fi(1);return{width:e.clientWidth*l.x,height:e.clientHeight*l.y,x:n*l.x,y:a*l.y}}(t,s);else{const s=Io(e);a={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Qi(a)}function qo(e,t){const s=Fo(e);return!(s===t||!ho(s)||So(s))&&("fixed"===Eo(s).position||qo(s,t))}function $o(e,t,s){const a=xo(t),n=uo(t),l="fixed"===s,r=Oo(e,!0,l,t);let i={scrollLeft:0,scrollTop:0};const o=Fi(0);function c(){o.x=Uo(n)}if(a||!a&&!l)if(("body"!==oo(t)||fo(n))&&(i=Ao(t)),a){const e=Oo(t,!0,l,t);o.x=e.x+t.clientLeft,o.y=e.y+t.clientTop}else n&&c();l&&!a&&n&&c();const d=!n||a||l?Fi(0):Ho(n,i);return{x:r.left+i.scrollLeft-o.x-d.x,y:r.top+i.scrollTop-o.y-d.y,width:r.width,height:r.height}}function Go(e){return"static"===Eo(e).position}function Ko(e,t){if(!xo(e)||"fixed"===Eo(e).position)return null;if(t)return t(e);let s=e.offsetParent;return uo(e)===s&&(s=s.ownerDocument.body),s}function Yo(e,t){const s=co(e);if(yo(e))return s;if(!xo(e)){let t=Fo(e);for(;t&&!So(t);){if(ho(t)&&!Go(t))return t;t=Fo(t)}return s}let a=Ko(e,t);for(;a&&bo(a)&&Go(a);)a=Ko(a,t);return a&&So(a)&&Go(a)&&!ko(a)?s:a||function(e){let t=Fo(e);for(;xo(t)&&!So(t);){if(ko(t))return t;if(yo(t))return null;t=Fo(t)}return null}(e)||s}const Jo={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:s,offsetParent:a,strategy:n}=e;const l="fixed"===n,r=uo(a),i=!!t&&yo(t.floating);if(a===r||i&&l)return s;let o={scrollLeft:0,scrollTop:0},c=Fi(1);const d=Fi(0),u=xo(a);if((u||!u&&!l)&&(("body"!==oo(a)||fo(r))&&(o=Ao(a)),xo(a))){const e=Oo(a);c=Ro(a),d.x=e.x+a.clientLeft,d.y=e.y+a.clientTop}const m=!r||u||l?Fi(0):Ho(r,o);return{width:s.width*c.x,height:s.height*c.y,x:s.x*c.x-o.scrollLeft*c.x+d.x+m.x,y:s.y*c.y-o.scrollTop*c.y+d.y+m.y}},getDocumentElement:uo,getClippingRect:function(e){let{element:t,boundary:s,rootBoundary:a,strategy:n}=e;const l="clippingAncestors"===s?yo(t)?[]:function(e,t){const s=t.get(e);if(s)return s;let a=zo(e,[],!1).filter(e=>ho(e)&&"body"!==oo(e)),n=null;const l="fixed"===Eo(e).position;let r=l?Fo(e):e;for(;ho(r)&&!So(r);){const t=Eo(r),s=ko(r);s||"fixed"!==t.position||(n=null),(l?!s&&!n:!s&&"static"===t.position&&n&&Wo.has(n.position)||fo(r)&&!s&&qo(e,r))?a=a.filter(e=>e!==r):n=t,r=Fo(r)}return t.set(e,a),a}(t,this._c):[].concat(s),r=[...l,a],i=r[0],o=r.reduce((e,s)=>{const a=Vo(t,s,n);return e.top=Si(a.top,e.top),e.right=_i(a.right,e.right),e.bottom=_i(a.bottom,e.bottom),e.left=Si(a.left,e.left),e},Vo(t,i,n));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}},getOffsetParent:Yo,getElementRects:async function(e){const t=this.getOffsetParent||Yo,s=this.getDimensions,a=await s(e.floating);return{reference:$o(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:s}=Po(e);return{width:t,height:s}},getScale:Ro,isElement:ho,isRTL:function(e){return"rtl"===Eo(e).direction}};function Qo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xo(e,t,s,a){void 0===a&&(a={});const{ancestorScroll:n=!0,ancestorResize:l=!0,elementResize:r="function"===typeof ResizeObserver,layoutShift:i="function"===typeof IntersectionObserver,animationFrame:o=!1}=a,c=Bo(e),u=n||l?[...c?zo(c):[],...zo(t)]:[];
2u.forEach(e=>{n&&e.addEventListener("scroll",s,{passive:!0}),l&&e.addEventListener("resize",s)});const m=c&&i?function(e,t){let s,a=null;const n=uo(e);function l(){var e;clearTimeout(s),null==(e=a)||e.disconnect(),a=null}return function r(i,o){void 0===i&&(i=!1),void 0===o&&(o=1),l();const c=e.getBoundingClientRect(),{left:u,top:m,width:h,height:x}=c;if(i||t(),!h||!x)return;const p={rootMargin:-Ai(m)+"px "+-Ai(n.clientWidth-(u+h))+"px "+-Ai(n.clientHeight-(m+x))+"px "+-Ai(u)+"px",threshold:Si(0,_i(1,o))||1};let g=!0;function f(t){const a=t[0].intersectionRatio;if(a!==o){if(!g)return r();a?r(!1,a):s=setTimeout(()=>{r(!1,1e-7)},1e3)}1!==a||Qo(c,e.getBoundingClientRect())||r(),g=!1}try{a=new IntersectionObserver(f,d(d({},p),{},{root:n.ownerDocument}))}catch(O1){a=new IntersectionObserver(f,p)}a.observe(e)}(!0),l}(c,s):null;let h,x=-1,p=null;r&&(p=new ResizeObserver(e=>{let[a]=e;a&&a.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),s()}),c&&!o&&p.observe(c),p.observe(t));let g=o?Oo(e):null;return o&&function t(){const a=Oo(e);g&&!Qo(g,a)&&s();g=a,h=requestAnimationFrame(t)}(),s(),()=>{var e;u.forEach(e=>{n&&e.removeEventListener("scroll",s),l&&e.removeEventListener("resize",s)}),null==m||m(),null==(e=p)||e.disconnect(),p=null,o&&cancelAnimationFrame(h)}}const Zo=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var s,a;const{x:n,y:l,placement:r,middlewareData:i}=t,o=await async function(e,t){const{placement:s,platform:a,elements:n}=e,l=await(null==a.isRTL?void 0:a.isRTL(n.floating)),r=Bi(s),i=Ri(s),o="y"===Ui(s),c=ro.has(r)?-1:1,d=l&&o?-1:1,u=Pi(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:x}="number"===typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"===typeof x&&(h="end"===i?-1*x:x),o?{x:h*d,y:m*c}:{x:m*c,y:h*d}}(t,e);return r===(null==(s=i.offset)?void 0:s.placement)&&null!=(a=i.arrow)&&a.alignmentOffset?{}:{x:n+o.x,y:l+o.y,data:d(d({},o),{},{placement:r})}}}},ec=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:a,placement:n}=t,r=Pi(e,t),{mainAxis:i=!0,crossAxis:o=!1,limiter:c={fn:e=>{let{x:t,y:s}=e;return{x:t,y:s}}}}=r,u=l(r,eo),m={x:s,y:a},h=await ao(t,u),x=Ui(Bi(n)),p=Li(x);let g=m[p],f=m[x];if(i){const e="y"===p?"bottom":"right";g=Mi(g+h["y"===p?"top":"left"],g,g-h[e])}if(o){const e="y"===x?"bottom":"right";f=Mi(f+h["y"===x?"top":"left"],f,f-h[e])}const v=c.fn(d(d({},t),{},{[p]:g,[x]:f}));return d(d({},v),{},{data:{x:v.x-s,y:v.y-a,enabled:{[p]:i,[x]:o}}})}}},tc=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var s,a;const{placement:n,middlewareData:r,rects:i,initialPlacement:o,platform:c,elements:d}=t,u=Pi(e,t),{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:x,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:f=!0}=u,v=l(u,Xi);if(null!=(s=r.arrow)&&s.alignmentOffset)return{};const b=Bi(n),j=Ui(o),y=Bi(o)===o,N=await(null==c.isRTL?void 0:c.isRTL(d.floating)),w=x||(y||!f?[Yi(o)]:function(e){const t=Yi(e);return[Wi(e),t,Wi(t)]}(o)),C="none"!==g;!x&&C&&w.push(...Ki(o,f,g,N));const k=[o,...w],D=await ao(t,v),_=[];let S=(null==(a=r.flip)?void 0:a.overflows)||[];if(m&&_.push(D[b]),h){const e=function(e,t,s){void 0===s&&(s=!1);const a=Ri(e),n=Hi(e),l=Ii(n);let r="x"===n?a===(s?"end":"start")?"right":"left":"start"===a?"bottom":"top";return t.reference[l]>t.floating[l]&&(r=Yi(r)),[r,Yi(r)]}(n,i,N);_.push(D[e[0]],D[e[1]])}if(S=[...S,{placement:n,overflows:_}],!_.every(e=>e<=0)){var E,A;const e=((null==(E=r.flip)?void 0:E.index)||0)+1,t=k[e];if(t){if(!("alignment"===h&&j!==Ui(t))||S.every(e=>Ui(e.placement)!==j||e.overflows[0]>0))return{data:{index:e,overflows:S},reset:{placement:t}}}let s=null==(A=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!s)switch(p){case"bestFit":{var F;const e=null==(F=S.filter(e=>{if(C){const t=Ui(e.placement);return t===j||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>
2e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:F[0];e&&(s=e);break}case"initialPlacement":s=o}if(n!==s)return{reset:{placement:s}}}return{}}}},sc=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var s,a;const{placement:n,rects:r,platform:i,elements:o}=t,c=Pi(e,t),{apply:u=()=>{}}=c,m=l(c,to),h=await ao(t,m),x=Bi(n),p=Ri(n),g="y"===Ui(n),{width:f,height:v}=r.floating;let b,j;"top"===x||"bottom"===x?(b=x,j=p===(await(null==i.isRTL?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(j=x,b="end"===p?"top":"bottom");const y=v-h.top-h.bottom,N=f-h.left-h.right,w=_i(v-h[b],y),C=_i(f-h[j],N),k=!t.middlewareData.shift;let D=w,_=C;if(null!=(s=t.middlewareData.shift)&&s.enabled.x&&(_=N),null!=(a=t.middlewareData.shift)&&a.enabled.y&&(D=y),k&&!p){const e=Si(h.left,0),t=Si(h.right,0),s=Si(h.top,0),a=Si(h.bottom,0);g?_=f-2*(0!==e||0!==t?e+t:Si(h.left,h.right)):D=v-2*(0!==s||0!==a?s+a:Si(h.top,h.bottom))}await u(d(d({},t),{},{availableWidth:_,availableHeight:D}));const S=await i.getDimensions(o.floating);return f!==S.width||v!==S.height?{reset:{rects:!0}}:{}}}},ac=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s}=t,a=Pi(e,t),{strategy:n="referenceHidden"}=a,r=l(a,Zi);switch(n){case"referenceHidden":{const e=no(await ao(t,d(d({},r),{},{elementContext:"reference"})),s.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:lo(e)}}}case"escaped":{const e=no(await ao(t,d(d({},r),{},{altBoundary:!0})),s.floating);return{data:{escapedOffsets:e,escaped:lo(e)}}}default:return{}}}}},nc=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:a,placement:n,rects:l,platform:r,elements:i,middlewareData:o}=t,{element:c,padding:u=0}=Pi(e,t)||{};if(null==c)return{};const m=Ji(u),h={x:s,y:a},x=Hi(n),p=Ii(x),g=await r.getDimensions(c),f="y"===x,v=f?"top":"left",b=f?"bottom":"right",j=f?"clientHeight":"clientWidth",y=l.reference[p]+l.reference[x]-h[x]-l.floating[p],N=h[x]-l.reference[x],w=await(null==r.getOffsetParent?void 0:r.getOffsetParent(c));let C=w?w[j]:0;C&&await(null==r.isElement?void 0:r.isElement(w))||(C=i.floating[j]||l.floating[p]);const k=y/2-N/2,D=C/2-g[p]/2-1,_=_i(m[v],D),S=_i(m[b],D),E=_,A=C-g[p]-S,F=C/2-g[p]/2+k,T=Mi(E,F,A),z=!o.arrow&&null!=Ri(n)&&F!==T&&l.reference[p]/2-(F<E?_:S)-g[p]/2<0,M=z?F<E?F-E:F-A:0;return{[x]:h[x]+M,data:d({[x]:T,centerOffset:F-T-M},z&&{alignmentOffset:M}),reset:z}}}),lc=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:s,y:a,placement:n,rects:l,middlewareData:r}=t,{offset:i=0,mainAxis:o=!0,crossAxis:c=!0}=Pi(e,t),u={x:s,y:a},m=Ui(n),h=Li(m);let x=u[h],p=u[m];const g=Pi(i,t),f="number"===typeof g?{mainAxis:g,crossAxis:0}:d({mainAxis:0,crossAxis:0},g);if(o){const e="y"===h?"height":"width",t=l.reference[h]-l.floating[e]+f.mainAxis,s=l.reference[h]+l.reference[e]-f.mainAxis;x<t?x=t:x>s&&(x=s)}if(c){var v,b;const e="y"===h?"width":"height",t=ro.has(Bi(n)),s=l.reference[m]-l.floating[e]+(t&&(null==(v=r.offset)?void 0:v[m])||0)+(t?0:f.crossAxis),a=l.reference[m]+l.reference[e]+(t?0:(null==(b=r.offset)?void 0:b[m])||0)-(t?f.crossAxis:0);p<s?p=s:p>a&&(p=a)}return{[h]:x,[m]:p}}}},rc=(e,t,s)=>{const a=new Map,n=d({platform:Jo},s),l=d(d({},n.platform),{},{_c:a});return(async(e,t,s)=>{const{placement:a="bottom",strategy:n="absolute",middleware:l=[],platform:r}=s,i=l.filter(Boolean),o=await(null==r.isRTL?void 0:r.isRTL(t));let c=await r.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:m}=so(c,a,o),h=a,x={},p=0;for(let g=0;g<i.length;g++){const{name:s,fn:l}=i[g],{x:f,y:v,data:b,reset:j}=await l({x:u,y:m,initialPlacement:a,placement:h,strategy:n,middlewareData:x,rects:c,platform:r,elements:{reference:e,floating:t}});u=null!=f?f:u,m=null!=v?v:m,x=d(d({},x),{},{[s]:d(d({},x[s]),b)}),j&&p<=50&&(p++,"object"===typeof j&&(j.placement&&(h=j.placement),j.rects&&(c=!0===j.rects?await r.getElementRects({reference:e,floating:t,strategy:n}):j.rects),({x:u,y:m}=so(c,h,o))),g=-1)}return{x:u,y:m,placement:h,strategy:n,middlewareData:x}})(e,t,d(d({},n),{},{platform:l}))};var ic="undefined"!==typeof document?t.useLayoutEffect:function(){};function oc(e,t){if(e===t)return!0;
2if(typeof e!==typeof t)return!1;if("function"===typeof e&&e.toString()===t.toString())return!0;let s,a,n;if(e&&t&&"object"===typeof e){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(a=s;0!==a--;)if(!oc(e[a],t[a]))return!1;return!0}if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(a=s;0!==a--;)if(!{}.hasOwnProperty.call(t,n[a]))return!1;for(a=s;0!==a--;){const s=n[a];if(("_owner"!==s||!e.$$typeof)&&!oc(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function cc(e){if("undefined"===typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function dc(e,t){const s=cc(e);return Math.round(t*s)/s}function uc(e){const s=t.useRef(e);return ic(()=>{s.current=e}),s}const mc=(e,t)=>d(d({},Zo(e)),{},{options:[e,t]}),hc=(e,t)=>d(d({},ec(e)),{},{options:[e,t]}),xc=(e,t)=>d(d({},lc(e)),{},{options:[e,t]}),pc=(e,t)=>d(d({},tc(e)),{},{options:[e,t]}),gc=(e,t)=>d(d({},sc(e)),{},{options:[e,t]}),fc=(e,t)=>d(d({},ac(e)),{},{options:[e,t]}),vc=(e,t)=>d(d({},(e=>({name:"arrow",options:e,fn(t){const{element:s,padding:a}="function"===typeof e?e(t):e;return s&&(n=s,{}.hasOwnProperty.call(n,"current"))?null!=s.current?nc({element:s.current,padding:a}).fn(t):{}:s?nc({element:s,padding:a}).fn(t):{};var n}}))(e)),{},{options:[e,t]}),bc=["children","width","height"];var jc=t.forwardRef((e,t)=>{const{children:s,width:a=10,height:n=5}=e,r=l(e,bc);return(0,ea.jsx)(Tr.svg,d(d({},r),{},{ref:t,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?s:(0,ea.jsx)("polygon",{points:"0,0 30,0 15,10"})}))});jc.displayName="Arrow";var yc=jc;function Nc(e){const[s,a]=t.useState(void 0);return Nr(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const s=t[0];let n,l;if("borderBoxSize"in s){const e=s.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,l=t.blockSize}else n=e.offsetWidth,l=e.offsetHeight;a({width:n,height:l})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}a(void 0)},[e]),s}const wc=["__scopePopper","virtualRef"],Cc=["__scopePopper","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","onPlaced"],kc=["__scopePopper"];var Dc="Popper",[_c,Sc]=jr(Dc),[Ec,Ac]=_c(Dc),Fc=e=>{const{__scopePopper:s,children:a}=e,[n,l]=t.useState(null);return(0,ea.jsx)(Ec,{scope:s,anchor:n,onAnchorChange:l,children:a})};Fc.displayName=Dc;var Tc="PopperAnchor",zc=t.forwardRef((e,s)=>{const{__scopePopper:a,virtualRef:n}=e,r=l(e,wc),i=Ac(Tc,a),o=t.useRef(null),c=fr(s,o),u=t.useRef(null);return t.useEffect(()=>{const e=u.current;u.current=(null===n||void 0===n?void 0:n.current)||o.current,e!==u.current&&i.onAnchorChange(u.current)}),n?null:(0,ea.jsx)(Tr.div,d(d({},r),{},{ref:c}))});zc.displayName=Tc;var Mc="PopperContent",[Pc,Bc]=_c(Mc),Rc=t.forwardRef((e,s)=>{var a,n,r,i,o,c,u,m;const{__scopePopper:h,side:x="bottom",sideOffset:p=0,align:g="center",alignOffset:f=0,arrowPadding:v=0,avoidCollisions:b=!0,collisionBoundary:j=[],collisionPadding:y=0,sticky:N="partial",hideWhenDetached:w=!1,updatePositionStrategy:C="optimized",onPlaced:k}=e,D=l(e,Cc),_=Ac(Mc,h),[S,E]=t.useState(null),A=fr(s,e=>E(e)),[F,T]=t.useState(null),z=Nc(F),M=null!==(a=null===z||void 0===z?void 0:z.width)&&void 0!==a?a:0,P=null!==(n=null===z||void 0===z?void 0:z.height)&&void 0!==n?n:0,B=x+("center"!==g?"-"+g:""),R="number"===typeof y?y:d({top:0,right:0,bottom:0,left:0},y),L=Array.isArray(j)?j:[j],I=L.length>0,O={padding:R,boundary:L.filter(Uc),altBoundary:I},{refs:U,floatingStyles:H,placement:W,isPositioned:V,middlewareData:q}=function(e){void 0===e&&(e={});const{placement:s="bottom",strategy:a="absolute",middleware:n=[],platform:l,elements:{reference:r,floating:i}={},transform:o=!0,whileElementsMounted:c,open:u}=e,[m,h]=t.useState({x:0,y:0,strategy:a,placement:s,middlewareData:{},isPositioned:!1}),[x,p]=t.useState(n);oc(x,n)||p(n);const[g,f]=t.useState(null),[v,b]=t.useState(null),j=t.useCallback(e=>{e!==C.current&&(C.current=e,f(e))},[]),y=t.useCallback(e=>
2{e!==k.current&&(k.current=e,b(e))},[]),N=r||g,w=i||v,C=t.useRef(null),k=t.useRef(null),D=t.useRef(m),_=null!=c,S=uc(c),E=uc(l),A=uc(u),F=t.useCallback(()=>{if(!C.current||!k.current)return;const e={placement:s,strategy:a,middleware:x};E.current&&(e.platform=E.current),rc(C.current,k.current,e).then(e=>{const t=d(d({},e),{},{isPositioned:!1!==A.current});T.current&&!oc(D.current,t)&&(D.current=t,Ts.flushSync(()=>{h(t)}))})},[x,s,a,E,A]);ic(()=>{!1===u&&D.current.isPositioned&&(D.current.isPositioned=!1,h(e=>d(d({},e),{},{isPositioned:!1})))},[u]);const T=t.useRef(!1);ic(()=>(T.current=!0,()=>{T.current=!1}),[]),ic(()=>{if(N&&(C.current=N),w&&(k.current=w),N&&w){if(S.current)return S.current(N,w,F);F()}},[N,w,F,S,_]);const z=t.useMemo(()=>({reference:C,floating:k,setReference:j,setFloating:y}),[j,y]),M=t.useMemo(()=>({reference:N,floating:w}),[N,w]),P=t.useMemo(()=>{const e={position:a,left:0,top:0};if(!M.floating)return e;const t=dc(M.floating,m.x),s=dc(M.floating,m.y);return o?d(d({},e),{},{transform:"translate("+t+"px, "+s+"px)"},cc(M.floating)>=1.5&&{willChange:"transform"}):{position:a,left:t,top:s}},[a,o,M.floating,m.x,m.y]);return t.useMemo(()=>d(d({},m),{},{update:F,refs:z,elements:M,floatingStyles:P}),[m,F,z,M,P])}({strategy:"fixed",placement:B,whileElementsMounted:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return Xo(...t,{animationFrame:"always"===C})},elements:{reference:_.anchor},middleware:[mc({mainAxis:p+P,alignmentAxis:f}),b&&hc(d({mainAxis:!0,crossAxis:!1,limiter:"partial"===N?xc():void 0},O)),b&&pc(d({},O)),gc(d(d({},O),{},{apply:e=>{let{elements:t,rects:s,availableWidth:a,availableHeight:n}=e;const{width:l,height:r}=s.reference,i=t.floating.style;i.setProperty("--radix-popper-available-width","".concat(a,"px")),i.setProperty("--radix-popper-available-height","".concat(n,"px")),i.setProperty("--radix-popper-anchor-width","".concat(l,"px")),i.setProperty("--radix-popper-anchor-height","".concat(r,"px"))}})),F&&vc({element:F,padding:v}),Hc({arrowWidth:M,arrowHeight:P}),w&&fc(d({strategy:"referenceHidden"},O))]}),[$,G]=Wc(W),K=Xr(k);Nr(()=>{V&&(null===K||void 0===K||K())},[V,K]);const Y=null===(r=q.arrow)||void 0===r?void 0:r.x,J=null===(i=q.arrow)||void 0===i?void 0:i.y,Q=0!==(null===(o=q.arrow)||void 0===o?void 0:o.centerOffset),[X,Z]=t.useState();return Nr(()=>{S&&Z(window.getComputedStyle(S).zIndex)},[S]),(0,ea.jsx)("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:d(d({},H),{},{transform:V?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[null===(c=q.transformOrigin)||void 0===c?void 0:c.x,null===(u=q.transformOrigin)||void 0===u?void 0:u.y].join(" ")},(null===(m=q.hide)||void 0===m?void 0:m.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}),dir:e.dir,children:(0,ea.jsx)(Pc,{scope:h,placedSide:$,onArrowChange:T,arrowX:Y,arrowY:J,shouldHideArrow:Q,children:(0,ea.jsx)(Tr.div,d(d({"data-side":$,"data-align":G},D),{},{ref:A,style:d(d({},D.style),{},{animation:V?void 0:"none"})}))})})});Rc.displayName=Mc;var Lc="PopperArrow",Ic={top:"bottom",right:"left",bottom:"top",left:"right"},Oc=t.forwardRef(function(e,t){const{__scopePopper:s}=e,a=l(e,kc),n=Bc(Lc,s),r=Ic[n.placedSide];return(0,ea.jsx)("span",{ref:n.onArrowChange,style:{position:"absolute",left:n.arrowX,top:n.arrowY,[r]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[n.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[n.placedSide],visibility:n.shouldHideArrow?"hidden":void 0},children:(0,ea.jsx)(yc,d(d({},a),{},{ref:t,style:d(d({},a.style),{},{display:"block"})}))})});function Uc(e){return null!==e}Oc.displayName=Lc;var Hc=e=>({name:"transformOrigin",options:e,fn(t){var s,a,n,l,r;const{placement:i,rects:o,middlewareData:c}=t,d=0!==(null===(s=c.arrow)||void 0===s?void 0:s.centerOffset),u=d?0:e.arrowWidth,m=d?0:e.arrowHeight,[h,x]=Wc(i),p={start:"0%",center:"50%",end:"100%"}[x],g=(null!==(a=null===(n=c.arrow)||void 0===n?void 0:n.x)&&void 0!==a?a:0)+u/2,f=(null!==(l=null===(r=c.arrow)||void 0===r?void 0:r.y
2)&&void 0!==l?l:0)+m/2;let v="",b="";return"bottom"===h?(v=d?p:"".concat(g,"px"),b="".concat(-m,"px")):"top"===h?(v=d?p:"".concat(g,"px"),b="".concat(o.floating.height+m,"px")):"right"===h?(v="".concat(-m,"px"),b=d?p:"".concat(f,"px")):"left"===h&&(v="".concat(o.floating.width+m,"px"),b=d?p:"".concat(f,"px")),{data:{x:v,y:b}}}});function Wc(e){const[t,s="center"]=e.split("-");return[t,s]}var Vc=Fc,qc=zc,$c=Rc,Gc=Oc;const Kc=["container"];var Yc=t.forwardRef((e,s)=>{var a;const{container:n}=e,r=l(e,Kc),[i,o]=t.useState(!1);Nr(()=>o(!0),[]);const c=n||i&&(null===globalThis||void 0===globalThis||null===(a=globalThis.document)||void 0===a?void 0:a.body);return c?Ts.createPortal((0,ea.jsx)(Tr.div,d(d({},r),{},{ref:s})),c):null});Yc.displayName="Portal";var Jc=e=>{const{present:s,children:a}=e,n=function(e){const[s,a]=t.useState(),n=t.useRef(null),l=t.useRef(e),r=t.useRef("none"),i=e?"mounted":"unmounted",[o,c]=function(e,s){return t.useReducer((e,t)=>{const a=s[e][t];return null!==a&&void 0!==a?a:e},e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return t.useEffect(()=>{const e=Qc(n.current);r.current="mounted"===o?e:"none"},[o]),Nr(()=>{const t=n.current,s=l.current;if(s!==e){const a=r.current,n=Qc(t);if(e)c("MOUNT");else if("none"===n||"none"===(null===t||void 0===t?void 0:t.display))c("UNMOUNT");else{c(s&&a!==n?"ANIMATION_OUT":"UNMOUNT")}l.current=e}},[e,c]),Nr(()=>{if(s){var e;let t;const a=null!==(e=s.ownerDocument.defaultView)&&void 0!==e?e:window,i=e=>{const r=Qc(n.current).includes(CSS.escape(e.animationName));if(e.target===s&&r&&(c("ANIMATION_END"),!l.current)){const e=s.style.animationFillMode;s.style.animationFillMode="forwards",t=a.setTimeout(()=>{"forwards"===s.style.animationFillMode&&(s.style.animationFillMode=e)})}},o=e=>{e.target===s&&(r.current=Qc(n.current))};return s.addEventListener("animationstart",o),s.addEventListener("animationcancel",i),s.addEventListener("animationend",i),()=>{a.clearTimeout(t),s.removeEventListener("animationstart",o),s.removeEventListener("animationcancel",i),s.removeEventListener("animationend",i)}}c("ANIMATION_END")},[s,c]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:t.useCallback(e=>{n.current=e?getComputedStyle(e):null,a(e)},[])}}(s),l="function"===typeof a?a({present:n.isPresent}):t.Children.only(a),r=fr(n.ref,function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(l));return"function"===typeof a||n.isPresent?t.cloneElement(l,{ref:r}):null};function Qc(e){return(null===e||void 0===e?void 0:e.animationName)||"none"}Jc.displayName="Presence";const Xc=["__scopeRovingFocusGroup","orientation","loop","dir","currentTabStopId","defaultCurrentTabStopId","onCurrentTabStopIdChange","onEntryFocus","preventScrollOnEntryFocus"],Zc=["__scopeRovingFocusGroup","focusable","active","tabStopId","children"];var ed="rovingFocusGroup.onEntryFocus",td={bubbles:!1,cancelable:!0},sd="RovingFocusGroup",[ad,nd,ld]=$r(sd),[rd,id]=jr(sd,[ld]),[od,cd]=rd(sd),dd=t.forwardRef((e,t)=>(0,ea.jsx)(ad.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,ea.jsx)(ad.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,ea.jsx)(ud,d(d({},e),{},{ref:t}))})}));dd.displayName=sd;var ud=t.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:a,orientation:n,loop:r=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:m,preventScrollOnEntryFocus:h=!1}=e,x=l(e,Xc),p=t.useRef(null),g=fr(s,p),f=Qr(i),[v,b]=Cr({prop:o,defaultProp:null!==c&&void 0!==c?c:null,onChange:u,caller:sd}),[j,y]=t.useState(!1),N=Xr(m),w=nd(a),C=t.useRef(!1),[k,D]=t.useState(0);return t.useEffect(()=>{const e=p.current;if(e)return e.addEventListener(ed,N),()=>e.removeEventListener(ed,N)},[N]),(0,ea.jsx)(od,{scope:a,orientation:n,dir:f,loop:r,currentTabStopId:v,onItemFocus:t.useCallback(e=>b(e),[b]),onItemShiftTab:t.useCallback(()=>y(!0),[]),onFocusableItemAdd:t.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>D(e=>e-1),[]),children:(0,ea.jsx)(Tr.div,d(d({tabIndex:j||0===k?-1:0,"data-orientation":n},x),{},{ref:g,style:d({outline:"none"},e.style),onMouseDown:xr(e.onMouseDown,()=>{C.current=!0}),onFocus:xr(e.onFocus,e=>{const t=!C.current;if(e.target===e.currentTarget&&t&&!j){const t=new CustomEvent(ed,td);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=w().filter(e=>
2e.focusable);pd([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),h)}}C.current=!1}),onBlur:xr(e.onBlur,()=>y(!1))}))})}),md="RovingFocusGroupItem",hd=t.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:a,focusable:n=!0,active:r=!1,tabStopId:i,children:o}=e,c=l(e,Zc),u=ki(),m=i||u,h=cd(md,a),x=h.currentTabStopId===m,p=nd(a),{onFocusableItemAdd:g,onFocusableItemRemove:f,currentTabStopId:v}=h;return t.useEffect(()=>{if(n)return g(),()=>f()},[n,g,f]),(0,ea.jsx)(ad.ItemSlot,{scope:a,id:m,focusable:n,active:r,children:(0,ea.jsx)(Tr.span,d(d({tabIndex:x?0:-1,"data-orientation":h.orientation},c),{},{ref:s,onMouseDown:xr(e.onMouseDown,e=>{n?h.onItemFocus(m):e.preventDefault()}),onFocus:xr(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:xr(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void h.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,s){const a=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,s);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(a)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)?void 0:xd[a]}(e,h.orientation,h.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();const l=n.indexOf(e.currentTarget);n=h.loop?(a=l+1,(s=n).map((e,t)=>s[(a+t)%s.length])):n.slice(l+1)}setTimeout(()=>pd(n))}var s,a}),children:"function"===typeof o?o({isCurrentTabStop:x,hasTabStop:null!=v}):o}))})});hd.displayName=md;var xd={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pd(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=document.activeElement;for(const a of e){if(a===s)return;if(a.focus({preventScroll:t}),document.activeElement!==s)return}}var gd=dd,fd=hd;const vd=["children"],bd=["children"];function jd(e){const s=yd(e),a=t.forwardRef((e,a)=>{const{children:n}=e,r=l(e,vd),i=t.Children.toArray(n),o=i.find(wd);if(o){const e=o.props.children,n=i.map(s=>s===o?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:s);return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null}))}return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:n}))});return a.displayName="".concat(e,".Slot"),a}function yd(e){const s=t.forwardRef((e,s)=>{const{children:a}=e,n=l(e,bd);if(t.isValidElement(a)){const e=function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),l=function(e,t){const s=d({},t);for(const a in t){const n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?s[a]=function(){const e=l(...arguments);return n(...arguments),e}:n&&(s[a]=n):"style"===a?s[a]=d(d({},n),l):"className"===a&&(s[a]=[n,l].filter(Boolean).join(" "))}return d(d({},e),s)}(n,a.props);return a.type!==t.Fragment&&(l.ref=s?gr(s,e):e),t.cloneElement(a,l)}return t.Children.count(a)>1?t.Children.only(null):null});return s.displayName="".concat(e,".SlotClone"),s}var Nd=Symbol("radix.slottable");function wd(e){return t.isValidElement(e)&&"function"===typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Nd}var Cd=function(e){return"undefined"===typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},kd=new WeakMap,Dd=new WeakMap,_d={},Sd=0,Ed=function(e){return e&&(e.host||Ed(e.parentNode))},Ad=function(e,t,s,a){var n=function(e,t){return t.map(function(t){if(e.contains(t))return t;var s=Ed(t);return s&&e.contains(s)?s:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);_d[s]||(_d[s]=new WeakMap);var l=_d[s],r=[],i=new Set,o=new Set(n),c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};
vendor: 8,989 bytes, line 2
2n.forEach(c);var d=function(e){e&&!o.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))d(e);else try{var t=e.getAttribute(a),n=null!==t&&"false"!==t,o=(kd.get(e)||0)+1,c=(l.get(e)||0)+1;kd.set(e,o),l.set(e,c),r.push(e),1===o&&n&&Dd.set(e,!0),1===c&&e.setAttribute(s,"true"),n||e.setAttribute(a,"true")}catch(G2){console.error("aria-hidden: cannot operate on ",e,G2)}})};return d(t),i.clear(),Sd++,function(){r.forEach(function(e){var t=kd.get(e)-1,n=l.get(e)-1;kd.set(e,t),l.set(e,n),t||(Dd.has(e)||e.removeAttribute(a),Dd.delete(e)),n||e.removeAttribute(s)}),--Sd||(kd=new WeakMap,kd=new WeakMap,Dd=new WeakMap,_d={})}},Fd=function(e,t,s){void 0===s&&(s="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),n=t||Cd(e);return n?(a.push.apply(a,Array.from(n.querySelectorAll("[aria-live], script"))),Ad(a,n,s,"aria-hidden")):function(){return null}};var Td=function(){return Td=Object.assign||function(e){for(var t,s=1,a=arguments.length;s<a;s++)for(var n in t=arguments[s])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Td.apply(this,arguments)};function zd(e,t){var s={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(s[a]=e[a]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(s[a[n]]=e[a[n]])}return s}Object.create;function Md(e,t,s){if(s||2===arguments.length)for(var a,n=0,l=t.length;n<l;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}Object.create;"function"===typeof SuppressedError&&SuppressedError;var Pd="right-scroll-bar-position",Bd="width-before-scroll-bar";function Rd(e,t){return"function"===typeof e?e(t):e&&(e.current=t),e}var Ld="undefined"!==typeof window?t.useLayoutEffect:t.useEffect,Id=new WeakMap;function Od(e,s){var a=function(e,s){var a=(0,t.useState)(function(){return{value:e,callback:s,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0];return a.callback=s,a.facade}(s||null,function(t){return e.forEach(function(e){return Rd(e,t)})});return Ld(function(){var t=Id.get(a);if(t){var s=new Set(t),n=new Set(e),l=a.current;s.forEach(function(e){n.has(e)||Rd(e,null)}),n.forEach(function(e){s.has(e)||Rd(e,l)})}Id.set(a,e)},[e]),a}function Ud(e){return e}function Hd(e,t){void 0===t&&(t=Ud);var s=[],a=!1,n={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:e},useMedium:function(e){var n=t(e,a);return s.push(n),function(){s=s.filter(function(e){return e!==n})}},assignSyncMedium:function(e){for(a=!0;s.length;){var t=s;s=[],t.forEach(e)}s={push:function(t){return e(t)},filter:function(){return s}}},assignMedium:function(e){a=!0;var t=[];if(s.length){var n=s;s=[],n.forEach(e),t=s}var l=function(){var s=t;t=[],s.forEach(e)},r=function(){return Promise.resolve().then(l)};r(),s={push:function(e){t.push(e),r()},filter:function(e){return t=t.filter(e),s}}}};return n}var Wd=function(e){void 0===e&&(e={});var t=Hd(null);return t.options=Td({async:!0,ssr:!1},e),t}(),Vd=function(){},qd=t.forwardRef(function(e,s){var a=t.useRef(null),n=t.useState({onScrollCapture:Vd,onWheelCapture:Vd,onTouchMoveCapture:Vd}),l=n[0],r=n[1],i=e.forwardProps,o=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,m=e.shards,h=e.sideCar,x=e.noRelative,p=e.noIsolation,g=e.inert,f=e.allowPinchZoom,v=e.as,b=void 0===v?"div":v,j=e.gapMode,y=zd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=h,w=Od([a,s]),C=Td(Td({},y),l);return t.createElement(t.Fragment,null,u&&t.createElement(N,{sideCar:Wd,removeScrollBar:d,shards:m,noRelative:x,noIsolation:p,inert:g,setCallbacks:r,allowPinchZoom:!!f,lockRef:a,gapMode:j}),i?t.cloneElement(t.Children.only(o),Td(Td({},C),{ref:w})):t.createElement(b,Td({},C,{className:c,ref:w}),o))});qd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},qd.classNames={fullWidth:Bd,zeroRight:Pd};var $d,Gd=function(e){var s=e.sideCar,a=zd(e,["sideCar"]);if(!s)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=s.read();if(!n)throw new Error("Sidecar medium not found");return t.createElement(n,Td({},a))};Gd.isSideCarExport=!0;function Kd(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=$d||s.nc;return t&&e.setAttribute("nonce",t),e}var Yd=function(){var e=0,t=null;return{add:function(s){var a;0==e&&(t=Kd())&&(!function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}(t,s),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Jd=function(){var e=function(){var e=Yd();return function(s,a){t.useEffect(function(){return e.add(s),function(){e.remove()}},[s&&a])}}();return function(t){var s=t.styles,a=t.dynamic;return e(s,a),null}},Qd={left:0,top:0,right:0,gap:0},Xd=function(e){return parseInt(e||"",10)||0},Zd=function(e){if(void 0===e&&(e="margin"),"undefined"===typeof window)return Qd;var t=function(e){var t=window.getComputedStyle(document.body),s=t["padding"===e?"paddingLeft":"marginLeft"],a=t["padding"===e?"paddingTop":"marginTop"],n=t["padding"===e?"paddingRight":"marginRight"];return[Xd(s),Xd(a),Xd(n)]}(e),s=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-s+t[2]-t[0])}},eu=Jd(),tu="data-scroll-locked",su=function(e,t,s,a){var n=e.left,l=e.top,r=e.right,i=e.gap;return void 0===s&&(s="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(a,";\n padding-right: ").concat(i,"px ").concat(a,";\n }\n body[").concat(tu,"] {\n overflow: hidden ").concat(a,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(a,";"),"margin"===s&&"\n padding-left: ".concat(n,"px;\n padding-top: ").concat(l,"px;\n padding-right: ").concat(r,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(a,";\n "),"padding"===s&&"padding-right: ".concat(i,"px ").concat(a,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Pd," {\n right: ").concat(i,"px ").concat(a,";\n }\n \n .").concat(Bd," {\n margin-right: ").concat(i,"px ").concat(a,";\n }\n \n .").concat(Pd," .").concat(Pd," {\n right: 0 ").concat(a,";\n }\n \n .").concat(Bd," .").concat(Bd," {\n margin-right: 0 ").concat(a,";\n }\n \n body[").concat(tu,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},au=function(){var e=parseInt(document.body.getAttribute(tu)||"0",10);return isFinite(e)?e:0},nu=function(e){var s=e.noRelative,a=e.noImportant,n=e.gapMode,l=void 0===n?"margin":n;t.useEffect(function(){return document.body.setAttribute(tu,(au()+1).toString()),function(){var e=au()-1;e<=0?document.body.removeAttribute(tu):document.body.setAttribute(tu,e.toString())}},[]);var r=t.useMemo(function(){return Zd(l)},[l]);return t.createElement(eu,{styles:su(r,!s,l,a?"":"!important")})},lu=!1;if("undefined"!==typeof window)try{var ru=Object.defineProperty({},"passive",{get:function(){return lu=!0,!0}});window.addEventListener("test",ru,ru),window.removeEventListener("test",ru,ru)}catch(K2){lu=!1}var iu=!!lu&&{passive:!1},ou=function(e,t){if(!(e instanceof Element))return!1;var s=window.getComputedStyle(e);return"hidden"!==s[t]&&!(s.overflowY===s.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===s[t])},cu=function(e,t){var s=t.ownerDocument,a=t;do{if("undefined"!==typeof ShadowRoot&&a instanceof ShadowRoot&&(a=a.host),du(e,a)){var n=uu(e,a);if(n[1]>n[2])return!0}a=a.parentNode}while(a&&a!==s.body);return!1},du=function(e,t){return"v"===e?function(e){return ou(e,"overflowY")}(t):function(e){return ou(e,"overflowX")}(t)},uu=function(e,t){return"v"===e?[(s=t).scrollTop,s.scrollHeight,s.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var s},mu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hu=function(e){return[e.deltaX,e.deltaY]},xu=function(e){return e&&"current"in e?e.current:e},pu=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},gu=0,fu=[];function vu(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const bu=(ju=function(e){var s=t.useRef([]),a=t.useRef([0,0]),n=t.useRef(),l=t.useState(gu++)[0],r=t.useState(Jd)[0],i=t.useRef(e);t.useEffect(function(){i.current=e},[e]),t.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(l));
vendor: 1,742 bytes, line 2
2var t=Md([e.lockRef.current],(e.shards||[]).map(xu),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(l))})}}},[e.inert,e.lockRef.current,e.shards]);var o=t.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var s,l=mu(e),r=a.current,o="deltaX"in e?e.deltaX:r[0]-l[0],c="deltaY"in e?e.deltaY:r[1]-l[1],d=e.target,u=Math.abs(o)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var m=window.getSelection(),h=m&&m.anchorNode;if(h&&(h===d||h.contains(d)))return!1;var x=cu(u,d);if(!x)return!0;if(x?s=u:(s="v"===u?"h":"v",x=cu(u,d)),!x)return!1;if(!n.current&&"changedTouches"in e&&(o||c)&&(n.current=s),!s)return!0;var p=n.current||s;return function(e,t,s,a,n){var l=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),r=l*a,i=s.target,o=t.contains(i),c=!1,d=r>0,u=0,m=0;do{if(!i)break;var h=uu(e,i),x=h[0],p=h[1]-h[2]-l*x;(x||p)&&du(e,i)&&(u+=p,m+=x);var g=i.parentNode;i=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!o&&i!==document.body||o&&(t.contains(i)||t===i));return(d&&(n&&Math.abs(u)<1||!n&&r>u)||!d&&(n&&Math.abs(m)<1||!n&&-r>m))&&(c=!0),c}(p,t,e,"h"===p?o:c,!0)},[]),c=t.useCallback(function(e){var t=e;if(fu.length&&fu[fu.length-1]===r){var a="deltaY"in t?hu(t):mu(t),n=s.current.filter(function(e){return e.name===t.type&&(e.target===t.target||t.target===e.shadowParent)&&(s=e.delta,n=a,s[0]===n[0]&&s[1]===n[1]);var s,n})[0];if(n&&n.should)t.cancelable&&t.preventDefault();
2else if(!n){var l=(i.current.shards||[]).map(xu).filter(Boolean).filter(function(e){return e.contains(t.target)});(l.length>0?o(t,l[0]):!i.current.noIsolation)&&t.cancelable&&t.preventDefault()}}},[]),d=t.useCallback(function(e,t,a,n){var l={name:e,delta:t,target:a,should:n,shadowParent:vu(a)};s.current.push(l),setTimeout(function(){s.current=s.current.filter(function(e){return e!==l})},1)},[]),u=t.useCallback(function(e){a.current=mu(e),n.current=void 0},[]),m=t.useCallback(function(t){d(t.type,hu(t),t.target,o(t,e.lockRef.current))},[]),h=t.useCallback(function(t){d(t.type,mu(t),t.target,o(t,e.lockRef.current))},[]);t.useEffect(function(){return fu.push(r),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",c,iu),document.addEventListener("touchmove",c,iu),document.addEventListener("touchstart",u,iu),function(){fu=fu.filter(function(e){return e!==r}),document.removeEventListener("wheel",c,iu),document.removeEventListener("touchmove",c,iu),document.removeEventListener("touchstart",u,iu)}},[]);var x=e.removeScrollBar,p=e.inert;return t.createElement(t.Fragment,null,p?t.createElement(r,{styles:pu(l)}):null,x?t.createElement(nu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Wd.useMedium(ju),Gd);var ju,yu=t.forwardRef(function(e,s){return t.createElement(qd,Td({},e,{ref:s,sideCar:bu}))});yu.classNames=qd.classNames;const Nu=yu,wu=["__scopeMenu"],Cu=["forceMount"],ku=["__scopeMenu","loop","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEntryFocus","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","disableOutsideScroll"],Du=["__scopeMenu"],_u=["__scopeMenu"],Su=["disabled","onSelect"],Eu=["__scopeMenu","disabled","textValue"],Au=["checked","onCheckedChange"],Fu=["value","onValueChange"],Tu=["value"],zu=["__scopeMenu","forceMount"],Mu=["__scopeMenu"],Pu=["__scopeMenu"],Bu=["forceMount"];var Ru=["Enter"," "],Lu=["ArrowUp","PageDown","End"],Iu=["ArrowDown","PageUp","Home",...Lu],Ou={ltr:[...Ru,"ArrowRight"],rtl:[...Ru,"ArrowLeft"]},Uu={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Hu="Menu",[Wu,Vu,qu]=$r(Hu),[$u,Gu]=jr(Hu,[qu,Sc,id]),Ku=Sc(),Yu=id(),[Ju,Qu]=$u(Hu),[Xu,Zu]=$u(Hu),em=e=>{const{__scopeMenu:s,open:a=!1,children:n,dir:l,onOpenChange:r,modal:i=!0}=e,o=Ku(s),[c,u]=t.useState(null),m=t.useRef(!1),h=Xr(r),x=Qr(l);return t.useEffect(()=>{const e=()=>{m.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>m.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,ea.jsx)(Vc,d(d({},o),{},{children:(0,ea.jsx)(Ju,{scope:s,open:a,onOpenChange:h,content:c,onContentChange:u,children:(0,ea.jsx)(Xu,{scope:s,onClose:t.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:x,modal:i,children:n})})}))};em.displayName=Hu;var tm=t.forwardRef((e,t)=>{const{__scopeMenu:s}=e,a=l(e,wu),n=Ku(s);return(0,ea.jsx)(qc,d(d(d({},n),a),{},{ref:t}))});tm.displayName="MenuAnchor";var sm="MenuPortal",[am,nm]=$u(sm,{forceMount:void 0}),lm=e=>{const{__scopeMenu:t,forceMount:s,children:a,container:n}=e,l=Qu(sm,t);return(0,ea.jsx)(am,{scope:t,forceMount:s,children:(0,ea.jsx)(Jc,{present:s||l.open,children:(0,ea.jsx)(Yc,{asChild:!0,container:n,children:a})})})};lm.displayName=sm;var rm="MenuContent",[im,om]=$u(rm),cm=t.forwardRef((e,t)=>{const s=nm(rm,e.__scopeMenu),{forceMount:a=s.forceMount}=e,n=l(e,Cu),r=Qu(rm,e.__scopeMenu),i=Zu(rm,e.__scopeMenu);return(0,ea.jsx)(Wu.Provider,{scope:e.__scopeMenu,children:(0,ea.jsx)(Jc,{present:a||r.open,children:(0,ea.jsx)(Wu.Slot,{scope:e.__scopeMenu,children:i.modal?(0,ea.jsx)(dm,d(d({},n),{},{ref:t})):(0,ea.jsx)(um,d(d({},n),{},{ref:t}))})})})}),dm=t.forwardRef((e,s)=>{const a=Qu(rm,e.__scopeMenu),n=t.useRef(null),l=fr(s,n);return t.useEffect(()=>{const e=n.current;if(e)return Fd(e)},[]),(0,ea.jsx)(hm,d(d({},e),{},{ref:l,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:xr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)}))}),um=t.forwardRef((e,t)=>
2{const s=Qu(rm,e.__scopeMenu);return(0,ea.jsx)(hm,d(d({},e),{},{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)}))}),mm=jd("MenuContent.ScrollLock"),hm=t.forwardRef((e,s)=>{const{__scopeMenu:a,loop:n=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:x,onInteractOutside:p,onDismiss:g,disableOutsideScroll:f}=e,v=l(e,ku),b=Qu(rm,a),j=Zu(rm,a),y=Ku(a),N=Yu(a),w=Vu(a),[C,k]=t.useState(null),D=t.useRef(null),_=fr(s,D,b.onContentChange),S=t.useRef(0),E=t.useRef(""),A=t.useRef(0),F=t.useRef(null),T=t.useRef("right"),z=t.useRef(0),M=f?Nu:t.Fragment,P=f?{as:mm,allowPinchZoom:!0}:void 0,B=e=>{var t,s;const a=E.current+e,n=w().filter(e=>!e.disabled),l=document.activeElement,r=null===(t=n.find(e=>e.ref.current===l))||void 0===t?void 0:t.textValue,i=function(e,t,s){const a=t.length>1&&Array.from(t).every(e=>e===t[0]),n=a?t[0]:t,l=s?e.indexOf(s):-1;let r=(i=e,o=Math.max(l,0),i.map((e,t)=>i[(o+t)%i.length]));var i,o;1===n.length&&(r=r.filter(e=>e!==s));const c=r.find(e=>e.toLowerCase().startsWith(n.toLowerCase()));return c!==s?c:void 0}(n.map(e=>e.textValue),a,r),o=null===(s=n.find(e=>e.textValue===i))||void 0===s?void 0:s.ref.current;!function e(t){E.current=t,window.clearTimeout(S.current),""!==t&&(S.current=window.setTimeout(()=>e(""),1e3))}(a),o&&setTimeout(()=>o.focus())};t.useEffect(()=>()=>window.clearTimeout(S.current),[]),di();const R=t.useCallback(e=>{var t,s;return T.current===(null===(t=F.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;const s={x:e.clientX,y:e.clientY};return function(e,t){const{x:s,y:a}=e;let n=!1;for(let l=0,r=t.length-1;l<t.length;r=l++){const e=t[l],i=t[r],o=e.x,c=e.y,d=i.x,u=i.y;c>a!==u>a&&s<(d-o)*(a-c)/(u-c)+o&&(n=!n)}return n}(s,t)}(e,null===(s=F.current)||void 0===s?void 0:s.area)},[]);return(0,ea.jsx)(im,{scope:a,searchRef:E,onItemEnter:t.useCallback(e=>{R(e)&&e.preventDefault()},[R]),onItemLeave:t.useCallback(e=>{var t;R(e)||(null===(t=D.current)||void 0===t||t.focus(),k(null))},[R]),onTriggerLeave:t.useCallback(e=>{R(e)&&e.preventDefault()},[R]),pointerGraceTimerRef:A,onPointerGraceIntentChange:t.useCallback(e=>{F.current=e},[]),children:(0,ea.jsx)(M,d(d({},P),{},{children:(0,ea.jsx)(gi,{asChild:!0,trapped:r,onMountAutoFocus:xr(i,e=>{var t;e.preventDefault(),null===(t=D.current)||void 0===t||t.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,ea.jsx)(li,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:x,onInteractOutside:p,onDismiss:g,children:(0,ea.jsx)(gd,d(d({asChild:!0},N),{},{dir:j.dir,orientation:"vertical",loop:n,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:xr(u,e=>{j.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ea.jsx)($c,d(d(d({role:"menu","aria-orientation":"vertical","data-state":Um(b.open),"data-radix-menu-content":"",dir:j.dir},y),v),{},{ref:_,style:d({outline:"none"},v.style),onKeyDown:xr(v.onKeyDown,e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,s=e.ctrlKey||e.altKey||e.metaKey,a=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!s&&a&&B(e.key));const n=D.current;if(e.target!==n)return;if(!Iu.includes(e.key))return;e.preventDefault();const l=w().filter(e=>!e.disabled).map(e=>e.ref.current);Lu.includes(e.key)&&l.reverse(),function(e){const t=document.activeElement;for(const s of e){if(s===t)return;if(s.focus(),document.activeElement!==t)return}}(l)}),onBlur:xr(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(S.current),E.current="")}),onPointerMove:xr(e.onPointerMove,Vm(e=>{const t=e.target,s=z.current!==e.clientX;if(e.currentTarget.contains(t)&&s){const t=e.clientX>z.current?"right":"left";T.current=t,z.current=e.clientX}}))}))}))})})}))})});cm.displayName=rm;var xm=t.forwardRef((e,t)=>{const{__scopeMenu:s}=e,a=l(e,Du);return(0,ea.jsx)(Tr.div,d(d({role:"group"},a),{},{ref:t}))});xm.displayName="MenuGroup";var pm=t.forwardRef((e,t)=>{const{__scopeMenu:s}=e,a=l(e,_u);return(0,ea.jsx)(Tr.div,d(d({},a),{},{ref:t}))});pm.displayName="MenuLabel";var gm="MenuItem",fm="menu.itemSelect",vm=t.forwardRef((e,s)=>{const{disabled:a=!1,onSelect:n}=e,r=l(e,Su),i=t.useRef(null),o=Zu(gm,e.__scopeMenu),c=om(gm,e.__scopeMenu),u=fr(s,i),m=t.useRef(!1);return(0,ea.jsx)(bm,d(d({},r),{},{ref:u,disabled:a,onClick:xr(e.onClick,()=>{const e=i.current;if(!a&&e){const t=new CustomEvent(fm,{bubbles:!0,cancelable:!0});e.addEventListener(fm,e=>null===n||void 0===n?void 0:n(e),{once:!0}),zr(e,t),t.defaultPrevented?m.current=!1:o.onClose()}}),onPointerDown:t=>{var s;null===(s=e.onPointerDown)||void 0===s||s.call(e,t),m.current=!0},onPointerUp:xr(e.onPointerUp,e=>{var t;m.current||null===(t=e.currentTarget)||void 0===t||t.click()}),onKeyDown:xr(e.onKeyDown,e=>{const t=""!==c.searchRef.current;
2a||t&&" "===e.key||Ru.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})}))});vm.displayName=gm;var bm=t.forwardRef((e,s)=>{const{__scopeMenu:a,disabled:n=!1,textValue:r}=e,i=l(e,Eu),o=om(gm,a),c=Yu(a),u=t.useRef(null),m=fr(s,u),[h,x]=t.useState(!1),[p,g]=t.useState("");return t.useEffect(()=>{const e=u.current;var t;e&&g((null!==(t=e.textContent)&&void 0!==t?t:"").trim())},[i.children]),(0,ea.jsx)(Wu.ItemSlot,{scope:a,disabled:n,textValue:null!==r&&void 0!==r?r:p,children:(0,ea.jsx)(fd,d(d({asChild:!0},c),{},{focusable:!n,children:(0,ea.jsx)(Tr.div,d(d({role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0},i),{},{ref:m,onPointerMove:xr(e.onPointerMove,Vm(e=>{if(n)o.onItemLeave(e);else if(o.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}})),onPointerLeave:xr(e.onPointerLeave,Vm(e=>o.onItemLeave(e))),onFocus:xr(e.onFocus,()=>x(!0)),onBlur:xr(e.onBlur,()=>x(!1))}))}))})}),jm=t.forwardRef((e,t)=>{const{checked:s=!1,onCheckedChange:a}=e,n=l(e,Au);return(0,ea.jsx)(Sm,{scope:e.__scopeMenu,checked:s,children:(0,ea.jsx)(vm,d(d({role:"menuitemcheckbox","aria-checked":Hm(s)?"mixed":s},n),{},{ref:t,"data-state":Wm(s),onSelect:xr(n.onSelect,()=>null===a||void 0===a?void 0:a(!!Hm(s)||!s),{checkForDefaultPrevented:!1})}))})});jm.displayName="MenuCheckboxItem";var ym="MenuRadioGroup",[Nm,wm]=$u(ym,{value:void 0,onValueChange:()=>{}}),Cm=t.forwardRef((e,t)=>{const{value:s,onValueChange:a}=e,n=l(e,Fu),r=Xr(a);return(0,ea.jsx)(Nm,{scope:e.__scopeMenu,value:s,onValueChange:r,children:(0,ea.jsx)(xm,d(d({},n),{},{ref:t}))})});Cm.displayName=ym;var km="MenuRadioItem",Dm=t.forwardRef((e,t)=>{const{value:s}=e,a=l(e,Tu),n=wm(km,e.__scopeMenu),r=s===n.value;return(0,ea.jsx)(Sm,{scope:e.__scopeMenu,checked:r,children:(0,ea.jsx)(vm,d(d({role:"menuitemradio","aria-checked":r},a),{},{ref:t,"data-state":Wm(r),onSelect:xr(a.onSelect,()=>{var e;return null===(e=n.onValueChange)||void 0===e?void 0:e.call(n,s)},{checkForDefaultPrevented:!1})}))})});Dm.displayName=km;var _m="MenuItemIndicator",[Sm,Em]=$u(_m,{checked:!1}),Am=t.forwardRef((e,t)=>{const{__scopeMenu:s,forceMount:a}=e,n=l(e,zu),r=Em(_m,s);return(0,ea.jsx)(Jc,{present:a||Hm(r.checked)||!0===r.checked,children:(0,ea.jsx)(Tr.span,d(d({},n),{},{ref:t,"data-state":Wm(r.checked)}))})});Am.displayName=_m;var Fm=t.forwardRef((e,t)=>{const{__scopeMenu:s}=e,a=l(e,Mu);return(0,ea.jsx)(Tr.div,d(d({role:"separator","aria-orientation":"horizontal"},a),{},{ref:t}))});Fm.displayName="MenuSeparator";var Tm=t.forwardRef((e,t)=>{const{__scopeMenu:s}=e,a=l(e,Pu),n=Ku(s);return(0,ea.jsx)(Gc,d(d(d({},n),a),{},{ref:t}))});Tm.displayName="MenuArrow";var zm="MenuSub",[Mm,Pm]=$u(zm),Bm=e=>{const{__scopeMenu:s,children:a,open:n=!1,onOpenChange:l}=e,r=Qu(zm,s),i=Ku(s),[o,c]=t.useState(null),[u,m]=t.useState(null),h=Xr(l);return t.useEffect(()=>(!1===r.open&&h(!1),()=>h(!1)),[r.open,h]),(0,ea.jsx)(Vc,d(d({},i),{},{children:(0,ea.jsx)(Ju,{scope:s,open:n,onOpenChange:h,content:u,onContentChange:m,children:(0,ea.jsx)(Mm,{scope:s,contentId:ki(),triggerId:ki(),trigger:o,onTriggerChange:c,children:a})})}))};Bm.displayName=zm;var Rm="MenuSubTrigger",Lm=t.forwardRef((e,s)=>{const a=Qu(Rm,e.__scopeMenu),n=Zu(Rm,e.__scopeMenu),l=Pm(Rm,e.__scopeMenu),r=om(Rm,e.__scopeMenu),i=t.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=r,u={__scopeMenu:e.__scopeMenu},m=t.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return t.useEffect(()=>m,[m]),t.useEffect(()=>{const e=o.current;return()=>{window.clearTimeout(e),c(null)}},[o,c]),(0,ea.jsx)(tm,d(d({asChild:!0},u),{},{children:(0,ea.jsx)(bm,d(d({id:l.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":l.contentId,"data-state":Um(a.open)},e),{},{ref:gr(s,l.onTriggerChange),onClick:t=>{var s;null===(s=e.onClick)||void 0===s||s.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:xr(e.onPointerMove,Vm(t=>{r.onItemEnter(t),t.defaultPrevented||e.disabled||a.open||i.current||(r.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{a.onOpenChange(!0),m()},100))})),onPointerLeave:xr(e.onPointerLeave,Vm(e=>{var t;m();const s=null===(t=a.content)||void 0===t?void 0:t.getBoundingClientRect();if(s){var n;const t=null===(n=a.content)||void 0===n?void 0:n.dataset.side,l="right"===t,i=l?-5:5,c=s[l?"left":"right"],d=s[l?"right":"left"];r.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:c,y:s.top},{x:d,y:s.top},{x:d,y:s.bottom},{x:c,y:s.bottom}],side:t}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>r.onPointerGraceIntentChange(null),300)}else{if(r.onTriggerLeave(e),e.defaultPrevented)return;r.onPointerGraceIntentChange(null)}})),onKeyDown:xr(e.onKeyDown,t=>{const s=""!==r.searchRef.current;var l;e.disabled||s&&" "===t.key||Ou[n.dir].includes(t.key)&&(a.onOpenChange(!0),null===(l=a.content)||void 0===l||l.focus(),t.preventDefault())})}))}))});Lm.displayName=Rm;var Im="MenuSubContent",Om=t.forwardRef((e,s)=>{const a=nm(rm,e.__scopeMenu),{forceMount:n=a.forceMount}=e,r=l(e,Bu),i=Qu(rm,e.__scopeMenu),o=Zu(rm,e.__scopeMenu),c=Pm(Im,e.__scopeMenu),u=t.useRef(null),m=fr(s,u);return(0,ea.jsx)(Wu.Provider,{scope:e.__scopeMenu,children:(0,ea.jsx)(Jc,{present:n||i.open,children:(0,ea.jsx)(Wu.Slot,{scope:e.__scopeMenu,children:(0,ea.jsx)(hm,d(d({id:c.contentId,"aria-labelledby":c.triggerId},r),{},{ref:m,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;o.isUsingKeyboardRef.current&&(null===(t=u.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:xr(e.onFocusOutside,e=>{e.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:xr(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:xr(e.onKeyDown,e=>{const t=e.currentTarget.contains(e.target),s=Uu[o.dir].includes(e.ke
2y);var a;t&&s&&(i.onOpenChange(!1),null===(a=c.trigger)||void 0===a||a.focus(),e.preventDefault())})}))})})})});function Um(e){return e?"open":"closed"}function Hm(e){return"indeterminate"===e}function Wm(e){return Hm(e)?"indeterminate":e?"checked":"unchecked"}function Vm(e){return t=>"mouse"===t.pointerType?e(t):void 0}Om.displayName=Im;var qm=em,$m=tm,Gm=lm,Km=cm,Ym=xm,Jm=pm,Qm=vm,Xm=jm,Zm=Cm,eh=Dm,th=Am,sh=Fm,ah=Tm,nh=Bm,lh=Lm,rh=Om;const ih=["__scopeDropdownMenu","disabled"],oh=["__scopeDropdownMenu"],ch=["__scopeDropdownMenu"],dh=["__scopeDropdownMenu"],uh=["__scopeDropdownMenu"],mh=["__scopeDropdownMenu"],hh=["__scopeDropdownMenu"],xh=["__scopeDropdownMenu"],ph=["__scopeDropdownMenu"],gh=["__scopeDropdownMenu"],fh=["__scopeDropdownMenu"],vh=["__scopeDropdownMenu"],bh=["__scopeDropdownMenu"],jh=["__scopeDropdownMenu"];var yh="DropdownMenu",[Nh,wh]=jr(yh,[Gu]),Ch=Gu(),[kh,Dh]=Nh(yh),_h=e=>{const{__scopeDropdownMenu:s,children:a,dir:n,open:l,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,c=Ch(s),u=t.useRef(null),[m,h]=Cr({prop:l,defaultProp:null!==r&&void 0!==r&&r,onChange:i,caller:yh});return(0,ea.jsx)(kh,{scope:s,triggerId:ki(),triggerRef:u,contentId:ki(),open:m,onOpenChange:h,onOpenToggle:t.useCallback(()=>h(e=>!e),[h]),modal:o,children:(0,ea.jsx)(qm,d(d({},c),{},{open:m,onOpenChange:h,dir:n,modal:o,children:a}))})};_h.displayName=yh;var Sh="DropdownMenuTrigger",Eh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,disabled:a=!1}=e,n=l(e,ih),r=Dh(Sh,s),i=Ch(s);return(0,ea.jsx)($m,d(d({asChild:!0},i),{},{children:(0,ea.jsx)(Tr.button,d(d({type:"button",id:r.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":r.open?"open":"closed","data-disabled":a?"":void 0,disabled:a},n),{},{ref:gr(t,r.triggerRef),onPointerDown:xr(e.onPointerDown,e=>{a||0!==e.button||!1!==e.ctrlKey||(r.onOpenToggle(),r.open||e.preventDefault())}),onKeyDown:xr(e.onKeyDown,e=>{a||(["Enter"," "].includes(e.key)&&r.onOpenToggle(),"ArrowDown"===e.key&&r.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})}))}))});Eh.displayName=Sh;var Ah=e=>{const{__scopeDropdownMenu:t}=e,s=l(e,oh),a=Ch(t);return(0,ea.jsx)(Gm,d(d({},a),s))};Ah.displayName="DropdownMenuPortal";var Fh="DropdownMenuContent",Th=t.forwardRef((e,s)=>{const{__scopeDropdownMenu:a}=e,n=l(e,ch),r=Dh(Fh,a),i=Ch(a),o=t.useRef(!1);return(0,ea.jsx)(Km,d(d(d({id:r.contentId,"aria-labelledby":r.triggerId},i),n),{},{ref:s,onCloseAutoFocus:xr(e.onCloseAutoFocus,e=>{var t;o.current||null===(t=r.triggerRef.current)||void 0===t||t.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:xr(e.onInteractOutside,e=>{const t=e.detail.originalEvent,s=0===t.button&&!0===t.ctrlKey,a=2===t.button||s;r.modal&&!a||(o.current=!0)}),style:d(d({},e.style),{"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"})}))});Th.displayName=Fh;var zh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,dh),n=Ch(s);return(0,ea.jsx)(Ym,d(d(d({},n),a),{},{ref:t}))});zh.displayName="DropdownMenuGroup";var Mh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,uh),n=Ch(s);return(0,ea.jsx)(Jm,d(d(d({},n),a),{},{ref:t}))});Mh.displayName="DropdownMenuLabel";var Ph=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,mh),n=Ch(s);return(0,ea.jsx)(Qm,d(d(d({},n),a),{},{ref:t}))});Ph.displayName="DropdownMenuItem";var Bh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,hh),n=Ch(s);return(0,ea.jsx)(Xm,d(d(d({},n),a),{},{ref:t}))});Bh.displayName="DropdownMenuCheckboxItem";var Rh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,xh),n=Ch(s);return(0,ea.jsx)(Zm,d(d(d({},n),a),{},{ref:t}))});Rh.displayName="DropdownMenuRadioGroup";var Lh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,ph),n=Ch(s);return(0,ea.jsx)(eh,d(d(d({},n),a),{},{ref:t}))});Lh.displayName="DropdownMenuRadioItem";var Ih=t.forwardRef((e,t)=>
2{const{__scopeDropdownMenu:s}=e,a=l(e,gh),n=Ch(s);return(0,ea.jsx)(th,d(d(d({},n),a),{},{ref:t}))});Ih.displayName="DropdownMenuItemIndicator";var Oh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,fh),n=Ch(s);return(0,ea.jsx)(sh,d(d(d({},n),a),{},{ref:t}))});Oh.displayName="DropdownMenuSeparator";var Uh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,vh),n=Ch(s);return(0,ea.jsx)(ah,d(d(d({},n),a),{},{ref:t}))});Uh.displayName="DropdownMenuArrow";var Hh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,bh),n=Ch(s);return(0,ea.jsx)(lh,d(d(d({},n),a),{},{ref:t}))});Hh.displayName="DropdownMenuSubTrigger";var Wh=t.forwardRef((e,t)=>{const{__scopeDropdownMenu:s}=e,a=l(e,jh),n=Ch(s);return(0,ea.jsx)(rh,d(d(d({},n),a),{},{ref:t,style:d(d({},e.style),{"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"})}))});Wh.displayName="DropdownMenuSubContent";var Vh=_h,qh=Eh,$h=Ah,Gh=Th,Kh=Mh,Yh=Ph,Jh=Bh,Qh=Lh,Xh=Ih,Zh=Oh,ex=e=>{const{__scopeDropdownMenu:t,children:s,open:a,onOpenChange:n,defaultOpen:l}=e,r=Ch(t),[i,o]=Cr({prop:a,defaultProp:null!==l&&void 0!==l&&l,onChange:n,caller:"DropdownMenuSub"});return(0,ea.jsx)(nh,d(d({},r),{},{open:i,onOpenChange:o,children:s}))},tx=Hh,sx=Wh;const ax=Vl("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),nx=Vl("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function lx(e){var t,s,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(s=lx(e[t]))&&(a&&(a+=" "),a+=s)}else for(s in e)e[s]&&(a&&(a+=" "),a+=s);return a}function rx(){for(var e,t,s=0,a="",n=arguments.length;s<n;s++)(e=arguments[s])&&(t=lx(e))&&(a&&(a+=" "),a+=t);return a}const ix=function(){return{nextPart:arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map,validators:arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,classGroupId:arguments.length>2?arguments[2]:void 0}},ox="-",cx=[],dx=e=>{const t=hx(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return mx(e);const s=e.split(ox),a=""===s[0]&&s.length>1?1:0;return ux(s,a,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=a[e],n=s[e];return t?n?((e,t)=>{const s=new Array(e.length+t.length);for(let a=0;a<e.length;a++)s[a]=e[a];for(let a=0;a<t.length;a++)s[e.length+a]=t[a];return s})(n,t):t:n||cx}return s[e]||cx}}},ux=(e,t,s)=>{if(0===e.length-t)return s.classGroupId;const a=e[t],n=s.nextPart.get(a);if(n){const s=ux(e,t+1,n);if(s)return s}const l=s.validators;if(null===l)return;const r=0===t?e.join(ox):e.slice(t).join(ox),i=l.length;for(let o=0;o<i;o++){const e=l[o];if(e.validator(r))return e.classGroupId}},mx=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),a=t.slice(0,s);return a?"arbitrary.."+a:void 0})(),hx=e=>{const{theme:t,classGroups:s}=e;return xx(s,t)},xx=(e,t)=>{const s=ix();for(const a in e){const n=e[a];px(n,s,a,t)}return s},px=(e,t,s,a)=>{const n=e.length;for(let l=0;l<n;l++){const n=e[l];gx(n,t,s,a)}},gx=(e,t,s,a)=>{"string"!==typeof e?"function"!==typeof e?bx(e,t,s,a):vx(e,t,s,a):fx(e,t,s)},fx=(e,t,s)=>{(""===e?t:jx(t,e)).classGroupId=s},vx=(e,t,s,a)=>{yx(e)?px(e(a),t,s,a):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(s,e)))},bx=(e,t,s,a)=>{const n=Object.entries(e),l=n.length;for(let r=0;r<l;r++){const[e,l]=n[r];px(l,jx(t,e),s,a)}},jx=(e,t)=>{let s=e;const a=t.split(ox),n=a.length;for(let l=0;l<n;l++){const e=a[l];let t=s.nextPart.get(e);t||(t=ix(),s.nextPart.set(e,t)),s=t}return s},yx=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Nx=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),a=Object.create(null);const n=(n,l)=>{s[n]=l,t++,t>e&&(t=0,a=s,s=Object.create(null))};return{get(e){let t=s[e];return void 0!==t?t:void 0!==(t=a[e])?(n(e,t),t):void 0},set(e,t){e in s?s[e]=t:n(e,t)}}},wx=[],Cx=(e,t,s,a,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:a,isExternal:n}),kx=e=>{const{prefix:t,experimentalParseClassName:s}=e;let a=e=>{const t=[];let s,a=0,n=0,l=0;const r=e.length;for(let d=0;d<r;d++){const r=e[d];if(0===a&&0===n){if(":"===r){t.push(e.slice(l,d)),l=d+1;continue}if("/"===r){s=d;continue}}"["===r?a++:"]"===r?a--:"("===r?n++:")"===r&&n--}const i=0===t.length?e:e.slice(l);let o=i,c=!1;i.endsWith("!")?(o=i.slice(0,-1),c=!0):i.startsWith("!")&&(o=i.slice(1),c=!0);return Cx(t,c,o,s&&s>l?s-l:void 0)};if(t){const e=t+":",s=a;a=t=>t.startsWith(e)?s(t.slice(e.length)):Cx(wx,!1,t,void 0,!0)}if(s){const e=a;a=t=>s({className:t,parseClassName:e})}return a},Dx=e=>{const t=new Map;
vendor: 6,503 bytes, line 2
2return e.orderSensitiveModifiers.forEach((e,s)=>{t.set(e,1e6+s)}),e=>{const s=[];let a=[];for(let n=0;n<e.length;n++){const l=e[n],r="["===l[0],i=t.has(l);r||i?(a.length>0&&(a.sort(),s.push(...a),a=[]),s.push(l)):a.push(l)}return a.length>0&&(a.sort(),s.push(...a)),s}},_x=/\s+/,Sx=e=>{if("string"===typeof e)return e;let t,s="";for(let a=0;a<e.length;a++)e[a]&&(t=Sx(e[a]))&&(s&&(s+=" "),s+=t);return s},Ex=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];let n,l,r,i;const o=e=>{const t=l(e);if(t)return t;const s=((e,t)=>{const{parseClassName:s,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:l}=t,r=[],i=e.trim().split(_x);let o="";for(let c=i.length-1;c>=0;c-=1){const e=i[c],{isExternal:t,modifiers:d,hasImportantModifier:u,baseClassName:m,maybePostfixModifierPosition:h}=s(e);if(t){o=e+(o.length>0?" "+o:o);continue}let x=!!h,p=a(x?m.substring(0,h):m);if(!p){if(!x){o=e+(o.length>0?" "+o:o);continue}if(p=a(m),!p){o=e+(o.length>0?" "+o:o);continue}x=!1}const g=0===d.length?"":1===d.length?d[0]:l(d).join(":"),f=u?g+"!":g,v=f+p;if(r.indexOf(v)>-1)continue;r.push(v);const b=n(p,x);for(let s=0;s<b.length;++s){const e=b[s];r.push(f+e)}o=e+(o.length>0?" "+o:o)}return o})(e,n);return r(e,s),s};return i=t=>{const a=s.reduce((e,t)=>t(e),e());return n=(e=>d({cache:Nx(e.cacheSize),parseClassName:kx(e),sortModifiers:Dx(e)},dx(e)))(a),l=n.cache.get,r=n.cache.set,i=o,o(t)},function(){return i(function(){let e,t,s=0,a="";for(;s<arguments.length;){var n;(e=(n=s++)<0||arguments.length<=n?void 0:arguments[n])&&(t=Sx(e))&&(a&&(a+=" "),a+=t)}return a}(...arguments))}},Ax=[],Fx=e=>{const t=t=>t[e]||Ax;return t.isThemeGetter=!0,t},Tx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Mx=/^\d+\/\d+$/,Px=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bx=/\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$/,Rx=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Lx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ix=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ox=e=>Mx.test(e),Ux=e=>!!e&&!Number.isNaN(Number(e)),Hx=e=>!!e&&Number.isInteger(Number(e)),Wx=e=>e.endsWith("%")&&Ux(e.slice(0,-1)),Vx=e=>Px.test(e),qx=()=>!0,$x=e=>Bx.test(e)&&!Rx.test(e),Gx=()=>!1,Kx=e=>Lx.test(e),Yx=e=>Ix.test(e),Jx=e=>!Xx(e)&&!np(e),Qx=e=>up(e,pp,Gx),Xx=e=>Tx.test(e),Zx=e=>up(e,gp,$x),ep=e=>up(e,fp,Ux),tp=e=>up(e,hp,Gx),sp=e=>up(e,xp,Yx),ap=e=>up(e,bp,Kx),np=e=>zx.test(e),lp=e=>mp(e,gp),rp=e=>mp(e,vp),ip=e=>mp(e,hp),op=e=>mp(e,pp),cp=e=>mp(e,xp),dp=e=>mp(e,bp,!0),up=(e,t,s)=>{const a=Tx.exec(e);return!!a&&(a[1]?t(a[1]):s(a[2]))},mp=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=zx.exec(e);return!!a&&(a[1]?t(a[1]):s)},hp=e=>"position"===e||"percentage"===e,xp=e=>"image"===e||"url"===e,pp=e=>"length"===e||"size"===e||"bg-size"===e,gp=e=>"length"===e,fp=e=>"number"===e,vp=e=>"family-name"===e,bp=e=>"shadow"===e,jp=(Symbol.toStringTag,()=>{const e=Fx("color"),t=Fx("font"),s=Fx("text"),a=Fx("font-weight"),n=Fx("tracking"),l=Fx("leading"),r=Fx("breakpoint"),i=Fx("container"),o=Fx("spacing"),c=Fx("radius"),d=Fx("shadow"),u=Fx("inset-shadow"),m=Fx("text-shadow"),h=Fx("drop-shadow"),x=Fx("blur"),p=Fx("perspective"),g=Fx("aspect"),f=Fx("ease"),v=Fx("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",np,Xx],j=()=>[np,Xx,o],y=()=>[Ox,"full","auto",...j()],N=()=>[Hx,"none","subgrid",np,Xx],w=()=>["auto",{span:["full",Hx,np,Xx]},Hx,np,Xx],C=()=>[Hx,"auto",np,Xx],k=()=>["auto","min","max","fr",np,Xx],D=()=>["auto",...j()],_=()=>[Ox,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],S=()=>[e,np,Xx],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ip,tp,{position:[np,Xx]}],A=()=>["auto","cover","contain",op,Qx,{size:[np,Xx]}],F=()=>[Wx,lp,Zx],T=()=>["","none","full",c,np,Xx],z=()=>["",Ux,lp,Zx],M=()=>[Ux,Wx,ip,tp],P=()=>["","none",x,np,Xx],B=()=>["none",Ux,np,Xx],R=()=>["none",Ux,np,Xx],L=()=>[Ux,np,Xx],I=()=>[Ox,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vx],breakpoint:[Vx],color:[qx],container:[Vx],"drop-shadow":[Vx],ease:["in","out","in-out"],font:[Jx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vx],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vx],shadow:[Vx],spacing:["px",Ux],text:[Vx],"text-shadow":[Vx],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ox,Xx,np,g]}],container:["container"],columns:[{columns:[Ux,Xx,np,i]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"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"],sr:["sr-only","not-sr-only"],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:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:y()}],"inset-x":[{"inset-x":y()}],"inset-y":[{"inset-y":y()}],start:[{start:y()}],end:[{end:y()}],top:[{top:y()}
vendor: 5,013 bytes, line 2
2],right:[{right:y()}],bottom:[{bottom:y()}],left:[{left:y()}],visibility:["visible","invisible","collapse"],z:[{z:[Hx,"auto",np,Xx]}],basis:[{basis:[Ox,"full","auto",i,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ux,Ox,"auto","initial","none",Xx]}],grow:[{grow:["",Ux,np,Xx]}],shrink:[{shrink:["",Ux,np,Xx]}],order:[{order:[Hx,"first","last","none",np,Xx]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:w()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:w()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],w:[{w:[i,"screen",..._()]}],"min-w":[{"min-w":[i,"screen","none",..._()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[r]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",s,lp,Zx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,np,ep]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wx,Xx]}],"font-family":[{font:[rp,Xx,t]}],"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:[n,np,Xx]}],"line-clamp":[{"line-clamp":[Ux,"none",np,ep]}],leading:[{leading:[l,...j()]}],"list-image":[{"list-image":["none",np,Xx]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",np,Xx]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Ux,"from-font","auto",np,Zx]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Ux,"auto",np,Xx]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",np,Xx]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",np,Xx]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:E()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hx,np,Xx],radial:["",np,Xx],conic:[Hx,np,Xx]},cp,sp]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:F()}
vendor: 7,802 bytes, line 2
2],"gradient-via-pos":[{via:F()}],"gradient-to-pos":[{to:F()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Ux,np,Xx]}],"outline-w":[{outline:["",Ux,lp,Zx]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",d,dp,ap]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",u,dp,ap]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Ux,Zx]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",m,dp,ap]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Ux,np,Xx]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ux]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[np,Xx]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Ux]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:E()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",np,Xx]}],filter:[{filter:["","none",np,Xx]}],blur:[{blur:P()}],brightness:[{brightness:[Ux,np,Xx]}],contrast:[{contrast:[Ux,np,Xx]}],"drop-shadow":[{"drop-shadow":["","none",h,dp,ap]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Ux,np,Xx]}],"hue-rotate":[{"hue-rotate":[Ux,np,Xx]}],invert:[{invert:["",Ux,np,Xx]}],saturate:[{saturate:[Ux,np,Xx]}],sepia:[{sepia:["",Ux,np,Xx]}],"backdrop-filter":[{"backdrop-filter":["","none",np,Xx]}],"backdrop-blur":[{"backdrop-blur":P()}],"backdrop-brightness":[{"backdrop-brightness":[Ux,np,Xx]}],"backdrop-contrast":[{"backdrop-contrast":[Ux,np,Xx]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ux,np,Xx]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ux,np,Xx]}],"backdrop-invert":[{"backdrop-invert":["",Ux,np,Xx]}],"backdrop-opacity":[{"backdrop-opacity":[Ux,np,Xx]}],"backdrop-saturate":[{"backdrop-saturate":[Ux,np,Xx]}],"backdrop-sepia":[{"backdrop-sepia":["",Ux,np,Xx]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",np,Xx]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ux,"initial",np,Xx]}],ease:[{ease:["linear","initial",f,np,Xx]}],delay:[{delay:[Ux,np,Xx]}],animate:[{animate:["none",v,np,Xx]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,np,Xx]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:B()}],"rotate-x":[{"rotate-x":B()}],"rotate-y":[{"rotate-y":B()}],"rotate-z":[{"rotate-z":B()}],scale:[{scale:R()}],"scale-x":[{"scale-x":R()}],"scale-y":[{"scale-y":R()}],"scale-z":[{"scale-z":R()}],"scale-3d":["scale-3d"],skew:[{skew:L()}],"skew-x":[{"skew-x":L()}],"skew-y":[{"skew-y":L()}],transform:[{transform:[np,Xx,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:I()}],"translate-x":[{"translate-x":I()}],"translate-y":[{"translate-y":I()}],"translate-z":[{"translate-z":I()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}
vendor: 4,802 bytes, line 2
2],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",np,Xx]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",np,Xx]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Ux,lp,Zx,ep]}],stroke:[{stroke:["none",...S()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}),yp=Ex(jp);function Np(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return yp(rx(t))}const wp=["className","inset","children"],Cp=["className"],kp=["className","sideOffset"],Dp=["className","inset"],_p=["className","children","checked"],Sp=["className","children"],Ep=["className","inset"],Ap=["className"],Fp=Vh,Tp=qh,zp=ex,Mp=t.forwardRef((e,t)=>
2{let{className:s,inset:a,children:n}=e,r=l(e,wp);return(0,ea.jsxs)(tx,d(d({ref:t,className:Np("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",s)},r),{},{children:[n,(0,ea.jsx)(ax,{className:"ml-auto"})]}))});Mp.displayName=tx.displayName;const Pp=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Cp);return(0,ea.jsx)(sx,d({ref:t,className:Np("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 origin-[--radix-dropdown-menu-content-transform-origin]",s)},a))});Pp.displayName=sx.displayName;const Bp=t.forwardRef((e,t)=>{let{className:s,sideOffset:a=4}=e,n=l(e,kp);return(0,ea.jsx)($h,{children:(0,ea.jsx)(Gh,d({ref:t,sideOffset:a,className:Np("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-dropdown-menu-content-transform-origin]",s)},n))})});Bp.displayName=Gh.displayName;const Rp=t.forwardRef((e,t)=>{let{className:s,inset:a}=e,n=l(e,Dp);return(0,ea.jsx)(Yh,d({ref:t,className:Np("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",a&&"pl-8",s)},n))});Rp.displayName=Yh.displayName;t.forwardRef((e,t)=>{let{className:s,children:a,checked:n}=e,r=l(e,_p);return(0,ea.jsxs)(Jh,d(d({ref:t,className:Np("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:n},r),{},{children:[(0,ea.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ea.jsx)(Xh,{children:(0,ea.jsx)(Xl,{className:"h-4 w-4"})})}),a]}))}).displayName=Jh.displayName;t.forwardRef((e,t)=>{let{className:s,children:a}=e,n=l(e,Sp);return(0,ea.jsxs)(Qh,d(d({ref:t,className:Np("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s)},n),{},{children:[(0,ea.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ea.jsx)(Xh,{children:(0,ea.jsx)(nx,{className:"h-2 w-2 fill-current"})})}),a]}))}).displayName=Qh.displayName;const Lp=t.forwardRef((e,t)=>{let{className:s,inset:a}=e,n=l(e,Ep);return(0,ea.jsx)(Kh,d({ref:t,className:Np("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",s)},n))});Lp.displayName=Kh.displayName;const Ip=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Ap);return(0,ea.jsx)(Zh,d({ref:t,className:Np("-mx-1 my-1 h-px bg-muted",s)},a))});Ip.displayName=Zh.displayName;const Op=["children"],Up=["children"];var Hp=Symbol.for("react.lazy"),Wp=a[" use ".trim().toString()];function Vp(e){return null!=e&&"object"===typeof e&&"$$typeof"in e&&e.$$typeof===Hp&&"_payload"in e&&("object"===typeof(t=e._payload)&&null!==t&&"then"in t);var t}function qp(e){const s=Gp(e),a=t.forwardRef((e,a)=>{let{children:n}=e,r=l(e,Op);Vp(n)&&"function"===typeof Wp&&(n=Wp(n._payload));const i=t.Children.toArray(n),o=i.find(Yp);if(o){const e=o.props.children,n=i.map(s=>s===o?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:s);return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null}))}return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:n}))});return a.displayName="".concat(e,".Slot"),a}var $p=qp("Slot");function Gp(e){const s=t.forwardRef((e,s)=>{let{children:a}=e,n=l(e,Up);if(Vp(a)&&"function"===typeof Wp&&(a=Wp(a._payload)),t.isValidElement(a)){const e=function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),l=function(e,t){const s=d({},t);for(const a in t){const n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?s[a]=function(){const e=l(...arguments);return n(...arguments),e}:n&&(s[a]=n):"style"===a?s[a]=d(d({}
2,n),l):"className"===a&&(s[a]=[n,l].filter(Boolean).join(" "))}return d(d({},e),s)}(n,a.props);return a.type!==t.Fragment&&(l.ref=s?gr(s,e):e),t.cloneElement(a,l)}return t.Children.count(a)>1?t.Children.only(null):null});return s.displayName="".concat(e,".SlotClone"),s}var Kp=Symbol("radix.slottable");function Yp(e){return t.isValidElement(e)&&"function"===typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Kp}const Jp=["class","className"],Qp=e=>"boolean"===typeof e?"".concat(e):0===e?"0":e,Xp=rx,Zp=(e,t)=>s=>{var a;if(null==(null===t||void 0===t?void 0:t.variants))return Xp(e,null===s||void 0===s?void 0:s.class,null===s||void 0===s?void 0:s.className);const{variants:n,defaultVariants:r}=t,i=Object.keys(n).map(e=>{const t=null===s||void 0===s?void 0:s[e],a=null===r||void 0===r?void 0:r[e];if(null===t)return null;const l=Qp(t)||Qp(a);return n[e][l]}),o=s&&Object.entries(s).reduce((e,t)=>{let[s,a]=t;return void 0===a||(e[s]=a),e},{}),c=null===t||void 0===t||null===(a=t.compoundVariants)||void 0===a?void 0:a.reduce((e,t)=>{let{class:s,className:a}=t,n=l(t,Jp);return Object.entries(n).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes(d(d({},r),o)[t]):d(d({},r),o)[t]===s})?[...e,s,a]:e},[]);return Xp(e,i,c,null===s||void 0===s?void 0:s.class,null===s||void 0===s?void 0:s.className)},eg=["className","variant","size","asChild"],tg=Zp("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),sg=t.forwardRef((e,t)=>{let{className:s,variant:a,size:n,asChild:r=!1}=e,i=l(e,eg);const o=r?$p:"button";return(0,ea.jsx)(o,d({className:Np(tg({variant:a,size:n,className:s})),ref:t},i))});sg.displayName="Button";const ag={en:{name:"English",flag:"\ud83c\uddec\ud83c\udde7"},de:{name:"Deutsch",flag:"\ud83c\udde9\ud83c\uddea"},fr:{name:"Fran\xe7ais",flag:"\ud83c\uddeb\ud83c\uddf7"},es:{name:"Espa\xf1ol",flag:"\ud83c\uddea\ud83c\uddf8"},it:{name:"Italiano",flag:"\ud83c\uddee\ud83c\uddf9"},pt:{name:"Portugu\xeas",flag:"\ud83c\uddf5\ud83c\uddf9"},nl:{name:"Nederlands",flag:"\ud83c\uddf3\ud83c\uddf1"},pl:{name:"Polski",flag:"\ud83c\uddf5\ud83c\uddf1"},ru:{name:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439",flag:"\ud83c\uddf7\ud83c\uddfa"},uk:{name:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",flag:"\ud83c\uddfa\ud83c\udde6"},ro:{name:"Rom\xe2n\u0103",flag:"\ud83c\uddf7\ud83c\uddf4"},hu:{name:"Magyar",flag:"\ud83c\udded\ud83c\uddfa"},cs:{name:"\u010ce\u0161tina",flag:"\ud83c\udde8\ud83c\uddff"},sk:{name:"Sloven\u010dina",flag:"\ud83c\uddf8\ud83c\uddf0"},sv:{name:"Svenska",flag:"\ud83c\uddf8\ud83c\uddea"},da:{name:"Dansk",flag:"\ud83c\udde9\ud83c\uddf0"},no:{name:"Norsk",flag:"\ud83c\uddf3\ud83c\uddf4"},fi:{name:"Suomi",flag:"\ud83c\uddeb\ud83c\uddee"},bg:{name:"\u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438",flag:"\ud83c\udde7\ud83c\uddec"},hr:{name:"Hrvatski",flag:"\ud83c\udded\ud83c\uddf7"},sr:{name:"\u0421\u0440\u043f\u0441\u043a\u0438",flag:"\ud83c\uddf7\ud83c\uddf8"},sl:{name:"Sloven\u0161\u010dina",flag:"\ud83c\uddf8\ud83c\uddee"},lt:{name:"Lietuvi\u0173",flag:"\ud83c\uddf1\ud83c\uddf9"},lv:{name:"Latvie\u0161u",flag:"\ud83c\uddf1\ud83c\uddfb"},et:{name:"Eesti",flag:"\ud83c\uddea\ud83c\uddea"},el:{name:"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",flag:"\ud83c\uddec\ud83c\uddf7"},tr:{name:"T\xfcrk\xe7e",flag:"\ud83c\uddf9\ud83c\uddf7"},ca:{name:"Catal\xe0",flag:"\ud83c\udff4"},gl:{name:"Galego",flag:"\ud83c\udff4"},eu:{name:"Euskara",flag:"\ud83c\udff4"},cy:{name:"Cymraeg",flag:"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f"},ga:{name:"Gaeilge",flag:"\ud83c\uddee\ud83c\uddea"},mt:{name:"Malti",flag:"\ud83c\uddf2\ud83c\uddf9"},zh:{name:"\u4e2d\u6587 (\u7b80\u4f53)",flag:"\ud83c\udde8\ud83c\uddf3"},"zh-TW":{name:"\u4e2d\u6587 (\u7e41\u9ad4)",flag:"\ud83c\uddf9\ud83c\uddfc"},ja:{name:"\u65e5\u672c\u8a9e",flag:"\ud83c\uddef\ud83c\uddf5"},ko:{name:"\ud55c\uad6d\uc5b4",flag:"\ud83c\uddf0\ud83c\uddf7"},th:{name:"\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22",flag:"\ud83c\uddf9\ud83c\udded"},vi:{name:"Ti\u1ebfng Vi\u1ec7t",flag:"\ud83c\uddfb\ud83c\uddf3"},id:{name:"Bahasa Indonesia",flag:"\ud83c\uddee\ud83c\udde9"},ms:{name:"Bahasa Melayu",flag:"\ud83c\uddf2\ud83c\uddfe"},tl:{name:"Filipino",flag:"\ud83c\uddf5\ud83c\udded"},km:{name:"\u1797\u17b6\u179f\u17b6\u1781\u17d2\u1798\u17c2\u179a",flag:"\ud83c\uddf0\ud83c\udded"},lo:{name:"\u0e9e\u0eb2\u0eaa\u0eb2\u0ea5\u0eb2\u0ea7",flag:"\ud83c\uddf1\ud83c\udde6"},my:{name:"\u1019\u103c\u1014\u103a\u1019\u102c\u1018\u102c\u101e\u102c",flag:"\ud83c\uddf2\ud83c\uddf2"},si:{name:"\u0dc3\u0dd2\u0d82\u0dc4\u0dbd",flag:"\ud83c\uddf1\ud83c\uddf0"},hi:{name:"\u0939\u093f\u0928\u094d\u0926\u0940",flag:"\ud83c\uddee\ud83c\uddf3"},bn:{name:"\u09ac\u09be\u0982\u09b2\u09be",flag:"\ud83c\udde7\ud83c\udde9"},ur:{name:"\u0627\u0631\u062f\u0648",flag:"\ud83c\uddf5\ud83c\uddf0"},pa:{name:"\u0a2a\u0a70\u0a1c\u0a3e\u0a2c\u0a40",flag:"\ud83c\uddee\ud83c\uddf3"},gu:{name:"\u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0",flag:"\ud83c\uddee\ud83c\uddf3"},mr:{name:"\u092e\u0930\u093e\u0920\u0940",flag:"\ud83c\uddee\ud83c\uddf3"},ta:{name:"\u0ba4\u0bae\u0bbf\u0bb4\u0bcd",flag:"\ud83c\uddee\ud83c\uddf3"},te:{name:"\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41",flag:"\ud83c\uddee\ud83c\uddf3"},kn:{name:"\u0c95\u0ca8\u0ccd\u0ca8\u0ca1",flag:"\ud83c\uddee\ud83c\uddf3"},ml:{name:"\u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02",flag:"\ud83c\uddee\ud83c\uddf3"},ne:{name:"\u0928\u0947\u092a\u093e\u0932\u0940",flag:"\ud83c\uddf3\ud83c\uddf5"},ar:{name:"\u0627\u0644\u0639\u0631\u0628\u064a\u0629",flag:"\ud83c\uddf8\ud83c\udde6"},fa:{name:"\u0641\u0627\u0631\u0633\u06cc",flag:"\ud83c\uddee\ud83c\uddf7"},he:{name:"\u05e2\u05d1\u05e8\u05d9\u05ea",flag:"\ud83c\uddee\ud83c\uddf1"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\ud83c\udde7\ud83c\uddf7"},ht:{name:"Krey\xf2l ayisyen",flag:"\ud83c\udded\ud83c\uddf9"}
2,sw:{name:"Kiswahili",flag:"\ud83c\uddf0\ud83c\uddea"},am:{name:"\u12a0\u121b\u122d\u129b",flag:"\ud83c\uddea\ud83c\uddf9"},so:{name:"Soomaali",flag:"\ud83c\uddf8\ud83c\uddf4"},zu:{name:"isiZulu",flag:"\ud83c\uddff\ud83c\udde6"},af:{name:"Afrikaans",flag:"\ud83c\uddff\ud83c\udde6"}},ng="nexuscms_language_preference",lg=()=>{var e;const t=localStorage.getItem(ng);if(t&&ag[t])return t;const s=null===(e=navigator.language)||void 0===e?void 0:e.split("-")[0];return s&&ag[s]?s:"en"},rg=e=>{let{onLanguageChange:s,currentLanguage:a="en",variant:n="default",enabledLanguages:l=null,className:r=""}=e;const[i,o]=(0,t.useState)(a),[c,d]=(0,t.useState)(!1);(0,t.useEffect)(()=>{const e=localStorage.getItem(ng);e&&ag[e]&&(o(e),s&&e!==a&&s(e))},[]);const u=l?Object.entries(ag).filter(e=>{let[t]=e;return l.includes(t)}):Object.entries(ag),m=async e=>{e!==i&&(d(!0),o(e),localStorage.setItem(ng,e),s&&await s(e),d(!1))},h=ag[i]||ag.en;return"minimal"===n?(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 ".concat(r),disabled:c,children:(0,ea.jsx)("span",{className:"text-lg",children:h.flag})})}),(0,ea.jsx)(Bp,{align:"end",className:"max-h-[300px] overflow-y-auto",children:u.map(e=>{let[t,s]=e;return(0,ea.jsxs)(Rp,{onClick:()=>m(t),className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("span",{children:s.flag}),(0,ea.jsx)("span",{children:s.name}),t===i&&(0,ea.jsx)(Xl,{size:14,className:"ml-auto text-green-500"})]},t)})})]}):"compact"===n?(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsxs)(sg,{variant:"outline",size:"sm",className:"h-8 gap-1.5 ".concat(r),disabled:c,children:[(0,ea.jsx)("span",{children:h.flag}),(0,ea.jsx)("span",{className:"uppercase text-xs font-medium",children:i}),(0,ea.jsx)(tr,{size:12,className:"opacity-50"})]})}),(0,ea.jsx)(Bp,{align:"end",className:"max-h-[300px] overflow-y-auto",children:u.map(e=>{let[t,s]=e;return(0,ea.jsxs)(Rp,{onClick:()=>m(t),className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("span",{children:s.flag}),(0,ea.jsx)("span",{children:s.name}),t===i&&(0,ea.jsx)(Xl,{size:14,className:"ml-auto text-green-500"})]},t)})})]}):(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsxs)(sg,{variant:"outline",size:"sm",className:"h-9 gap-2 ".concat(r),disabled:c,children:[(0,ea.jsx)(hr,{size:16,className:"opacity-70"}),(0,ea.jsx)("span",{children:h.flag}),(0,ea.jsx)("span",{className:"hidden sm:inline",children:h.name}),(0,ea.jsx)(tr,{size:14,className:"opacity-50"})]})}),(0,ea.jsx)(Bp,{align:"end",className:"w-48 max-h-[400px] overflow-y-auto",children:u.map(e=>{let[t,s]=e;return(0,ea.jsxs)(Rp,{onClick:()=>m(t),className:"flex items-center gap-2 cursor-pointer ".concat(t===i?"bg-indigo-50":""),children:[(0,ea.jsx)("span",{className:"text-base",children:s.flag}),(0,ea.jsx)("span",{className:"flex-1",children:s.name}),t===i&&(0,ea.jsx)(Xl,{size:14,className:"text-indigo-600"})]},t)})})]})};const ig=s(495),og="[A-Za-z$_][0-9A-Za-z$_]*",cg=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],dg=["true","false","null","undefined","NaN","Infinity"],ug=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],mg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],hg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decode
2URI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],xg=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],pg=[].concat(hg,ug,mg);function gg(e){const t=e.regex,s=og,a="<>",n="</>",l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const s=e[0].length+e.index,a=e.input[s];if("<"===a||","===a)return void t.ignoreMatch();let n;">"===a&&(((e,t)=>{let{after:s}=t;const a="</"+e[0].slice(1);return-1!==e.input.indexOf(a,s)})(e,{after:s})||t.ignoreMatch());const l=e.input.substring(s);((n=l.match(/^\s*=/))||(n=l.match(/^\s+extends\s+/))&&0===n.index)&&t.ignoreMatch()}},r={$pattern:og,keyword:cg,literal:dg,built_in:pg,"variable.language":xg},i="[0-9](_?[0-9])*",o="\\.(".concat(i,")"),c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:"(\\b(".concat(c,")((").concat(o,")|\\.)?|(").concat(o,"))")+"[eE][+-]?(".concat(i,")\\b")},{begin:"\\b(".concat(c,")\\b((").concat(o,")\\b|\\.)?|(").concat(o,")\\b")},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:r,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},p={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},f=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,h,x,p,{match:/\$\d+/},d];u.contains=f.concat({begin:/\{/,end:/\}/,keywords:r,contains:["self"].concat(f)});const v=[].concat(g,u.contains),b=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:r,contains:["self"].concat(v)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:b},y={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},N={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...ug,...mg]}},w={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/};const C={match:t.concat(/\b/,(k=[...hg,"super","import"].map(e=>"".concat(e,"\\s*\\(")),t.concat("(?!",k.join("|"),")")),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0};var k;const D={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},_={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},S="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(S)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:r,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,h,x,p,g,{match:/\$\d+/},d,N,{scope:"attr",match:s+t.lookahead(":"),relevance:0},E,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:S,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0}
2,{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a,end:n},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},w,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},C,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},y,_,{match:/\$[(.]/}]}}const fg="[A-Za-z$_][0-9A-Za-z$_]*",vg=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],bg=["true","false","null","undefined","NaN","Infinity"],jg=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],yg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ng=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],wg=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Cg=[].concat(Ng,jg,yg);function kg(e){const t=e.regex,s=function(e){const t=e.regex,s=fg,a="<>",n="</>",l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const s=e[0].length+e.index,a=e.input[s];if("<"===a||","===a)return void t.ignoreMatch();let n;">"===a&&(((e,t)=>{let{after:s}=t;const a="</"+e[0].slice(1);return-1!==e.input.indexOf(a,s)})(e,{after:s})||t.ignoreMatch());const l=e.input.substring(s);((n=l.match(/^\s*=/))||(n=l.match(/^\s+extends\s+/))&&0===n.index)&&t.ignoreMatch()}},r={$pattern:fg,keyword:vg,literal:bg,built_in:Cg,"variable.language":wg},i="[0-9](_?[0-9])*",o="\\.(".concat(i,")"),c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:"(\\b(".concat(c,")((").concat(o,")|\\.)?|(").concat(o,"))")+"[eE][+-]?(".concat(i,")\\b")},{begin:"\\b(".concat(c,")\\b((").concat(o,")\\b|\\.)?|(").concat(o,")\\b")},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:r,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},p={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]}
vendor: 4,461 bytes, line 2
2,f=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,h,x,p,{match:/\$\d+/},d];u.contains=f.concat({begin:/\{/,end:/\}/,keywords:r,contains:["self"].concat(f)});const v=[].concat(g,u.contains),b=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:r,contains:["self"].concat(v)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:b},y={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},N={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...jg,...yg]}},w={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},C={match:t.concat(/\b/,(k=[...Ng,"super","import"].map(e=>"".concat(e,"\\s*\\(")),t.concat("(?!",k.join("|"),")")),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0};var k;const D={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},_={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},S="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(S)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:r,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,h,x,p,g,{match:/\$\d+/},d,N,{scope:"attr",match:s+t.lookahead(":"),relevance:0},E,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:S,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a,end:n},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},w,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},C,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},y,_,{match:/\$[(.]/}]}}(e),a=fg,n=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],l={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},r={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:n},contains:[s.exports.CLASS_REFERENCE]},i={$pattern:fg,keyword:vg.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:bg,built_in:Cg.concat(n),"variable.language":wg},o={className:"meta",begin:"@"+a},c=(e,t,s)=>{const a=e.contains.findIndex(e=>e.label===t);if(-1===a)throw new Error("can not find mode to replace");e.contains.splice(a,1,s)};Object.assign(s.keywords,i),s.exports.PARAMS_CONTAINS.push(o);const d=s.contains.find(e=>"attr"===e.scope),u=Object.assign({},d,{match:t.concat(a,t.lookahead(/\s*\?:/))});s.exports.PARAMS_CONTAINS.push([s.exports.CLASS_REFERENCE,d,u]),s.contains=s.contains.concat([o,l,r,u]),c(s,"shebang",e.SHEBANG()),c(s,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/});const m=s.contains.find(e=>"func.def"===e.label);return m.relevance=0,Object.assign(s,{name:"TypeScript",aliases:["t
2s","tsx","mts","cts"]}),s}function Dg(e){const t=e.regex,s=/(?:[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037B-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFB
2D3-\uFC5D\uFC64-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDF9\uFE71\uFE73\uFE77\uFE79\uFE7B\uFE7D\uFE7F-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])(?:[0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037B-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u0870-\u0887\u0889-\u088F\u0897-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5C\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDC-\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1715\u171F-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B4C\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA827\uA82C\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFB
2D3-\uFC5D\uFC64-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDF9\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE71\uFE73\uFE77\uFE79\uFE7B\uFE7D\uFE7F-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF65-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDD40-\uDD65\uDD69-\uDD6D\uDD6F-\uDD85\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDEC2-\uDEC7\uDEFA-\uDF1C\uDF27\uDF30-\uDF50\uDF70-\uDF85\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC75\uDC7F-\uDCBA\uDCC2\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E-\uDE41\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD3\uDFE1\uDFE2]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDED0-\uDEE3\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39\uDF40-\uDF46]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEB0-\uDEF8\uDF60-\uDF67\uDFC0-\uDFE0\uDFF0-\uDFF9]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDDB0-\uDDDB\uDDE0-\uDDE9\uDEE0-\uDEF6\uDF00-\uDF10\uDF12-\uDF3A\uDF3E-\uDF42\uDF50-\uDF5A\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC40-\uDC55\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD39]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDD70-\uDD79\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC30-\uDC6D\uDC8F\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAE\uDEC0-\uDEF9]|\uD839[\uDCD0-\uDCF9\uDDD0-\uDDFA\uDEC0-\uDEDE\uDEE0-\uDEF5\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]|\uDB40[\uDD00-\uDDEF])*/,a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],n={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/,end:/\}/,keywords:n,illegal:/#/},i={begin:/\{\{/,relevance:0},o={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,i,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,i,r]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,i,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},c="[0-9](_?[0-9])*",d="(\\b(".concat(c,"))?\\.(").concat(c,")|\\b(").concat(c,")\\."),u="\\b|".concat(a.join("|")),m={className:"number",relevance:0,variants:[{begin:"(\\b(".concat(c,")|(").concat(d,"))[eE][+-]?(").concat(c,")[jJ]?(?=").concat(u,")")},{begin:"(".concat(d,")[jJ]?")},{begin:"\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=".concat(u,")")},{begin:"\\b0[bB](_?[01])+[lL]?(?=".concat(u,")")},{begin:"\\b0[oO](_?[0-7])+[lL]?(?=".concat(u,")")},{begin:"\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=".concat(u,")")},{begin:"\\b(".concat(c,")[jJ](?=").concat(u,")")}]},h={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:n,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},x={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n,contains:["self",l,m,o,e.HASH_COMMENT_MODE]}]};return r.contains=[o,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:n,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},o,h,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,s],scope:{1:"keyword",3:"title.function"},contains:[x]}
2,{variants:[{match:[/\bclass/,/\s+/,s,/\s*/,/\(\s*/,s,/\s*\)/]},{match:[/\bclass/,/\s+/,s]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,x,o]}]}}function _g(e){const t=e.regex,s=t.concat(/(?:[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFB
2D3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])/,t.optional(/(?:[\x2D\.0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u
20EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE4
20-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])*:/),/(?:[\x2D\.0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFB
2D3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])*/),a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},n={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=e.inherit(n,{begin:/\(/,end:/\)/}),r=e.inherit(e.APOS_STRING_MODE,{className:"string"}),i=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),o={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:/(?:[\x2D\.0-:A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u
20EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE4
20-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])+/,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[n,i,r,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[n,l,i,r]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[i]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[o],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[o],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(s,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:s,relevance:0,starts:o}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(s,/>/))),contains:[{className:"name",begin:s,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}const Sg=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Eg=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Ag=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invali
2d","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Fg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Tg=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-
2area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function zg(e){const t=e.regex,s={},a={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[s]}]};Object.assign(s,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const n={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},l=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),r={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},i={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,n]};n.contains.push(i);const o={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,s]},c=e.SHEBANG({binary:"(".concat(["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"].join("|"),")"),relevance:10}),d={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],literal:["true","false"],built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]},contains:[c,e.SHEBANG(),d,o,l,r,{match:/(\/[a-z._-]+)+/},i,{match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},s]}}var Mg="[0-9](_*[0-9])*",Pg="\\.(".concat(Mg,")"),Bg="[0-9a-fA-F](_*[0-9a-fA-F])*",Rg={className:"number",variants:[{begin:"(\\b(".concat(Mg,")((").concat(Pg,")|\\.)?|(").concat(Pg,"))")+"[eE][+-]?(".concat(Mg,")[fFdD]?\\b")},{begin:"\\b(".concat(Mg,")((").concat(Pg,")[fFdD]?\\b|\\.([fFdD]\\b)?)")},{begin:"(".concat(Pg,")[fFdD]?\\b")},{begin:"\\b(".concat(Mg,")[fFdD]\\b")},{begin:"\\b0[xX]((".concat(Bg,")\\.?|(").concat(Bg,")?\\.(").concat(Bg,"))")+"[pP][+-]?(".concat(Mg,")[fFdD]?\\b")},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:"\\b0[xX](".concat(Bg,")[lL]?\\b")},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Lg(e,t,s){return-1===s?"":e.replace(t,a=>Lg(e,t,s-1))}function Ig(e){const t={keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","
2sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"]),built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],literal:["default","false","null","true"]},s=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),a={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},n={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},l=e.inherit(n,{illegal:/\n/}),r={className:"subst",begin:/\{/,end:/\}/,keywords:t},i=e.inherit(r,{illegal:/\n/}),o={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,i]},c={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},r]},d=e.inherit(c,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},i]});r.contains=[c,o,n,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],i.contains=[d,o,l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const u={variants:[{className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},c,o,n,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},m={begin:"<",end:">",contains:[{beginKeywords:"in out"},s]},h=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",x={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:t,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},u,a,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},s,m,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,m,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+h+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:t,contains:[{beginKeywords:["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"].join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,m],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:t,relevance:0,contains:[u,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},x]}}function Og(e){const t=e.regex,s="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),n=t.concat(a,/(::\w+)*/),l={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepe
2nd","public","private","protected","raise","throw"],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},r={className:"doctag",begin:"@[A-Za-z]+"},i={begin:"#<",end:">"},o=[e.COMMENT("#","$",{contains:[r]}),e.COMMENT("^=begin","^=end",{contains:[r],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:l},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},u="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:"\\b(".concat("[1-9](_?[0-9])*|0",")(\\.(").concat(u,"))?([eE][+-]?(").concat(u,")|r)?i?\\b")},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},h={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:l}]},x=[d,{variants:[{match:[/class\s+/,n,/\s+<\s+/,n]},{match:[/\b(class|module)\s+/,n]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,n],scope:{2:"title.class"},keywords:l},{relevance:0,match:[n,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{match:[/def/,/\s+/,s],scope:{1:"keyword",3:"title.function"},contains:[h]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:s}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:l},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(i,o),relevance:0}].concat(i,o);c.contains=x,h.contains=x;const p=[{begin:/^\s*=>/,starts:{end:"$",contains:x}},{className:"meta.prompt",begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])",starts:{end:"$",keywords:l,contains:x}}];return o.unshift(i),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:l,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(p).concat(o).concat(x)}}function Ug(e){const t={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},a={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},n={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/}
vendor: 4,197 bytes, line 2
2,{begin:/_(?![_\s])/,end:/_/,relevance:0}]},l=e.inherit(a,{contains:[]}),r=e.inherit(n,{contains:[]});a.contains.push(r),n.contains.push(l);let i=[t,s];[a,n,l,r].forEach(e=>{e.contains=e.contains.concat(i)}),i=i.concat(a,n);return{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:i},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:i}]}]},t,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a,n,{className:"quote",begin:"^>\\s+",contains:i,end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},s,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Hg(e){const t="true false yes no null",s="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},n=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l={className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},r={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},i={begin:/\{/,end:/\}/,contains:[r],illegal:"\\n",relevance:0},o={begin:"\\[",end:"\\]",contains:[r],illegal:"\\n",relevance:0},c=[{className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+s},{className:"type",begin:"!<"+s+">"},{className:"type",begin:"!"+s},{className:"type",begin:"!!"+s},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},l,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},i,o,{className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a],d=[...c];return d.pop(),d.push(n),r.contains=d,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:c}}ig.registerLanguage("javascript",gg),ig.registerLanguage("js",gg),ig.registerLanguage("typescript",kg),ig.registerLanguage("ts",kg),ig.registerLanguage("python",Dg),ig.registerLanguage("py",Dg),ig.registerLanguage("html",_g),ig.registerLanguage("xml",_g),ig.registerLanguage("css",function(e){const t=e.regex,s=(e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}))(e),a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[s.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0}
vendor: 6,029 bytes, line 2
2,{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},s.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Ag.join("|")+")"},{begin:":(:)?("+Fg.join("|")+")"}]},s.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Tg.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[s.BLOCK_COMMENT,s.HEXCOLOR,s.IMPORTANT,s.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},s.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:Eg.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,s.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Sg.join("|")+")\\b"}]}}),ig.registerLanguage("json",function(e){const t=["true","false","null"],s={scope:"literal",beginKeywords:t.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:t},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}),ig.registerLanguage("bash",zg),ig.registerLanguage("shell",zg),ig.registerLanguage("sql",function(e){const t=e.regex,s=e.COMMENT("--","$"),a=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],n=a,l=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","ver
2sioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter(e=>!a.includes(e)),r={match:t.concat(/\b/,t.either(...n),/\s*\(/),relevance:0,keywords:{built_in:n}};function i(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,"\\s+"))),/\b/)}const o={scope:"keyword",match:i(["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"]),relevance:0};return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:function(e){let{exceptions:t,when:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=s;return t=t||[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:a(e)?"".concat(e,"|0"):e)}(l,{when:e=>e.length<3}),literal:["true","false","unknown"],type:["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"]},contains:[{scope:"type",match:i(["double precision","large object","with timezone","without timezone"])},o,r,{scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},{scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},{begin:/"/,end:/"/,contains:[{match:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,s,{scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}),ig.registerLanguage("java",function(e){const t=e.regex,s="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",a=s+Lg("(?:<"+s+"~~~(?:\\s*,\\s*"+s+"~~~)*>)?",/~~~/g,2),n={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},l={className:"meta",begin:"@"+s,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},r={className:"params",begin:/\(/,end:/\)/,keywords:n,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:n,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,s],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,s),/\s+/,s,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,s],className:{1:"keyword",3:"title.class"},contains:[r,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:n,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:n,relevance:0,contains:[l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Rg,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Rg,l]}}),ig.registerLanguage("csharp",Ig),ig.registerLanguage("cs",Ig),ig.registerLanguage("php",function(e){const t=e.regex,s=/(?![A-Za-z0-9])(?![$])/,a=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,s),n=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,s),l=t.concat(/[A-Z]+/,s),r={scope:"variable",match:"\\$+"+a},i={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},o=e.inherit(e.APOS_STRING_MODE,{illegal:null}),c=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(i)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(i),"on:begin":(e,t)=>
vendor: 11,108 bytes, line 2
2{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},u="[ \t\n]",m={scope:"string",variants:[c,o,d,e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/})]},h={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},x=["false","null","true"],p=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],g=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],f={keyword:p,literal:(e=>{const t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(x),built_in:g},v=e=>e.map(e=>e.replace(/\|\d+$/,"")),b={variants:[{match:[/new/,t.concat(u,"+"),t.concat("(?!",v(g).join("\\b|"),"\\b)"),n],scope:{1:"keyword",4:"title.class"}}]},j=t.concat(a,"\\b(?!\\()"),y={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),j],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[n,t.concat(/::/,t.lookahead(/(?!class\b)/)),j],scope:{1:"title.class",3:"variable.constant"}},{match:[n,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[n,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},N={scope:"attr",match:t.concat(a,t.lookahead(":"),t.lookahead(/(?!::)/))},w={relevance:0,begin:/\(/,end:/\)/,keywords:f,contains:[N,r,y,e.C_BLOCK_COMMENT_MODE,m,h,b]},C={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",v(p).join("\\b|"),"|",v(g).join("\\b|"),"\\b)"),a,t.concat(u,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[w]};w.contains.push(C);const k=[N,y,e.C_BLOCK_COMMENT_MODE,m,h,b],D={begin:t.concat(/#\[\s*\\?/,t.either(n,l)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:x,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:x,keyword:["new","array"]},contains:["self",...k]},...k,{scope:"meta",variants:[{match:n},{match:l}]}]};return{case_insensitive:!1,keywords:f,contains:[D,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},r,C,y,{match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},b,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:f,contains:["self",D,r,y,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,h]}}),ig.registerLanguage("ruby",Og),ig.registerLanguage("rb",Og),ig.registerLanguage("go",function(e){const t={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:t,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}),ig.registerLanguage("rust",function(e){const t=e.regex,s=/(r#)?/,a=t.concat(s,e.UNDERSCORE_IDENT_RE),n=t.concat(s,e.IDENT_RE),l={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,n,t.lookahead(/\s*\(/))},r="([ui](8|16|32|64|128|size)|f(32|64))?",i=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],o=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:o,keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],literal:["true","false","Some","None","Ok","Err"],built_in:i},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+r},{begin:"\\b0o([0-7_]+)"+r},{begin:"\\b0x([A-Fa-f0-9_]+)"+r},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+r}],relevance:0},{begin:[/fn/,/\s+/,a],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,a],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,a,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:i,type:o}},{className:"punctuation",begin:"->"},l]}}),ig.registerLanguage("markdown",Ug),ig.registerLanguage("md",Ug),ig.registerLanguage("yaml",Hg),ig.registerLanguage("yml",Hg);const Wg=[{value:"github-dark",label:"GitHub Dark"},{value:"monokai",label:"Monokai"},{value:"dracula",label:"Dracula"},{value:"nord",label:"Nord"},{value:"atom-one-dark",label:"Atom One Dark"},{value:"vs2015",label:"VS 2015"},{value:"github",label:"GitHub Light"},{value:"stackoverflow-light",label:"Stack Overflow Light"}],Vg=[{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"json",label:"JSON"},{value:"bash",label:"Bash/Shell"},{value:"sql",label:"SQL"},{value:"java",label:"Java"},{value:"csharp",label:"C#"},{value:"php",label:"PHP"},{value:"ruby",label:"Ruby"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"markdown",label:"Markdown"},{value:"yaml",label:"YAML"}],qg=e=>{let{code:s,language:a="javascript",theme:n="github-dark",showLineNumbers:l=!0}=e;const r=(0,t.useRef)(null);(0,t.useEffect)(()=>
2{if(r.current&&s)try{const e=ig.highlight(s,{language:a||"plaintext",ignoreIllegals:!0});r.current.innerHTML=e.value}catch(G2){try{const e=ig.highlightAuto(s);r.current.innerHTML=e.value}catch(e){r.current.textContent=s}}},[s,a]);const i=s?s.split("\n"):[],o=(()=>{const e={"github-dark":{bg:"#0d1117",text:"#c9d1d9",border:"#30363d",lineNum:"#484f58"},monokai:{bg:"#272822",text:"#f8f8f2",border:"#3e3d32",lineNum:"#75715e"},dracula:{bg:"#282a36",text:"#f8f8f2",border:"#44475a",lineNum:"#6272a4"},nord:{bg:"#2e3440",text:"#d8dee9",border:"#3b4252",lineNum:"#4c566a"},"atom-one-dark":{bg:"#282c34",text:"#abb2bf",border:"#3e4451",lineNum:"#636d83"},vs2015:{bg:"#1e1e1e",text:"#dcdcdc",border:"#2d2d2d",lineNum:"#858585"},github:{bg:"#ffffff",text:"#24292e",border:"#e1e4e8",lineNum:"#959da5"},"stackoverflow-light":{bg:"#f6f6f6",text:"#2f3337",border:"#e0e0e0",lineNum:"#9a9a9a"}};return e[n]||e["github-dark"]})();return(0,ea.jsxs)("div",{className:"rounded-lg overflow-hidden font-mono text-sm",style:{backgroundColor:o.bg,border:"1px solid ".concat(o.border)},children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between px-4 py-2",style:{borderBottom:"1px solid ".concat(o.border),backgroundColor:o.border},children:[(0,ea.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide",style:{color:o.lineNum},children:a||"code"}),(0,ea.jsx)("button",{onClick:()=>navigator.clipboard.writeText(s),className:"text-xs px-2 py-1 rounded hover:bg-black/20 transition-colors",style:{color:o.lineNum},title:"Copy code",children:"Copy"})]}),(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("div",{className:"flex min-w-full",children:[l&&i.length>0&&(0,ea.jsx)("div",{className:"flex-shrink-0 text-right pr-4 pl-4 py-4 select-none",style:{color:o.lineNum,borderRight:"1px solid ".concat(o.border),backgroundColor:"".concat(o.bg,"cc")},children:i.map((e,t)=>(0,ea.jsx)("div",{className:"leading-6",children:t+1},t))}),(0,ea.jsx)("pre",{className:"flex-1 p-4 m-0 overflow-x-auto",style:{color:o.text},children:(0,ea.jsx)("code",{ref:r,className:"hljs language-".concat(a),children:s||"// Enter your code here..."})})]})})]})},$g=Vl("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"}]]),Gg=Vl("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Kg=Vl("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),Yg=["asChild"];var Jg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,s)=>{const a=qp("Primitive.".concat(s)),n=t.forwardRef((e,t)=>{const{asChild:n}=e,r=l(e,Yg),i=n?a:s;return"undefined"!==typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ea.jsx)(i,d(d({},r),{},{ref:t}))});return n.displayName="Primitive.".concat(s),d(d({},e),{},{[s]:n})},{});var Qg=t.forwardRef((e,t)=>(0,ea.jsx)(Jg.label,d(d({},e),{},{ref:t,onMouseDown:t=>{var s;t.target.closest("button, input, select, textarea")||(null===(s=e.onMouseDown)||void 0===s||s.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})));Qg.displayName="Label";var Xg=Qg;const Zg=["className"],ef=Zp("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),tf=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Zg);return(0,ea.jsx)(Xg,d({ref:t,className:Np(ef(),s)},a))});function sf(e,t){let[s,a]=t;return Math.min(a,Math.max(s,e))}tf.displayName=Xg.displayName;const af=["children"],nf=["children"];function lf(e){const s=rf(e),a=t.forwardRef((e,a)=>{const{children:n}=e,r=l(e,af),i=t.Children.toArray(n),o=i.find(cf);if(o){const e=o.props.children,n=i.map(s=>s===o?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:s);return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null}))}return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:n}))});return a.displayName="".concat(e,".Slot"),a}function rf(e){const s=t.forwardRef((e,s)=>{const{children:a}=e,n=l(e,nf);if(t.isValidElement(a)){const e=function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),l=function(e,t){const s=d({},t);for(const a in t){const n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?s[a]=function(){const e=l(...arguments);return n(...arguments),e}:n&&(s[a]=n):"style"===a?s[a]=d(d({}
2,n),l):"className"===a&&(s[a]=[n,l].filter(Boolean).join(" "))}return d(d({},e),s)}(n,a.props);return a.type!==t.Fragment&&(l.ref=s?gr(s,e):e),t.cloneElement(a,l)}return t.Children.count(a)>1?t.Children.only(null):null});return s.displayName="".concat(e,".SlotClone"),s}var of=Symbol("radix.slottable");function cf(e){return t.isValidElement(e)&&"function"===typeof e.type&&"__radixId"in e.type&&e.type.__radixId===of}function df(e){const s=t.useRef({value:e,previous:e});return t.useMemo(()=>(s.current.value!==e&&(s.current.previous=s.current.value,s.current.value=e),s.current.previous),[e])}var uf=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"}),mf=t.forwardRef((e,t)=>(0,ea.jsx)(Tr.span,d(d({},e),{},{ref:t,style:d(d({},uf),e.style)})));mf.displayName="VisuallyHidden";var hf=mf;const xf=["__scopeSelect","disabled"],pf=["__scopeSelect","className","style","children","placeholder"],gf=["__scopeSelect","children"],ff=["__scopeSelect","position","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","side","sideOffset","align","alignOffset","arrowPadding","collisionBoundary","collisionPadding","sticky","hideWhenDetached","avoidCollisions"],vf=["__scopeSelect","onPlaced"],bf=["__scopeSelect","align","collisionPadding"],jf=["__scopeSelect","nonce"],yf=["__scopeSelect"],Nf=["__scopeSelect"],wf=["__scopeSelect","value","disabled","textValue"],Cf=["__scopeSelect","className","style"],kf=["__scopeSelect"],Df=["__scopeSelect","onAutoScroll"],_f=["__scopeSelect"],Sf=["__scopeSelect"],Ef=["__scopeSelect","value"];var Af=[" ","Enter","ArrowUp","ArrowDown"],Ff=[" ","Enter"],Tf="Select",[zf,Mf,Pf]=$r(Tf),[Bf,Rf]=jr(Tf,[Pf,Sc]),Lf=Sc(),[If,Of]=Bf(Tf),[Uf,Hf]=Bf(Tf),Wf=e=>{const{__scopeSelect:s,children:a,open:n,defaultOpen:l,onOpenChange:r,value:i,defaultValue:o,onValueChange:c,dir:u,name:m,autoComplete:h,disabled:x,required:p,form:g}=e,f=Lf(s),[v,b]=t.useState(null),[j,y]=t.useState(null),[N,w]=t.useState(!1),C=Qr(u),[k,D]=Cr({prop:n,defaultProp:null!==l&&void 0!==l&&l,onChange:r,caller:Tf}),[_,S]=Cr({prop:i,defaultProp:o,onChange:c,caller:Tf}),E=t.useRef(null),A=!v||(g||!!v.closest("form")),[F,T]=t.useState(new Set),z=Array.from(F).map(e=>e.props.value).join(";");return(0,ea.jsx)(Vc,d(d({},f),{},{children:(0,ea.jsxs)(If,{required:p,scope:s,trigger:v,onTriggerChange:b,valueNode:j,onValueNodeChange:y,valueNodeHasChildren:N,onValueNodeHasChildrenChange:w,contentId:ki(),value:_,onValueChange:S,open:k,onOpenChange:D,dir:C,triggerPointerDownPosRef:E,disabled:x,children:[(0,ea.jsx)(zf.Provider,{scope:s,children:(0,ea.jsx)(Uf,{scope:e.__scopeSelect,onNativeOptionAdd:t.useCallback(e=>{T(t=>new Set(t).add(e))},[]),onNativeOptionRemove:t.useCallback(e=>{T(t=>{const s=new Set(t);return s.delete(e),s})},[]),children:a})}),A?(0,ea.jsxs)(Fv,{"aria-hidden":!0,required:p,tabIndex:-1,name:m,autoComplete:h,value:_,onChange:e=>S(e.target.value),disabled:x,form:g,children:[void 0===_?(0,ea.jsx)("option",{value:""}):null,Array.from(F)]},z):null]})}))};Wf.displayName=Tf;var Vf="SelectTrigger",qf=t.forwardRef((e,s)=>{const{__scopeSelect:a,disabled:n=!1}=e,r=l(e,xf),i=Lf(a),o=Of(Vf,a),c=o.disabled||n,u=fr(s,o.onTriggerChange),m=Mf(a),h=t.useRef("touch"),[x,p,g]=zv(e=>{const t=m().filter(e=>!e.disabled),s=t.find(e=>e.value===o.value),a=Mv(t,e,s);void 0!==a&&o.onValueChange(a.value)}),f=e=>{c||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,ea.jsx)(qc,d(d({asChild:!0},i),{},{children:(0,ea.jsx)(Tr.button,d(d({type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Tv(o.value)?"":void 0},r),{},{ref:u,onClick:xr(r.onClick,e=>{e.currentTarget.focus(),"mouse"!==h.current&&f(e)}),onPointerDown:xr(r.onPointerDown,e=>{h.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(f(e),e.preventDefault())}),onKeyDown:xr(r.onKeyDown,e=>{const t=""!==x.current;
2e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),t&&" "===e.key||Af.includes(e.key)&&(f(),e.preventDefault())})}))}))});qf.displayName=Vf;var $f="SelectValue",Gf=t.forwardRef((e,t)=>{const{__scopeSelect:s,className:a,style:n,children:r,placeholder:i=""}=e,o=l(e,pf),c=Of($f,s),{onValueNodeHasChildrenChange:u}=c,m=void 0!==r,h=fr(t,c.onValueNodeChange);return Nr(()=>{u(m)},[u,m]),(0,ea.jsx)(Tr.span,d(d({},o),{},{ref:h,style:{pointerEvents:"none"},children:Tv(c.value)?(0,ea.jsx)(ea.Fragment,{children:i}):r}))});Gf.displayName=$f;var Kf=t.forwardRef((e,t)=>{const{__scopeSelect:s,children:a}=e,n=l(e,gf);return(0,ea.jsx)(Tr.span,d(d({"aria-hidden":!0},n),{},{ref:t,children:a||"\u25bc"}))});Kf.displayName="SelectIcon";var Yf=e=>(0,ea.jsx)(Yc,d({asChild:!0},e));Yf.displayName="SelectPortal";var Jf="SelectContent",Qf=t.forwardRef((e,s)=>{const a=Of(Jf,e.__scopeSelect),[n,l]=t.useState();if(Nr(()=>{l(new DocumentFragment)},[]),!a.open){const t=n;return t?Ts.createPortal((0,ea.jsx)(Zf,{scope:e.__scopeSelect,children:(0,ea.jsx)(zf.Slot,{scope:e.__scopeSelect,children:(0,ea.jsx)("div",{children:e.children})})}),t):null}return(0,ea.jsx)(sv,d(d({},e),{},{ref:s}))});Qf.displayName=Jf;var Xf=10,[Zf,ev]=Bf(Jf),tv=lf("SelectContent.RemoveScroll"),sv=t.forwardRef((e,s)=>{const{__scopeSelect:a,position:n="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:m,alignOffset:h,arrowPadding:x,collisionBoundary:p,collisionPadding:g,sticky:f,hideWhenDetached:v,avoidCollisions:b}=e,j=l(e,ff),y=Of(Jf,a),[N,w]=t.useState(null),[C,k]=t.useState(null),D=fr(s,e=>w(e)),[_,S]=t.useState(null),[E,A]=t.useState(null),F=Mf(a),[T,z]=t.useState(!1),M=t.useRef(!1);t.useEffect(()=>{if(N)return Fd(N)},[N]),di();const P=t.useCallback(e=>{const[t,...s]=F().map(e=>e.ref.current),[a]=s.slice(-1),n=document.activeElement;for(const l of e){if(l===n)return;if(null===l||void 0===l||l.scrollIntoView({block:"nearest"}),l===t&&C&&(C.scrollTop=0),l===a&&C&&(C.scrollTop=C.scrollHeight),null===l||void 0===l||l.focus(),document.activeElement!==n)return}},[F,C]),B=t.useCallback(()=>P([_,N]),[P,_,N]);t.useEffect(()=>{T&&B()},[T,B]);const{onOpenChange:R,triggerPointerDownPosRef:L}=y;t.useEffect(()=>{if(N){let e={x:0,y:0};const t=t=>{var s,a,n,l;e={x:Math.abs(Math.round(t.pageX)-(null!==(s=null===(a=L.current)||void 0===a?void 0:a.x)&&void 0!==s?s:0)),y:Math.abs(Math.round(t.pageY)-(null!==(n=null===(l=L.current)||void 0===l?void 0:l.y)&&void 0!==n?n:0))}},s=s=>{e.x<=10&&e.y<=10?s.preventDefault():N.contains(s.target)||R(!1),document.removeEventListener("pointermove",t),L.current=null};return null!==L.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",s,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",s,{capture:!0})}}},[N,R,L]),t.useEffect(()=>{const e=()=>R(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[R]);const[I,O]=zv(e=>{const t=F().filter(e=>!e.disabled),s=t.find(e=>e.ref.current===document.activeElement),a=Mv(t,e,s);a&&setTimeout(()=>a.ref.current.focus())}),U=t.useCallback((e,t,s)=>{const a=!M.current&&!s;(void 0!==y.value&&y.value===t||a)&&(S(e),a&&(M.current=!0))},[y.value]),H=t.useCallback(()=>null===N||void 0===N?void 0:N.focus(),[N]),W=t.useCallback((e,t,s)=>{const a=!M.current&&!s;(void 0!==y.value&&y.value===t||a)&&A(e)},[y.value]),V="popper"===n?nv:av,q=V===nv?{side:c,sideOffset:u,align:m,alignOffset:h,arrowPadding:x,collisionBoundary:p,collisionPadding:g,sticky:f,hideWhenDetached:v,avoidCollisions:b}:{};return(0,ea.jsx)(Zf,{scope:a,content:N,viewport:C,onViewportChange:k,itemRefCallback:U,selectedItem:_,onItemLeave:H,itemTextRefCallback:W,focusSelectedItem:B,selectedItemText:E,position:n,isPositioned:T,searchRef:I,children:(0,ea.jsx)(Nu,{as:tv,allowPinchZoom:!0,children:(0,ea.jsx)(gi,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:xr(r,e=>{var t;null===(t=y.trigger)||void 0===t||t.focus({preventScroll:!0}),e.preventDefault()}),children:(0,ea.jsx)(li,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,ea.jsx)(V,d(d(d({role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:e=>e.preventDefault()},j),q),{},{onPlaced:()=>z(!0),ref:D,style:d({display:"flex",flexDirection:"column",outline:"none"},j.style),onKeyDown:xr(j.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;
2if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||O(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const s=e.target,a=t.indexOf(s);t=t.slice(a+1)}setTimeout(()=>P(t)),e.preventDefault()}})}))})})})})});sv.displayName="SelectContentImpl";var av=t.forwardRef((e,s)=>{const{__scopeSelect:a,onPlaced:n}=e,r=l(e,vf),i=Of(Jf,a),o=ev(Jf,a),[c,u]=t.useState(null),[m,h]=t.useState(null),x=fr(s,e=>h(e)),p=Mf(a),g=t.useRef(!1),f=t.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:j,focusSelectedItem:y}=o,N=t.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&m&&v&&b&&j){const e=i.trigger.getBoundingClientRect(),t=m.getBoundingClientRect(),s=i.valueNode.getBoundingClientRect(),a=j.getBoundingClientRect();if("rtl"!==i.dir){const n=a.left-t.left,l=s.left-n,r=e.left-l,i=e.width+r,o=Math.max(i,t.width),d=window.innerWidth-Xf,u=sf(l,[Xf,Math.max(Xf,d-o)]);c.style.minWidth=i+"px",c.style.left=u+"px"}else{const n=t.right-a.right,l=window.innerWidth-s.right-n,r=window.innerWidth-e.right-l,i=e.width+r,o=Math.max(i,t.width),d=window.innerWidth-Xf,u=sf(l,[Xf,Math.max(Xf,d-o)]);c.style.minWidth=i+"px",c.style.right=u+"px"}const l=p(),r=window.innerHeight-2*Xf,o=v.scrollHeight,d=window.getComputedStyle(m),u=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),x=parseInt(d.borderBottomWidth,10),f=u+h+o+parseInt(d.paddingBottom,10)+x,y=Math.min(5*b.offsetHeight,f),N=window.getComputedStyle(v),w=parseInt(N.paddingTop,10),C=parseInt(N.paddingBottom,10),k=e.top+e.height/2-Xf,D=r-k,_=b.offsetHeight/2,S=u+h+(b.offsetTop+_),E=f-S;if(S<=k){const e=l.length>0&&b===l[l.length-1].ref.current;c.style.bottom="0px";const t=m.clientHeight-v.offsetTop-v.offsetHeight,s=S+Math.max(D,_+(e?C:0)+t+x);c.style.height=s+"px"}else{const e=l.length>0&&b===l[0].ref.current;c.style.top="0px";const t=Math.max(k,u+v.offsetTop+(e?w:0)+_)+E;c.style.height=t+"px",v.scrollTop=S-k+v.offsetTop}c.style.margin="".concat(Xf,"px 0"),c.style.minHeight=y+"px",c.style.maxHeight=r+"px",null===n||void 0===n||n(),requestAnimationFrame(()=>g.current=!0)}},[p,i.trigger,i.valueNode,c,m,v,b,j,i.dir,n]);Nr(()=>N(),[N]);const[w,C]=t.useState();Nr(()=>{m&&C(window.getComputedStyle(m).zIndex)},[m]);const k=t.useCallback(e=>{e&&!0===f.current&&(N(),null===y||void 0===y||y(),f.current=!1)},[N,y]);return(0,ea.jsx)(lv,{scope:a,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:k,children:(0,ea.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:(0,ea.jsx)(Tr.div,d(d({},r),{},{ref:x,style:d({boxSizing:"border-box",maxHeight:"100%"},r.style)}))})})});av.displayName="SelectItemAlignedPosition";var nv=t.forwardRef((e,t)=>{const{__scopeSelect:s,align:a="start",collisionPadding:n=Xf}=e,r=l(e,bf),i=Lf(s);return(0,ea.jsx)($c,d(d(d({},i),r),{},{ref:t,align:a,collisionPadding:n,style:d(d({boxSizing:"border-box"},r.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)"})}))});nv.displayName="SelectPopperPosition";var[lv,rv]=Bf(Jf,{}),iv="SelectViewport",ov=t.forwardRef((e,s)=>{const{__scopeSelect:a,nonce:n}=e,r=l(e,jf),i=ev(iv,a),o=rv(iv,a),c=fr(s,i.onViewportChange),u=t.useRef(0);return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,ea.jsx)(zf.Slot,{scope:a,children:(0,ea.jsx)(Tr.div,d(d({"data-radix-select-viewport":"",role:"presentation"},r),{},{ref:c,style:d({position:"relative",flex:1,overflow:"hidden auto"},r.style),onScroll:xr(r.onScroll,e=>{const t=e.currentTarget,{contentWrapper:s,shouldExpandOnScrollRef:a}=o;if(null!==a&&void 0!==a&&a.current&&s){const e=Math.abs(u.current-t.scrollTop);if(e>0){const a=window.innerHeight-2*Xf,n=parseFloat(s.style.minHeight),l=parseFloat(s.style.height),r=Math.max(n,l);if(r<a){const n=r+e,l=Math.min(a,n),i=n-l;s.style.height=l+"px","0px"===s.style.bottom&&(t.scrollTop=i>0?i:0,s.style.justifyContent="flex-end")}}}u.current=t.scrollTop})}))})]})});ov.displayName=iv;var cv="SelectGroup",[dv,uv]=Bf(cv),mv=t.forwardRef((e,t)=>
2{const{__scopeSelect:s}=e,a=l(e,yf),n=ki();return(0,ea.jsx)(dv,{scope:s,id:n,children:(0,ea.jsx)(Tr.div,d(d({role:"group","aria-labelledby":n},a),{},{ref:t}))})});mv.displayName=cv;var hv="SelectLabel",xv=t.forwardRef((e,t)=>{const{__scopeSelect:s}=e,a=l(e,Nf),n=uv(hv,s);return(0,ea.jsx)(Tr.div,d(d({id:n.id},a),{},{ref:t}))});xv.displayName=hv;var pv="SelectItem",[gv,fv]=Bf(pv),vv=t.forwardRef((e,s)=>{const{__scopeSelect:a,value:n,disabled:r=!1,textValue:i}=e,o=l(e,wf),c=Of(pv,a),u=ev(pv,a),m=c.value===n,[h,x]=t.useState(null!==i&&void 0!==i?i:""),[p,g]=t.useState(!1),f=fr(s,e=>{var t;return null===(t=u.itemRefCallback)||void 0===t?void 0:t.call(u,e,n,r)}),v=ki(),b=t.useRef("touch"),j=()=>{r||(c.onValueChange(n),c.onOpenChange(!1))};if(""===n)throw new Error("A <Select.Item /> 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(0,ea.jsx)(gv,{scope:a,value:n,disabled:r,textId:v,isSelected:m,onItemTextChange:t.useCallback(e=>{x(t=>{var s;return t||(null!==(s=null===e||void 0===e?void 0:e.textContent)&&void 0!==s?s:"").trim()})},[]),children:(0,ea.jsx)(zf.ItemSlot,{scope:a,value:n,disabled:r,textValue:h,children:(0,ea.jsx)(Tr.div,d(d({role:"option","aria-labelledby":v,"data-highlighted":p?"":void 0,"aria-selected":m&&p,"data-state":m?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1},o),{},{ref:f,onFocus:xr(o.onFocus,()=>g(!0)),onBlur:xr(o.onBlur,()=>g(!1)),onClick:xr(o.onClick,()=>{"mouse"!==b.current&&j()}),onPointerUp:xr(o.onPointerUp,()=>{"mouse"===b.current&&j()}),onPointerDown:xr(o.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:xr(o.onPointerMove,e=>{var t;(b.current=e.pointerType,r)?null===(t=u.onItemLeave)||void 0===t||t.call(u):"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xr(o.onPointerLeave,e=>{var t;e.currentTarget===document.activeElement&&(null===(t=u.onItemLeave)||void 0===t||t.call(u))}),onKeyDown:xr(o.onKeyDown,e=>{var t;""!==(null===(t=u.searchRef)||void 0===t?void 0:t.current)&&" "===e.key||(Ff.includes(e.key)&&j()," "===e.key&&e.preventDefault())})}))})})});vv.displayName=pv;var bv="SelectItemText",jv=t.forwardRef((e,s)=>{const{__scopeSelect:a,className:n,style:r}=e,i=l(e,Cf),o=Of(bv,a),c=ev(bv,a),u=fv(bv,a),m=Hf(bv,a),[h,x]=t.useState(null),p=fr(s,e=>x(e),u.onItemTextChange,e=>{var t;return null===(t=c.itemTextRefCallback)||void 0===t?void 0:t.call(c,e,u.value,u.disabled)}),g=null===h||void 0===h?void 0:h.textContent,f=t.useMemo(()=>(0,ea.jsx)("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=m;return Nr(()=>(v(f),()=>b(f)),[v,b,f]),(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Tr.span,d(d({id:u.textId},i),{},{ref:p})),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ts.createPortal(i.children,o.valueNode):null]})});jv.displayName=bv;var yv="SelectItemIndicator",Nv=t.forwardRef((e,t)=>{const{__scopeSelect:s}=e,a=l(e,kf);return fv(yv,s).isSelected?(0,ea.jsx)(Tr.span,d(d({"aria-hidden":!0},a),{},{ref:t})):null});Nv.displayName=yv;var wv="SelectScrollUpButton",Cv=t.forwardRef((e,s)=>{const a=ev(wv,e.__scopeSelect),n=rv(wv,e.__scopeSelect),[l,r]=t.useState(!1),i=fr(s,n.onScrollButtonChange);return Nr(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;r(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?(0,ea.jsx)(_v,d(d({},e),{},{ref:i,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}})):null});Cv.displayName=wv;var kv="SelectScrollDownButton",Dv=t.forwardRef((e,s)=>{const a=ev(kv,e.__scopeSelect),n=rv(kv,e.__scopeSelect),[l,r]=t.useState(!1),i=fr(s,n.onScrollButtonChange);return Nr(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,s=Math.ceil(t.scrollTop)<e;r(s)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?(0,ea.jsx)(_v,d(d({},e),{},{ref:i,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}})):null});Dv.displayName=kv;var _v=t.forwardRef((e,s)=>{const{__scopeSelect:a,onAutoScroll:n}=e,r=l(e,Df),i=ev("SelectScrollButton",a),o=t.useRef(null),c=Mf(a),u=t.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return t.useEffect(()=>()=>u(),[u]),Nr(()=>{var e;const t=c().find(e=>e.ref.current===document.activeElement);null===t||void 0===t||null===(e=t.ref.current)||void 0===e||e.scrollIntoView({block:"nearest"})},[c]),(0,ea.jsx)(Tr.div,d(d({"aria-hidden":!0},r),{},{ref:s,style:d({flexShrink:0},r.style),onPointerDown:xr(r.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(n,50))}),onPointerMove:xr(r.onPointerMove,()=>{var e;null===(e=i.onItemLeave)||void 0===e||e.call(i),null===o.current&&(o.current=window.setInterval(n,50))}),onPointerLeave:xr(r.onPointerLeave,()=>{u()})}))}),Sv=t.forwardRef((e,t)=>
2{const{__scopeSelect:s}=e,a=l(e,_f);return(0,ea.jsx)(Tr.div,d(d({"aria-hidden":!0},a),{},{ref:t}))});Sv.displayName="SelectSeparator";var Ev="SelectArrow",Av=t.forwardRef((e,t)=>{const{__scopeSelect:s}=e,a=l(e,Sf),n=Lf(s),r=Of(Ev,s),i=ev(Ev,s);return r.open&&"popper"===i.position?(0,ea.jsx)(Gc,d(d(d({},n),a),{},{ref:t})):null});Av.displayName=Ev;var Fv=t.forwardRef((e,s)=>{let{__scopeSelect:a,value:n}=e,r=l(e,Ef);const i=t.useRef(null),o=fr(s,i),c=df(n);return t.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,s=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==n&&s){const t=new Event("change",{bubbles:!0});s.call(e,n),e.dispatchEvent(t)}},[c,n]),(0,ea.jsx)(Tr.select,d(d({},r),{},{style:d(d({},uf),r.style),ref:o,defaultValue:n}))});function Tv(e){return""===e||void 0===e}function zv(e){const s=Xr(e),a=t.useRef(""),n=t.useRef(0),l=t.useCallback(e=>{const t=a.current+e;s(t),function e(t){a.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(t)},[s]),r=t.useCallback(()=>{a.current="",window.clearTimeout(n.current)},[]);return t.useEffect(()=>()=>window.clearTimeout(n.current),[]),[a,l,r]}function Mv(e,t,s){const a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,n=s?e.indexOf(s):-1;let l=(r=e,i=Math.max(n,0),r.map((e,t)=>r[(i+t)%r.length]));var r,i;1===a.length&&(l=l.filter(e=>e!==s));const o=l.find(e=>e.textValue.toLowerCase().startsWith(a.toLowerCase()));return o!==s?o:void 0}Fv.displayName="SelectBubbleInput";var Pv=qf,Bv=Kf,Rv=Yf,Lv=Qf,Iv=ov,Ov=xv,Uv=vv,Hv=jv,Wv=Nv,Vv=Cv,qv=Dv,$v=Sv;const Gv=["className","children"],Kv=["className"],Yv=["className"],Jv=["className","children","position"],Qv=["className"],Xv=["className","children"],Zv=["className"],eb=Wf,tb=Gf,sb=t.forwardRef((e,t)=>{let{className:s,children:a}=e,n=l(e,Gv);return(0,ea.jsxs)(Pv,d(d({ref:t,className:Np("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s)},n),{},{children:[a,(0,ea.jsx)(Bv,{asChild:!0,children:(0,ea.jsx)(tr,{className:"h-4 w-4 opacity-50"})})]}))});sb.displayName=Pv.displayName;const ab=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Kv);return(0,ea.jsx)(Vv,d(d({ref:t,className:Np("flex cursor-default items-center justify-center py-1",s)},a),{},{children:(0,ea.jsx)(er,{className:"h-4 w-4"})}))});ab.displayName=Vv.displayName;const nb=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Yv);return(0,ea.jsx)(qv,d(d({ref:t,className:Np("flex cursor-default items-center justify-center py-1",s)},a),{},{children:(0,ea.jsx)(tr,{className:"h-4 w-4"})}))});nb.displayName=qv.displayName;const lb=t.forwardRef((e,t)=>{let{className:s,children:a,position:n="popper"}=e,r=l(e,Jv);return(0,ea.jsx)(Rv,{children:(0,ea.jsxs)(Lv,d(d({ref:t,className:Np("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-select-content-transform-origin]","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:n},r),{},{children:[(0,ea.jsx)(ab,{}),(0,ea.jsx)(Iv,{className:Np("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,ea.jsx)(nb,{})]}))})});lb.displayName=Lv.displayName;t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Qv);return(0,ea.jsx)(Ov,d({ref:t,className:Np("px-2 py-1.5 text-sm font-semibold",s)},a))}).displayName=Ov.displayName;const rb=t.forwardRef((e,t)=>
2{let{className:s,children:a}=e,n=l(e,Xv);return(0,ea.jsxs)(Uv,d(d({ref:t,className:Np("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s)},n),{},{children:[(0,ea.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ea.jsx)(Wv,{children:(0,ea.jsx)(Xl,{className:"h-4 w-4"})})}),(0,ea.jsx)(Hv,{children:a})]}))});rb.displayName=Uv.displayName;t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Zv);return(0,ea.jsx)($v,d({ref:t,className:Np("-mx-1 my-1 h-px bg-muted",s)},a))}).displayName=$v.displayName;const ib=["__scopeSwitch","name","checked","defaultChecked","required","disabled","value","onCheckedChange","form"],ob=["__scopeSwitch"],cb=["__scopeSwitch","control","checked","bubbles"];var db="Switch",[ub,mb]=jr(db),[hb,xb]=ub(db),pb=t.forwardRef((e,s)=>{const{__scopeSwitch:a,name:n,checked:r,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:m,form:h}=e,x=l(e,ib),[p,g]=t.useState(null),f=fr(s,e=>g(e)),v=t.useRef(!1),b=!p||(h||!!p.closest("form")),[j,y]=Cr({prop:r,defaultProp:null!==i&&void 0!==i&&i,onChange:m,caller:db});return(0,ea.jsxs)(hb,{scope:a,checked:j,disabled:c,children:[(0,ea.jsx)(Tr.button,d(d({type:"button",role:"switch","aria-checked":j,"aria-required":o,"data-state":bb(j),"data-disabled":c?"":void 0,disabled:c,value:u},x),{},{ref:f,onClick:xr(e.onClick,e=>{y(e=>!e),b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})),b&&(0,ea.jsx)(vb,{control:p,bubbles:!v.current,name:n,value:u,checked:j,required:o,disabled:c,form:h,style:{transform:"translateX(-100%)"}})]})});pb.displayName=db;var gb="SwitchThumb",fb=t.forwardRef((e,t)=>{const{__scopeSwitch:s}=e,a=l(e,ob),n=xb(gb,s);return(0,ea.jsx)(Tr.span,d(d({"data-state":bb(n.checked),"data-disabled":n.disabled?"":void 0},a),{},{ref:t}))});fb.displayName=gb;var vb=t.forwardRef((e,s)=>{let{__scopeSwitch:a,control:n,checked:r,bubbles:i=!0}=e,o=l(e,cb);const c=t.useRef(null),u=fr(c,s),m=df(r),h=Nc(n);return t.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(t,"checked").set;if(m!==r&&s){const t=new Event("click",{bubbles:i});s.call(e,r),e.dispatchEvent(t)}},[m,r,i]),(0,ea.jsx)("input",d(d({type:"checkbox","aria-hidden":!0,defaultChecked:r},o),{},{tabIndex:-1,ref:u,style:d(d(d({},o.style),h),{},{position:"absolute",pointerEvents:"none",opacity:0,margin:0})}))});function bb(e){return e?"checked":"unchecked"}vb.displayName="SwitchBubbleInput";var jb=pb,yb=fb;const Nb=["className"],wb=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Nb);return(0,ea.jsx)(jb,d(d({className:Np("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors 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 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s)},a),{},{ref:t,children:(0,ea.jsx)(yb,{className:Np("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}))});wb.displayName=jb.displayName;const Cb=["name","min","max","step","orientation","disabled","minStepsBetweenThumbs","defaultValue","value","onValueChange","onValueCommit","inverted","form"],kb=["min","max","dir","inverted","onSlideStart","onSlideMove","onSlideEnd","onStepKeyDown"],Db=["min","max","inverted","onSlideStart","onSlideMove","onSlideEnd","onStepKeyDown"],_b=["__scopeSlider","onSlideStart","onSlideMove","onSlideEnd","onHomeKeyDown","onEndKeyDown","onStepKeyDown"],Sb=["__scopeSlider"],Eb=["__scopeSlider"],Ab=["__scopeSlider","index","name"],Fb=["__scopeSlider","value"];var Tb=["PageUp","PageDown"],zb=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mb={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Pb="Slider",[Bb,Rb,Lb]=$r(Pb),[Ib,Ob]=jr(Pb,[Lb]),[Ub,Hb]=Ib(Pb),Wb=t.forwardRef((e,s)=>{const{name:a,min:n=0,max:r=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:m=[n],value:h,onValueChange:x=()=>{},onValueCommit:p=()=>{},inverted:g=!1,form:f}=e,v=l(e,Cb),b=t.useRef(new Set),j=t.useRef(0),y="horizontal"===o?$b:Gb,[N=[],w]=Cr({prop:h,defaultProp:m,onChange:e=>{var t;null===(t=[...b.current][j.current])||void 0===t||t.focus(),x(e)}}),C=t.useRef(N);
2function k(e,t){let{commit:s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{commit:!1};const a=function(e){return(String(e).split(".")[1]||"").length}(i),l=function(e,t){const s=Math.pow(10,t);return Math.round(e*s)/s}(Math.round((e-n)/i)*i+n,a),o=sf(l,[n,r]);w(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,s=arguments.length>2?arguments[2]:void 0;const a=[...e];return a[s]=t,a.sort((e,t)=>e-t)}(e,o,t);if(function(e,t){if(t>0){const s=function(e){return e.slice(0,-1).map((t,s)=>e[s+1]-t)}(e);return Math.min(...s)>=t}return!0}(a,u*i)){j.current=a.indexOf(o);const t=String(a)!==String(e);return t&&s&&p(a),t?a:e}return e})}return(0,ea.jsx)(Ub,{scope:e.__scopeSlider,name:a,disabled:c,min:n,max:r,valueIndexToChangeRef:j,thumbs:b.current,values:N,orientation:o,form:f,children:(0,ea.jsx)(Bb.Provider,{scope:e.__scopeSlider,children:(0,ea.jsx)(Bb.Slot,{scope:e.__scopeSlider,children:(0,ea.jsx)(y,d(d({"aria-disabled":c,"data-disabled":c?"":void 0},v),{},{ref:s,onPointerDown:xr(v.onPointerDown,()=>{c||(C.current=N)}),min:n,max:r,inverted:g,onSlideStart:c?void 0:function(e){const t=function(e,t){if(1===e.length)return 0;const s=e.map(e=>Math.abs(e-t)),a=Math.min(...s);return s.indexOf(a)}(N,e);k(e,t)},onSlideMove:c?void 0:function(e){k(e,j.current)},onSlideEnd:c?void 0:function(){const e=C.current[j.current];N[j.current]!==e&&p(N)},onHomeKeyDown:()=>!c&&k(n,0,{commit:!0}),onEndKeyDown:()=>!c&&k(r,N.length-1,{commit:!0}),onStepKeyDown:e=>{let{event:t,direction:s}=e;if(!c){const e=Tb.includes(t.key)||t.shiftKey&&zb.includes(t.key)?10:1,a=j.current;k(N[a]+i*e*s,a,{commit:!0})}}}))})})})});Wb.displayName=Pb;var[Vb,qb]=Ib(Pb,{startEdge:"left",endEdge:"right",size:"width",direction:1}),$b=t.forwardRef((e,s)=>{const{min:a,max:n,dir:r,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:m}=e,h=l(e,kb),[x,p]=t.useState(null),g=fr(s,e=>p(e)),f=t.useRef(void 0),v=Qr(r),b="ltr"===v,j=b&&!i||!b&&i;function y(e){const t=f.current||x.getBoundingClientRect(),s=nj([0,t.width],j?[a,n]:[n,a]);return f.current=t,s(e-t.left)}return(0,ea.jsx)(Vb,{scope:e.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:(0,ea.jsx)(Kb,d(d({dir:v,"data-orientation":"horizontal"},h),{},{ref:g,style:d(d({},h.style),{},{"--radix-slider-thumb-transform":"translateX(-50%)"}),onSlideStart:e=>{const t=y(e.clientX);null===o||void 0===o||o(t)},onSlideMove:e=>{const t=y(e.clientX);null===c||void 0===c||c(t)},onSlideEnd:()=>{f.current=void 0,null===u||void 0===u||u()},onStepKeyDown:e=>{const t=Mb[j?"from-left":"from-right"].includes(e.key);null===m||void 0===m||m({event:e,direction:t?-1:1})}}))})}),Gb=t.forwardRef((e,s)=>{const{min:a,max:n,inverted:r,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u}=e,m=l(e,Db),h=t.useRef(null),x=fr(s,h),p=t.useRef(void 0),g=!r;function f(e){const t=p.current||h.current.getBoundingClientRect(),s=nj([0,t.height],g?[n,a]:[a,n]);return p.current=t,s(e-t.top)}return(0,ea.jsx)(Vb,{scope:e.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:(0,ea.jsx)(Kb,d(d({"data-orientation":"vertical"},m),{},{ref:x,style:d(d({},m.style),{},{"--radix-slider-thumb-transform":"translateY(50%)"}),onSlideStart:e=>{const t=f(e.clientY);null===i||void 0===i||i(t)},onSlideMove:e=>{const t=f(e.clientY);null===o||void 0===o||o(t)},onSlideEnd:()=>{p.current=void 0,null===c||void 0===c||c()},onStepKeyDown:e=>{const t=Mb[g?"from-bottom":"from-top"].includes(e.key);null===u||void 0===u||u({event:e,direction:t?-1:1})}}))})}),Kb=t.forwardRef((e,t)=>{const{__scopeSlider:s,onSlideStart:a,onSlideMove:n,onSlideEnd:r,onHomeKeyDown:i,onEndKeyDown:o,onStepKeyDown:c}=e,u=l(e,_b),m=Hb(Pb,s);return(0,ea.jsx)(Tr.span,d(d({},u),{},{ref:t,onKeyDown:xr(e.onKeyDown,e=>{"Home"===e.key?(i(e),e.preventDefault()):"End"===e.key?(o(e),e.preventDefault()):Tb.concat(zb).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:xr(e.onPointerDown,e=>{const t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),m.thumbs.has(t)?t.focus():a(e)}),onPointerMove:xr(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&n(e)}),onPointerUp:xr(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),r(e))})}))}),Yb="SliderTrack",Jb=t.forwardRef((e,t)=>
2{const{__scopeSlider:s}=e,a=l(e,Sb),n=Hb(Yb,s);return(0,ea.jsx)(Tr.span,d(d({"data-disabled":n.disabled?"":void 0,"data-orientation":n.orientation},a),{},{ref:t}))});Jb.displayName=Yb;var Qb="SliderRange",Xb=t.forwardRef((e,s)=>{const{__scopeSlider:a}=e,n=l(e,Eb),r=Hb(Qb,a),i=qb(Qb,a),o=fr(s,t.useRef(null)),c=r.values.length,u=r.values.map(e=>aj(e,r.min,r.max)),m=c>1?Math.min(...u):0,h=100-Math.max(...u);return(0,ea.jsx)(Tr.span,d(d({"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0},n),{},{ref:o,style:d(d({},e.style),{},{[i.startEdge]:m+"%",[i.endEdge]:h+"%"})}))});Xb.displayName=Qb;var Zb="SliderThumb",ej=t.forwardRef((e,s)=>{const a=Rb(e.__scopeSlider),[n,l]=t.useState(null),r=fr(s,e=>l(e)),i=t.useMemo(()=>n?a().findIndex(e=>e.ref.current===n):-1,[a,n]);return(0,ea.jsx)(tj,d(d({},e),{},{ref:r,index:i}))}),tj=t.forwardRef((e,s)=>{const{__scopeSlider:a,index:n,name:r}=e,i=l(e,Ab),o=Hb(Zb,a),c=qb(Zb,a),[u,m]=t.useState(null),h=fr(s,e=>m(e)),x=!u||(o.form||!!u.closest("form")),p=Nc(u),g=o.values[n],f=void 0===g?0:aj(g,o.min,o.max),v=function(e,t){return t>2?"Value ".concat(e+1," of ").concat(t):2===t?["Minimum","Maximum"][e]:void 0}(n,o.values.length),b=null===p||void 0===p?void 0:p[c.size],j=b?function(e,t,s){const a=e/2,n=nj([0,50],[0,a]);return(a-n(t)*s)*s}(b,f,c.direction):0;return t.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),(0,ea.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:"calc(".concat(f,"% + ").concat(j,"px)")},children:[(0,ea.jsx)(Bb.ItemSlot,{scope:e.__scopeSlider,children:(0,ea.jsx)(Tr.span,d(d({role:"slider","aria-label":e["aria-label"]||v,"aria-valuemin":o.min,"aria-valuenow":g,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0},i),{},{ref:h,style:void 0===g?{display:"none"}:e.style,onFocus:xr(e.onFocus,()=>{o.valueIndexToChangeRef.current=n})}))}),x&&(0,ea.jsx)(sj,{name:null!==r&&void 0!==r?r:o.name?o.name+(o.values.length>1?"[]":""):void 0,form:o.form,value:g},n)]})});ej.displayName=Zb;var sj=t.forwardRef((e,s)=>{let{__scopeSlider:a,value:n}=e,r=l(e,Fb);const i=t.useRef(null),o=fr(i,s),c=df(n);return t.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==n&&s){const t=new Event("input",{bubbles:!0});s.call(e,n),e.dispatchEvent(t)}},[c,n]),(0,ea.jsx)(Tr.input,d(d({style:{display:"none"}},r),{},{ref:o,defaultValue:n}))});function aj(e,t,s){return sf(100/(s-t)*(e-t),[0,100])}function nj(e,t){return s=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(s-e[0])}}sj.displayName="RadioBubbleInput";var lj=Wb,rj=Jb,ij=Xb,oj=ej;const cj=["className"],dj=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,cj);return(0,ea.jsxs)(lj,d(d({ref:t,className:Np("relative flex w-full touch-none select-none items-center",s)},a),{},{children:[(0,ea.jsx)(rj,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:(0,ea.jsx)(ij,{className:"absolute h-full bg-primary"})}),(0,ea.jsx)(oj,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}))});dj.displayName=lj.displayName;const uj=[{value:"none",label:"None"},{value:"fadeIn",label:"Fade In"},{value:"fadeInUp",label:"Fade In Up"},{value:"fadeInDown",label:"Fade In Down"},{value:"fadeInLeft",label:"Slide from Left"},{value:"fadeInRight",label:"Slide from Right"},{value:"zoomIn",label:"Zoom In"},{value:"bounceIn",label:"Bounce In"},{value:"slideInUp",label:"Slide Up"},{value:"flipIn",label:"Flip In"},{value:"rotateIn",label:"Rotate In"}],mj=[{value:"none",label:"None"},{value:"pulse",label:"Pulse"},{value:"bounce",label:"Bounce"},{value:"float",label:"Float"},{value:"shake",label:"Shake"},{value:"swing",label:"Swing"},{value:"glowPulse",label:"Glow Pulse"}],hj=[{value:"none",label:"None"},{value:"fadeIn",label:"Fade In"},{value:"fadeInUp",label:"Fade In Up"},{value:"textReveal",label:"Text Reveal"},{value:"letterSpacing",label:"Letter Expand"},{value:"blurIn",label:"Blur In"},{value:"bounceIn",label:"Bounce In"}],xj=[{value:"slow",label:"Slow (1.5s)"},{value:"normal",label:"Normal (0.8s)"},{value:"fast",label:"Fast (0.4s)"}],pj=[{value:"0",label:"No delay"},{value:"100",label:"0.1s"},{value:"200",label:"0.2s"},{value:"300",label:"0.3s"},{value:"500",label:"0.5s"},{value:"700",label:"0.7s"},{value:"1000",label:"1s"}],gj=e=>{let{animation:t={},onChange:s,showTextAnimations:a=!1}=e;const{entrance:n="none",attention:l="none",textAnimation:r="none",speed:i="normal",delay:o="0",animateO
2nScroll:c=!1}=t,u=(e,a)=>{s(d(d({},t),{},{[e]:a}))};return(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-slate-700 pb-2 border-b border-slate-200",children:[(0,ea.jsx)($g,{size:16,className:"text-purple-500"}),"Animation"]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-600 flex items-center gap-1",children:[(0,ea.jsx)(Gg,{size:12}),"Entrance Animation"]}),(0,ea.jsxs)(eb,{value:n,onValueChange:e=>u("entrance",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:uj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),a&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Text Animation"}),(0,ea.jsxs)(eb,{value:r,onValueChange:e=>u("textAnimation",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:hj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-600 flex items-center gap-1",children:[(0,ea.jsx)(Gl,{size:12}),"Continuous Effect"]}),(0,ea.jsxs)(eb,{value:l,onValueChange:e=>u("attention",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:mj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),("none"!==n||"none"!==l||"none"!==r)&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Speed"}),(0,ea.jsxs)(eb,{value:i,onValueChange:e=>u("speed",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:xj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-600 flex items-center gap-1",children:[(0,ea.jsx)(Kg,{size:12}),"Delay"]}),(0,ea.jsxs)(eb,{value:o,onValueChange:e=>u("delay",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:pj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]}),"none"!==n&&(0,ea.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-slate-200",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Animate when scrolled into view"}),(0,ea.jsx)(wb,{checked:c,onCheckedChange:e=>
2u("animateOnScroll",e)})]})]})},fj=Vl("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),vj=Vl("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),bj=Vl("external-link",[["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"}]]),jj=Vl("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"}]]),yj=Vl("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"}]]),Nj=Vl("rotate-ccw",[["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"}]]),wj=Vl("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Cj=e=>{let{title:s,subtitle:a,questions:n,plans:l,accentColor:r,onRecommendation:i,recommendedPlanId:o}=e;const[c,u]=(0,t.useState)(0),[m,h]=(0,t.useState)({}),x=(n||[]).length,p=(n||[])[c]||null,g=c>=x&&x>0,f=(0,t.useMemo)(()=>o&&(l||[]).find(e=>e.id===o)||null,[l,o]),v=(0,t.useCallback)((e,t)=>{const s=d(d({},m),{},{[e.id]:t});h(s);const a=c+1;if(u(a),a>=x){const e={};(l||[]).forEach(t=>{e[t.id]=0}),(n||[]).forEach(t=>{"yes"===s[t.id]&&(t.yesPlanIds||[]).forEach(t=>{e[t]=(e[t]||0)+1})});let t=null,a=-1;if(Object.entries(e).forEach(e=>{let[s,n]=e;n>a&&(t=s,a=n)}),a<=0){const e=(l||[]).find(e=>e.highlighted)||(l||[])[0];t=e?e.id:null}i&&t&&i(t)}},[m,c,x,n,l,i]);if(0===x)return null;const b=Math.round(Math.min(c,x)/x*100);return(0,ea.jsxs)("div",{className:"rounded-2xl border bg-white p-6 md:p-8 mb-10",style:{borderColor:"".concat(r,"33"),boxShadow:"0 1px 3px ".concat(r,"1A")},"data-testid":"plan-recommender-wizard",children:[(0,ea.jsxs)("div",{className:"flex items-start gap-3 mb-4",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"".concat(r,"1A"),color:r},children:(0,ea.jsx)($g,{size:20})}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("h3",{className:"text-lg font-bold",style:{color:"var(--site-heading-color)"},children:s||"Find the right plan for you"}),a&&(0,ea.jsx)("p",{className:"text-sm opacity-70 mt-0.5",style:{color:"var(--site-body-color)"},children:a})]}),(c>0||g)&&(0,ea.jsxs)("button",{type:"button",onClick:()=>{h({}),u(0),i&&i(null)},className:"text-xs flex items-center gap-1 px-2 py-1 rounded hover:bg-slate-100 transition-colors",style:{color:r},"data-testid":"recommender-reset-btn",children:[(0,ea.jsx)(Nj,{size:12})," Reset"]})]}),(0,ea.jsx)("div",{className:"h-1.5 w-full bg-slate-100 rounded-full overflow-hidden mb-5",children:(0,ea.jsx)("div",{className:"h-full transition-all duration-500 ease-out",style:{width:"".concat(b,"%"),backgroundColor:r}})}),!g&&p&&(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"text-xs uppercase tracking-wider opacity-60 mb-2",children:["Question ",c+1," of ",x]}),(0,ea.jsx)("p",{className:"text-base md:text-lg font-medium mb-4",style:{color:"var(--site-heading-color)"},children:p.text}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>v(p,"yes"),className:"flex-1 min-w-[120px] px-5 py-3 rounded-lg font-medium text-white transition-transform hover:scale-[1.02]",style:{backgroundColor:r},"data-testid":"recommender-yes-".concat(p.id),children:"Yes"}),(0,ea.jsx)("button",{type:"button",onClick:()=>v(p,"no"),className:"flex-1 min-w-[120px] px-5 py-3 rounded-lg font-medium border-2 transition-colors hover:bg-slate-50",style:{borderColor:"#cbd5e1",color:"var(--site-body-color)"},"data-testid":"recommender-no-".concat(p.id),children:"No"})]})]}),g&&f&&(0,ea.jsxs)("div",{className:"text-center py-2","data-testid":"recommender-result",children:[(0,ea.jsx)("p",{className:"text-xs uppercase tracking-wider opacity-60 mb-2",children:"Our recommendation"}),(0,ea.jsx)("p",{className:"text-2xl md:text-3xl font-bold mb-3",style:{color:r},children:f.name}),f.buttonText&&f.buttonUrl&&(0,ea.jsxs)("a",{href:f.buttonUrl,className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg font-medium text-white transition-transform hover:scale-[1.02]",style:{backgroundColor:r},children:[f.buttonText," ",(0,ea.jsx)(wj,{size:16})]}),(0,ea.jsx)("p",{className:"text-xs opacity-60 mt-3",children:"See the highlighted column below for full details."})]})]})},kj=Vl("message-circle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),Dj=e=>{let{tenantId:s}=e;const[a,n]=(0,t.useState)(null),[l,r]=(0,t.useState)(!1),[i,o]=(0,t.useState)([]),[c,d]=(0,t.useState)(""),[u,m]=(0,t.useState)(!1),h=(0,t.useRef)(null),x=(0,t.useRef)(null);if((0,t.useEffect)(()=>
2{if(!s)return;let e=!0;return fetch("".concat("","/api/public/ai-widget/").concat(s)).then(e=>e.json()).then(t=>{e&&null!==t&&void 0!==t&&t.enabled&&n(t)}).catch(()=>{}),()=>{e=!1}},[s]),(0,t.useEffect)(()=>{l&&a&&0===i.length&&o([{role:"bot",text:a.greeting||"Hi! How can I help you today?"}])},[l,a]),(0,t.useEffect)(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,u]),!a)return null;if("selected"===a.widget_scope){const e=a.widget_paths||[],t=(window.location.pathname||"/").replace(/\/+$/,"")||"/",s=e.some(e=>{const s=(e||"/").replace(/\/+$/,"")||"/";return s===t||"/"!==s&&t.endsWith(s)});if(!s)return null}const p=a.primary_color||"#4f46e5",g=async()=>{const e=c.trim();if(e&&!u){d(""),o(t=>[...t,{role:"user",text:e}]),m(!0);try{const t=await fetch("".concat("","/api/public/ai-widget/").concat(s,"/chat"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,session_id:h.current})}),a=await t.json();if(!t.ok)throw new Error((null===a||void 0===a?void 0:a.detail)||"error");
2h.current=a.session_id||h.current,o(e=>[...e,{role:"bot",text:a.response,cta:a.cta||null,footer:a.footer||null}])}catch(G2){o(e=>[...e,{role:"bot",text:"Sorry, I'm having trouble responding right now. Please try again."}])}finally{m(!1)}}};return(0,ea.jsxs)("div",{"data-testid":"ai-assistant-widget",className:"fixed bottom-5 right-5 z-[9999] flex flex-col items-end",children:[l&&(0,ea.jsxs)("div",{"data-testid":"ai-assistant-panel",className:"mb-3 w-[min(380px,calc(100vw-2.5rem))] h-[min(560px,calc(100vh-7rem))] rounded-2xl overflow-hidden shadow-2xl border border-black/10 bg-white flex flex-col animate-in fade-in slide-in-from-bottom-4 duration-200",children:[(0,ea.jsxs)("div",{className:"px-4 py-3 flex items-center gap-3 text-white shrink-0",style:{backgroundColor:p},children:[(0,ea.jsx)("div",{className:"h-8 w-8 rounded-full bg-white/20 flex items-center justify-center",children:(0,ea.jsx)(kj,{size:18})}),(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsx)("p",{className:"font-semibold text-sm truncate leading-tight",children:a.bot_name||"Assistant"}),(0,ea.jsx)("p",{className:"text-[11px] text-white/80 leading-tight",children:"Online"})]}),(0,ea.jsx)("button",{onClick:()=>r(!1),"aria-label":"Close assistant","data-testid":"ai-assistant-close",className:"ml-auto h-7 w-7 rounded-full hover:bg-white/20 flex items-center justify-center transition-colors",children:(0,ea.jsx)(sr,{size:18})})]}),(0,ea.jsxs)("div",{ref:x,className:"flex-1 overflow-y-auto p-4 space-y-3 bg-slate-50","data-testid":"ai-assistant-messages",children:[i.map((e,t)=>(0,ea.jsxs)("div",{className:"flex flex-col ".concat("user"===e.role?"items-end":"items-start"),children:[(0,ea.jsx)("div",{className:"max-w-[80%] px-3.5 py-2 rounded-2xl text-sm whitespace-pre-wrap break-words ".concat("user"===e.role?"text-white rounded-br-sm":"bg-white border border-slate-200 text-slate-700 rounded-bl-sm"),style:"user"===e.role?{backgroundColor:p}:void 0,children:e.text}),e.cta&&e.cta.url&&(0,ea.jsx)("a",{href:e.cta.url,target:"_blank",rel:"noopener noreferrer","data-testid":"ai-assistant-cta",className:"mt-1.5 inline-block px-3.5 py-2 rounded-xl text-sm font-medium text-white shadow-sm hover:opacity-90 transition-opacity",style:{backgroundColor:p},children:e.cta.label||"Learn more"}),e.footer&&(e.footer.message||e.footer.cta)&&(0,ea.jsxs)("div",{className:"mt-1.5 max-w-[85%] flex flex-col items-start gap-1.5","data-testid":"ai-assistant-footer",children:[e.footer.message&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 leading-snug",children:e.footer.message}),e.footer.cta&&e.footer.cta.url&&(0,ea.jsx)("a",{href:e.footer.cta.url,target:"_blank",rel:"noopener noreferrer","data-testid":"ai-assistant-footer-cta",className:"inline-block px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors hover:bg-slate-50",style:{color:p,borderColor:p},children:e.footer.cta.label||"Learn more"})]})]},t)),u&&(0,ea.jsx)("div",{className:"flex justify-start",children:(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 text-slate-400 px-3.5 py-2 rounded-2xl rounded-bl-sm text-sm flex items-center gap-2",children:[(0,ea.jsx)(ql,{size:14,className:"animate-spin"})," Typing\u2026"]})})]}),(0,ea.jsxs)("div",{className:"p-3 border-t border-slate-200 bg-white shrink-0 flex items-end gap-2",children:[(0,ea.jsx)("textarea",{value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),g())},rows:1,placeholder:"Type your message\u2026","data-testid":"ai-assistant-input",className:"flex-1 resize-none max-h-24 text-sm px-3 py-2 rounded-xl border border-slate-200 focus:outline-none focus:ring-2 focus:ring-offset-0",style:{"--tw-ring-color":p}}),(0,ea.jsx)("button",{onClick:g,disabled:!c.trim()||u,"aria-label":"Send message","data-testid":"ai-assistant-send",className:"h-9 w-9 shrink-0 rounded-full text-white flex items-center justify-center disabled:opacity-40 transition-opacity",style:{backgroundColor:p},children:(0,ea.jsx)(dr,{size:16})})]})]}),(0,ea.jsx)("button",{type:"button","data-testid":"ai-assistant-toggle",onClick:()=>r(e=>!e),"aria-label":l?"Close assistant":"Open assistant",className:"h-14 w-14 roun
2ded-full text-white shadow-xl flex items-center justify-center transition-transform hover:scale-105 active:scale-95",style:{backgroundColor:p},children:l?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(kj,{size:26})})]})},_j=Vl("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Sj=Vl("shopping-cart",[["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"}]]),Ej=Vl("shopping-bag",[["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"}]]),Aj=Vl("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]),Fj=Vl("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"}]]),Tj=Vl("thumbs-up",[["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"}]]),zj=Vl("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"}]]),Mj=Vl("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"}]]),Pj=Vl("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"}]]),Bj=Vl("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Rj=Vl("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"}]]),Lj=Vl("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"}]]),Ij=Vl("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),Oj=Vl("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"}]]),Uj=Vl("book-open",[["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"}]]),Hj=Vl("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"}]]),Wj=Vl("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"}]]),Vj=Vl("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),qj=Vl("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),$j=[{value:"none",label:"No icon"},{value:"arrow-right",label:"Arrow right"},{value:"arrow-left",label:"Arrow left"},{value:"chevron-right",label:"Chevron right"},{value:"chevron-down",label:"Chevron down"},{value:"download",label:"Download"},{value:"external-link",label:"External link"},{value:"send",label:"Send"},{value:"mail",label:"Mail"},{value:"phone",label:"Phone"},{value:"message",label:"Message"},{value:"cart",label:"Cart"},{value:"bag",label:"Shopping bag"},{value:"credit-card",label:"Credit card"},{value:"play",label:"Play"},{value:"check",label:"Check"},{value:"check-circle",label:"Check circle"},{value:"star",label:"Star"},{value:"heart",label:"Heart"},{value:"thumbs-up",label:"Thumbs up"},{value:"gift",label:"Gift"},{value:"sparkles",label:"Sparkles"},{value:"zap",label:"Lightning"},{value:"rocket",label:"Rocket"},{value:"calendar",label:"Calendar"},{value:"clock",label:"Clock"},{value:"search",label:"Search"},{value:"user",label:"User"},{value:"users",label:"Users"},{value:"home",label:"Home"},{value:"globe",label:"Globe"},{value:"map-pin",label:"Map pin"},{value:"lock",label:"Lock"},{value:"bell",label:"Bell"},{value:"settings",label:"Settings"},{value:"book-open",label:"Book"},{value:"camera",label:"Camera"},{value:"tag",label:"Tag"},{value:"plus",label:"Plus"},{value:"info",label:"Info"}],Gj={"arrow-right":wj,"arrow-left":_j,"chevron-right":ax,"chevron-down":tr,download:jj,"external-link":bj,send:dr,mail:Yl,phone:Jl,message:kj,cart:Sj,bag:Ej,"credit-card":Aj,play:Gg,check:Xl,"check-circle":cr,star:$l,heart:Fj,"thumbs-up":Tj,gift:zj,sparkles:$g,zap:Gl,rocket:Mj,calendar:yj,clock:Kg,search:fj,user:Pj,users:Bj,home:Rj,globe:hr,"map-pin":Ql,lock:Lj,bell:Ij,settings:Oj,"book-open":Uj,camera:Hj,tag:Wj,plus:Vj,info:qj},Kj=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,s=arguments.length>2?arguments[2]:void 0;if(!e||"none"===e)return null;const a=Gj[e];return a?(0,ea.jsx)(a,{size:t,strokeWidth:2.25,color:s||void 0}):null},Yj=e=>"square"===e?"0px":"pill"===e?"9999px":"8px",Jj=e=>{switch(e){case"darken":return"hover:brightness-95";case"lift":return"hover:-translate-y-0.5 hover:shadow-lg";case"none":return"";default:return"hover:opacity-90"}},Qj=e=>"sm"===e?"px-3 py-1 text-sm":"lg"===e?"px-6 py-3 text-lg":"px-4 py-2",Xj=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.style||"solid",s=e.color||"#6366f1",a=e.textColor||"#ffffff",n=e.gradientColor||"#8b5cf6",l={borderRadius:Yj(e.radius),fontFamily:"inherit",border:"none"};switch(t){case"outline":return d(d({},l),{}
2,{backgroundColor:"transparent",color:s,border:"2px solid ".concat(s)});case"ghost":return d(d({},l),{},{backgroundColor:"transparent",color:s});case"gradient":return d(d({},l),{},{background:"linear-gradient(135deg, ".concat(s,", ").concat(n,")"),color:a});case"soft":return d(d({},l),{},{backgroundColor:"".concat(s,"26"),color:s});default:return d(d({},l),{},{backgroundColor:s,color:a})}},Zj=function(){return Xj(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{style:e.buttonStyle,color:e.buttonColor,textColor:e.buttonTextColor,gradientColor:e.buttonGradientColor,radius:e.buttonRadius}}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))},ey=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.buttonRadius?{borderRadius:Yj(e.buttonRadius)}:{}},ty=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.buttonHover?Jj(e.buttonHover):""},sy=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!(!e.buttonIcon||"none"===e.buttonIcon)},ay=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).buttonIconPosition||"right"},ny=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;return Kj(e.buttonIcon,t,e.buttonIconColor)},ly=["preset","icon","layout"],ry=["preset","icon","layout"],iy=e=>{const t="function"===typeof e?e:()=>{};return"\n .image-text-slide-content h1 { font-size: ".concat(t("h1_size")||48,"px; font-weight: 700; line-height: 1.2; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content h2 { font-size: ").concat(t("h2_size")||36,"px; font-weight: 700; line-height: 1.3; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content h3 { font-size: ").concat(t("h3_size")||28,"px; font-weight: 600; line-height: 1.3; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content h4 { font-size: ").concat(t("h4_size")||22,"px; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content h5 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content h6 { font-size: 1rem; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content p { margin: 0.75rem 0; color: inherit; }\n .image-text-slide-content p:first-child { margin-top: 0; }\n .image-text-slide-content p:last-child { margin-bottom: 0; }\n .image-text-slide-content ul { list-style-type: disc; padding-left: 1.5rem; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content ol { list-style-type: decimal; padding-left: 1.5rem; margin: 0.5rem 0; color: inherit; }\n .image-text-slide-content li { margin: 0.25rem 0; display: list-item; color: inherit; }\n .image-text-slide-content ul ul { list-style-type: circle; }\n .image-text-slide-content ul ul ul { list-style-type: square; }\n .image-text-slide-content strong, .image-text-slide-content b { font-weight: 700; }\n .image-text-slide-content a { color: ").concat(t("link_color")||"#2563eb","; text-decoration: underline; }\n .image-text-slide-content a:hover { color: ").concat(t("link_hover_color")||"#1d4ed8","; }\n")},oy=()=>{try{return"undefined"!==typeof window&&window.location.pathname.startsWith("/preview/")}catch(G2){return!1}},cy=e=>{let{block:s,content:a,plans:n,categories:l,accentColor:r,ts:i,renderValue:o,finalBlockStyle:c,wrapperClass:u,animationClass:m,index:h}=e;const[x,p]=(0,t.useState)(null);t.useEffect(()=>{if(x){const e=document.querySelector('[data-testid="feature-comparison-'.concat(s.id,'"]'));e&&setTimeout(()=>e.scrollIntoView({behavior:"smooth",block:"start"}),250)}},[x,s.id]);const g=e=>x&&e===x,f=e=>g(e)?{boxShadow:"0 0 0 3px ".concat(r),animation:"fcPulse 2s ease-in-out 2"}:{};return(0,ea.jsxs)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(u," ").concat(m),style:c,children:[(0,ea.jsx)("style",{children:"\n @keyframes fcPulse {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(1.015); }\n }\n "}),(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[a.title&&(0,ea.jsx)("h2",{className:"mb-3",style:{fontSize:i.fontSize?"clamp(1.5rem, 4vw, ".concat(parseInt(i.fontSize,10)/16,"rem)"):"clamp(1.875rem, 4vw, 2.25rem)",fontFamily:i.fontFamily&&"inherit"!==i.fontFamily?"".concat(i.fontFamily,", sans-serif"):"inherit",fontWeight:i.fontWeight||"bold",color:i.color||"var(--site-heading-color)",textAlign:i.align||"center"},children:a.title}),a.subtitle&&(0,ea.jsx)("p",{className:"text-center mb-10 opacity-70",style:{color:"var(--site-body-color)"},children:a.subtitle}),a.enableRecommender&&(a.recommenderQuestions||[]).length>0&&n.length>0&&(0,ea.jsx)(Cj,{title:a.recommenderTitle,subtitle:a.recommenderSubtitle,questions:a.recommenderQuestions||[],plans:n,accentColor:r,recommendedPlanId:x,onRecommendation:p}),(0,ea.jsx)("div",{className:"hidden md:block overflow-x-auto rounded-2xl border border-slate-200 bg-white",children:(0,ea.jsxs)("table",{className:"w-full text-left","data-testid":"feature-comparison-".concat(s.id),children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"p-4 align-bottom text-sm font-medium text-slate-500
2w-1/4"}),n.map(e=>{const t=e.highlighted||g(e.id);return(0,ea.jsxs)("th",{className:"p-4 align-bottom text-center transition-all",style:d(d({},t?{backgroundColor:"".concat(r,"0F")}:{}),f(e.id)),children:[g(e.id)&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold animate-pulse",style:{backgroundColor:r,color:"#fff"},children:"\u2605 Recommended for You"}),!g(e.id)&&e.badge&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold",style:{backgroundColor:r,color:"#fff"},children:e.badge}),(0,ea.jsx)("div",{className:"font-semibold text-lg",style:{color:"var(--site-heading-color)"},children:e.name}),(e.price||e.period)&&(0,ea.jsxs)("div",{className:"mt-1",children:[(0,ea.jsx)("span",{className:"text-2xl font-bold",style:{color:"var(--site-heading-color)"},children:e.price}),e.period&&(0,ea.jsx)("span",{className:"text-sm opacity-60 ml-1",children:e.period})]}),e.buttonText&&(0,ea.jsx)("a",{href:e.buttonUrl||"#",className:"inline-block mt-3 px-4 py-2 rounded-lg text-sm font-medium transition-opacity hover:opacity-90",style:{backgroundColor:t?r:"transparent",color:t?"#fff":r,border:"1px solid ".concat(r)},children:e.buttonText})]},e.id)})]})}),(0,ea.jsx)("tbody",{children:l.map(e=>(0,ea.jsxs)(t.Fragment,{children:[e.name&&(0,ea.jsx)("tr",{children:(0,ea.jsx)("td",{colSpan:n.length+1,className:"px-4 py-3 text-xs font-semibold uppercase tracking-wider text-slate-500 bg-slate-50 border-t border-slate-200",children:e.name})}),(e.features||[]).map(e=>(0,ea.jsxs)("tr",{className:"border-t border-slate-100",children:[(0,ea.jsx)("td",{className:"p-4 text-sm font-medium",style:{color:"var(--site-heading-color)"},children:e.name}),n.map(t=>{const s=t.highlighted||g(t.id);return(0,ea.jsx)("td",{className:"p-4 text-center",style:s?{backgroundColor:"".concat(r,"0A")}:{},children:o((e.values||{})[t.id])},t.id)})]},e.id))]},e.id))})]})}),(0,ea.jsx)("div",{className:"md:hidden space-y-6",children:n.map(e=>{const t=e.highlighted||g(e.id);return(0,ea.jsxs)("div",{className:"rounded-xl border bg-white overflow-hidden",style:t?d({borderColor:r,borderWidth:2},f(e.id)):{borderColor:"#e2e8f0"},children:[(0,ea.jsxs)("div",{className:"p-5 text-center border-b border-slate-100",style:t?{backgroundColor:"".concat(r,"0F")}:{},children:[g(e.id)&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold animate-pulse",style:{backgroundColor:r,color:"#fff"},children:"\u2605 Recommended for You"}),!g(e.id)&&e.badge&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold",style:{backgroundColor:r,color:"#fff"},children:e.badge}),(0,ea.jsx)("div",{className:"font-semibold text-lg",style:{color:"var(--site-heading-color)"},children:e.name}),(e.price||e.period)&&(0,ea.jsxs)("div",{className:"mt-1",children:[(0,ea.jsx)("span",{className:"text-2xl font-bold",style:{color:"var(--site-heading-color)"},children:e.price}),e.period&&(0,ea.jsx)("span",{className:"text-sm opacity-60 ml-1",children:e.period})]}),e.buttonText&&(0,ea.jsx)("a",{href:e.buttonUrl||"#",className:"inline-block mt-3 px-4 py-2 rounded-lg text-sm font-medium",style:{backgroundColor:t?r:"transparent",color:t?"#fff":r,border:"1px solid ".concat(r)},children:e.buttonText})]}),(0,ea.jsx)("div",{className:"p-4 space-y-3",children:l.map(t=>(0,ea.jsxs)("div",{children:[t.name&&(0,ea.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-slate-400 mb-1",children:t.name}),(0,ea.jsx)("ul",{className:"space-y-2",children:(t.features||[]).map(t=>(0,ea.jsxs)("li",{className:"flex items-center justify-between gap-3",children:[(0,ea.jsx)("span",{className:"text-sm",style:{color:"var(--site-body-color)"},children:t.name}),(0,ea.jsx)("span",{children:o((t.values||{})[e.id])})]},t.id))})]},t.id))})]},e.id)})})]})]},"block-".concat(h))},dy=e=>{let{block:s,content:a,plans:n,rows:l,accentColor:r,ts:i,finalBlockStyle:o,wrapperClass:c,animationClass:u,index:m,resolveUrl:h,getPopupClickHandler:x}=e;const[p,g]=(0,t.useState)(null);t.useEffect(()=>{if(p){const e=document.querySelector('[data-testid="plan-comparison-'.concat(s.id,'"]'));e&&setTimeout(()=>e.scrollIntoView({behavior:"smooth",block:"start"}),250)}},[p,s.id]);const f=e=>p&&e===p,v=e=>f(e)?{boxShadow:"0 0 0 3px ".concat(r),animation:"pcPulse 2s ease-in-out 2"}:{},b=e=>{const t=(null==e?"":String(e)).trim(),s=t.toLowerCase();return["yes","true","\u2713","included","y","1"].includes(s)?(0,ea.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full",style:{backgroundColor:"".concat(r,"1A"),color:r},"aria-label":"Included",children:(0,ea.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("polyline",{points:"4 11 8 15 16 6"})})}):["no","false","-","","x","\u2717","n","0"].includes(s)?(0,ea.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full bg-slate-100 text-slate-400","aria-label":"Not included",children:(0,ea.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[(0,ea.jsx)("line",{x1:"5",y1:"5",x2:"15",y2:"15"}),(0,ea.jsx)("line",{x1:"15",y1:"5",x2:"5",y2:"15"})]})}):(0,ea.jsx)("span",{className:"text-sm font-medium",style:{color:"var(--site-body-color)"},children:t})},j=(e,t)=>{if(!e.buttonText)return null;const s=h?h(e.buttonUrl):e.buttonUrl||"#",a=x&&e.buttonUrl?x(e.buttonUrl):void 0;return(0,ea.jsx)("a",{href:s,onClick:a,className:"inline-block mt-3 px-4 py-2 rounded-lg text-sm font-medium transition-opacity hover:opacity-90",style:{backgroundColor:t?r:"transparent",color:t?"#fff":r,border:"1px solid ".concat(r)},children:e.buttonText})};return n&&0!==n.length?(0,ea.jsxs)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(c," ").concat(u),style:o,children:[(0,ea.jsx)("style",{children:"@keyframes pcPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.015); } }"}),(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[a.title&&(0,ea.jsx)("h2",{className:"mb-3",style:{fontSize:i.fontSize?"clamp(1.5rem, 4vw, ".concat(parseInt(i.fontSize,10)/16,"rem)"):"clamp(1.875rem, 4vw, 2.25rem)",fontFamily:i.fontFamily&&"inherit"!==i.fontFamily?"".concat(i.fontFamily,", sans-serif"):"inherit",fontWeight:i.fontWeight||"bold",color:i.color||"var(--site-heading-color)",textAlign:i.align||"center"},children:a.title}),a.subtitle&&(0,ea.jsx)("p",{className:"text-center mb-10 opacity-70",style:{color:"var(--site-body-color)"},children:a.subtitle}),a.enableRecommender&&(a.recommenderQuestions||[]).length>0&&n.length>0&&(0,ea.jsx)(Cj,{title:a.recommenderTitle,subtitle:a.recommenderSubtitle,questions:a.recommenderQuestions||[],plans:n,accentColor:r,recommendedPlanId:p,onRecommendation:g}),(0,ea.jsx)("div",{className:"hidden md:block overflow-x-auto rounded-2xl border border-slate-200 bg-white",children:(0,ea.jsxs)("table",{className:"w-full text-left","data-testid":"plan-comparison-".concat(s.id),children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"border-b border-slate-200",children:[(0,ea.jsx)("th",{className:"p-4 align-bottom text-sm font-semibold text-slate-500
2w-1/3",children:"Feature"}),n.map(e=>{const t=e.highlighted||f(e.id);return(0,ea.jsxs)("th",{className:"p-4 align-bottom text-center transition-all",style:d(d({},t?{backgroundColor:"".concat(r,"0F")}:{}),v(e.id)),children:[f(e.id)&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold animate-pulse",style:{backgroundColor:r,color:"#fff"},children:"\u2605 Recommended for You"}),!f(e.id)&&e.badge&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold",style:{backgroundColor:r,color:"#fff"},children:e.badge}),(0,ea.jsx)("div",{className:"font-semibold text-lg",style:{color:"var(--site-heading-color)"},children:e.name}),(e.price||e.period)&&(0,ea.jsxs)("div",{className:"mt-1",children:[(0,ea.jsx)("span",{className:"text-2xl font-bold",style:{color:"var(--site-heading-color)"},children:e.price}),e.period&&(0,ea.jsx)("span",{className:"text-sm opacity-60 ml-1",children:e.period})]}),j(e,t)]},e.id)})]})}),(0,ea.jsx)("tbody",{children:l.map((e,t)=>(0,ea.jsxs)("tr",{className:t%2===0?"bg-white":"bg-slate-50/50",children:[(0,ea.jsx)("td",{className:"p-4 text-sm font-medium",style:{color:"var(--site-heading-color)"},children:e.label}),n.map(t=>{const s=t.highlighted||f(t.id);return(0,ea.jsx)("td",{className:"p-4 text-center",style:s?{backgroundColor:"".concat(r,"0A")}:{},children:b((e.values||{})[t.id])},t.id)})]},e.id||"".concat(e.label,"-").concat(t)))})]})}),(0,ea.jsx)("div",{className:"md:hidden space-y-6",children:n.map(e=>{const t=e.highlighted||f(e.id);return(0,ea.jsxs)("div",{className:"rounded-xl border bg-white overflow-hidden",style:t?d({borderColor:r,borderWidth:2},v(e.id)):{borderColor:"#e2e8f0"},children:[(0,ea.jsxs)("div",{className:"p-5 text-center border-b border-slate-100",style:t?{backgroundColor:"".concat(r,"0F")}:{},children:[f(e.id)&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold animate-pulse",style:{backgroundColor:r,color:"#fff"},children:"\u2605 Recommended for You"}),!f(e.id)&&e.badge&&(0,ea.jsx)("span",{className:"inline-block mb-2 px-2 py-0.5 rounded-full text-[11px] font-semibold",style:{backgroundColor:r,color:"#fff"},children:e.badge}),(0,ea.jsx)("div",{className:"font-semibold text-lg",style:{color:"var(--site-heading-color)"},children:e.name}),(e.price||e.period)&&(0,ea.jsxs)("div",{className:"mt-1",children:[(0,ea.jsx)("span",{className:"text-2xl font-bold",style:{color:"var(--site-heading-color)"},children:e.price}),e.period&&(0,ea.jsx)("span",{className:"text-sm opacity-60 ml-1",children:e.period})]}),j(e,t)]}),(0,ea.jsx)("ul",{className:"p-4 space-y-2",children:l.map(t=>(0,ea.jsxs)("li",{className:"flex items-center justify-between gap-3",children:[(0,ea.jsx)("span",{className:"text-sm",style:{color:"var(--site-body-color)"},children:t.label}),(0,ea.jsx)("span",{children:b((t.values||{})[e.id])})]},t.id||t.label))})]},e.id)})})]})]},"block-".concat(m)):(0,ea.jsx)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(c," ").concat(u),style:o,children:(0,ea.jsx)("div",{className:"max-w-3xl mx-auto p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"Add a Pricing block to this page (Auto mode), or switch this block to Custom mode to add plans."})})},"block-".concat(m))},uy="",my=e=>{let{items:s=[],theme:a,accentColor:n,cardBg:l,bodyColor:r}=e;const[i,o]=(0,t.useState)(null);return 0===s.length?(0,ea.jsx)("div",{className:"p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"No questions yet"})}):(0,ea.jsx)("div",{className:"space-y-4",children:s.map(e=>{const t=i===e.id;return(0,ea.jsxs)("div",{className:"border rounded-lg overflow-hidden transition-colors",style:{backgroundColor:l,borderColor:t?n:"#e2e8f0"},children:[(0,ea.jsxs)("button",{type:"button",className:"w-full px-6 py-4 flex items-center justify-between text-left font-medium",style:{color:r},onClick:()=>o(t?null:e.id),children:[(0,ea.jsx)("span",{children:e.question}),t?(0,ea.jsx)(er,{size:20,style:{color:n}}):(0,ea.jsx)(tr,{size:20,style:{color:n}})]}),t&&e.answer&&(0,ea.jsx)("div",{className:"px-6 pb-4 opacity-80",style:{color:r},children:e.answer})]},e.id)})})},hy=e=>{let{content:s,siteTheme:a,subdomain:n,wrapperClass:l,animationClass:r,blockStyle:i}=e;const[o,c]=(0,t.useState)(""),[d,u]=(0,t.useState)([]),[m,h]=(0,t.useState)(!1),[x,p]=(0,t.useState)(!1),g=(null===s||void 0===s?void 0:s.placeholder)||"Search pages and articles...",f=(null===s||void 0===s?void 0:s.buttonText)||"Search",v=!1!==(null===s||void 0===s?void 0:s.searchPages),b=!1!==(null===s||void 0===s?void 0:s.searchArticles),j=async()=>
2{if(!o.trim()||!n)return;h(!0),p(!0);const e=[];v&&e.push("pages"),b&&e.push("articles");try{const t=await fetch("/api/public/tenant/".concat(n,"/search?q=").concat(encodeURIComponent(o),"&types=").concat(e.join(",")));if(t.ok){const e=await t.json();u(e.results||[])}}catch(t){console.error("Search error:",t)}finally{h(!1)}},y=(null===a||void 0===a?void 0:a.primary_color)||"#4f46e5";return(0,ea.jsx)("div",{className:"".concat(l," ").concat(r),style:i,children:(0,ea.jsx)("div",{className:"py-8",children:(0,ea.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)("div",{className:"flex-1 relative",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)("input",{type:"text",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j()},placeholder:g,className:"w-full pl-12 pr-4 py-3 border border-slate-300 rounded-lg text-base focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent"})]}),(0,ea.jsx)("button",{onClick:j,disabled:m,style:{backgroundColor:y},className:"px-6 py-3 text-white rounded-lg font-medium hover:opacity-90 transition-opacity disabled:opacity-50",children:m?"Searching...":f})]}),x&&(0,ea.jsx)("div",{className:"mt-6",children:0===d.length?(0,ea.jsxs)("p",{className:"text-center text-slate-500 py-8",children:['No results found for "',o,'"']}):(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[d.length," result",1!==d.length?"s":""," found"]}),d.map((e,t)=>(0,ea.jsxs)("a",{href:e.url,className:"block p-4 bg-white border border-slate-200 rounded-lg hover:border-indigo-300 hover:shadow-md transition-all",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,ea.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:"page"===e.type?"#eff6ff":"#fef3c7",color:"page"===e.type?"#3b82f6":"#d97706"},children:"page"===e.type?"Page":"Article"})}),(0,ea.jsx)("h3",{className:"font-semibold text-slate-800",children:e.title}),e.snippet&&(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1 line-clamp-2",children:e.snippet})]},t))]})})]})})})},xy=e=>{let{platform:t,size:s=20,color:a="currentColor"}=e;const n={facebook:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})}),twitter:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),instagram:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"})}),linkedin:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})}),youtube:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})}),bluesky:(0,ea.jsx)("svg",{viewBox:"0 0 600 530",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M135.72 44.03C202.216 93.951 273.74 195.17 300 249.49c26.262-54.316 97.782-155.54 164.28-205.46C512.26 8.009 590-19.862 590 68.825c0 17.712-10.155 148.79-16.111 170.07-20.703 73.984-96.144 92.854-163.25 81.433 117.3 19.964 147.14 86.092 82.697 152.22-122.39 125.59-175.91-31.511-189.63-71.766-2.514-7.38-3.69-10.832-3.708-7.896-.017-2.936-1.193.516-3.707 7.896-13.714 40.255-67.233 197.36-189.63 71.766-64.444-66.128-34.605-132.26 82.697-152.22-67.108 11.421-142.55-7.449-163.25-81.433C20.15 217.613 10 86.536 10 68.824c0-88.687 77.742-60.816 125.72-24.795z"})}),tiktok:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08
2-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"})}),pinterest:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z"})}),github:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})}),email:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"})}),website:(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"})})};return n[t]||n.website},py=e=>e&&e.startsWith("download:"),gy=e=>{try{const t=(e=>e?e.replace(/^download:/,""):"")(e);return new URL(t).pathname.split("/").pop()||"download"}catch(t){return"download"}},fy=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!t||!t.includes("#"))return!1;const a=t.indexOf("#"),n=t.substring(0,a),l=t.substring(a+1);if(!l)return!1;const r=s||window.location.pathname,i="/"===r?"/home":r;if(i===("/"===n?"/home":n||"/home")||""===n&&r.endsWith(i.split("/").pop())||"/home"===n&&("/"===r||"/home"===r)||""===n||t.startsWith("#")){e.preventDefault();const t=document.getElementById(l);if(t)return t.scrollIntoView({behavior:"smooth",block:"start"}),window.history.pushState(null,"","#".concat(l)),!0}return!1},vy=e=>{if(!e)return"";if(e.includes("youtube-nocookie.com")){const t=e.match(/embed\/([^?&#]+)/);return t?t[1]:""}const t=e.match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/);return t&&11===t[7].length?t[7]:""},by=e=>{if(!e)return"";const t=e.match(/vimeo.*\/(\d+)/i);return t?t[1]:""},jy=e=>{const t=parseFloat(e);if(!Number.isFinite(t)||t<=0)return;if(t<=20)return"".concat(t,"px");const s=Math.max(14,Math.round(.45*t)),a=(t/12.8).toFixed(2);return"clamp(".concat(s,"px, ").concat(a,"vw, ").concat(t,"px)")},yy=function(e){if(!e||"string"!==typeof e)return e;const t=Boolean((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).tighter);return e.replace(/font-size\s*:\s*(\d+(?:\.\d+)?)\s*px/gi,(e,s)=>{const a=parseFloat(s);if(!Number.isFinite(a)||a<=16)return e;const n=t?.34:.45,l=Math.max(14,Math.round(a*n)),r=(a/(t?9.6:12.8)).toFixed(2);return"font-size: clamp(".concat(l,"px, ").concat(r,"vw, ").concat(a,"px)")})},Ny=function(e,s){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50;const n=t.useRef({x:0,y:0,t:0});return{onTouchStart:e=>{const t=e.touches[0];n.current={x:t.clientX,y:t.clientY,t:Date.now()}},onTouchEnd:t=>{const l=t.changedTouches[0],r=l.clientX-n.current.x,i=l.clientY-n.current.y;Date.now()-n.current.t>600||Math.abs(r)<a||Math.abs(i)>Math.abs(r)||(r<0&&e?e():r>0&&s&&s())}}},wy=e=>{let{slides:s,overlay:a,overlayStyle:n,textColorClass:l,defaultTextColor:r,textPositionH:i,textPositionV:o,height:c,widthStyle:u,isFullWidth:m,autoPlay:h,autoPlaySpeed:x,transitionEffect:p,wrapperClass:g,blockStyle:f,pages:v=[]}=e;const[b,j]=(0,t.useState)(0),[y,N]=(0,t.useState)(!1);t.useEffect(()=>{if(!h||s.length<=1)return;const e=setInterval(()=>{N(!0),setTimeout(()=>{j(e=>(e+1)%s.length),N(!1)},300)},x);return()=>clearInterval(e)},[h,x,s.length]);const w=e=>{e!==b&&(N(!0),setTimeout(()=>{j(e),N(!1)},300))},C=()=>w(b>0?b-1:s.length-1),k=()=>w((b+1)%s.length),D=Ny(k,C),_=s[b],S=e=>"string"===typeof e&&/^#[0-9a-fA-F]{3,8}$/.test(e.trim()),E=_&&S(_.textColor)?_.textColor:S(r)?r:null,A=E?"":l,F=E?{color:E}:{},T=e=>e&&"none"!==e.entrance?"animate animate-".concat(e.entrance," animate-").concat(e.speed||"normal"," ").concat("0"!==e.delay?"animate-delay-".concat(e.delay):""):"";return(0,ea.jsxs)("div",d(d({className:"relative overflow-hidden ".concat(m?"":"mb-8"," ").concat(g," hero-responsive"),style:d(d(d({},f),{},{borderRadius:(null===f||void 0===f?void 0:f.borderRadius)||(m?void 0:"12px"),overflow:"hidden",minHeight:"".concat(c,"px")}
2,u),{},{touchAction:"pan-y"})},D),{},{children:[(0,ea.jsx)("div",{className:"absolute inset-0 transition-all duration-500 ".concat((()=>{if(!y)return"opacity-100";switch(p){case"fade":default:return"opacity-0";case"slide":return"opacity-0 -translate-x-full";case"zoom":return"opacity-0 scale-95"}})()," overflow-hidden"),children:"video"===(null===_||void 0===_?void 0:_.backgroundType)&&null!==_&&void 0!==_&&_.videoUrl?(0,ea.jsx)(ea.Fragment,{children:_.videoUrl.includes("youtube.com")||_.videoUrl.includes("youtu.be")||_.videoUrl.includes("youtube-nocookie.com")?(0,ea.jsx)("div",{className:"absolute inset-0 overflow-hidden",children:(0,ea.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(vy(_.videoUrl),"?autoplay=1&mute=").concat(!1!==_.videoMuted?1:0,"&loop=1&playlist=").concat(vy(_.videoUrl),"&controls=1&showinfo=0&modestbranding=1&rel=0"),className:"absolute inset-0 w-full h-full",allow:"autoplay; encrypted-media; fullscreen",allowFullScreen:!0,title:"Video"})}):_.videoUrl.includes("vimeo.com")?(0,ea.jsx)("div",{className:"absolute inset-0 overflow-hidden",children:(0,ea.jsx)("iframe",{src:"https://player.vimeo.com/video/".concat(by(_.videoUrl),"?autoplay=1&muted=").concat(!1!==_.videoMuted?1:0,"&loop=1"),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0,title:"Video"})}):(0,ea.jsx)("video",{src:_.videoUrl,autoPlay:!0,muted:!1!==_.videoMuted,loop:!1!==_.videoLoop,playsInline:!0,className:"absolute inset-0 w-full h-full object-cover"})}):null!==_&&void 0!==_&&_.useBackgroundColor?(0,ea.jsx)("div",{className:"absolute inset-0",style:{backgroundColor:_.backgroundColor||"#6366f1"}}):null!==_&&void 0!==_&&_.imageUrl?(0,ea.jsx)("img",{src:_.imageUrl,alt:"Hero background",className:"absolute inset-0 w-full h-full object-cover"}):(0,ea.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-600 to-purple-700"})}),"none"!==a&&(0,ea.jsx)("div",{className:"absolute inset-0",style:n}),(0,ea.jsxs)("div",{className:"\n absolute inset-0 px-6 pt-8 pb-20 md:p-12 flex flex-col transition-opacity duration-300\n ".concat("left"===i?"items-start text-left":"","\n ").concat("center"===i?"items-center text-center":"","\n ").concat("right"===i?"items-end text-right":"","\n ").concat("top"===o?"justify-start":"","\n ").concat("middle"===o?"justify-center":"","\n ").concat("bottom"===o?"justify-end":"","\n ").concat(A,"\n ").concat(y?"opacity-0":"opacity-100","\n "),style:F,children:[(null===_||void 0===_?void 0:_.headline)&&(0,ea.jsx)("h2",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-4 w-full max-w-3xl ".concat(T(_.headlineAnimation)),style:d({textShadow:"2px 2px 4px rgba(0,0,0,0.3)"},_.headlineStyle||{}),children:_.headline}),(null===_||void 0===_?void 0:_.subheadline)&&(0,ea.jsx)("p",{className:"text-xl md:text-2xl mb-8 w-full max-w-2xl opacity-90 ".concat(T(_.subheadlineAnimation)),style:d({textShadow:"1px 1px 2px rgba(0,0,0,0.3)"},_.subheadlineStyle||{}),children:_.subheadline}),(null===_||void 0===_?void 0:_.buttonText)&&(0,ea.jsxs)("a",{href:(e=>{if(!e||"#"===e)return"#";if(e.startsWith("download:"))return e.substring(9);if(e.startsWith("mailto:")||e.startsWith("tel:"))return e;if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("#"))return e;if(e.includes("#")){const[t,s]=e.split("#"),a=t.startsWith("/")?t.substring(1):t;if(a&&v&&v.length>0){const e=v.find(e=>e.slug===a);if(e&&e.preview_token&&oy())return"/preview/".concat(e.preview_token,"#").concat(s)}return t.startsWith("/")?e:"/".concat(e)}const t=e.startsWith("/")?e.substring(1):e;if(v&&v.length>0){const e=v.find(e=>e.slug===t);if(e&&e.preview_token&&oy())return"/preview/".concat(e.preview_token)}return e.startsWith("/")?e:"/".concat(e)})(_.buttonUrl)||"#",download:py(_.buttonUrl)?gy(_.buttonUrl):void 0,target:_.buttonOpenInNewTab?"_blank":void 0,rel:_.buttonOpenInNewTab?"noopener noreferrer":void 0,className:"inline-flex items-center justify-center gap-2 px-8 py-4 bg-white text-slate-900 rounded-lg font-semibold text-lg hover:bg-slate-100 transition-all transform hover:scale-105 shadow-lg ".concat(T(_.buttonAnimation)),style:ey(_),children:[sy(_)&&"left"===ay(_)&&ny(_,20),_.buttonText,sy(_)&&"right"===ay(_)&&ny(_,20)]})]},b),(0,ea.jsx)("button",{onClick:C,className:"hidden md:flex absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 bg-black/30 hover:bg-black/50 rounded-full items-center justify-center text-white transition-all z-20","aria-label":"Previous slide",children:(0,ea.jsx)(vj,{size:24})}),(0,ea.jsx)("button",{onClick:k,className:"hidden md:flex absolute right-4 top-1/2 -translate-y-1/2 w-10 h-10 bg-black/30 hover:bg-black/50 rounded-full items-center justify-center text-white transition-all z-20","aria-label":"Next slide",children:(0,ea.jsx)(ax,{size:24})}),(0,ea.jsx)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-1.5 md:gap-2 z-30",children:s.map((e,t)=>(0,ea.jsx)("button",{onClick:()=>w(t),"aria-label":"Go to slide ".concat(t+1),className:"h-1.5 md:h-2 rounded-full transition-all ".concat(t===b?"w-6 md:w-8 bg-white":"w-1.5 md:w-2 bg-white/50 hover:bg-white/70")},t))})]}))},Cy=e=>{let{slides:s,autoPlay:a,autoPlaySpeed:n,showDots:l,showArrows:r,wrapperClass:i,animationClass:o,blockStyle:c,processHtml:u,blockWidth:m,pages:h=[],isQuickPreview:x=!1}=e;const[p,g]=(0,t.useState)(0),[f,v]=(0,t.useState)(!1),b=(()=>{switch(m){case"full":return x?{width:"100%",maxWidth:"none"}:{width:"100vw",maxWidth:"none",marginLeft:"calc(-50vw + 50%)",marginRight:"calc(-50vw + 50%)",paddingLeft:"1rem",paddingRight:"1rem"};case"large":return{width:"100%",maxWidth:"1200px",margin:"0 auto"};case"medium":return{width:"100%",maxWidth:"900px",margin:"0 auto"};case"small":return{width:"100%",maxWidth:"600px",margin:"0 auto"};default:return{width:"100%",maxWidth:"none"}}})();t.useEffect(()=>{if(!a||s.length<=1)return;const e=setInterval(()=>{v(!0),setTimeout(()=>{g(e=>(e+1)%s.length),v(!1)},300)},n);return()=>clearInterval(e)},[a,n,s.length]);const j=e=>{e!==p&&(v(!0),setTimeout(()=>{g(e),v(!1)},300))},y=()=>j(p>0?p-1:s.length-1),N=()=>j((p+1)%s.length),w=Ny(N,y),C=s[p],k="left"===C.imagePosition,D=e=>{const t=(e=>{const t=e.shapeMask||"none",s=e.shapeSize||250,a=e.imageCorners||"rounded";return d({width:"none"!==t?"".concat(s,"px"):"custom"===e.imageSizeMode?"".concat(e.imageWidth||300,"px"):"height"===e.imageSizeMode?"auto":"".concat(e.imageWidth||300,"px"),height:"none"!==t?"".concat("ellipse"===t?1.25*s:s,"px"):"custom"===e.imageSizeMode||"height"===e.imageSizeMode?"".concat(e.imageHeight||200,"px"):"auto",maxWidth:"100%",borderRadius:(()=>
2{if("circle"===t||"ellipse"===t)return"50%";if("rounded"===t)return"20px";if("none"!==t)return"0";switch(a){case"square":return"0";case"pill":return"9999px";default:return"8px"}})(),clipPath:"diamond"===t?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===t?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===t?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===t?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===t?"ellipse(50% 100% at 50% 100%)":"none",border:e.shapeBorderWidth&&"none"!==t?"".concat(e.shapeBorderWidth,"px solid ").concat(e.shapeBorderColor||"#ffffff"):"none",overflow:"hidden"},e.paddingSize?{paddingTop:"all"!==e.paddingSide&&"top"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingRight:"all"!==e.paddingSide&&"right"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingBottom:"all"!==e.paddingSide&&"bottom"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingLeft:"all"!==e.paddingSide&&"left"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px")}:{})})(e);return(0,ea.jsx)("div",{style:{textAlign:e.imageAlign||"center",minWidth:0,maxWidth:"100%"},children:(0,ea.jsx)("div",{className:"inline-block",style:d(d({},t),{},{maxWidth:"100%"}),children:(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",className:"w-full h-full object-cover",style:{borderRadius:t.borderRadius||"8px",maxWidth:"100%"}})})})};return(0,ea.jsxs)("div",d(d({className:"relative mb-8 ".concat(i," ").concat(o," overflow-hidden"),style:d(d(d({},c),b),{},{touchAction:"pan-y"})},w),{},{children:[(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-center transition-opacity duration-300 ".concat(f?"opacity-0":"opacity-100"),children:[k&&C.imageUrl&&D(C),(0,ea.jsxs)("div",{className:"space-y-4 min-w-0",children:[(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(u(C.textHtml||"<p>Text content</p>"),{tighter:!0})},className:"leading-relaxed image-text-slide-content",style:{textAlign:C.textAlign||"left",color:C.textColor||"#475569",fontSize:jy(C.textSize||18),fontFamily:C.fontFamily||"inherit",overflowWrap:"anywhere",wordBreak:"break-word",minWidth:0}}),(0,ea.jsx)("style",{children:iy()}),C.hasButton&&(0,ea.jsx)("div",{style:{textAlign:C.buttonAlign||"left",marginTop:"1rem"},children:(0,ea.jsxs)("a",{href:(e=>{if(!e||"#"===e)return"#";if(e.startsWith("download:"))return e.substring(9);if(e.startsWith("mailto:")||e.startsWith("tel:"))return e;if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("#"))return e;if(e.includes("#")){const[t,s]=e.split("#"),a=t.startsWith("/")?t.substring(1):t;if(a&&h&&h.length>0){const e=h.find(e=>e.slug===a);if(e&&e.preview_token&&oy())return"/preview/".concat(e.preview_token,"#").concat(s)}return t.startsWith("/")?e:"/".concat(e)}const t=e.startsWith("/")?e.substring(1):e;if(h&&h.length>0){const e=h.find(e=>e.slug===t);if(e&&e.preview_token&&oy())return"/preview/".concat(e.preview_token)}return e.startsWith("/")?e:"/".concat(e)})(C.buttonUrl)||"#",download:py(C.buttonUrl)?gy(C.buttonUrl):void 0,target:C.buttonOpenInNewTab?"_blank":void 0,rel:C.buttonOpenInNewTab?"noopener noreferrer":void 0,className:"inline-flex items-center justify-center gap-2 ".concat("sm"===C.buttonSize?"px-3 py-1 text-sm":"lg"===C.buttonSize?"px-6 py-3 text-lg":"px-4 py-2"," ").concat(C.buttonFullWidth?"w-full":""," font-medium transition-all ").concat(Jj(C.buttonHover||"fade")),style:Zj(C),children:[sy(C)&&"left"===ay(C)&&ny(C,"lg"===C.buttonSize?20:16),C.buttonText||"Learn More",sy(C)&&"right"===ay(C)&&ny(C,"lg"===C.buttonSize?20:16)]})})]}),!k&&C.imageUrl&&D(C)]}),r&&s.length>1&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("button",{onClick:y,className:"hidden md:flex absolute left-2 top-1/2 -translate-y-1/2 w-10 h-10 bg-slate-100 hover:bg-slate-200 rounded-full items-center justify-center text-slate-600 transition-all z-20 shadow-md","aria-label":"Previous slide",children:(0,ea.jsx)(vj,{size:20})}),(0,ea.jsx)("button",{onClick:N,className:"hidden md:flex absolute right-2 top-1/2 -translate-y-1/2 w-10 h-10 bg-slate-100 hover:bg-slate-200 rounded-full items-center justify-center text-slate-600 transition-all z-20 shadow-md","aria-label":"Next slide",children:(0,ea.jsx)(ax,{size:20})})]}),l&&s.length>1&&(0,ea.jsx)("div",{className:"flex items-center justify-center gap-2 mt-4",children:s.map((e,t)=>(0,ea.jsx)("button",{onClick:()=>j(t),className:"h-2 rounded-full transition-all ".concat(t===p?"w-8 bg-indigo-600":"w-2 bg-slate-300 hover:bg-slate-400")},t))})]}))},ky=e=>{var s,a,n;let{images:l,enableLightbox:r,blockStyle:i,wrapperClass:o,renderGallery:c}=e;const[d,u]=(0,t.useState)(!1),[m,h]=(0,t.useState)(0),x=()=>u(!1),p=t.useCallback(()=>h(e=>e>0?e-1:l.length-1),[l.length]),g=t.useCallback(()=>h(e=>e<l.length-1?e+1:0),[l.length]);return t.useEffect(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&x(),"ArrowLeft"===e.key&&p(),"ArrowRight"===e.key&&g()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,p,g]),(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"mb-8 ".concat(o),style:i,children:c(e=>{r&&(h(e),u(!0))})}),d&&(0,ea.jsxs)("div",{className:"fixed inset-0 z-[70] bg-black/90 flex items-center justify-center",onClick:x,children:[(0,ea.jsx)("button",{className:"absolute top-4 right-4 text-white hover:text-gray-300 z-[70]",onClick:x,children:(0,ea.jsx)(sr,{size:32})}),l.length>1&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("button",{className:"absolute left-4 top-1/2 -translate-y-1/2 w-12 h-12 bg-white/20 hover:bg-white/40 rounded-full flex items-center justify-center text-white transition-all",onClick:e=>{e.stopPropagation(),p()},children:(0,ea.jsx)(vj,{size:28})}),(0,ea.jsx)("button",{className:"absolute right-4 top-1/2 -translate-y-1/2 w-12 h-12 bg-white/20 hover:bg-white/40 rounded-full flex items-center justify-center text-white transition-all",onClick:e=>{e.stopPropagation(),g()},children:(0,ea.jsx)(ax,{size:28})})]}),(0,ea.jsx)("div",{className:"max-w-[90vw] max-h-[85vh] flex items-center justify-center",onClick:e=>e.stopPropagation(),children:(0,ea.jsx)("img",{src:null===(s=l[m])||void 0===s?void 0:s.url,alt:(null===(a=l[m])||void 0===a?void 0:a.alt)||"",className:"max-w-full max-h-[85vh] object-contain rounded-lg shadow-2xl"})}),(0,ea.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white text-sm bg-black/50 px-4 py-2 rounded-full",children:[m+1," / ",l.length]}),(null===(n=l[m])||void 0===n?void 0:n.caption)&&(0,ea.jsx)("div",{className:"absolute bottom-16 left-1/2 -translate-x-1/2 text-white text-center max-w-2xl px-4",children:l[m].caption})]})]})},Dy=e=>{let{images:s,gap:a,radius:n,thumbnailPosition:l,blockStyle:r,wrapperClass:i,animationClass:o,enableLightbox:c=!0}=e;const[d,u]=(0,t.useState)(0),[m,h]=(0,t.useState)(0),[x,p]=(0,t.useState)(!1),g="bottom"===l,f=g?6:4,v=Math.max(0,s.length-f),b=s[d]||s[0],j=()=>{c&&p(!0)},y=()=>p(!1),N=t.useCallback(()=>u(e=>e>0?e-1:s.length-1),[s.length]),w=t.useCallback(()=>u(e=>e<s.length-1?e+1:0),[s.length]);t.useEffect(()=>{if(!x)return;const e=e=>{"Escape"===e.key&&y(),"ArrowLeft"===e.key&&N(),"ArrowRight"===e.key&&w()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,N,w]);const C=()=>{h(e=>Math.max(0,e-1))},k=()=>{h(e=>Math.min(v,e+1))},D=s.slice(m,m+f),_=m>0,S=m<v,E=()=>x&&(0,ea.jsxs)("div",{className:"fixed inset-0 z-[70] bg-black/90 flex items-center justify-center",onClick:y,children:[(0,ea.jsx)("button",{className:"absolute top-4 right-4 text-white hover:text-gray-300 z-[70]",onClick:y,children:(0,ea.jsx)(sr,{size:32})}),s.length>1&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("button",{className:"absolute left-4 top-1/2 -translate-y-1/2 w-12 h-12 bg-white/20 hover:bg-white/40 rounded-full flex items-center justify-center text-white",onClick:e=>{e.stopPropagation(),N()},children:(0,ea.jsx)(vj,{size:28})}),(0,ea.jsx)("button",{className:"absolute right-4 top-1/2 -translate-y-1/2 w-12 h-12 bg-white/20 hover:bg-white/40 rounded-full flex items-center justify-center text-white",onClick:e=>{e.stopPropagation(),w()},children:(0,ea.jsx)(ax,{size:28})})]}),(0,ea.jsx)("img",{src:null===b||void 0===b?void 0:b.url,alt:(null===b||void 0===b?void 0:b.alt)||"",className:"max-w-[90vw] max-h-[85vh] object-contain rounded-lg",onClick:e=>e.stopPropagation()}),(0,ea.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white text-sm bg-black/50 px-4 py-2 rounded-full",children:[d+1," / ",s.length]})]});return g?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"mb-8 ".concat(i," ").concat(o),style:r,children:[(0,ea.jsx)("div",{style:{borderRadius:"".concat(n,"px"),overflow:"hidden"},className:"mb-3 cursor-pointer hover:opacity-95 transition-opacity",onClick:j,children:(0,ea.jsx)("img",{src:null===b||void 0===b?void 0:b.url,alt:(null===b||void 0===b?void 0:b.alt)||"",className:"w-full h-96 object-cover transition-all duration-300"})}),(0,ea.jsxs)("div",{className:"relative",children:[_&&(0,ea.jsx)("button",{onClick:C,className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 w-8 h-8 bg-white/90 hover:bg-white shadow-md rounded-full flex items-center justify-center transition-all",children:(0,ea.jsx)(vj,{size:18,className:"text-slate-700"})}),(0,ea.jsx)("div",{className:"flex gap-2 justify-center px-10",style:{gap:"".concat(a,"px")},children:D.map((e,t)=>{const s=m+t;return(0,ea.jsx)("button",{onClick:()=>u(s),className:"flex-shrink-0 transition-all duration-200 ".concat(d===s?"ring-2 ring-indigo-500 ring-offset-2 scale-105":"opacity-70 hover:opacity-100"),style:{borderRadius:"".concat(n,"px"),overflow:"hidden"},children:(0,ea.jsx)("img",{src:e.url,alt:e.alt||"",className:"w-20 h-16 object-cover"})},e.id||t)})}),S&&(0,ea.jsx)("button",{onClick:k,className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 w-8 h-8 bg-white/90 hover:bg-white shadow-md rounded-full flex items-center justify-center transition-all",children:(0,ea.jsx)(ax,{size:18,className:"text-slate-700"})})]}),(0,ea.jsxs)("div",{className:"text-center mt-2 text-sm text-slate-500",children:[d+1," / ",s.length]})]}),E()]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"mb-8 ".concat(i," ").concat(o),style:r,children:[(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-4",style:{gap:"".concat(a,"px")},children:[(0,ea.jsx)("div",{className:"col-span-3 cursor-pointer hover:opacity-95 transition-opacity",style:{borderRadius:"".concat(n,"px"),overflow:"hidden"},onClick:j,children:(0,ea.jsx)("img",{src:null===b||void 0===b?void 0:b.url,alt:(null===b||void 0===b?void 0:b.alt)||"",className:"w-full h-96 object-cover transition-all duration-300"})}),(0,ea.jsxs)("div",{className:"col-span-1 relative",children:[_&&(0,ea.jsx)("button",{onClick:C,className:"absolute -top-2 left-1/2 -translate-x-1/2 z-10 w-7 h-7 bg-white/90 hover:bg-white shadow-md rounded-full flex items-center justify-center transition-all",children:(0,ea.jsx)(vj,{size:16,className:"text-slate-700 rotate-90"})}),(0,ea.jsx)("div",{className:"flex flex-col gap-2 py-2",style:{gap:"".concat(a,"px")},children:D.map((e,t)=>{const s=m+t;return(0,ea.jsx)("button",{onClick:()=>u(s),className:"transition-all duration-200 ".concat(d===s?"ring-2 ring-indigo-500 ring-offset-2 scale-105":"opacity-70 hover:opacity-100"),style:{borderRadius:"".concat(n,"px"),overflow:"hidden"},children:(0,ea.jsx)("img",{src:e.url,alt:e.alt||"",className:"w-full h-20 object-cover"})},e.id||t)})}),S&&(0,ea.jsx)("button",{onClick:k,className:"absolute -bottom-2 left-1/2 -translate-x-1/2 z-10 w-7 h-7 bg-white/90 hover:bg-white shadow-md rounded-full flex items-center justify-center transition-all",children:(0,ea.jsx)(ax,{size:16,className:"text-slate-700 rotate-90"})})]})]}),(0,ea.jsxs)("div",{className:"text-center mt-2 text-sm text-slate-500",children:[d+1," / ",s.length]})]}),E()]})},_y={none:{},dark:{background:"rgba(0,0,0,0.5)"},darker:{background:"rgba(0,0,0,0.7)"},light:{background:"rgba(255,255,255,0.5)"},"gradient-dark":{background:"linear-gradient(to top, rgba(0,0,0,0.8), transparent)"},"gradient-primary":{background:"linear-gradient(135deg, rgba(99,102,241,0.8), rgba(168,85,247,0.8))"},"gradient-warm":{background:"linear-gradient(135deg, rgba(251,146,60,0.8), rgba(251,113,133,0.8))"},"gradient-cool":{background:"linear-gradient(135deg, rgba(56,189,248,0.8), rgba(99,102,241,0.8))"},custom:{}},Sy=e=>{var s;let{menu:a,location:n,siteTheme:l,previewToken:r,pages:i,onPopupOpen:o,subdomain:c,currentLanguage:u,defaultLanguage:m="en",tenantId:h}=e;const[x,p]=(0,t.useState)({}),[g,f]=(0,t.useState)(!1),v=t.useRef(null),b=t.useRef({}),[j,y]=(0,t.useState)({});t.useEffect(()=>{var e;if(!u||u===m||null===a||void 0===a||null===(e=a.items)||void 0===e||!e.length)return void y({});(async()=>{var e;const t={},s=e=>
2{e.forEach(e=>{var a;e.label&&(t[e.item_id]=e.label),null!==(a=e.children)&&void 0!==a&&a.length&&s(e.children)})};s(a.items),null!==(e=a.footer_settings)&&void 0!==e&&e.sections&&a.footer_settings.sections.forEach((e,s)=>{e.title&&(t["footer_section_".concat(s)]=e.title),e.links&&e.links.forEach(e=>{e.label&&(t[e.link_id]=e.label)})});const n=Object.keys(t),l=Object.values(t);if(0!==l.length)try{const e=await fetch("".concat(uy,"/api/translation/translate-texts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texts:l,target_language:u,tenant_id:h,source_language:m})});if(e.ok){const s=await e.json();if(s.translated_texts){const e={};n.forEach((a,n)=>{e[a]=s.translated_texts[n]||t[a]}),y(e)}}}catch(K2){console.error("[NavigationPreview] Translation error:",K2)}})()},[u,m,a,h]);const N=e=>j[e.item_id]||e.label,w=(e,t)=>j["footer_section_".concat(t)]||e.title,C=e=>j[e.link_id]||e.label,[k,D]=(0,t.useState)(!1),[_,S]=(0,t.useState)(""),[E,A]=(0,t.useState)([]),[F,T]=(0,t.useState)(!1),[z,M]=(0,t.useState)(!1),P=t.useRef(null);t.useEffect(()=>{k&&P.current&&P.current.focus()},[k]),t.useEffect(()=>{const e=e=>{k&&v.current&&!v.current.contains(e.target)&&(D(!1),M(!1),A([]))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[k]);const B=async()=>{if(_.trim()&&c){T(!0),M(!0);try{const e=await fetch("/api/public/tenant/".concat(c,"/search?q=").concat(encodeURIComponent(_),"&types=pages,articles"));if(e.ok){const t=await e.json();A(t.results||[])}}catch(e){console.error("Search error:",e)}finally{T(!1)}}},R=e=>{"Enter"===e.key?B():"Escape"===e.key&&(D(!1),M(!1),A([]),S(""))},L=()=>{k?(D(!1),M(!1),A([]),S("")):D(!0)},I=a.dropdown_trigger||"click",O="hamburger"===a.style,U=O?"hidden":"hidden md:flex",H=O?"":"md:hidden",W=O?"":"md:hidden",V=(null===(s=a.items)||void 0===s?void 0:s.length)>0||c&&a.show_search,q=e=>{if(!e||!i||0===i.length)return null;if("internal"===e.link_type&&e.link_value){const t=i.find(t=>t.page_id===e.link_value);if(t&&t.isPopup)return t}const t=e.url||e.link_value;if(t&&!t.startsWith("http")&&!t.startsWith("#")){const e=t.startsWith("/")?t.substring(1):t,s=i.find(t=>t.slug===e);if(s&&s.isPopup)return s}return null},$=oy(),G=e=>{if(!e)return null;if("external"===e.link_type)return e.link_value||e.url||null;if("anchor"===e.link_type){const t=e.link_value||"";if(!t)return null;if(t.includes("#")){const[e,s]=t.split("#");if($&&i&&i.length>0){const t=i.find(t=>t.slug===e);if(t&&t.preview_token)return"/preview/".concat(t.preview_token,"#").concat(s)}return"/".concat(e,"#").concat(s)}return"#".concat(t)}if("internal"===e.link_type&&e.link_value){if(i&&i.length>0){let t=i.find(t=>t.page_id===e.link_value);if(t||(t=i.find(t=>t.slug===e.link_value)),t){if($&&t.preview_token)return"/preview/".concat(t.preview_token);if(t.full_path)return"/".concat(t.full_path);if(t.slug)return"/".concat(t.slug)}}return e.link_value&&/^[a-z0-9-]+$/i.test(e.link_value)&&!e.link_value.match(/^[0-9a-f]{8}-[0-9a-f]{4}/i)?"/".concat(e.link_value):null}return e.url?e.url.startsWith("http")||e.url.startsWith("/")||e.url.startsWith("#")?e.url:"/".concat(e.url):null};if(t.useEffect(()=>{if("click"!==I)return;const e=e=>{v.current&&!v.current.contains(e.target)&&p({})},t=e=>{"Escape"===e.key&&p({})};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("keydown",t)}},[I]),t.useEffect(()=>()=>{Object.values(b.current).forEach(e=>clearTimeout(e))},[]),!a)return null;const K=!(!a.logo||!a.logo.url);if("header"===n&&(!a.items||0===a.items.length)&&!K)return null;if("footer"===n){const e=a.footer_settings||{},t=a.items&&a.items.length>0,s=e.sections&&e.sections.length>0,n=e.social_links&&e.social_links.length>0,l=!1!==e.show_copyright;if(!t&&!s&&!n&&!l)return null}const Y=a.theme_override&&Object.keys(a.theme_override).length>0,J=Y?a.theme_override.backgroundColor:(null===l||void 0===l?void 0:l.background_color)||(null===l||void 0===l?void 0:l.primary_color)||"#1e293b",Q=Y?a.theme_override.textColor:(null===l||void 0===l?void 0:l.heading_color)||(null===l||void 0===l?void 0:l.primary_color)||"#ffffff",X=Y?a.theme_override.accentColor:(null===l||void 0===l?void 0:l.accent_color)||(null===l||void 0===l?void 0:l.primary_color)||"#6366f1",Z=a.logo||{},ee=Z.url,te=Z.position||"left",se=Z.height||40,ae=Z.maxWidth||Z.width||null,
2ne=Z.link||"/",le=Z.alt||"Logo",re=e=>{"click"===I&&p(t=>{if(t[e])return d(d({},t),{},{[e]:!1});const s={};return Object.keys(t).forEach(e=>{s[e]=!1}),s[e]=!0,s})},ie=e=>{"hover"===I&&(b.current[e]&&(clearTimeout(b.current[e]),delete b.current[e]),p(t=>{const s={};return Object.keys(t).forEach(e=>{s[e]=!1}),s[e]=!0,s}))},oe=e=>{"hover"===I&&(b.current[e]=setTimeout(()=>{p(t=>d(d({},t),{},{[e]:!1})),delete b.current[e]},150))},ce=()=>{if(!ee)return null;const e=(0,ea.jsx)("img",{src:ee,alt:le,style:d(d({height:"".concat(se,"px"),width:"auto"},ae?{maxWidth:"".concat(ae,"px")}:{}),{},{objectFit:"contain"}),className:"flex-shrink-0 max-w-[65vw] md:max-w-none"});return ne?(0,ea.jsx)("a",{href:ne,className:"flex items-center hover:opacity-80 transition-opacity",children:e}):e},de=function(e){var t;const s=(null===(t=e.children)||void 0===t?void 0:t.length)>0,a=x[e.item_id],n=q(e),l="hover"===I&&s?{onMouseEnter:()=>ie(e.item_id),onMouseLeave:()=>oe(e.item_id)}:{},r=n?null:G(e),i=t=>{if(n&&o)t.preventDefault(),o(n.slug,n.preview_token);else{if(r){if(r.includes("#")){if(fy(t,r))return}return}s?(t.preventDefault(),re(e.item_id)):t.preventDefault()}};return(0,ea.jsxs)("div",d(d({className:"relative group"},l),{},{children:[(0,ea.jsxs)("div",{className:"flex items-center",children:[e.is_button?(()=>{const t=e.button_bg_color||X,s=e.button_text_color||"#ffffff",a=e.button_style||"solid",n="pill"===e.button_border_radius?"9999px":"square"===e.button_border_radius?"2px":"6px";let l;return l="outline"===a?{background:"transparent",color:t,border:"1.5px solid ".concat(t),borderRadius:n}:"ghost"===a?{background:"".concat(t,"18"),color:t,borderRadius:n}:{backgroundColor:t,color:s,borderRadius:n},(0,ea.jsx)("a",{href:r||void 0,target:e.target,onClick:i,className:"inline-flex items-center gap-1 px-4 py-1.5 text-sm font-semibold transition-all hover:opacity-80 active:scale-95",style:l,"data-testid":"nav-button-".concat(e.item_id),children:N(e)})})():(0,ea.jsxs)("a",{href:r||void 0,target:e.target,onClick:i,className:"flex items-center gap-1 px-4 py-2 rounded-md transition-colors hover:bg-black/5 text-sm font-medium",style:{color:Q,cursor:r||n||s?"pointer":"default"},children:[(0,ea.jsx)("span",{children:N(e)}),"external"===e.link_type&&(0,ea.jsx)(bj,{size:12,className:"ml-1 opacity-50"})]}),s&&(0,ea.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),re(e.item_id)},className:"p-1 rounded hover:bg-black/5 transition-colors -ml-2",style:{color:Q},children:(0,ea.jsx)(tr,{size:14,className:"transition-transform ".concat(a?"rotate-180":"")})})]}),s&&a&&(0,ea.jsx)("div",{className:"absolute top-full left-0 mt-1 py-2 min-w-[180px] rounded-lg shadow-lg border bg-white z-50",onMouseEnter:()=>"hover"===I&&ie(e.item_id),onMouseLeave:()=>"hover"===I&&oe(e.item_id),children:e.children.map(e=>{const t=q(e),s=t?null:G(e);return(0,ea.jsx)("a",{href:s||void 0,target:e.target,onClick:e=>{if(t&&o)e.preventDefault(),o(t.slug,t.preview_token);else if(s&&s.includes("#")){if(fy(e,s))return}else s||e.preventDefault()},className:"block px-4 py-2 text-sm hover:bg-slate-50 transition-colors",style:{color:"#1e293b",cursor:s||t?"pointer":"default"},children:N(e)},e.item_id)})})]}),e.item_id)};if("header"===n){const e=Math.ceil(a.items.length/2),t=a.items.slice(0,e),s=a.items.slice(e),n=Math.max(8,Math.min(16,20-(se-40)/5)),l=a.content_width||"contained",r="full"===l?"w-full":"wide"===l?"max-w-screen-2xl mx-auto":"max-w-7xl mx-auto",i=void 0!==a.edge_padding&&null!==a.edge_padding?a.edge_padding:16;return(0,ea.jsxs)("header",{ref:v,className:"sticky top-0 z-40 border-b shadow-sm relative",style:{backgroundColor:J},children:[(0,ea.jsxs)("div",{className:"".concat(r," flex items-center justify-between"),style:{paddingTop:"".concat(n,"px"),paddingBottom:"".concat(n,"px"),paddingLeft:"".concat(i,"px"),paddingRight:"".concat(i,"px")},children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:["left"===te&&ce(),"left"===te&&!ee&&(0,ea.jsx)("div",{className:"font-bold text-lg",style:{color:X},children:a.name||"Site Name"}),"center"===te&&(0,ea.jsx)("nav",{className:"".concat(U," items-center gap-1"),children:t.map(e=>de(e))})]}),"center"===te&&(0,ea.jsxs)("div",{className:"flex items-center",children:[ce(),!ee&&(0,ea.jsx)("div",{className:"font-bold text-lg",style:{color:X},children:a.name||"Site Name"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("nav",{className:"".concat(U," items-center gap-1"),children:"center"===te?s.map(e=>de(e)):"right"!==te&&a.items.map(e=>de(e))}),"right"===te&&(0,ea.jsx)("nav",{className:"".concat(U," items-center gap-1"),children:a.items.map(e=>de(e))}),"right"===te&&ce(),"right"===te&&!ee&&(0,ea.jsx)("div",{className:"font-bold text-lg",style:{color:X},children:a.name||"Site Name"}),c&&a.show_search&&(0,ea.jsxs)("div",{className:"relative flex items-center",children:[k?(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)("input",{ref:P,type:"text",value:_,onCh
2ange:e=>S(e.target.value),onKeyDown:R,placeholder:"Search...",className:"w-48 md:w-64 pl-3 pr-10 py-2 text-sm border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 transition-all",style:{backgroundColor:"white",color:"#334155",borderColor:"#e2e8f0"},"data-testid":"nav-search-input"}),(0,ea.jsx)("button",{onClick:B,disabled:F,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-slate-400 hover:text-slate-600","data-testid":"nav-search-submit",children:(0,ea.jsx)(fj,{size:16})})]}),(0,ea.jsx)("button",{onClick:L,className:"p-2 rounded-lg hover:bg-black/5 transition-colors",style:{color:Q},title:"Close search","data-testid":"nav-search-close",children:(0,ea.jsx)(sr,{size:18})})]}):(0,ea.jsx)("button",{onClick:L,className:"p-2 rounded-lg hover:bg-black/5 transition-colors",style:{color:Q},title:"Search","data-testid":"nav-search-toggle",children:(0,ea.jsx)(fj,{size:20})}),k&&z&&(0,ea.jsx)("div",{className:"absolute top-full right-0 mt-2 w-80 max-h-96 overflow-y-auto bg-white rounded-lg shadow-xl border border-slate-200 z-50","data-testid":"nav-search-results",children:F?(0,ea.jsx)("div",{className:"p-4 text-center text-slate-500",children:"Searching..."}):0===E.length?(0,ea.jsxs)("div",{className:"p-4 text-center text-slate-500",children:['No results found for "',_,'"']}):(0,ea.jsxs)("div",{className:"py-2",children:[(0,ea.jsxs)("div",{className:"px-3 py-1 text-xs text-slate-400 uppercase tracking-wide",children:[E.length," result",1!==E.length?"s":""]}),E.map((e,t)=>(0,ea.jsxs)("a",{href:e.url,className:"block px-3 py-2 hover:bg-slate-50 transition-colors",onClick:()=>{D(!1),M(!1),A([])},children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-0.5",children:(0,ea.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:"page"===e.type?"#eff6ff":"#fef3c7",color:"page"===e.type?"#3b82f6":"#d97706"},children:"page"===e.type?"Page":"Article"})}),(0,ea.jsx)("div",{className:"font-medium text-sm text-slate-800",children:e.title}),e.snippet&&(0,ea.jsx)("p",{className:"text-xs text-slate-500 line-clamp-1 mt-0.5",children:e.snippet})]},t))]})})]}),V&&(0,ea.jsx)("button",{className:"".concat(H," p-2 rounded-lg hover:bg-black/5"),onClick:()=>f(!g),style:{color:Q},"aria-label":"Toggle menu",children:g?(0,ea.jsx)(sr,{size:20}):(0,ea.jsx)(ar,{size:20})})]})]}),g&&(()=>{const e=a.hamburger_align||"left",t="right"===e?"justify-end":"center"===e?"justify-center":"justify-start",s="right"===e?"right":"center"===e?"center":"left",n=O?"absolute z-40 mt-2 px-4":"".concat(W," border-t py-2 px-4"),l=O?"right"===e?"right-0":"center"===e?"left-1/2 -translate-x-1/2":"left-0":"",r=O?"rounded-xl shadow-2xl border min-w-[240px] max-w-[320px] p-3":"",i=O?{backgroundColor:J,borderColor:"".concat(Q,"1A")}:{backgroundColor:J},u=O?(0,ea.jsx)("div",{className:"fixed inset-0 z-30 bg-black/10",onClick:()=>f(!1),"aria-hidden":"true"}):null;return(0,ea.jsxs)(ea.Fragment,{children:[u,(0,ea.jsx)("div",{className:"".concat(n," ").concat(l),style:O?{}:i,children:(0,ea.jsxs)("div",{className:r,style:O?i:{},children:[c&&a.show_search&&(0,ea.jsxs)("div",{className:"py-2 mb-2 border-b",style:{borderColor:"".concat(Q,"20")},children:[(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)("input",{type:"text",value:_,onChange:e=>S(e.target.value),onKeyDown:R,placeholder:"Search...",className:"w-full pl-3 pr-10 py-2 text-sm border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500",style:{backgroundColor:"white",color:"#334155",borderColor:"#e2e8f0"},"data-testid":"nav-mobile-search-input"}),(0,ea.jsx)("button",{onClick:B,disabled:F,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-slate-400 hover:text-slate-600","data-testid":"nav-mobile-search-submit",children:(0,ea.jsx)(fj,{size:16})})]}),z&&(0,ea.jsx)("div",{className:"mt-2 max-h-48 overflow-y-auto bg-white rounded-lg border border-slate-200",children:F?(0,ea.jsx)("div",{className:"p-3 text-center text-slate-500 text-sm",children:"Searching..."}):0===E.length?(0,ea.jsx)("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No results found"}):E.map((e,t)=>(0,ea.jsx)("a",{href:e.url,className:"block px-3 py-2 hover:bg-slate-50 border-b border-slate-100 last:border-b-0",onClick:()=>f(!1),children:(0,ea.jsx)("div",{className:"font-medium text-sm text-slate-800",children:e.title})},t))})]}),a.items.map(a=>{var n;const l=(null===(n=a.children)||void 0===n?void 0:n.length)>0,r=G(a),i=q(a),c=e=>{if(l)return e.preventDefault(),void p(e=>d(d({},e),{},{[a.item_id]:!e[a.item_id]}));if(i&&o)e.preventDefault(),o(i.slug,i.preview_token),f(!1);else if(r&&r.includes("#")){fy(e,r)&&f(!1)}};return(0,ea.jsxs)("div",{style:{textAlign:s},children:[a.is_button?(()=>{const e=a.button_bg_color||X,t=a.button_text_color||"#ffffff",s=a.button_style||"solid",n="pill"===a.button_border_radius?"9999px":"square"===a.button_border_radius?"2px":"6px";let l;return l="outline"===s?{background:"transparent",color:e,border:"1.5px solid ".concat(e),borderRadius:n}:"ghost"===s?{background:"".concat(e,"18"),color:e,borderRadius:n}:{backgroundColor:e,color:t,borderRadius:n},(0,ea.jsx)("a",{href:r||"#",onClick:e=>{c(e),f(!1)},className:"inline-flex items-center gap-2 mx-3 my-1 px-4 py-2 text-sm font-semibold transition-all hover:opacity-80",style:l,children:N(a)})})():(0,ea.jsxs)("a",{href:r||"#",onClick:c,className:"flex items-center ".concat(t," gap-2 px-3 py-2 text-sm font-medium rounded-lg hover:bg-black/5 transition-colors"),style:{color:Q},children:[(0,ea.jsx)("span",{children:N(a)}),l&&(0,ea.jsx)(tr,{size:16,className:"transition-transform ".concat(x[a.item_id]?"rotate-180":""),style:{color:Q,opacity:.6}})]}),l&&x[a.item_id]&&(0,ea.jsx)("div",{className:"pb-2 space-y-1 mt-1 ".concat("right"===e?"pr-3 border-r-2 mr-1":"center"===e?"":"pl-3 border-l-2 ml-1"),style:{borderColor:"".concat(Q,"20")},children:a.children.map(e=>{const t=G(e),a=q(e);return(0,ea.jsx)("a",{href:t||"#",onClick:e=>{if(a&&o)e.preventDefault(),o(a.slug,a.preview_token),f(!1);else if(t&&t.includes("#")){fy(e,t)&&f(!1)}else t&&f(!1)},className:"block px-3 py-1.5 text-sm rounded-md hover:bg-black/5 transition-colors",style:{color:Q,opacity:.85,textAlign:s},children:N(e)},e.item_id)})})]},a.item_id)})]})})]})})()]})}if("footer"===n){var ue,me;const e=a.footer_settings||{},t=e.layout||"simple",s=e.sections||[],n=!1!==e.show_copyright,l=e.copyright_text||"\xa9 ".concat((new Date).getFullYear()," All rights reserved"),r=e.padding_top||48,o=e.padding_bottom||32,c=null!==(ue=e.margin_top)&&void 0!==ue?ue:48,d=e.section_title_color||Q,u=e.copyright_color||Q,m=e.link_color||Q,h=e.content_align||("columns"===t?"left":"center"),x="right"===h?"text-right":"left"===h?"text-left":"text-center",p="right"===h?"items-end":"left"
2===h?"items-start":"items-center",g="right"===h?"justify-end":"left"===h?"justify-start":"justify-center",f="center"===h?"mx-auto":"";return(0,ea.jsx)("footer",{className:"border-t",style:{backgroundColor:J,paddingTop:"".concat(r,"px"),paddingBottom:"".concat(o,"px"),marginTop:"".concat(c,"px")},children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto px-4",children:["columns"===t&&s.length>0&&(0,ea.jsxs)("div",{className:"grid gap-8 mb-8 ".concat(1===s.length?"grid-cols-1 md:grid-cols-2":2===s.length?"grid-cols-1 md:grid-cols-3":s.length>=3?"grid-cols-1 md:grid-cols-4":"grid-cols-1"),children:[ee&&(0,ea.jsx)("div",{className:"space-y-4",children:ce()}),s.map((t,s)=>(0,ea.jsxs)("div",{className:"space-y-3 ".concat(x),children:[t.title&&(0,ea.jsx)("h4",{className:"font-semibold text-sm uppercase tracking-wide",style:{color:d},children:w(t,s)}),t.content_html&&(0,ea.jsx)("div",{className:"text-sm space-y-1 prose prose-sm max-w-none",style:{color:Q,opacity:.9},dangerouslySetInnerHTML:{__html:t.content_html}}),t.links&&t.links.length>0&&(0,ea.jsx)("nav",{className:"flex flex-col gap-1.5 mt-2 ".concat(p),children:t.links.map(t=>(0,ea.jsx)("a",{href:"internal"===t.link_type&&t.page_id?(()=>{const e=null===i||void 0===i?void 0:i.find(e=>e.page_id===t.page_id);return e?e.preview_token&&oy()?"/preview/".concat(e.preview_token):e.full_path?"/".concat(e.full_path):e.slug?"/".concat(e.slug):t.url||"#":t.url||"#"})():t.url||"#",target:"external"===t.link_type?"_blank":void 0,rel:"external"===t.link_type?"noopener noreferrer":void 0,className:"text-sm hover:underline transition-opacity hover:opacity-80",style:{color:m,opacity:e.link_color?1:.9},children:C(t)},t.link_id))})]},t.section_id)),a.items.length>0&&(0,ea.jsxs)("div",{className:"space-y-3 ".concat(x),children:[(0,ea.jsx)("h4",{className:"font-semibold text-sm uppercase tracking-wide",style:{color:d},children:"Quick Links"}),(0,ea.jsx)("nav",{className:"flex flex-col gap-2 ".concat(p),children:a.items.map(t=>{const s=G(t)||"#",a="external"===t.link_type;return(0,ea.jsx)("a",{href:s,target:t.target||(a?"_blank":void 0),rel:a?"noopener noreferrer":void 0,className:"text-sm hover:underline",style:{color:m,opacity:e.link_color?1:.9},children:N(t)},t.item_id)})})]})]}),"stacked"===t&&s.length>0&&(0,ea.jsxs)("div",{className:"mb-8 space-y-6",children:[ee&&(0,ea.jsx)("div",{className:"flex justify-center",children:ce()}),(0,ea.jsx)("div",{className:"grid gap-6 ".concat(1===s.length?"grid-cols-1":2===s.length?"grid-cols-1 md:grid-cols-2":"grid-cols-1 md:grid-cols-3"),children:s.map((t,s)=>(0,ea.jsxs)("div",{className:x,children:[t.title&&(0,ea.jsx)("h4",{className:"font-semibold text-sm uppercase tracking-wide mb-2",style:{color:d},children:w(t,s)}),t.content_html&&(0,ea.jsx)("div",{className:"text-sm prose prose-sm max-w-none ".concat(f),style:{color:Q,opacity:.9},dangerouslySetInnerHTML:{__html:t.content_html}}),t.links&&t.links.length>0&&(0,ea.jsx)("nav",{className:"flex flex-col gap-1.5 mt-2 ".concat(p),children:t.links.map(t=>(0,ea.jsx)("a",{href:"internal"===t.link_type&&t.page_id?(()=>{const e=null===i||void 0===i?void 0:i.find(e=>e.page_id===t.page_id);return e?e.preview_token&&oy()?"/preview/".concat(e.preview_token):e.full_path?"/".concat(e.full_path):e.slug?"/".concat(e.slug):t.url||"#":t.url||"#"})():t.url||"#",target:"external"===t.link_type?"_blank":void 0,rel:"external"===t.link_type?"noopener noreferrer":void 0,className:"text-sm hover:underline transition-opacity hover:opacity-80",style:{color:m,opacity:e.link_color?1:.9},children:C(t)},t.link_id))})]},t.section_id))})]}),("simple"===t||0===s.length)&&(0,ea.jsx)(ea.Fragment,{children:ee&&(0,ea.jsx)("div",{className:"flex justify-center mb-6",children:ce()})}),"simple"===t&&s.length>0&&(0,ea.jsx)("div",{className:"grid gap-8 mb-8 ".concat(x," ").concat(1===s.length?"grid-cols-1":2===s.length?"grid-cols-1 md:grid-cols-2":"grid-cols-1 md:grid-cols-3"),children:s.map((t,s)=>(0,ea.jsxs)("div",{className:"space-y-3 ".concat(x),children:[t.title&&(0,ea.jsx)("h4",{className:"font-semibold text-sm uppercase tracking-wide",style:{color:d},children:w(t,s)}),t.content_html&&(0,ea.jsx)("div",{className:"text-sm prose prose-sm max-w-none ".concat(f),style:{color:Q,opacity:.9},dangerouslySetInnerHTML:{__html:t.content_html}}
2),t.links&&t.links.length>0&&(0,ea.jsx)("nav",{className:"flex flex-col gap-1.5 mt-2 ".concat(p),children:t.links.map(t=>(0,ea.jsx)("a",{href:"internal"===t.link_type&&t.page_id?(()=>{const e=null===i||void 0===i?void 0:i.find(e=>e.page_id===t.page_id);return e?e.preview_token&&oy()?"/preview/".concat(e.preview_token):e.full_path?"/".concat(e.full_path):e.slug?"/".concat(e.slug):t.url||"#":t.url||"#"})():t.url||"#",target:"external"===t.link_type?"_blank":void 0,rel:"external"===t.link_type?"noopener noreferrer":void 0,className:"text-sm hover:underline transition-opacity hover:opacity-80",style:{color:m,opacity:e.link_color?1:.9},children:C(t)},t.link_id))})]},t.section_id))}),"columns"!==t&&a.items.length>0&&(0,ea.jsx)("nav",{className:"flex flex-wrap gap-6 mb-4 ".concat(g),children:a.items.map(e=>{const t=G(e)||"#",s="external"===e.link_type;return(0,ea.jsx)("a",{href:t,target:e.target||(s?"_blank":void 0),rel:s?"noopener noreferrer":void 0,className:"text-sm hover:underline",style:{color:m},children:N(e)},e.item_id)})}),(null===(me=e.social_links)||void 0===me?void 0:me.length)>0&&(0,ea.jsx)("div",{className:"flex justify-center gap-4 mb-4",children:e.social_links.map(e=>(0,ea.jsx)("a",{href:e.url||"#",target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-70 transition-opacity p-2 rounded-full hover:bg-black/5",style:{color:Q},title:e.platform.charAt(0).toUpperCase()+e.platform.slice(1),children:(0,ea.jsx)(xy,{platform:e.platform,size:22,color:Q})},e.id))}),n&&(0,ea.jsx)("p",{className:"text-center text-xs mt-6 pt-4 border-t border-current/10",style:{color:u,opacity:e.copyright_color?1:.6},children:l})]})})}return null},Ey=e=>{var s;let{formId:a,formName:n,blockStyle:l,wrapperClass:r,animationClass:i,customStyle:o={},enabledLanguages:c=null,defaultLanguage:u="en"}=e;const[m,h]=(0,t.useState)(null),[x,p]=(0,t.useState)(!0),[g,f]=(0,t.useState)(!1),[v,b]=(0,t.useState)(!1),[j,y]=(0,t.useState)({}),[N,w]=(0,t.useState)({}),[C]=(0,t.useState)(Date.now()),k=(0,t.useCallback)(async()=>{try{var e;const t=await _l.get("/public/forms/".concat(a));h(t.data),null!==(e=t.data)&&void 0!==e&&e.collect_language_preference&&y(e=>d(d({},e),{},{preferred_language:e.preferred_language||u||"en"}))}catch(t){console.error("Failed to fetch form:",t)}finally{p(!1)}},[a,u]);(0,t.useEffect)(()=>{a&&k()},[a,k]);const D=(e,t)=>{y(s=>d(d({},s),{},{[e]:t})),N[e]&&w(t=>d(d({},t),{},{[e]:null}))};if(!a)return(0,ea.jsx)("div",{className:"mb-8 p-6 bg-slate-50 border border-dashed border-slate-300 rounded-lg text-center ".concat(r," ").concat(i),style:l,children:(0,ea.jsx)("p",{className:"text-slate-500",children:"No form selected"})});if(x)return(0,ea.jsx)("div",{className:"mb-8 p-6 bg-white border border-slate-200 rounded-lg ".concat(r," ").concat(i),style:l,children:(0,ea.jsxs)("div",{className:"animate-pulse space-y-4",children:[(0,ea.jsx)("div",{className:"h-4 bg-slate-200 rounded w-1/4"}),(0,ea.jsx)("div",{className:"h-10 bg-slate-200 rounded"}),(0,ea.jsx)("div",{className:"h-10 bg-slate-200 rounded"})]})});if(!m)return(0,ea.jsx)("div",{className:"mb-8 p-6 bg-red-50 border border-red-200 rounded-lg text-center ".concat(r," ").concat(i),style:l,children:(0,ea.jsx)("p",{className:"text-red-600",children:"Form not found or inactive"})});if(v)return(0,ea.jsxs)("div",{className:"mb-8 p-8 bg-green-50 border border-green-200 rounded-lg text-center ".concat(r," ").concat(i),style:l,children:[(0,ea.jsx)("div",{className:"text-4xl mb-4",children:"\u2705"}),(0,ea.jsx)("p",{className:"text-green-800 text-lg font-medium",children:m.success_message})]});const _=!1===(null===m||void 0===m||null===(s=m.styles)||void 0===s?void 0:s.use_site_theme)?m.styles:{},S=o.layout||_.layout||"stacked",E=o.formWidth||_.formWidth||"100",A=o.fieldWidth||_.fieldWidth||"100",F=o.fieldRadius||_.fieldRadius||"rounded",T=o.fieldSize||_.fieldSize||"md",z=o.buttonWidth||_.buttonWidth||"auto",M=o.buttonStyle||_.buttonStyle||"solid",P=o.buttonRadius||_.buttonRadius||"rounded",B=o.buttonColor||_.button_color||"#6366f1",R=o.buttonTextColor||_.button_text_color||"#ffffff",L=o.buttonAlign||_.buttonAlign||"left",I=o.buttonText,O=o.labelColor||_.label_color||"#374151",U=o.labelSize||_.labelSize||"sm",H=o.labelWeight||_.labelWeight||"medium",W=o.fieldGap||_.fieldGap||"16",V=o.formPadding||_.formPadding||"0",q=o.backgroundColor||_.background_color||"#ffffff",$=o.transparentBg||_.transparentBg||!1,G={background_color:q,text_color:_.text_color||"#1e293b",label_color:O,input_background:_.input_background||"#ffffff",input_border_color:_.input_border_color||"#d1d5db",input_text_color:_.input_text_color||"#1e293b",button_color:B,button_text_color:R,border_radius:_.border_radius||"8px",padding:_.padding||"24px"},K=(()=>{switch(F){case"none":return"0";case"pill":return"9999px";default:return"8px"}})(),Y=(()=>{switch(P){case"none":return"0";case"pill":return"9999px";default:return"8px"}})(),J=(()=>{switch(T){case"sm":return"0.375rem 0.75rem";case"lg":return"0.75rem 1rem";default:return"0.5rem 1rem"}})(),Q=(()=>{switch(U){case"xs":return"0.75rem";case"md":return"1rem";case"lg":return"1.125rem";default:return"0.875rem"}})(),X=(()=>{switch(H){case"normal":return"400";
2case"semibold":return"600";case"bold":return"700";default:return"500"}})(),Z=e=>{const t=N[e.field_id],s={backgroundColor:G.input_background,borderColor:t?"#ef4444":G.input_border_color,color:G.input_text_color,borderRadius:K,padding:J,width:"100%"};switch(e.type){case"textarea":return(0,ea.jsx)("textarea",{value:j[e.field_id]||"",onChange:t=>D(e.field_id,t.target.value),placeholder:e.placeholder,className:"border focus:outline-none focus:ring-2 focus:ring-indigo-500 min-h-[100px]",style:s});case"select":return(0,ea.jsxs)("select",{value:j[e.field_id]||"",onChange:t=>D(e.field_id,t.target.value),className:"border focus:outline-none focus:ring-2 focus:ring-indigo-500",style:s,children:[(0,ea.jsx)("option",{value:"",children:e.placeholder||"Select..."}),(e.options||[]).map((e,t)=>(0,ea.jsx)("option",{value:e,children:e},t))]});case"recipient_select":return(0,ea.jsxs)("select",{value:j[e.field_id]||"",onChange:t=>D(e.field_id,t.target.value),className:"border focus:outline-none focus:ring-2 focus:ring-indigo-500",style:s,children:[(0,ea.jsx)("option",{value:"",children:e.placeholder||"Select recipient..."}),((null===m||void 0===m?void 0:m.recipient_names)||[]).map((e,t)=>(0,ea.jsx)("option",{value:e,children:e},t))]});case"radio":return(0,ea.jsx)("div",{className:"space-y-2",children:(e.options||[]).map((t,s)=>(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",style:{color:G.text_color},children:[(0,ea.jsx)("input",{type:"radio",name:e.field_id,value:t,checked:j[e.field_id]===t,onChange:t=>D(e.field_id,t.target.value),className:"w-4 h-4",style:{accentColor:B}}),(0,ea.jsx)("span",{children:t})]},s))});case"checkbox":return(0,ea.jsx)("div",{className:"space-y-2",children:(e.options||[]).map((t,s)=>(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",style:{color:G.text_color},children:[(0,ea.jsx)("input",{type:"checkbox",checked:(j[e.field_id]||[]).includes(t),onChange:s=>{const a=j[e.field_id]||[],n=s.target.checked?[...a,t]:a.filter(e=>e!==t);D(e.field_id,n)},className:"w-4 h-4 rounded",style:{accentColor:B}}),(0,ea.jsx)("span",{children:t})]},s))});default:return(0,ea.jsx)("input",{type:e.type,value:j[e.field_id]||"",onChange:t=>D(e.field_id,t.target.value),placeholder:e.placeholder,className:"border focus:outline-none focus:ring-2 focus:ring-indigo-500",style:s})}},ee={backgroundColor:$?"transparent":q,borderRadius:K,padding:"0"!==V?"".concat(V,"px"):G.padding,width:"".concat(E,"%"),margin:"100"!==E?"0 auto":void 0},te={backgroundColor:"solid"===M?B:"transparent",color:"solid"===M?R:B,borderRadius:Y,border:"outline"===M?"2px solid ".concat(B):"none",width:"auto"===z?"auto":"".concat(z,"%"),padding:"0.75rem 1.5rem",fontFamily:"inherit"},se={textAlign:L,marginTop:"1.5rem"},ae={color:O,fontSize:Q,fontWeight:X,marginBottom:"0.25rem",display:"block"};return(0,ea.jsxs)("div",{className:"mb-8 ".concat(r," ").concat(i),style:l,children:[(0,ea.jsx)("style",{children:"\n @media (max-width: 639px) {\n .form-inline-layout > div {\n width: 100% !important;\n padding-right: 0 !important;\n margin-right: 0 !important;\n }\n }\n "}),(0,ea.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),j._hp_website_url)return void b(!0);if(Date.now()-C<2e3)return void b(!0);const t={};if(((null===m||void 0===m?void 0:m.fields)||[]).forEach(e=>{e.required&&!j[e.field_id]&&(t[e.field_id]="".concat(e.label," is required"))}),Object.keys(t).length>0)w(t);else{f(!0);try{const e=d({},j);delete e._hp_website_url;await _l.post("/public/forms/".concat(a,"/submit"),{form_id:a,data:e,_t:C});b(!0)}catch(l){var s,n;const e=(null===(s=l.response)||void 0===s||null===(n=s.data)||void 0===n?void 0:n.detail)||"Submission failed. Please try again.";w({submit:e})}finally{f(!1)}}},className:$?"":"border border-slate-200 shadow-sm",style:ee,children:[(0,ea.jsxs)("div",{style:{position:"absolute",left:"-9999px",opacity:0,height:0,overflow:"hidden"},"aria-hidden":"true",children:[(0,ea.jsx)("label",{htmlFor:"_hp_website_url",children:"Website URL"}),(0,ea.jsx)("input",{type:"text",id:"_hp_website_url",name:"_hp_website_url",tabIndex:-1,autoComplete:"off",value:j._hp_website_url||"",onChange:e=>y(t=>d(d({},t),{},{_hp_website_url:e.target.value}))})]}),m.name&&(0,ea.jsx)("h3",{className:"text-xl font-semibold mb-2",style:{color:G.text_color},children:m.name}),m.description&&(0,ea.jsx)("p",{className:"mb-6",style:{color:O},children:m.description}),(0,ea.jsxs)("div",{className:(()=>{switch(S){case"inline":return"flex flex-wrap items-end form-inline-layout";case"two-column":return"grid grid-cols-1 md:grid-cols-2";case"three-column":return"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3";default:return"flex flex-col"}})(),style:{gap:"".concat(W,"px")},children:[(m.fields||[]).map(e=>(0,ea.jsxs)("div",{style:"two-column"===S||"three-column"===S?{width:"100%"}:"inline"===S?{width:"".concat(A,"%"),paddingRight:"0.5rem",flexShrink:0}:{width:"".concat(A,"%"),margin:"100"!==A?"0 auto":void 0},children:[(0,ea.jsxs)("label",{style:ae,children:[e.label,e.required&&(0,ea.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),Z(e),N[e.field_id]&&(0,ea.jsx)("p",{className:"text-sm text-red-500 mt-1",children:N[e.field_id]})]},e.field_id)),m.collect_language_preference&&(()=>{const e=Array.isArray(c)&&c.length>0?c.filter(e=>ag[e]):Object.keys(ag);return u&&ag[u]&&!e.includes(u)&&e.unshift(u),(0,ea.jsxs)("div",{style:{width:"100%"},"data-testid":"form-language-field",children:[(0,ea.jsx)("label",{style:ae,children:"Preferred language"}),(0,ea.jsx)("select",{value:j.preferred_language||u||"en",onChange:e=>D("preferred_language",e.target.value),className:"border focus:outline-none focus:ring-2 focus:ring-indigo-500",style:{backgroundColor:G.input_background,borderColor:G.input_border_color,color:G.input_text_color,borderRadius:K,padding:J,width:"100%"},"data-testid":"form-language-select",children:e.map(e=>{var t,s;return(0,ea.jsxs)("option",{value:e,children:[null!==(t=ag[e])&&void 0!==t&&t.flag?"".concat(ag[e].flag," "):"",(null===(s=ag[e])||void 0===s?void 0:s.name)||e]},e)})}),(0,ea.jsx)("p",{className:"text-xs mt-1",style:{color:O,opacity:.7},children:"We'll send you newsletters in this language."})]})})(),"inline"===S&&(0,ea.jsx)("div",{style:{flexShrink:0},children:(0,ea.jsx)("button",{type:"submit",disabled:g,className:"font-medium disabled:opacity-50 disabled:cursor-not-allowed transition-colors hover:opacity-90",style:te,children:g?"Submitting...":I||m.submit_button_text})})]}),N.submit&&(0,ea.jsx)("p",{className:"text-sm text-red-500 mt-4",children:N.submit}),"inline"!==S&&(0,ea.jsx)("div",{style:se,children:(0,ea.jsx)("button",{type:"submit",disabled:g,className:"font-medium disabled:opacity-50 disabled:cursor-not-allowed transition-colors hover:opacity-90",style:te,children:g?"Submitting...":I||m.submit_button_text})})]})]})},Ay=e=>{let{items:s,direction:a,stepDuration:n,pauseOnHover:l,spacing:r,renderItem:i}=e;const[o,c]=(0,t.useState)(0),[d,u]=(0,t.useState)(!1);t.useEffect(()=>{if(d||s.length<=1)return;const e=setInterval(()=>{c(e=>
2"left"===a?(e+1)%s.length:0===e?s.length-1:e-1)},n);return()=>clearInterval(e)},[a,n,s.length,d]);return(0,ea.jsx)("div",{className:"relative overflow-hidden",onMouseEnter:()=>l&&u(!0),onMouseLeave:()=>l&&u(!1),children:(0,ea.jsx)("div",{className:"flex items-center transition-transform duration-500 ease-in-out",style:{gap:"".concat(r,"px"),transform:"translateX(-".concat(o*(150+r),"px)")},children:s.map((e,t)=>i(e,t))})})},Fy=e=>d({fontFamily:e.fontFamily&&"inherit"!==e.fontFamily?e.fontFamily:"var(--site-heading-font)",color:e.color||"var(--site-heading-color)",fontWeight:e.fontWeight||800,textAlign:e.align||void 0},e.fontSize?{fontSize:jy(e.fontSize)}:{}),Ty=e=>e?/^(https?:|\/|#|mailto:|tel:)/i.test(e)?e:"https://".concat(e):"#",zy=e=>{switch(e){case"full":return{width:"100%"};case"large":return{width:"100%",maxWidth:"1200px",marginLeft:"auto",marginRight:"auto"};case"medium":return{width:"100%",maxWidth:"900px",marginLeft:"auto",marginRight:"auto"};case"small":return{width:"100%",maxWidth:"600px",marginLeft:"auto",marginRight:"auto"};case"container":return{width:"100%",maxWidth:"1280px",marginLeft:"auto",marginRight:"auto"};default:return{}}},My=e=>d(d({},zy(e.width)),(e=>e&&parseInt(e)>0?{minHeight:"".concat(parseInt(e),"px"),display:"flex",flexDirection:"column",justifyContent:"center"}:{})(e.height)),Py=(e,t)=>{const s=e.headlineStyle||{},a=e.titleStyle||{};return d(d(d(d({},s.fontFamily&&"inherit"!==s.fontFamily?{fontFamily:s.fontFamily}:a.fontFamily&&"inherit"!==a.fontFamily?{fontFamily:a.fontFamily}:{}),s.fontWeight?{fontWeight:s.fontWeight}:a.fontWeight?{fontWeight:a.fontWeight}:{}),s.fontSize?{fontSize:jy(s.fontSize)}:{}),s.color?{color:s.color}:a.color?{color:a.color}:t?{color:t}:{})},By=(e,t)=>{const s=e.subheadlineStyle||{};return d(d(d(d({},s.fontFamily&&"inherit"!==s.fontFamily?{fontFamily:s.fontFamily}:{}),s.fontWeight?{fontWeight:s.fontWeight}:{}),s.fontSize?{fontSize:jy(s.fontSize)}:{}),s.color?{color:s.color}:t?{color:t}:{})},Ry=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.tabs||[]).filter(e=>e),[u,m]=(0,t.useState)(0),h=c[u]||c[0],x=s.tabColor||a,p="rectangle"===s.tabShape?"8px":"9999px";return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(i," ").concat(o),style:d(d({},r),My(s)),children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto text-center",children:[s.eyebrow&&(0,ea.jsx)("span",{className:"inline-block px-3 py-1 rounded-full text-xs font-semibold mb-5",style:{backgroundColor:a,color:"#fff"},children:s.eyebrow}),s.headline&&(0,ea.jsx)("h1",{style:d(d({},n),{},{fontSize:jy(52),lineHeight:1.1},Py(s)),children:s.headline}),s.subtitle&&(0,ea.jsx)("p",{className:"mt-5 max-w-2xl mx-auto",style:d({color:l,fontSize:jy(18),lineHeight:1.6},By(s)),children:s.subtitle}),s.ctaText&&(0,ea.jsxs)("a",{href:Ty(s.ctaUrl),className:"inline-flex items-center justify-center gap-2 mt-7 px-7 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(s)),style:{backgroundColor:a,color:s.buttonTextColor||"#fff",borderRadius:Yj(s.buttonRadius)},children:[sy(s)&&"left"===ay(s)&&ny(s,18),s.ctaText,sy(s)&&"right"===ay(s)&&ny(s,18)]}),c.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"flex flex-wrap justify-center gap-2 mt-12",children:c.map((e,t)=>(0,ea.jsx)("button",{onClick:()=>m(t),className:"px-4 py-2 text-sm font-medium transition-colors",style:d(t===u?{backgroundColor:x,color:"#fff",borderRadius:p}:{backgroundColor:"transparent",color:l,border:"1px solid ".concat(x,"55"),borderRadius:p},e.labelStyle||{}),children:e.label||"Tab ".concat(t+1)},e.id||t))}),(0,ea.jsx)("div",{className:"mt-8 relative rounded-2xl overflow-hidden mx-auto",style:{maxWidth:"900px",border:"1px solid ".concat(a,"33"),boxShadow:"0 24px 70px -24px ".concat(a,"66")},children:null!==h&&void 0!==h&&h.imageUrl?(0,ea.jsx)("img",{src:h.imageUrl,alt:h.label||"",className:"w-full block"}):(0,ea.jsx)("div",{className:"flex items-center justify-center bg-slate-100 text-slate-400",style:{aspectRatio:"16 / 9"},children:"Add an image for this tab"})})]})]})})},Ly={home:"M3 12l9-9 9 9M5 10v10h14V10",bell:"M6 8a6 6 0 0112 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 003.4 0",settings:"M12 15a3 3 0 100-6 3 3 0 000 6zM19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 11-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 11-4 0v-.09A1.65 1.65 0 009
219.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 11-2.83-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 110-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 112.83-2.83l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 114 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 112.83 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 110 4h-.09a1.65 1.65 0 00-1.51 1z",help:"M12 22a10 10 0 100-20 10 10 0 000 20zM9.1 9a3 3 0 015.8 1c0 2-3 3-3 3M12 17h.01",shield:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",mail:"M4 4h16v16H4zM4 6l8 6 8-6",user:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2M12 11a4 4 0 100-8 4 4 0 000 8z",file:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6",lock:"M5 11h14v10H5zM8 11V7a4 4 0 018 0v4",star:"M12 2l3 7 7 .5-5.5 4.5 2 7L12 17l-6.5 4 2-7L2 9.5 9 9z",heart:"M20.8 5.6a5.5 5.5 0 00-7.8 0L12 6.6l-1-1a5.5 5.5 0 00-7.8 7.8l1 1L12 22l7.8-7.6 1-1a5.5 5.5 0 000-7.8z",globe:"M12 22a10 10 0 100-20 10 10 0 000 20zM2 12h20M12 2a15 15 0 010 20 15 15 0 010-20z",phone:"M22 16.9v3a2 2 0 01-2.2 2 19.8 19.8 0 01-8.6-3 19.5 19.5 0 01-6-6 19.8 19.8 0 01-3-8.6A2 2 0 014.1 2h3a2 2 0 012 1.7c.1.9.3 1.8.6 2.7a2 2 0 01-.5 2.1L8 9.8a16 16 0 006 6l1.3-1.3a2 2 0 012.1-.4c.9.3 1.8.5 2.7.6a2 2 0 011.7 2z",calendar:"M3 4h18v18H3zM3 10h18M8 2v4M16 2v4",cart:"M6 6h15l-1.5 9h-12zM6 6L5 2H2M9 21a1 1 0 100-2 1 1 0 000 2zM18 21a1 1 0 100-2 1 1 0 000 2z",zap:"M13 2L3 14h7l-1 8 10-12h-7z"},Iy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.tabs||[]).filter(e=>e),u=s.tabColor||a,[m,h]=(0,t.useState)(null),x=(0,t.useRef)(null);(0,t.useEffect)(()=>{const e=e=>{x.current&&!x.current.contains(e.target)&&h(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=e=>{let{name:t}=e;return(0,ea.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:Ly[t]||Ly.star})})};return(0,ea.jsx)("section",{className:"py-14 px-6 ".concat(i," ").concat(o),style:r,children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto text-center",children:[s.heading&&(0,ea.jsx)("h2",{className:"mb-3",style:d({fontSize:jy(34),lineHeight:1.2},n),children:s.heading}),s.subheading&&(0,ea.jsx)("p",{className:"mb-8 max-w-xl mx-auto",style:{color:l,fontSize:jy(16)},children:s.subheading}),(0,ea.jsxs)("div",{ref:x,className:"inline-flex flex-wrap items-center gap-2 justify-center rounded-2xl p-1.5",style:{border:"1px solid ".concat(u,"33"),background:"var(--site-card-bg,#fff)"},children:[c.map((e,t)=>{if("separator"===e.type)return(0,ea.jsx)("span",{className:"mx-1.5 self-stretch my-1",style:{width:"2px",minHeight:"1.75rem",backgroundColor:"".concat(u,"66"),borderRadius:"2px"}},t);const s=m===t,a=(0,ea.jsxs)("span",{className:"flex items-center overflow-hidden whitespace-nowrap",style:{color:s?u:"var(--site-body-color)"},children:[(0,ea.jsx)(p,{name:e.icon}),(0,ea.jsx)("span",{style:{maxWidth:s?"160px":"0px",marginLeft:s?"8px":"0px",transition:"max-width .35s ease, margin-left .35s ease",fontSize:jy(14),fontWeight:600},children:e.label})]}),n="flex items-center rounded-xl px-3 py-2 transition-colors",l={backgroundColor:s?"".concat(u,"1a"):"transparent",cursor:"pointer"};return e.url?(0,ea.jsx)("a",{href:Ty(e.url),className:n,style:l,onMouseEnter:()=>h(t),onClick:()=>h(t),children:a},e.id||t):(0,ea.jsx)("button",{type:"button",className:n,style:l,onClick:()=>h(s?null:t),onMouseEnter:()=>h(t),children:a},e.id||t)}),0===c.length&&(0,ea.jsx)("span",{className:"px-3 py-2 text-sm",style:{color:l},children:"Add tabs in the editor"})]})]})})},Oy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(0,t.useRef)(null),u=s.backgroundColor||"#020617",m=s.particleColor||"#FFFFFF",h=Math.max(20,Math.min(400,parseInt(s.density)||120)),x=parseInt(s.height)||460;return(0,t.useEffect)(()=>{const e=c.current;if(!e)return;const t=e.getContext("2d");let s,a=[],n=0,l=0;const r=Math.min(window.devicePixelRatio||1,2),i=()=>{const s=e.getBoundingClientRect();n=s.width,l=s.height,e.width=n*r,e.height=l*r,t.setTransform(r,0,0,r,0,0);const i=Math.floor(n*l/8e3*(h/120));a=Array.from({length:i},()=>({x:Math.random()*n,y:Math.random()*l,r:1.1*Math.random()+.3,a:Math.random(),s:.02*Math.random()+.005}))},o=()=>
2{t.clearRect(0,0,n,l),t.fillStyle=m,a.forEach(e=>{e.a+=e.s,(e.a>1||e.a<0)&&(e.s=-e.s),t.globalAlpha=Math.abs(e.a),t.beginPath(),t.arc(e.x,e.y,e.r,0,2*Math.PI),t.fill()}),t.globalAlpha=1,s=requestAnimationFrame(o)};return i(),o(),window.addEventListener("resize",i),()=>{cancelAnimationFrame(s),window.removeEventListener("resize",i)}},[h,m]),(0,ea.jsxs)("section",{className:"relative overflow-hidden ".concat(i," ").concat(o),style:d(d({},r),{},{backgroundColor:u,minHeight:"".concat(x,"px")}),children:[(0,ea.jsx)("canvas",{ref:c,className:"absolute inset-0 w-full h-full",style:{width:"100%",height:"100%"}}),(0,ea.jsxs)("div",{className:"relative z-10 flex flex-col items-center justify-center text-center px-6",style:{minHeight:"".concat(x,"px")},children:[s.headline&&(0,ea.jsx)("h1",{style:d(d({},n),{},{color:null!==n&&void 0!==n&&n.color&&"var(--site-heading-color)"!==n.color?n.color:"#fff",fontSize:jy(64),lineHeight:1.05}),children:s.headline}),(0,ea.jsxs)("div",{className:"relative my-5",style:{width:"min(38rem,90%)",height:"2px"},children:[(0,ea.jsx)("div",{className:"absolute inset-x-[15%] top-0 h-[2px] blur-sm",style:{background:"linear-gradient(to right, transparent, ".concat(a,", transparent)")}}),(0,ea.jsx)("div",{className:"absolute inset-x-[15%] top-0 h-px",style:{background:"linear-gradient(to right, transparent, ".concat(a,", transparent)")}})]}),s.subheadline&&(0,ea.jsx)("p",{className:"max-w-xl",style:{color:s.subtitleColor||"rgba(255,255,255,0.7)",fontSize:jy(18),lineHeight:1.6},children:s.subheadline}),s.buttonText&&(0,ea.jsxs)("a",{href:Ty(s.buttonUrl),className:"inline-flex items-center justify-center gap-2 mt-7 px-7 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(s)),style:{backgroundColor:a,color:s.buttonTextColor||"#fff",borderRadius:Yj(s.buttonRadius)},children:[sy(s)&&"left"===ay(s)&&ny(s,18),s.buttonText,sy(s)&&"right"===ay(s)&&ny(s,18)]})]})]})},Uy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.items||[]).filter(e=>e),u=(0,t.useRef)(null),m=e=>{const t=u.current;t&&t.scrollBy({left:e*Math.min(.8*t.clientWidth,420),behavior:"smooth"})};return(0,ea.jsxs)("section",{className:"py-20 ".concat(i," ").concat(o),style:r,children:[(0,ea.jsx)("div",{className:"max-w-6xl mx-auto px-6",children:(0,ea.jsxs)("div",{className:"flex items-end justify-between gap-4 mb-8",children:[(0,ea.jsxs)("div",{children:[s.title&&(0,ea.jsx)("h2",{style:d({fontSize:jy(40),lineHeight:1.15},n),children:s.title}),s.description&&(0,ea.jsx)("p",{className:"mt-3 max-w-xl",style:{color:l,fontSize:jy(16),lineHeight:1.6},children:s.description})]}),(0,ea.jsxs)("div",{className:"hidden sm:flex gap-2 shrink-0",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>m(-1),"aria-label":"Previous",className:"h-10 w-10 rounded-full flex items-center justify-center transition-colors",style:{border:"1px solid ".concat(a,"55"),color:a},children:(0,ea.jsx)(vj,{size:18})}),(0,ea.jsx)("button",{type:"button",onClick:()=>m(1),"aria-label":"Next",className:"h-10 w-10 rounded-full flex items-center justify-center transition-colors",style:{border:"1px solid ".concat(a,"55"),color:a},children:(0,ea.jsx)(ax,{size:18})})]})]})}),(0,ea.jsxs)("div",{ref:u,className:"flex gap-6 overflow-x-auto pb-4 px-6 max-w-6xl mx-auto",style:{scrollSnapType:"x mandatory",scrollbarWidth:"none"},children:[c.map((e,t)=>{const n=s.cardTextColor||"#ffffff";return(0,ea.jsxs)("a",{href:Ty(e.href),className:"group relative shrink-0 rounded-2xl overflow-hidden block",style:{width:"min(20rem,80vw)",height:"24rem",scrollSnapAlign:"start",boxShadow:"0 20px 60px -28px ".concat(a,"88")},children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:e.title||"",className:"absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}):(0,ea.jsx)("div",{className:"absolute inset-0 bg-slate-200"}),(0,ea.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,.1) 55%)"}}),(0,ea.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 p-6",style:{color:n},children:[e.title&&(0,ea.jsx)("h3",{className:"font-semibold mb-1",style:{fontSize:jy(20
2),lineHeight:1.25},children:e.title}),e.description&&(0,ea.jsx)("p",{className:"opacity-85 line-clamp-3",style:{fontSize:jy(14),lineHeight:1.5},children:e.description}),(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 mt-3 text-sm font-medium",children:["Read more ",(0,ea.jsx)(ax,{size:14})]})]})]},e.id||t)}),0===c.length&&(0,ea.jsx)("div",{className:"shrink-0 rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",style:{width:"20rem",height:"24rem"},children:"Add gallery items"})]})]})},Hy=e=>{let{n:t=5,color:s}=e;return(0,ea.jsx)("div",{className:"flex gap-0.5",children:Array.from({length:5}).map((e,a)=>(0,ea.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:a<t?s:"none",stroke:s,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:"M12 2l3 7 7 .5-5.5 4.5 2 7L12 17l-6.5 4 2-7L2 9.5 9 9z"})},a))})},Wy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.items||[]).filter(e=>e),[u,m]=(0,t.useState)(0),h=c.length;(0,t.useEffect)(()=>{if(h<2||!1===s.autoplay)return;const e=1e3*Math.max(1,parseInt(s.autoplaySeconds)||5),t=setInterval(()=>m(e=>(e+1)%h),e);return()=>clearInterval(t)},[h,s.autoplay,s.autoplaySeconds]);const x=parseInt(s.maxChars)||0,p=e=>m(t=>(t+e+h)%h);return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(i," ").concat(o),style:r,children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto text-center",children:[s.heading&&(0,ea.jsx)("h2",{className:"mb-3",style:d({fontSize:jy(38),lineHeight:1.15},n),children:s.heading}),s.subheading&&(0,ea.jsx)("p",{className:"mb-12 max-w-2xl mx-auto",style:{color:l,fontSize:jy(17)},children:s.subheading}),(0,ea.jsxs)("div",{className:"relative mx-auto",style:{maxWidth:"34rem",height:"20rem"},children:[c.map((e,t)=>{const s=(t-u+h)%h,n=s<=2;return(0,ea.jsxs)("button",{type:"button",onClick:()=>m(0===s?(t+1)%h:t),"aria-label":"Testimonial ".concat(t+1),className:"absolute inset-0 text-left rounded-3xl p-8 flex flex-col",style:{background:"var(--site-card-bg,#fff)",border:"1px solid ".concat(a,"33"),boxShadow:"0 30px 70px -30px ".concat(a,"66"),transform:"translateY(".concat(14*s,"px) scale(").concat(1-.05*s,") rotate(").concat(0===s?0:t%2?1.5:-1.5,"deg)"),zIndex:h-s,opacity:n?0===s?1:.55:0,transition:"transform .5s cubic-bezier(.2,.8,.2,1), opacity .5s",cursor:"pointer"},children:[(0,ea.jsx)(Hy,{n:e.rating||5,color:a}),(0,ea.jsxs)("p",{className:"mt-4 flex-1 overflow-hidden",style:{color:"var(--site-heading-color)",fontSize:jy(18),lineHeight:1.5},children:["\u201c",(r=e.quote,x>0&&r&&r.length>x?r.slice(0,x).trim()+"\u2026":r),"\u201d"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 mt-5",children:[e.avatarUrl?(0,ea.jsx)("img",{src:e.avatarUrl,alt:e.name||"",className:"h-11 w-11 rounded-full object-cover"}):(0,ea.jsx)("span",{className:"h-11 w-11 rounded-full flex items-center justify-center font-bold text-white",style:{backgroundColor:a},children:(e.name||"?").charAt(0)}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"font-semibold",style:{color:"var(--site-heading-color)",fontSize:jy(15)},children:e.name}),e.role&&(0,ea.jsx)("div",{style:{color:l,fontSize:jy(13)},children:e.role})]})]})]},e.id||t);var r}),0===h&&(0,ea.jsx)("div",{className:"absolute inset-0 rounded-3xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",children:"Add testimonials"})]}),h>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-center gap-4 mt-8 px-4",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>p(-1),"aria-label":"Previous",className:"h-10 w-10 rounded-full flex items-center justify-center transition-transform hover:-translate-y-0.5 shrink-0",style:{backgroundColor:a,color:"#fff"},children:(0,ea.jsx)(vj,{size:18})}),(0,ea.jsx)("div",{className:"flex flex-wrap justify-center gap-2",children:c.map((e,t)=>(0,ea.jsx)("button",{type:"button",onClick:()=>m(t),"aria-label":"Go to ".concat(t+1),className:"h-2 rounded-full transition-all",style:{width:t===u?22:8,backgroundColor:t===u?a:"".concat(a,"66")}},t))}),(0,ea.jsx)("button",{type:"button",onClick:()=>p(1),"aria-label":"Next",className:"h-10 w-10 rounded-full flex items-center justify-center transition-transform hover:-translate-y-0.5 shrink-0",style:{backgroundColor:a,color:"#fff"},children:(0,ea.jsx)(ax,{size:18})})]})]})})},Vy=e=>{var t;let{content:s,accent:a,headStyle:n,finalBlockStyle:l,wrapperClass:r,animationClass:i}=e;const o="dark"===s.glassTint,c=o?"rgba(15,23,42,0.35)":"rgba(255,255,255,0.18)",u=s.textColor||(o?"#f8fafc":"#0f172a"),m=null!==n&&void 0!==n&&n.color&&"var(--site-heading-color)"!==n.color?n.color:u,h=parseInt(s.height)||0,x=s.backgroundImageUrl?d({backgroundImage:"url(".concat(s.backgroundImageUrl,")"),backgroundSize:"cover",backgroundPosition:"center"},h?{minHeight:"".concat(h,"px")}:{}):{background:s.backgroundColor||"linear-gradient(135deg, ".concat(a,", #0ea5e9 60%, #8b5cf6)")};return(0,ea.jsx)("section",{className:"relative overflow-hidden py-24 px-6 flex items-center ".concat(r," ").concat(i),style:d(d({},l),x),children:(0,ea.jsxs)("div",{className:"relative max-w-2xl mx-auto rounded-[28px] p-10 text-center",style:{background:c,backdropFilter:"blur(18px) saturate(160%)",WebkitBackdropFilter:"blur(18px) saturate(160%)",border:"1px solid rgba(255,255,255,0.35)",boxShadow:"inset 0 1px 1px rgba(255,255,255,0.6), inset 0 -1px 1px rgba(255,255,255,0.15), 0 30px 80px -30px rgba(0,0,0,0.45)"},children:[s.eyebrow&&(0,ea.jsx)("span",{className:"inline-block px-3 py-1 rounded-full text-xs font-semibold mb-5",style:{backgroundColor:"rgba(255,255,255,0.25)",color:u,border:"1px solid rgba(255,255,255,0.35)"},children:s.eyebrow}),s.headline&&(0,ea.jsx)("h2",{style:d(d({},n),{},{color:m,fontSize:jy(parseInt(null===(t=s.titleStyle)||void 0===t?void 0:t.fontSize)||44),lineHeight:1.1}),children:s.headline}),s.subtitle&&(0,ea.jsx)("p",{className:"mt-4 max-w-lg mx-auto",style:{color:u,opacity:.85,fontSize:jy(18),lineHeight:1.6},children:s.subtitle}),s.buttonText&&(0,ea.jsxs)("a",{href:Ty(s.buttonUrl),className:"inline-flex items-center justify-center gap-2 mt-7 px-7 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(s)),style:{background:"rgba(255,255,255,0.9)",color:s.buttonTextColor||"#0f172a",boxShadow:"0 8px 24px -8px rgba(0,0,0,0.4)",borderRadius:Yj(s.buttonRadius||"pill")},children:[sy(s)&&"left"===ay(s)&&ny(s,18),s.buttonText,sy(s)&&"right"===ay(s)&&ny(s,18)]})]})})},qy=e=>{let{content:t,accent:s,headStyle:a,subColor:n,finalBlockStyle:l,wrapperClass:r,animationClass:i,scopeId:o}=e;const c=(t.items||[]).filter(e=>e),u=o||"tc",m=Math.max(15,parseInt(t.speed)||40),h=c.length>=3?3:c.length>=2?2:1,x=[[],[],[]];
2c.forEach((e,t)=>x[t%h].push(e));const p=t.cardTextColor,g=e=>{let{t:t,k:a}=e;return(0,ea.jsxs)("div",{className:"rounded-2xl p-6 mb-4",style:{background:"var(--site-card-bg,#fff)",border:"1px solid ".concat(s,"22"),boxShadow:"0 12px 40px -24px ".concat(s,"55")},children:[(0,ea.jsx)("p",{style:{color:p||"var(--site-heading-color)",fontSize:jy(15),lineHeight:1.55},children:t.quote}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[t.avatarUrl?(0,ea.jsx)("img",{src:t.avatarUrl,alt:t.name||"",className:"h-9 w-9 rounded-full object-cover"}):(0,ea.jsx)("span",{className:"h-9 w-9 rounded-full flex items-center justify-center text-white text-sm font-bold",style:{backgroundColor:s},children:(t.name||"?").charAt(0)}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"font-semibold leading-tight",style:{color:p||"var(--site-heading-color)",fontSize:jy(14)},children:t.name}),t.role&&(0,ea.jsx)("div",{style:{color:p||n,opacity:p?.75:1,fontSize:jy(12)},children:t.role})]})]})]},a)};return(0,ea.jsxs)("section",{className:"".concat(u," py-10 px-4 md:py-20 md:px-6 ").concat(r," ").concat(i),style:l,children:[(0,ea.jsx)("style",{children:"\n @keyframes ".concat(u,"-scroll{from{transform:translateY(0);}to{transform:translateY(-50%);}}\n .").concat(u," .tc-col{animation:").concat(u,"-scroll linear infinite;}\n .").concat(u," .tc-col:hover{animation-play-state:paused;}\n ")}),(0,ea.jsxs)("div",{className:"max-w-2xl mx-auto text-center mb-14",children:[t.badge&&(0,ea.jsx)("span",{className:"inline-block px-3 py-1 rounded-full text-xs font-semibold mb-4",style:{backgroundColor:"".concat(s,"1a"),color:s,border:"1px solid ".concat(s,"33")},children:t.badge}),t.heading&&(0,ea.jsx)("h2",{style:d({fontSize:jy(40),lineHeight:1.15},a),children:t.heading}),t.subheading&&(0,ea.jsx)("p",{className:"mt-4",style:{color:n,fontSize:jy(17)},children:t.subheading})]}),(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto grid gap-6",style:{gridTemplateColumns:"repeat(".concat(h,",minmax(0,1fr))"),maxHeight:"34rem",overflow:"hidden",maskImage:"linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent)",WebkitMaskImage:"linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent)"},children:[x.slice(0,h).map((e,t)=>(0,ea.jsx)("div",{className:t>0?"hidden md:block":"",children:(0,ea.jsx)("div",{className:"tc-col",style:{animationDuration:"".concat(m+8*t,"s")},children:[...e,...e].map((e,s)=>(0,ea.jsx)(g,{t:e,k:"".concat(t,"-").concat(s)},"".concat(t,"-").concat(s)))})},t)),0===c.length&&(0,ea.jsx)("div",{className:"col-span-full rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400 py-16",children:"Add testimonials"})]})]})},$y=e=>{var s,a;let{content:n,accent:l,headStyle:r,finalBlockStyle:i,wrapperClass:o,animationClass:c}=e;const u=(n.phrases||[]).filter(e=>e&&e.length),m=parseInt(n.speed)||70,h=parseInt(n.deleteSpeed)||40,x=parseInt(n.waitTime)||1500,p=!1!==n.loop,g=n.cursorChar||"|",[f,v]=(0,t.useState)(""),[b,j]=(0,t.useState)(0),[y,N]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(0===u.length)return;const e=u[b%u.length];let t;if(!y&&f.length<e.length)t=setTimeout(()=>v(e.slice(0,f.length+1)),m);else if(y||f.length!==e.length){if(y&&f.length>0)t=setTimeout(()=>v(e.slice(0,f.length-1)),h);else if(y&&0===f.length){N(!1);const e=b+1;if(e>=u.length&&!p)return;j(e%u.length)}}else{if(1===u.length&&!p)return;t=setTimeout(()=>N(!0),x)}return()=>clearTimeout(t)},[f,y,b,u.length,m,h,x,p]);const w=(null===(s=n.titleStyle)||void 0===s?void 0:s.align)||"left";return(0,ea.jsxs)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(o," ").concat(c),style:i,children:[(0,ea.jsx)("div",{className:"max-w-4xl mx-auto",style:{textAlign:w},children:(0,ea.jsxs)("p",{className:"whitespace-pre-wrap",style:d(d({},r),{},{textAlign:w,fontSize:jy(parseInt(null===(a=n.titleStyle)||void 0===a?void 0:a.fontSize)||44),lineHeight:1.2}),children:[n.prefixText&&(0,ea.jsx)("span",{children:n.prefixText}),(0,ea.jsx)("span",{style:{color:n.wordColor||l},children:f}),(0,ea.jsx)("span",{className:"tw-cursor",style:{color:n.wordColor||l},children:g})]})}),(0,ea.jsx)("style",{children:"@keyframes tw-blink{0%,100%{opacity:1}50%{opacity:0}
2} .tw-cursor{animation:tw-blink 1s step-end infinite;}"})]})},Gy=e=>{var s,a;let{content:n,accent:l,headStyle:r,finalBlockStyle:i,wrapperClass:o,animationClass:c,scopeId:u}=e;const m=(n.texts||[]).filter(e=>e&&e.length),h=u||"goo",x=1e3*((parseFloat(n.morphTime)||1)+(parseFloat(n.cooldownTime)||.25))+1e3,[p,g]=(0,t.useState)(0);(0,t.useEffect)(()=>{if(m.length<2)return;const e=Math.max(1600,x),t=setInterval(()=>g(e=>(e+1)%m.length),e);return()=>clearInterval(t)},[m.length,x]);const f=jy(parseInt(null===(s=n.titleStyle)||void 0===s?void 0:s.fontSize)||64),v=(null===(a=n.titleStyle)||void 0===a?void 0:a.color)||l;return(0,ea.jsx)("section",{className:"".concat(h," relative py-24 px-6 ").concat(o," ").concat(c),style:i,children:(0,ea.jsxs)("div",{className:"relative flex items-center justify-center",style:{minHeight:"8rem"},children:[0===m.length&&(0,ea.jsx)("span",{className:"inline-block text-slate-400",style:d(d({},r),{},{color:void 0,fontSize:f}),children:"Add words in the editor"}),m.map((e,t)=>(0,ea.jsx)("span",{className:"absolute inline-block whitespace-nowrap",style:d(d({},r),{},{color:v,fontSize:f,lineHeight:1,opacity:t===p?1:0,filter:t===p?"blur(0px)":"blur(10px)",transform:t===p?"scale(1)":"scale(.96)",transition:"opacity .55s ease, filter .55s ease, transform .55s ease",pointerEvents:"none"}),children:e},t))]})})},Ky=e=>{var s,a;let{content:n,accent:l,headStyle:r,finalBlockStyle:i,wrapperClass:o,animationClass:c}=e;const u=(n.words||[]).filter(e=>e&&e.length),m=parseInt(n.interval)||3e3,[h,x]=(0,t.useState)(0),[p,g]=(0,t.useState)(!0);(0,t.useEffect)(()=>{if(u.length<2)return;const e=setInterval(()=>{g(!1),setTimeout(()=>{x(e=>(e+1)%u.length),g(!0)},240)},m);return()=>clearInterval(e)},[u.length,m]);const f=(null===(s=n.titleStyle)||void 0===s?void 0:s.align)||"center";return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(o," ").concat(c),style:i,children:(0,ea.jsx)("div",{className:"max-w-4xl mx-auto",style:{textAlign:f},children:(0,ea.jsxs)("h2",{style:d(d({},r),{},{textAlign:f,fontSize:jy(parseInt(null===(a=n.titleStyle)||void 0===a?void 0:a.fontSize)||44),lineHeight:1.25}),children:[n.prefix&&(0,ea.jsxs)("span",{children:[n.prefix," "]}),(0,ea.jsx)("span",{className:"inline-block",style:{color:n.wordColor||l,transition:"opacity .24s ease, transform .24s ease",opacity:p?1:0,transform:p?"translateY(0)":"translateY(10px)"},children:u[h%(u.length||1)]||""}),n.suffix&&(0,ea.jsxs)("span",{children:[" ",n.suffix]})]})})})},Yy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.items||[]).filter(e=>e),u=c.length,[m,h]=(0,t.useState)(0);(0,t.useEffect)(()=>{if(u<2||!1===s.autoplay)return;const e=setInterval(()=>h(e=>(e+1)%u),5e3);return()=>clearInterval(e)},[u,s.autoplay]);const x=c[m]||{},p=e=>h(t=>(t+e+u)%u);return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(i," ").concat(o),style:r,children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[s.heading&&(0,ea.jsx)("h2",{className:"text-center mb-12",style:d({fontSize:jy(38),lineHeight:1.15},n),children:s.heading}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-10 items-center",children:[(0,ea.jsxs)("div",{className:"relative mx-auto",style:{width:"100%",maxWidth:"22rem",height:"22rem",perspective:"1000px"},children:[c.map((e,t)=>{const s=(t-m+u)%u,n=0===s,l=s===u-1,r={opacity:n?1:l?.55:0,transform:"scale(".concat(n?1:.92,") rotateY(").concat(n?0:l?12:-12,"deg) translateX(").concat(n?0:l?16:-16,"px)"),zIndex:n?3:l?2:1,transition:"opacity .6s, transform .6s",boxShadow:"0 30px 70px -30px rgba(0,0,0,.5)"};return e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:e.name||"",className:"absolute inset-0 w-full h-full object-cover rounded-3xl",style:r},e.id||t):(0,ea.jsx)("div",{className:"absolute inset-0 rounded-3xl flex items-center justify-center text-white font-bold",style:d(d({},r),{},{backgroundColor:a,fontSize:jy(64)}),children:(e.name||"?").charAt(0)},e.id||t)}),0===u&&(0,ea.jsx)("div",{className:"absolute inset-0 rounded-3xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",children:"Add testimonials"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{style:{color:"var(--site-heading-color)",fontSize:jy(20
2),lineHeight:1.55},children:["\u201c",x.quote,"\u201d"]}),(0,ea.jsxs)("div",{className:"mt-6",children:[(0,ea.jsx)("div",{className:"font-bold break-words",style:{color:"var(--site-heading-color)",fontSize:jy(18),lineHeight:1.25},children:x.name}),x.designation&&(0,ea.jsx)("div",{className:"break-words",style:{color:l,fontSize:jy(14)},children:x.designation})]}),u>1&&(0,ea.jsxs)("div",{className:"flex gap-3 mt-8",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>p(-1),"aria-label":"Previous",className:"h-11 w-11 rounded-full flex items-center justify-center transition-transform hover:-translate-y-0.5",style:{backgroundColor:a,color:"#fff"},children:(0,ea.jsx)(vj,{size:20})}),(0,ea.jsx)("button",{type:"button",onClick:()=>p(1),"aria-label":"Next",className:"h-11 w-11 rounded-full flex items-center justify-center transition-transform hover:-translate-y-0.5",style:{backgroundColor:a,color:"#fff"},children:(0,ea.jsx)(ax,{size:20})})]})]})]})]})})},Jy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.items||[]).filter(e=>e),u=c.length,[m,h]=(0,t.useState)(0);(0,t.useEffect)(()=>{if(u<2||!1===s.autoplay)return;const e=setInterval(()=>h(e=>(e+1)%u),5e3);return()=>clearInterval(e)},[u,s.autoplay]);const x=e=>h(t=>(t+e+u)%u),p=s.cardColor||a;return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(i," ").concat(o),style:r,children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[s.heading&&(0,ea.jsx)("h2",{className:"text-center mb-12",style:d({fontSize:jy(38),lineHeight:1.15},n),children:s.heading}),(0,ea.jsxs)("div",{className:"relative mx-auto",style:{height:"24rem",perspective:"1000px"},children:[c.map((e,t)=>{let a=t-m;a>u/2&&(a-=u),a<-u/2&&(a+=u);const n=0===a,l=Math.abs(a);return(0,ea.jsxs)("div",{onClick:()=>n?x(1):h(t),className:"absolute top-0 left-1/2 rounded-3xl p-8 flex flex-col cursor-pointer",style:{width:"min(24rem,86vw)",height:"22rem",marginLeft:"calc(min(24rem, 86vw) / -2)",background:n?p:"var(--site-card-bg,#fff)",color:n?"#fff":"var(--site-heading-color)",border:"1px solid ".concat(p,"33"),transform:"translateX(".concat(55*a,"%) translateZ(").concat(n?0:-180,"px) rotateY(").concat(-10*a,"deg) scale(").concat(n?1:.85,")"),opacity:l>2?0:1,zIndex:u-l,boxShadow:n?"0 30px 70px -28px ".concat(p,"aa"):"0 14px 40px -28px rgba(0,0,0,.4)",transition:"transform .5s cubic-bezier(.2,.8,.2,1), opacity .5s, background .4s",pointerEvents:l>
22?"none":"auto"},children:[e.avatarUrl&&(0,ea.jsx)("img",{src:e.avatarUrl,alt:e.name||"",className:"h-14 w-14 rounded-full object-cover mb-4"}),(0,ea.jsxs)("p",{className:"flex-1 font-medium",style:{fontSize:jy(19),lineHeight:1.45},children:["\u201c",e.quote,"\u201d"]}),(0,ea.jsxs)("p",{className:"mt-4",style:{fontSize:jy(14),opacity:n?.9:.7,color:s.subtitleColor||void 0},children:["- ",e.name,e.role?", ".concat(e.role):""]})]},e.id||t)}),0===u&&(0,ea.jsx)("div",{className:"absolute inset-0 rounded-3xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",children:"Add testimonials"})]}),u>1&&(0,ea.jsxs)("div",{className:"flex justify-center gap-3 mt-8",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>x(-1),"aria-label":"Previous",className:"h-11 w-11 rounded-full flex items-center justify-center transition-transform hover:-translate-y-0.5",style:{backgroundColor:p,color:"#fff"},children:(0,ea.jsx)(vj,{size:20})}),(0,ea.jsx)("button",{type:"button",onClick:()=>x(1),"aria-label":"Next",className:"h-11 w-11 rounded-full flex items-center justify-center transition-transform hover:-translate-y-0.5",style:{backgroundColor:p,color:"#fff"},children:(0,ea.jsx)(ax,{size:20})})]})]})})},Qy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o,scopeId:c}=e;const u=c||"hw",m=s.circleColor||a,h=!0===s.loop,[x,p]=(0,t.useState)(!1),g=(0,t.useRef)(null);return(0,t.useEffect)(()=>{const e=g.current;if(!e||"undefined"===typeof IntersectionObserver)return void p(!0);const t=new IntersectionObserver(e=>{let[t]=e;t.isIntersecting&&p(!0)},{threshold:.3});return t.observe(e),()=>t.disconnect()},[]),(0,ea.jsxs)("section",{ref:g,className:"".concat(u," ").concat(x?"hw-in":""," relative py-24 px-6 text-center ").concat(i," ").concat(o),style:r,children:[(0,ea.jsx)("style",{children:"\n .".concat(u," .hw-path{stroke-dasharray:1600;stroke-dashoffset:1600;}\n .").concat(u,".hw-in .hw-path{animation:").concat(u,"-draw ").concat(h?"5s":"2.5s"," ease ").concat(h?"infinite":"forwards"," .2s;}\n @keyframes ").concat(u,"-draw{").concat(h?"0%{stroke-dashoffset:1600}45%{stroke-dashoffset:0}80%{stroke-dashoffset:0}100%{stroke-dashoffset:1600}":"to{stroke-dashoffset:0}","}\n .").concat(u," .hw-title{opacity:").concat(h?1:0,";}\n .").concat(u,".hw-in .hw-title{").concat(h?"":"animation:".concat(u,"-fade .8s ease forwards .9s;"),"}\n @keyframes ").concat(u,"-fade{to{opacity:1;}}\n ")}),(0,ea.jsxs)("div",{className:"relative inline-block px-24 py-16",children:[(0,ea.jsx)("svg",{className:"absolute pointer-events-none",style:{inset:"0",width:"100%",height:"100%",zIndex:0},viewBox:"0 0 600 220",fill:"none",preserveAspectRatio:"none","aria-hidden":!0,children:(0,ea.jsx)("path",{className:"hw-path",d:"M70 110 C 130 40, 240 30, 320 38 C 470 50, 560 78, 552 118 C 545 160, 450 188, 300 190 C 150 192, 48 168, 52 118 C 55 82, 120 58, 220 54",stroke:m,strokeWidth:"5",strokeLinecap:"round"})}),(0,ea.jsx)("h1",{className:"hw-title relative",style:d(d({},n),{},{fontSize:jy(64),lineHeight:1.1,zIndex:1}),children:s.title||"Hello"})]}),s.subtitle&&(0,ea.jsx)("p",{className:"hw-title mt-6 max-w-xl mx-auto",style:{color:l,fontSize:jy(18)},children:s.subtitle})]})},Xy=e=>{var s;let{content:a,accent:n,headStyle:l,subColor:r,finalBlockStyle:i,wrapperClass:o,animationClass:c,scopeId:u}=e;const m=u||"tws",h=(a.words||[]).filter(e=>e&&e.length),x=h.length-1,p=a.wordColor||n,g=(null===(s=a.titleStyle)||void 0===s?void 0:s.align)||"center",f=!0===a.loop,[v,b]=(0,t.useState)(0),[j,y]=(0,t.useState)(!1),N=(0,t.useRef)(null);(0,t.useEffect)(()=>{const e=N.current;if(!e||"undefined"===typeof IntersectionObserver)return void y(!0);const t=new IntersectionObserver(e=>{let[t]=e;t.isIntersecting&&y(!0)},{threshold:.25});return t.observe(e),()=>t.disconnect()},[]),(0,t.useEffect)(()=>{if(!j||0===h.length)return;let e;return v<h.length?e=setTimeout(()=>b(e=>e+1),430):f&&(e=setTimeout(()=>b(0),1800)),()=>clearTimeout(e)},[j,v,h.length,f]);h.length;return(0,ea.jsxs)("section",{ref:N,className:"".concat(m," py-10 px-4 md:py-20 md:px-6 ").concat(o," ").concat(c),style:i,children:[(0,ea.jsx)("style",{children:"\n .".concat(m," .tws-cursor{display:inline-block;width:.1em;height:1em;background:").concat(p,";margin-left:.12em;vertical-align:-.05em;animation:").concat(m,"-blink 1s step-end infinite;}\n @keyframes ").concat(m,"-blink{0%,100%{opacity:1}50%{opacity:0}
2}\n ")}),(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",style:{textAlign:g},children:[(e=>{const t=parseInt(null===(e=a.titleStyle)||void 0===e?void 0:e.fontSize)||56;return(0,ea.jsxs)(ea.Fragment,{children:[a.prefix&&(0,ea.jsx)("p",{className:"mb-4",style:{color:r,fontSize:jy(t),lineHeight:1.15},children:a.prefix}),(0,ea.jsxs)("div",{style:d(d({},l),{},{fontSize:jy(t),lineHeight:1.15}),children:[h.map((e,t)=>(0,ea.jsx)("span",{style:{display:"inline-block",marginRight:"0.3em",color:t===x?p:void 0,opacity:t<v?1:0,transform:t<v?"translateY(0)":"translateY(0.25em)",transition:"opacity .35s ease, transform .35s ease"},children:e},t)),(0,ea.jsx)("span",{className:"tws-cursor",style:{opacity:1}})]})]})})(),(a.button1Text||a.button2Text)&&(0,ea.jsxs)("div",{className:"flex flex-wrap gap-4 mt-9",style:{justifyContent:"center"===g?"center":"right"===g?"flex-end":"flex-start"},children:[a.button1Text&&(0,ea.jsxs)("a",{href:Ty(a.button1Url),className:"inline-flex items-center justify-center gap-2 px-7 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(a)),style:{backgroundColor:n,color:a.buttonTextColor||"#fff",borderRadius:Yj(a.buttonRadius||"rounded")},children:[sy(a)&&"left"===ay(a)&&ny(a,18),a.button1Text,sy(a)&&"right"===ay(a)&&ny(a,18)]}),a.button2Text&&(0,ea.jsx)("a",{href:Ty(a.button2Url),className:"inline-flex items-center justify-center gap-2 px-7 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(a)),style:{border:"1px solid ".concat(n,"66"),color:a.button2TextColor||"var(--site-heading-color)",borderRadius:Yj(a.buttonRadius||"rounded")},children:a.button2Text})]})]})]})},Zy=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.items||[]).filter(e=>e&&e.imageUrl).slice(0,6),[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(null),p=c.length,g=s.folderColor||a,f=e=>x(t=>(t+e+p)%p);return(0,ea.jsxs)("section",{className:"py-24 px-6 text-center ".concat(i," ").concat(o),style:r,children:[s.heading&&(0,ea.jsx)("h2",{className:"mb-3",style:d({fontSize:jy(34),lineHeight:1.2},n),children:s.heading}),s.subheading&&(0,ea.jsx)("p",{className:"mb-12 max-w-xl mx-auto",style:{color:l,fontSize:jy(16)},children:s.subheading}),(0,ea.jsxs)("div",{className:"relative mx-auto select-none",style:{width:"20rem",height:"18rem"},children:[c.map((e,t)=>{const s=(e=>{const t=e-(p-1)/2;return{x:64*t,y:-120- -6*Math.abs(t),rot:9*t}})(t);return(0,ea.jsx)("button",{type:"button",onClick:()=>u&&(e=>x(e))(t),"aria-label":"View photo ".concat(t+1),className:"absolute left-1/2 rounded-xl overflow-hidden p-0 border-0",style:{width:"8rem",height:"10rem",bottom:"3.5rem",marginLeft:"-4rem",transform:u?"translate(".concat(s.x,"px, ").concat(s.y,"px) rotate(").concat(s.rot,"deg)"):"translate(0,0) rotate(0deg) scale(.8)",opacity:u?1:0,zIndex:u?5+t:1,boxShadow:"0 18px 40px -18px rgba(0,0,0,.5)",transition:"transform .55s cubic-bezier(.2,1.2,.4,1) ".concat(40*t,"ms, opacity .4s ").concat(40*t,"ms"),cursor:u?"zoom-in":"default",pointerEvents:u?"auto":"none",background:"transparent"},children:(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"w-full h-full object-cover",draggable:!1})},e.id||t)}),(0,ea.jsx)("div",{className:"absolute bottom-0 left-1/2 rounded-2xl",style:{width:"18rem",height:"11rem",marginLeft:"-9rem",background:g,opacity:.55,zIndex:4}}),(0,ea.jsx)("button",{type:"button",onClick:()=>m(e=>!e),"aria-label":"Toggle folder",className:"absolute bottom-0 left-1/2 rounded-2xl rounded-tl-none flex items-end justify-center pb-4 cursor-pointer",style:{width:"18rem",height:"8.5rem",marginLeft:"-9rem",background:g,zIndex:10,transform:u?"rotateX(-18deg)":"rotateX(0)",transformOrigin:"bottom",transition:"transform .5s",boxShadow:"0 20px 50px -20px ".concat(g,"cc")},children:(0,ea.jsx)("span",{className:"text-white font-semibold",style:{fontSize:jy(15)},children:s.folderLabel||"Photos"})})]}),(0,ea.jsx)("p",{className:"mt-8 text-sm",style:{color:l},children:u?s.openHint||"Click a photo to view it \u2014 or the folder to close":s.closedHint||"Click the folder to open"}),null!==h&&c[h]&&(0,ea.jsxs)("div",{onClick:()=>x(null),className:"fixed inset-0 z-[9999] flex items-center justify-center p-6",style:{background:"rgba(0,0,0,0.85)"},children:[(0,ea.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),x(null)},"aria-label":"Close",className:"absolute top-5 right-5 h-11 w-11 rounded-full flex items-center justify-center text-white",style:{background:"rgba(255,255,255,0.15)"},children:(0,ea.jsx)(sr,{size:22})}),p>1&&(0,ea.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),f(-1)},"aria-label":"Previous",className:"absolute left-5 h-12 w-12 rounded-full flex items-center justify-center text-white",style:{background:"rgba(255,255,255,0.15)"},children:(0,ea.jsx)(vj,{size:26})}),(0,ea.jsx)("img",{src:c[h].imageUrl,alt:"",onClick:e=>e.stopPropagation(),className:"max-h-[85vh] max-w-[85vw] rounded-2xl object-contain",style:{boxShadow:"0 30px 80px -20px rgba(0,0,0,0.8)"}}),p>1&&(0,ea.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),f(1)},"aria-label":"Next",className:"absolute right-5 h-12 w-12 rounded-full flex items-center justify-center text-white",style:{background:"rgba(255,255,255,0.15)"},children:(0,ea.jsx)(ax,{size:26})})]})]})},eN=e=>{let{content:s,accentColor:a,headStyle:n,finalBlockStyle:l,wrapperClass:r,animationClass:i}=e;const o=()=>{const e=s.targetDate?new Date(s.targetDate).getTime():0,t=e-Date.now();if(!e||isNaN(e)||t<=0)return null;const a=Math.floor(t/1e3);return{days:Math.floor(a/86400),hours:Math.floor(a%86400/3600),minutes:Math.floor(a%3600/60),seconds:a%60}},[c,u]=(0,t.useState)(o());(0,t.useEffect)(()=>{u(o());const e=setInterval(()=>u(o()),1e3);return()=>clearInterval(e)},[s.targetDate]);const m=a||"var(--site-accent)",h=s.boxBgColor||m,x=s.boxTextColor||"#fff",p="left"===s.align?"items-start text-left":"r
2ight"===s.align?"items-end text-right":"items-center text-center",g=null===c,f=e=>{let{val:t,label:s}=e;return(0,ea.jsxs)("div",{className:"flex flex-col items-center",children:[(0,ea.jsx)("div",{className:"rounded-xl font-extrabold tabular-nums shadow-sm",style:{minWidth:"78px",padding:"16px 10px",backgroundColor:h,color:x,fontSize:jy(36),lineHeight:1},children:String(t).padStart(2,"0")}),(0,ea.jsx)("span",{className:"mt-2 text-xs uppercase tracking-wider",style:{color:"var(--site-body-color)",opacity:.7},children:s})]})};return(0,ea.jsx)("section",{className:"pt-16 pb-20 px-6 ".concat(r," ").concat(i),style:l,children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto flex flex-col ".concat(p),children:[s.heading&&(0,ea.jsx)("h2",{style:d({color:"var(--site-heading-color)",fontFamily:"var(--site-heading-font)",fontSize:jy(36),fontWeight:800,lineHeight:1.2},n||{}),children:s.heading}),s.subheading&&(0,ea.jsx)("p",{className:"mt-3 max-w-xl",style:{color:"var(--site-body-color)",opacity:.8,fontSize:jy(17)},children:s.subheading}),g?(0,ea.jsx)("div",{className:"mt-8 inline-block px-6 py-4 rounded-xl font-bold",style:{backgroundColor:m,color:"#fff",fontSize:jy(22)},children:s.expiredText||"We're live!"}):(0,ea.jsxs)("div",{className:"mt-8 flex gap-3 sm:gap-5",children:[(0,ea.jsx)(f,{val:c.days,label:"Days"}),(0,ea.jsx)(f,{val:c.hours,label:"Hours"}),(0,ea.jsx)(f,{val:c.minutes,label:"Minutes"}),(0,ea.jsx)(f,{val:c.seconds,label:"Seconds"})]}),!g&&s.buttonText&&(0,ea.jsxs)("a",{href:s.buttonUrl&&/^(https?:|\/|#|mailto:|tel:)/i.test(s.buttonUrl)?s.buttonUrl:s.buttonUrl?"https://".concat(s.buttonUrl):"#",className:"mt-8 inline-flex items-center justify-center gap-2 px-6 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(s)),style:{backgroundColor:m,color:s.buttonTextColor||"#fff",borderRadius:Yj(s.buttonRadius)},children:[sy(s)&&"left"===ay(s)&&ny(s,18),s.buttonText,sy(s)&&"right"===ay(s)&&ny(s,18)]})]})})},tN=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.steps||[]).filter(e=>e),u=s.accentColor||a,m=s.badgeColor||"#10b981";return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(i," ").concat(o),style:d(d({},r),My(s)),children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsxs)("div",{className:"text-center mb-14",children:[s.badge&&(0,ea.jsx)("span",{className:"inline-block px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wide mb-5",style:{backgroundColor:"".concat(m,"22"),color:m},children:s.badge}),s.heading&&(0,ea.jsx)("h2",{className:"max-w-2xl mx-auto",style:d({fontSize:jy(44),lineHeight:1.12},n),children:s.heading}),s.subheading&&(0,ea.jsx)("p",{className:"mt-5 max-w-xl mx-auto",style:{color:l,fontSize:jy(17),lineHeight:1.6},children:s.subheading})]}),"vertical"===s.layout?(0,ea.jsxs)("div",{className:"max-w-2xl mx-auto flex flex-col",children:[0===c.length&&(0,ea.jsx)("div",{className:"w-full rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400 py-16",children:"Add steps in the editor"}),c.map((e,t)=>(0,ea.jsxs)("div",{className:"flex gap-5",children:[(0,ea.jsxs)("div",{className:"flex flex-col items-center",children:[(0,ea.jsx)("div",{className:"flex items-center justify-center rounded-full shrink-0",style:{width:"64px",height:"64px",backgroundColor:"".concat(u,"1a"),color:u},children:(0,ea.jsx)("svg",{width:"26",height:"26",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:Ly[e.icon]||Ly.zap})})}),t<c.length-1&&(0,ea.jsx)("div",{className:"w-0.5 flex-1 my-2",style:{backgroundColor:"".concat(u,"33"),minHeight:"28px"},"aria-hidden":!0})]}),(0,ea.jsxs)("div",{className:"text-left pb-9 pt-2",children:[e.title&&(0,ea.jsx)("h3",{className:"font-bold mb-2",style:{color:"var(--site-heading-color)",fontSize:jy(21)},children:e.title}),e.description&&(0,ea.jsx)("p",{style:{color:l,fontSize:jy(15),lineHeight:1.6},children:e.description}),e.linkText&&(0,ea.jsxs)("a",{href:Ty(e.linkUrl),className:"inline-flex items-center gap-1 mt-4 font-semibold",style:{color:u},children:[e.linkText,(0,ea.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:"M9 6l6 6-6 6"})})]})]})]},e.id||t))]}):(0,ea.jsxs)("div",{className:"flex flex-col md:flex-row md:items-start justify-center gap-10 md:gap-4",children:[0===c.length&&(0,ea.jsx)("div",{className:"w-full rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400 py-16",children:"Add steps in the editor"}),c.map((e,s)=>(0,ea.jsxs)(t.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex-1 md:max-w-xs mx-auto text-center",children:[(0,ea.jsx)("div",{className:"mx-auto mb-6 flex items-center justify-center rounded-full",style:{width:"84px",height:"84px",backgroundColor:"".concat(u,"1a"),color:u},children:(0,ea.jsx)("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:Ly[e.icon]||Ly.zap})})}),e.title&&(0,ea.jsx)("h3",{className:"font-bold mb-3",style:{color:"var(--site-heading-color)",fontSize:jy(22)},children:e.title}),e.description&&(0,ea.jsx)("p",{style:{color:l,fontSize:jy(15),lineHeight:1.6},children:e.description}),e.linkText&&(0,ea.jsxs)("a",{href:Ty(e.linkUrl),className:"inline-flex items-center gap-1 mt-5 font-semibold",style:{color:u},children:[e.linkText,(0,ea.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:"M9 6l6 6-6 6"})})]})]}),s<c.length-1&&(0,ea.jsx)("div",{className:"hidden md:flex items-center justify-center",style:{paddingTop:"28px",color:"".concat(u,"80")}
2,"aria-hidden":!0,children:(0,ea.jsx)("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:"M5 12h14M13 6l6 6-6 6"})})})]},e.id||s))]})]})})},sN=e=>{let{content:s,accent:a,headStyle:n,subColor:l,finalBlockStyle:r,wrapperClass:i,animationClass:o}=e;const c=(s.steps||[]).filter(e=>e),u=s.accentColor||a,m=s.badgeColor||"#10b981",h=s.buttonColor||u;return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(i," ").concat(o),style:d(d({},r),My(s)),children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsxs)("div",{className:"text-center mb-14",children:[s.badge&&(0,ea.jsx)("span",{className:"inline-block px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wide mb-5",style:{backgroundColor:"".concat(m,"22"),color:m},children:s.badge}),s.heading&&(0,ea.jsx)("h2",{className:"max-w-2xl mx-auto",style:d({fontSize:jy(44),lineHeight:1.12},n),children:s.heading}),s.subheading&&(0,ea.jsx)("p",{className:"mt-5 max-w-xl mx-auto",style:{color:l,fontSize:jy(17),lineHeight:1.6},children:s.subheading})]}),"vertical"===s.layout?(0,ea.jsxs)("div",{className:"max-w-2xl mx-auto flex flex-col",children:[0===c.length&&(0,ea.jsx)("div",{className:"w-full rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400 py-16",children:"Add steps in the editor"}),c.map((e,t)=>(0,ea.jsxs)("div",{className:"flex gap-5",children:[(0,ea.jsxs)("div",{className:"flex flex-col items-center",children:[(0,ea.jsx)("span",{className:"shrink-0 h-9 w-9 rounded-lg flex items-center justify-center text-sm font-bold",style:{backgroundColor:"".concat(u,"1a"),color:u},children:t+1}),t<c.length-1&&(0,ea.jsx)("div",{className:"w-0.5 flex-1 my-2",style:{backgroundColor:"".concat(u,"33"),minHeight:"24px"},"aria-hidden":!0})]}),(0,ea.jsxs)("div",{className:"flex-1 rounded-2xl p-5 mb-4",style:{background:"var(--site-card-bg,#fff)",border:"1px solid ".concat(u,"22"),boxShadow:"0 14px 44px -30px ".concat(u,"88")},children:[e.title&&(0,ea.jsx)("h3",{className:"font-bold mb-2",style:{color:"var(--site-heading-color)",fontSize:jy(19)},children:e.title}),e.description&&(0,ea.jsx)("p",{style:{color:l,fontSize:jy(14),lineHeight:1.6},children:e.description})]})]},e.id||t))]}):(0,ea.jsxs)("div",{className:"flex flex-col md:flex-row items-stretch justify-center",children:[0===c.length&&(0,ea.jsx)("div",{className:"w-full rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400 py-16",children:"Add steps in the editor"}),c.map((e,s)=>(0,ea.jsxs)(t.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex-1 rounded-2xl p-6",style:{background:"var(--site-card-bg,#fff)",border:"1px solid ".concat(u,"22"),boxShadow:"0 14px 44px -30px ".concat(u,"88")},children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-3",children:[e.title&&(0,ea.jsx)("h3",{className:"font-bold",style:{color:"var(--site-heading-color)",fontSize:jy(19)},children:e.title}),(0,ea.jsx)("span",{className:"shrink-0 h-7 w-7 rounded-md flex items-center justify-center text-sm font-bold",style:{backgroundColor:"".concat(u,"1a"),color:u},children:s+1})]}),e.description&&(0,ea.jsx)("p",{style:{color:l,fontSize:jy(14),lineHeight:1.6},children:e.description})]}),s<c.length-1&&(0,ea.jsx)("div",{className:"hidden md:block self-center shrink-0",style:{width:"28px",height:"2px",backgroundColor:"".concat(u,"44")},"aria-hidden":!0})]},e.id||s))]}),s.buttonText&&(0,ea.jsx)("div",{className:"text-center mt-12",children:(0,ea.jsxs)("a",{href:Ty(s.buttonUrl),className:"inline-flex items-center justify-center gap-2 px-8 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(s)),style:{backgroundColor:h,color:s.buttonTextColor||"#fff",borderRadius:Yj(s.buttonRadius)},children:[sy(s)&&"left"===ay(s)&&ny(s,18),s.buttonText,sy(s)&&"right"===ay(s)&&ny(s,18)]})})]})})},aN=e=>{let{content:t,accent:s,headStyle:a,subColor:n,finalBlockStyle:l,wrapperClass:r,animationClass:i}=e;const o=(t.steps||[]).filter(e=>e),c=t.accentColor||s,u="left"!==t.imagePosition,m=(0,ea.jsxs)("div",{children:[t.heading&&(0,ea.jsx)("h2",{className:"mb-8",style:d({fontSize:jy(36),lineHeight:1.15},a),children:t.heading}),t.subheading&&(0,ea.jsx)("p",{className:"mb-8 -mt-4",style:{color:n,fontSize:jy(16),lineHeight:1.6},children:t.subheading}),(0,ea.jsxs)("div",{className:"grid sm:grid-cols-2 gap-x-8 gap-y-2",children:[0===o.length&&(0,ea.jsx)("div",{className:"col-span-2 rounded-xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400 py-12",children:"Add steps"}),o.map((e,t)=>(0,ea.jsxs)("div",{className:"rounded-xl p-4",style:{background:e.highlight?"".concat(c,"12"):"transparent"},children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)("span",{className:"h-6 w-6 rounded-md flex items-center justify-center text-xs font-bold text-white shrink-0",style:{backgroundColor:e.badgeColor||c},children:t+1}),e.title&&(0,ea.jsx)("h3",{className:"font-bold",style:{color:"var(--site-heading-color)",fontSize:jy(18)},children:e.title})]}),e.description&&(0,ea.jsx)("p",{style:{color:n,fontSize:jy(14),lineHeight:1.65},children:e.description})]},e.id||t))]})]},"steps"),h=t.imageUrl?(0,ea.jsx)("img",{src:t.imageUrl,alt:"",className:"w-full object-cover rounded-2xl",style:{maxHeight:"560px"}},"img"):(0,ea.jsx)("div",{className:"rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",style:{minHeight:"340px"},children:"Add an image"},"img");return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(r," ").concat(i),style:d(d({},l),My(t)),children:(0,ea.jsx)("div",{className:"max-w-6xl mx-auto grid lg:grid-cols-2 gap-12 items-center",children:u?[m,h]:[h,m]})})},nN=e=>{let{content:t,accent:s,headStyle:a,subColor:n,finalBlockStyle:l,wrapperClass:r,animationClass:i}=e;const o=(t.steps||[]).filter(e=>e),c=t.accentColor||s,u="left"!==t.imagePosition,m=(0,ea.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:"M12 5v14M6 13l6 6 6-6"})}),h=(0,ea.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("path",{d:"M20 6L9 17l-5-5"})}),x=(e,t,s,a,l)=>(0,ea.jsxs)("div",{className:"flex gap-4",children:[(0,ea.jsxs)("div",{className:"flex flex-col items-center",children:[(0,ea.jsx)("div",{className:"h-9 w-9 rounded-full border flex items-center justify-center shrink-0",style:{borderColor:"".concat(c,"55"),color:c,background:"var(--site-card-bg,#fff)"},children:e}),!a&&(0,ea.jsx)("div",{className:"w-0.5 flex-1 my-1",style:{backgroundColor:"".concat(c,"33"),minHeight:"38px"},"aria-hidden":!0})]}),(0,ea.jsxs)("div",{className:a?"pb-1 pt-1":"pb-8 pt-1",children:[(0,ea.jsx)("h3",{className:"font-bold mb-1",style:{color:"var(--site-heading-color)",fontSize:jy(18)},children:t}),s&&(0,ea.jsx)("p",{style:{color:n,fontSize:jy(14),lineHeight:1.65},children:s})]})]},l),p=(0,ea.jsxs)("div",{children:[t.heading&&(0,ea.jsx)("h2",{className:"mb-8",style:d({fontSize:jy(36),lineHeight:1.15},a),children:t.heading}),0===o.length&&!t.showSuccess&&(0,ea.jsx)("div",{className:"rounded-xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400 py-12",children:"Add steps"}),o.map((e,s)=>x(m,e.title,e.description,!t.showSuccess&&s===o.length-1,e.id||s)),t.showSuccess&&x(h,t.successLabel||"Success","",!0,"success")]},"steps"),g=t.imageUrl?(0,ea.jsx)("img",{src:t.imageUrl,alt:"",className:"w-full object-cover rounded-2xl",style:{maxHeight:"620px"}},"img"):(0,ea.jsx)("div",{className:"rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",style:{minHeight:"340px"},children:"Add an image"},"img");return(0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(r," ").concat(i),style:d(d({},l),My(t)),children:(0,ea.jsx)("div",{className:"max-w-6xl mx-auto grid lg:grid-cols-2 gap-12 items-center",children:u?[p,g]:[g,p]})})},lN=e=>{let{content:s,finalBlockStyle:a,wrapperClass:n,animationClass:l}=e;const[r,i]=(0,t.useState)(null!=s.startPosition?Number(s.startPosition):50);(0,t.useEffect)(()=>{null!=s.startPosition&&""!==s.startPosition&&i(Number(s.startPosition))},[s.startPosition]);const o=(e,t)=>{const s=t.getBoundingClientRect();let a=(e-s.left)/s.width*100;i(Math.max(0,Math.min(100,a)))},c=s.height||420,d=s.beforeImage,u=s.afterImage;return(0,ea.jsx)("section",{className:"py-6 px-4 md:py-12 md:px-6 ".concat(n," ").concat(l),style:a,children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[s.heading&&(0,ea.jsx)("h2",{className:"mb-6",style:{color:"var(--site-heading-color)",fontFamily:"var(--site-heading-font)",fontSize:jy(32),fontWeight:700,textAlign:"center",lineHeight:1.2},children:s.heading}),d||u?(0,ea.jsxs)("div",{className:"relative w-full overflow-hidden rounded-xl select-none",style:{height:"".concat(c,"px"),cursor:"ew-resize",backgroundColor:"#0f172a"},onMouseMove:e=>{1===e.buttons&&o(e.clientX,e.currentTarget)},onMouseDown:e=>o(e.clientX,e.currentTarget),onTouchMove:e=>o(e.touches[0].clientX,e.currentTarget),children:[u&&(0,ea.jsx)("img",{src:u,alt:s.afterLabel||"After",className:"absolute inset-0 w-full h-full object-cover",draggable:!1}),d&&(0,ea.jsx)("img",{src:d,alt:s.beforeLabel||"Before",className:"absolute inset-0 w-full h-full object-cover",draggable:!1,style:{clipPath:"inset(0 ".concat(100-r,"% 0 0)")}}),s.beforeLabel&&(0,ea.jsx)("span",{className:"absolute bottom-3 left-3 px-2.5 py-1 rounded-md text-xs font-semibold",style:{backgroundColor:"rgba(0,0,0,.6)",color:"#fff"},children:s.beforeLabel}),s.afterLabel&&(0,ea.jsx)("span",{className:"absolute bottom-3 right-3 px-2.5 py-1 rounded-md text-xs font-semibold",style:{backgroundColor:"rgba(0,0,0,.6)",color:"#fff"},children:s.afterLabel}),(0,ea.jsx)("div",{className:"absolute top-0 bottom-0",style:{left:"".concat(r,"%"),width:"2px",backgroundColor:"#fff",transform:"translateX(-1px)"},children:(0,ea.jsxs)("div",{className:"absolute top-1/2 left-1/2 flex items-center justify-center rounded-full shadow-lg",style:{width:"40px",height:"40px",transform:"translate(-50%,-50%)",backgroundColor:"#fff",color:"#0f172a"},children:[(0,ea.jsx)(vj,{size:16}),(0,ea.jsx)(ax,{size:16})]})})]}):(0,ea.jsx)("div",{className:"p-10 bg-slate-50 border-2 border-dashed border-slate-200 rounded-xl text-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"Add a \u201cbefore\u201d and \u201cafter\u201d image to enable the slider"})})]})})},rN=e=>{let{content:s={},styles:a={},wrapperClass:n="",animationClass:l="",blockStyle:r={},tenantId:i,subdomain:o}=e;const c=o||i,u=a.accentColor||"#6366f1",[m,h]=(0,t.useState)([]),[x,p]=(0,t.useState)(!0),[g,f]=(0,t.useState)(s.defaultView||"calendar"),[v,b]=(0,t.useState)(new Date),[j,y]=(0,t.useState)(null),[N,w]=(0,t.useState)({name:"",email:"",party_size:1}),[C,k]=(0,t.useState)(null),[D,_]=(0,t.useState)(null),[S,E]=(0,t.useState)(!1),[A,F]=(0,t.useState)({name:"",email:"",party_size:1}),[T,z]=(0,t.useState)(null),[M,P]=(0,t.useState)(null),[B,R]=(0,t.useState)(!1);(0,t.useEffect)(()=>
2{if(!c)return void p(!1);let e=!0;const t=s.groupId?"?group_id=".concat(encodeURIComponent(s.groupId)):"";return fetch("".concat(uy,"/api/public/events/").concat(c).concat(t)).then(e=>e.ok?e.json():Promise.reject()).then(t=>{if(!e)return;const s=t.events||[];h(s);const a=Date.now(),n=s.filter(e=>e.start&&new Date(e.start).getTime()>=a).sort((e,t)=>new Date(e.start)-new Date(t.start))[0]||s[s.length-1];null!==n&&void 0!==n&&n.start&&b(new Date(n.start))}).catch(()=>{}).finally(()=>e&&p(!1)),()=>{e=!1}},[c,s.groupId]),(0,t.useEffect)(()=>{if(!j)return;const e=e=>{"Escape"===e.key&&y(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[j]);const L=e=>{y(e),w({name:"",email:"",party_size:1}),k(null),_(null),F({name:"",email:"",party_size:1}),z(null),P(null)},I=v.getFullYear(),O=v.getMonth(),U=new Date(I,O,1).getDay(),H=new Date(I,O+1,0).getDate(),W=[];for(let t=0;t<U;t++)W.push(null);for(let t=1;t<=H;t++)W.push(new Date(I,O,t));for(;W.length%7!==0;)W.push(null);const V={};m.forEach(e=>{if(e.start){const t=new Date(e.start).toDateString();(V[t]=V[t]||[]).push(e)}});const q=v.toLocaleDateString(void 0,{month:"long",year:"numeric"}),$=new Date;$.setHours(0,0,0,0);const G=m.filter(e=>e.start&&new Date(e.start)>=$).sort((e,t)=>new Date(e.start)-new Date(t.start)).slice(0,s.limit||10),K="".concat(uy,"/api/public/events/").concat(c,"/calendar.ics");return(0,ea.jsxs)("div",{className:"".concat(n," ").concat(l),style:r,"data-testid":"events-calendar-block",children:[(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-5",children:[s.title?(0,ea.jsx)("h2",{className:"text-2xl font-bold",style:{color:a.headingColor||"inherit"},children:s.title}):(0,ea.jsx)("span",{}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("div",{className:"inline-flex rounded-lg border border-slate-200 p-0.5 bg-white",children:[(0,ea.jsx)("button",{onClick:()=>f("calendar"),className:"px-3 py-1.5 text-sm rounded-md",style:"calendar"===g?{background:u,color:"#fff"}:{color:"#475569"},"data-testid":"events-block-view-calendar",children:"Calendar"}),(0,ea.jsx)("button",{onClick:()=>f("list"),className:"px-3 py-1.5 text-sm rounded-md",style:"list"===g?{background:u,color:"#fff"}:{color:"#475569"},"data-testid":"events-block-view-list",children:"List"})]}),!1!==s.showIcal&&c&&(0,ea.jsxs)("a",{href:K,className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg border border-slate-200 bg-white text-sm text-slate-700 hover:bg-slate-50","data-testid":"events-block-ical-link",children:[(0,ea.jsx)(jj,{className:"w-4 h-4"})," iCal"]})]})]}),x?(0,ea.jsx)("div",{className:"py-16 text-center text-slate-400 text-sm",children:"Loading events\u2026"}):0===m.length?(0,ea.jsxs)("div",{className:"py-16 text-center text-slate-400 bg-slate-50 rounded-xl border border-slate-200",children:[(0,ea.jsx)(yj,{className:"w-10 h-10 mx-auto mb-3 opacity-40"})," No upcoming events."]}):"calendar"===g?(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-4",children:[(0,ea.jsx)("button",{onClick:()=>b(new Date(I,O-1,1)),className:"p-2 rounded-lg hover:bg-slate-100","data-testid":"events-block-prev",children:(0,ea.jsx)(vj,{className:"w-5 h-5"})}),(0,ea.jsx)("h3",{className:"text-lg font-semibold w-48 text-center",children:q}),(0,ea.jsx)("button",{onClick:()=>b(new Date(I,O+1,1)),className:"p-2 rounded-lg hover:bg-slate-100","data-testid":"events-block-next",children:(0,ea.jsx)(ax,{className:"w-5 h-5"})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-7 gap-px bg-slate-200 rounded-lg overflow-hidden border border-slate-200",children:[["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(e=>(0,ea.jsx)("div",{className:"bg-slate-50 text-center text-xs font-semibold text-slate-500 py-2",children:e},e)),W.map((e,t)=>{const s=e&&V[e.toDateString()]||[],a=e&&e.toDateString()===(new Date).toDateString();return(0,ea.jsx)("div",{className:"bg-white min-h-[92px] p-1.5 ".concat(e?"":"bg-slate-50/40"),children:e&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"text-xs font-medium mb-1",style:a?{background:u,color:"#fff",borderRadius:"9999px",width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"}:{color:"#64748b"},children:e.getDate()}),(0,ea.jsx)("div",{className:"space-y-1",children:s.map(e=>(0,ea.jsx)("button",{onClick:()=>L(e),className:"w-full text-left text-[11px] leading-tight px-1.5 py-0.5 rounded truncate text-white hover:opacity-90",style:{backgroundColor:e.color||u},title:e.title,"data-testid":"events-block-day-event-".concat(e.event_id),children:e.title},e.event_id))})]})},t)})]})]}):(0,ea.jsx)("div",{className:"space-y-3",children:G.map(e=>(0,ea.jsxs)("button",{onClick:()=>L(e),className:"w-full text-left bg-white rounded-xl border border-slate-200 p-4 flex items-center gap-4 hover:shadow-md transition-shadow","data-testid":"events-block-list-event-".concat(e.event_id),children:[(0,ea.jsxs)("div",{className:"flex flex-col items-center justify-center w-14 shrink-0",children:[(0,ea.jsx)("span",{className:"text-xs uppercase text-slate-400",children:new Date(e.start).toLocaleDateString(void 0,{month:"short"})}),(0,ea.jsx)("span",{className:"text-2xl font-bold text-slate-900",children:new Date(e.start).getDate()})]}),(0,ea.jsx)("div",{className:"w-1 self-stretch rounded-full",style:{backgroundColor:e.color||u}}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:e.title}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-slate-500 mt-1",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Kg,{className:"w-3 h-3"}),e.all_day?"All day":new Date(e.start).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),e.location&&(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Ql,{className:"w-3 h-3"}),e.location]}),e.rsvp_enabled&&(0,ea.jsx)("span",{style:{color:u},children:e.rsvp_full?"Fully booked":"RSVP"})]})]})]},e.event_id))})]}),j&&(0,ea.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4",onClick:()=>y(null),children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":j.title,"data-testid":"events-block-modal",children:[(0,ea.jsx)("div",{className:"h-2",style:{backgroundColor:j.color||u}}),(0,ea.jsxs)("div",{className:"p-6",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ea.jsx)("h3",{className:"text-2xl font-bold text-slate-900",children:j.title}),(0,ea.jsx)("button",{onClick:()=>y(null),className:"text-slate-400 hover:text-slate-600","aria-label":"Close","data-testid":"events-block-modal-close",children:(0,ea.jsx)(sr,{className:"w-5 h-5"})})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-x-5 gap-y-2 text-sm text-slate-600 mt-3",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Kg,{className:"w-4 h-4 text-slate-400"}),j.all_day?new Date(j.start).toLocaleDateString():new Date(j.start).toLocaleStr
2ing()]}),j.location&&(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Ql,{className:"w-4 h-4 text-slate-400"}),j.location]})]}),j.description_html&&(0,ea.jsx)("div",{className:"prose prose-sm max-w-none mt-4",dangerouslySetInnerHTML:{__html:j.description_html}}),(0,ea.jsx)("div",{className:"mt-5",children:(0,ea.jsxs)("a",{href:"".concat(uy,"/api/public/events/").concat(c,"/").concat(j.event_id,".ics"),className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg text-white text-sm font-medium",style:{background:u},"data-testid":"events-block-modal-ics",children:[(0,ea.jsx)(jj,{className:"w-4 h-4"})," Add to calendar"]})}),!1!==s.showRsvp&&j.rsvp_enabled&&(0,ea.jsxs)("div",{className:"mt-6 border-t border-slate-100 pt-5","data-testid":"events-block-rsvp-section",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsx)("h4",{className:"text-base font-semibold text-slate-900",children:"Register / RSVP"}),null!=j.spots_left&&(0,ea.jsx)("span",{className:"text-sm font-medium ".concat(j.rsvp_full?"text-red-600":"text-emerald-600"),"data-testid":"events-block-spots",children:j.rsvp_full?"Fully booked":"".concat(j.spots_left," spot").concat(1===j.spots_left?"":"s"," left")})]}),C?(0,ea.jsxs)("div",{className:"bg-emerald-50 border border-emerald-100 rounded-xl p-4 text-center","data-testid":"events-block-rsvp-success",children:[(0,ea.jsx)("p",{className:"font-semibold text-emerald-800",children:"You're registered! \ud83c\udf89"}),(0,ea.jsxs)("p",{className:"text-sm text-emerald-700 mt-1",children:["A confirmation has been emailed to ",N.email,"."]}),C.cancel_token&&(0,ea.jsxs)("p",{className:"text-sm text-emerald-700 mt-2",children:["Can't make it later? ",(0,ea.jsx)("a",{href:"/site/".concat(o||c,"/events/rsvp/").concat(C.cancel_token),className:"underline font-medium",children:"Cancel your RSVP"}),"."]})]}):j.rsvp_full?j.waitlist_enabled?T?(0,ea.jsxs)("div",{className:"bg-amber-50 border border-amber-100 rounded-xl p-4 text-center","data-testid":"events-block-waitlist-success",children:[(0,ea.jsx)("p",{className:"font-semibold text-amber-800",children:"You're on the waitlist \u2713"}),(0,ea.jsxs)("p",{className:"text-sm text-amber-700 mt-1",children:["We'll email you a claim link if a spot opens up",T.position?" \u2014 you're #".concat(T.position," in line"):"","."]})]}):j.waitlist_full?(0,ea.jsx)("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-4 text-center text-slate-500 text-sm",children:"Event and waitlist are both full."}):(0,ea.jsxs)("div",{className:"bg-amber-50/60 border border-amber-100 rounded-xl p-4 space-y-3","data-testid":"events-block-waitlist-form",children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-amber-900",children:"This event is full \u2014 join the waitlist."}),M&&(0,ea.jsx)("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-3 py-2","data-testid":"events-block-waitlist-error",children:M}),(0,ea.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,ea.jsx)("input",{value:A.name,onChange:e=>F(t=>d(d({},t),{},{name:e.target.value})),placeholder:"Your name",className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"events-block-waitlist-name"}),(0,ea.jsx)("input",{type:"email",value:A.email,onChange:e=>F(t=>d(d({},t),{},{email:e.target.value})),placeholder:"Email",className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"events-block-waitlist-email"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Party size"}),(0,ea.jsx)("input",{type:"number",min:"1",value:A.party_size,onChange:e=>F(t=>d(d({},t),{},{party_size:e.target.value})),className:"w-24 border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"events-block-waitlist-party"})]}),(0,ea.jsx)("button",{onClick:async()=>{if(A.name.trim()&&A.email.trim()){R(!0),P(null);try{const e=await fetch("".concat(uy,"/api/public/events/").concat(c,"/").concat(j.event_id,"/waitlist"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d(d({},A),{},{party_size:parseInt(A.party_size,10)||1}
2))}),t=await e.json();if(!e.ok)return void P(t.detail||"Could not join the waitlist");z(t)}catch(G2){P("Something went wrong. Please try again.")}finally{R(!1)}}else P("Please enter your name and email.")},disabled:B,className:"px-5 py-2.5 rounded-lg text-white text-sm font-medium disabled:opacity-60",style:{background:"#d97706"},"data-testid":"events-block-waitlist-submit",children:B?"Joining\u2026":"Join the waitlist"})]}):(0,ea.jsx)("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-4 text-center text-slate-500 text-sm",children:"This event is fully booked."}):(0,ea.jsxs)("div",{className:"space-y-3",children:[D&&(0,ea.jsx)("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-3 py-2","data-testid":"events-block-rsvp-error",children:D}),(0,ea.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,ea.jsx)("input",{value:N.name,onChange:e=>w(t=>d(d({},t),{},{name:e.target.value})),placeholder:"Your name",className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"events-block-rsvp-name"}),(0,ea.jsx)("input",{type:"email",value:N.email,onChange:e=>w(t=>d(d({},t),{},{email:e.target.value})),placeholder:"Email",className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"events-block-rsvp-email"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Party size"}),(0,ea.jsx)("input",{type:"number",min:"1",max:null!=j.spots_left?j.spots_left:void 0,value:N.party_size,onChange:e=>w(t=>d(d({},t),{},{party_size:e.target.value})),className:"w-24 border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"events-block-rsvp-party"})]}),(0,ea.jsx)("button",{onClick:async()=>{if(N.name.trim()&&N.email.trim()){E(!0),_(null);try{const e=await fetch("".concat(uy,"/api/public/events/").concat(c,"/").concat(j.event_id,"/rsvp"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d(d({},N),{},{party_size:parseInt(N.party_size,10)||1}))}),t=await e.json();if(!e.ok)return void _(t.detail||"Could not register");k(t);const a=s.groupId?"?group_id=".concat(encodeURIComponent(s.groupId)):"";fetch("".concat(uy,"/api/public/events/").concat(c).concat(a)).then(e=>e.json()).then(e=>{const t=e.events||[];h(t);const s=t.find(e=>e.event_id===j.event_id);s&&y(s)}).catch(()=>{})}catch(G2){_("Registration failed. Please try again.")}finally{E(!1)}}else _("Please enter your name and email.")},disabled:S,className:"block px-5 py-2.5 rounded-lg text-white text-sm font-medium disabled:opacity-60",style:{background:u},"data-testid":"events-block-rsvp-submit",children:S?"Registering\u2026":"Register"})]})]})]})]})})]})},iN=e=>{var s;let{content:a,styles:n={},wrapperClass:l,animationClass:r,blockStyle:i,tenantId:o,currentLanguage:c,defaultLanguage:u="en"}=e;const[m,h]=(0,t.useState)([]),[x,p]=(0,t.useState)(null),[g,f]=(0,t.useState)(!0),[v,b]=(0,t.useState)(!1),[j,y]=(0,t.useState)(""),[N,w]=(0,t.useState)("all"),[C,k]=(0,t.useState)([]),[D,_]=(0,t.useState)(1),[S,E]=(0,t.useState)(0),[A,F]=(0,t.useState)(null),[T,z]=(0,t.useState)(null),[M,P]=(0,t.useState)(!1),[B,R]=(0,t.useState)(o||null),[L,I]=(0,t.useState)(null),[O,U]=(0,t.useState)(!1);t.useEffect(()=>{if(!A||!c||c===u)return void z(null);(async()=>{P(!0);try{if(A.content_html){const e=await fetch("".concat(uy,"/api/translation/translate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:A.content_html,target_language:c,source_language:u,preserve_html:!0})});if(e.ok){const t=await e.json();if(t.translated_text)return void z({type:"html",content:t.translated_text})}}if(A.blocks&&A.blocks.length>0){const e=await fetch("".concat(uy,"/api/translation/translate-blocks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blocks:A.blocks,target_language:c,tenant_id:B,source_language:u})});if(e.ok){const t=await e.json();t.translated_blocks&&z({type:"blocks",content:t.translated_blocks})}}}catch(K2){console.error("[ArticleFeed] Article translation error:",K2)}finally{P(!1)}})()},[A,c,u,B]);const H=e=>{const t=(null===e||void 0===e?void 0:e.slug)||(null===e||void 0===e?void 0:e.article_id);if(!t)return null;const s=window.location.hostname,a=s.includes("emergentagent.com")||s.includes("localhost")||/^\d+\.\d+\.\d+\.\d+$/.test(s),n=!s.includes("nexuscms")&&!a;return a&&L?"".concat(window.location.origin,"/site/").concat(L,"/article/").concat(t):n||L?"".concat(window.location.origin,"/article/").concat(t):null};t.useEffect(()=>{if(o)return void R(o);(async()=>{try{const e=localStorage.getItem("user");if(e){const t=JSON.parse(e);if(t.tenant_id)return void R(t.tenant_id)}}catch(G2){console.error("Failed to get tenant ID:",G2)}})()},[o]),t.useEffect(()=>{if(!B||!a.showCategoryFilter)return;(async()=>{try{const e=await fetch("".concat(uy,"/api/public/articles/").concat(B,"/categories"));if(e.ok){const t=await e.json();k(Array.isArray(t)?t.map(e=>e.name||e):[])}}catch(G2){console.error("Failed to fetch public categories:",G2)}})()},[B,a.showCategoryFilter]),t.useEffect(()=>{if(!B)return;(async()=>{try{var e;f(!0);const t=new URLSearchParams({limit:String(a.enablePagination?a.perPage||6:a.limit||6
2),offset:String((D-1)*(a.perPage||6))});N&&"all"!==N?t.append("category",N):(null===(e=a.categoryFilters)||void 0===e?void 0:e.length)>0?t.append("category",a.categoryFilters.join(",")):a.categoryFilter&&t.append("category",a.categoryFilter),j&&t.append("search",j);const s=await fetch("".concat(uy,"/api/public/articles/").concat(B,"?").concat(t)),n=await s.json();if(h(n.articles||[]),E(n.total||0),n.subdomain)I(n.subdomain);else try{const e=await fetch("".concat(uy,"/api/public/tenant/").concat(B,"/info"));if(e.ok){const t=await e.json();I(t.subdomain||t.site_slug)}}catch(G2){console.log("Could not fetch tenant info for URL generation")}}catch(t){console.error("Failed to fetch articles:",t),h([])}finally{f(!1)}})()},[B,a.categoryFilter,a.categoryFilters,a.limit,a.perPage,a.enablePagination,D,j,N]),t.useEffect(()=>{(async()=>{if(c&&c!==u&&0!==m.length){b(!0);try{const e=m.map(async e=>{try{const l=await fetch("".concat(uy,"/api/translation/translate-blocks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blocks:[{type:"text",content:{text:e.title||""}},{type:"text",content:{text:e.excerpt||""}}],target_language:c,tenant_id:B})});if(l.ok){const r=await l.json();var t,s,a,n;if(r.translated_blocks&&r.translated_blocks.length>=2)return d(d({},e),{},{title:(null===(t=r.translated_blocks[0])||void 0===t||null===(s=t.content)||void 0===s?void 0:s.text)||e.title,excerpt:(null===(a=r.translated_blocks[1])||void 0===a||null===(n=a.content)||void 0===n?void 0:n.text)||e.excerpt})}return e}catch(G2){return console.error("Article translation failed:",G2),e}}),t=await Promise.all(e);p(t)}catch(e){console.error("Failed to translate articles:",e),p(null)}finally{b(!1)}}else p(null)})()},[m,c,u,B]);const W=x||m,V=a.layout||"grid",q=a.columns||3,$=!1!==a.showImage,G=!1!==a.showDate,K=!1!==a.showExcerpt,Y=!1!==a.showCategory,J=a.openAs||"popup",Q=n.imageHeight||"192px",X=parseInt(Q)||192,Z=e=>{if(z(null),"newpage"===J){const t=H(e);if(t)window.location.href=t;else{const t=e.slug||e.article_id;if(!t)return void F(e);const s=window.location.hostname,a=s.includes("emergentagent.com")||s.includes("localhost")||/^\d+\.\d+\.\d+\.\d+$/.test(s),n=!s.includes("nexuscms")&&!a;a&&L?window.location.href="/site/".concat(L,"/article/").concat(t):n||L?window.location.href="/article/".concat(t):F(e)}}else F(e)},ee=e=>e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"",te=a.enablePagination?Math.ceil(S/(a.perPage||6)):1;return g?(0,ea.jsx)("div",{className:"mb-8 ".concat(l," ").concat(r),style:i,children:(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})})}):B?(0,ea.jsxs)("div",{className:"mb-8 ".concat(l," ").concat(r),style:i,children:[a.heading&&(0,ea.jsx)("h2",{className:"text-2xl font-bold text-slate-800 mb-6",children:a.heading}),a.showSearch&&(0,ea.jsx)("div",{className:"mb-6",children:(0,ea.jsx)("input",{type:"text",placeholder:"Search articles...",value:j,onChange:e=>{y(e.target.value),_(1)},className:"w-full max-w-md px-4 py-2 border border-slate-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"})}),a.showCategoryFilter&&C.length>0&&(0,ea.jsxs)("div",{className:"mb-6 flex flex-wrap gap-2","data-testid":"public-category-filter",children:[(0,ea.jsx)("button",{onClick:()=>{w("all"),_(1)},className:"px-4 py-2 rounded-full text-sm font-medium transition-all ".concat("all"===N?"bg-slate-800 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"),"data-testid":"category-filter-all",children:"All"}),C.map(e=>(0,ea.jsx)("button",{onClick:()=>{w(e),_(1)},className:"px-4 py-2 rounded-full text-sm font-medium transition-all ".concat(N===e?"bg-slate-800 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"),"data-testid":"category-filter-".concat(e.toLowerCase().replace(/\s+/g,"-")),children:e},e))]}),v&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 mb-4",children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-indigo-600"}),(0,ea.jsx)("span",{children:"Translating..."})]}),0===W.length?(0,ea.jsx)("div",{className:"p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"No articles found"})}):"grid"===V?(0,ea.jsx)("div",{className:"grid gap-6 ".concat(2===q?"grid-cols-1 md:grid-cols-2":4===q?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),children:W.map(e=>{var t;return(0,ea.jsxs)("div",{onClick:()=>Z(e),className:"bg-white border border-slate-200 rounded-lg overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",children:[$&&e.image_url&&e.show_image_in_feed&&(0,ea.jsx)("img",{src:e.image_url,alt:e.image_alt||e.title,className:"w-full object-top ".concat("contain"===e.image_fit?"object-contain bg-slate-100":"object-cover"),style:{height:"".concat(X,"px")}
2}),(0,ea.jsxs)("div",{className:"p-4",children:[Y&&((null===(t=e.categories)||void 0===t?void 0:t.length)>0||e.category)&&(0,ea.jsx)("div",{className:"flex flex-wrap gap-1 mb-2",children:(e.categories||(e.category?[e.category]:[])).map((e,t)=>(0,ea.jsx)("span",{className:"inline-block px-2 py-1 text-xs font-medium bg-indigo-100 text-indigo-700 rounded",children:e},t))}),(0,ea.jsx)("h3",{className:"font-semibold text-slate-800 mb-2 line-clamp-2",children:e.title}),G&&e.show_date&&e.date&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-2",children:ee(e.date)}),K&&e.excerpt&&(0,ea.jsx)("p",{className:"text-sm text-slate-600 line-clamp-3",children:e.excerpt})]})]},e.article_id)})}):(0,ea.jsx)("div",{className:"space-y-4",children:W.map(e=>{var t;return(0,ea.jsxs)("div",{onClick:()=>Z(e),className:"flex gap-4 bg-white border border-slate-200 rounded-lg overflow-hidden cursor-pointer hover:shadow-lg transition-shadow p-4",children:[$&&e.image_url&&e.show_image_in_feed&&(0,ea.jsx)("img",{src:e.image_url,alt:e.image_alt||e.title,className:"w-32 h-24 rounded flex-shrink-0 ".concat("contain"===e.image_fit?"object-contain bg-slate-100":"object-cover object-top")}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsxs)("div",{className:"flex items-start gap-2 mb-1 flex-wrap",children:[Y&&((null===(t=e.categories)||void 0===t?void 0:t.length)>0||e.category)&&(e.categories||(e.category?[e.category]:[])).map((e,t)=>(0,ea.jsx)("span",{className:"inline-block px-2 py-0.5 text-xs font-medium bg-indigo-100 text-indigo-700 rounded flex-shrink-0",children:e},t)),G&&e.show_date&&e.date&&(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:ee(e.date)})]}),(0,ea.jsx)("h3",{className:"font-semibold text-slate-800 mb-1 line-clamp-1",children:e.title}),K&&e.excerpt&&(0,ea.jsx)("p",{className:"text-sm text-slate-600 line-clamp-2",children:e.excerpt})]})]},e.article_id)})}),a.enablePagination&&te>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-center gap-2 mt-6",children:[(0,ea.jsx)("button",{onClick:()=>_(e=>Math.max(1,e-1)),disabled:1===D,className:"px-3 py-1 text-sm border border-slate-300 rounded disabled:opacity-50 hover:bg-slate-50",children:"Previous"}),(0,ea.jsxs)("span",{className:"text-sm text-slate-600",children:["Page ",D," of ",te]}),(0,ea.jsx)("button",{onClick:()=>_(e=>Math.min(te,e+1)),disabled:D===te,className:"px-3 py-1 text-sm border border-slate-300 rounded disabled:opacity-50 hover:bg-slate-50",children:"Next"})]}),A&&(0,ea.jsx)("div",{className:"fixed inset-0 bg-black/50 z-[70] flex items-center justify-center p-4",onClick:()=>{F(null),z(null)},children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl max-w-3xl w-full max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,ea.jsxs)("div",{className:"sticky top-0 z-10 bg-white border-b border-slate-200 px-6 py-4 flex items-center justify-between shadow-sm",children:[(0,ea.jsx)("h2",{className:"text-xl font-bold text-slate-800 line-clamp-1",children:A.title}),(0,ea.jsx)("button",{onClick:()=>{F(null),z(null)},className:"p-2 hover:bg-slate-100 rounded-full transition-colors",children:(0,ea.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,ea.jsxs)("div",{className:"p-6",children:[A.image_url&&(0,ea.jsx)("img",{src:A.image_url,alt:A.image_alt||A.title,className:"w-full max-h-96 object-contain rounded-lg mb-6"}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-4 flex-wrap",children:[((null===(s=A.categories)||void 0===s?void 0:s.length)>0||A.category)&&(A.categories||(A.category?[A.category]:[])).map((e,t)=>(0,ea.jsx)("span",{className:"px-3 py-1 text-sm font-medium bg-indigo-100 text-indigo-700 rounded-full",children:e},t)),A.show_date&&A.date&&(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:ee(A.date)})]}),M&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 mb-4",children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-indigo-600"}),(0,ea.jsx)("span",{children:"Translating article..."})]}),"html"===(null===T||void 0===T?void 0:T.type)?(0,ea.jsx)("div",{className:"prose prose-slate max-w-none article-content-links",dangerouslySetInnerHTML:{__html:T.content}}):"blocks"===(null===T||void 0===T?void 0:T.type)?(0,ea.jsx)("div",{className:"article-blocks-content",children:(0,ea.jsx)(oN,{blocks:T.content,isQuickPreview:!0,showNavigation:!1,siteTheme:{}})}):A.content_html?(0,ea.jsx)("div",{className:"prose prose-slate max-w-none article-content-links",dangerouslySetInnerHTML:{__html:A.content_html}}
2):A.blocks&&A.blocks.length>0?(0,ea.jsx)("div",{className:"article-blocks-content",children:(0,ea.jsx)(oN,{blocks:A.blocks,isQuickPreview:!0,showNavigation:!1,siteTheme:{}})}):(0,ea.jsx)("p",{className:"text-slate-500 italic",children:"No content available for this article."}),H(A)&&(0,ea.jsxs)("div",{className:"mt-8 pt-6 border-t border-slate-200",children:[(0,ea.jsx)("h4",{className:"text-sm font-medium text-slate-700 mb-3",children:"Share this article"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-4 p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("input",{type:"text",readOnly:!0,value:H(A),className:"flex-1 bg-transparent text-sm text-slate-600 outline-none"}),(0,ea.jsx)("button",{onClick:()=>{return e=H(A),navigator.clipboard.writeText(e),U(!0),void setTimeout(()=>U(!1),2e3);var e},className:"px-3 py-1.5 rounded text-sm font-medium transition-colors ".concat(O?"bg-green-100 text-green-700":"bg-slate-200 hover:bg-slate-300 text-slate-700"),children:O?"\u2713 Copied!":"Copy Link"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500 mr-2",children:"Share on:"}),(0,ea.jsx)("button",{onClick:()=>{return e=H(A),A.title,void window.open("https://www.facebook.com/sharer/sharer.php?u=".concat(encodeURIComponent(e)),"_blank","width=600,height=400");var e},className:"p-2 rounded-full bg-blue-600 hover:bg-blue-700 text-white transition-colors",title:"Share on Facebook",children:(0,ea.jsx)("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})})}),(0,ea.jsx)("button",{onClick:()=>{return e=H(A),t=A.title,void window.open("https://twitter.com/intent/tweet?url=".concat(encodeURIComponent(e),"&text=").concat(encodeURIComponent(t)),"_blank","width=600,height=400");var e,t},className:"p-2 rounded-full bg-sky-500 hover:bg-sky-600 text-white transition-colors",title:"Share on X (Twitter)",children:(0,ea.jsx)("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),(0,ea.jsx)("button",{onClick:()=>{return e=H(A),t=A.title,void window.open("https://www.linkedin.com/shareArticle?mini=true&url=".concat(encodeURIComponent(e),"&title=").concat(encodeURIComponent(t)),"_blank","width=600,height=400");var e,t},className:"p-2 rounded-full bg-blue-700 hover:bg-blue-800 text-white transition-colors",title:"Share on LinkedIn",children:(0,ea.jsx)("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})}),(0,ea.jsx)("button",{onClick:()=>((e,t)=>{const s=document.createElement("a");s.href="mailto:?subject=".concat(encodeURIComponent(t),"&body=").concat(encodeURIComponent("Check out this article: ".concat(e))),s.target="_blank",document.body.appendChild(s),s.click(),document.body.removeChild(s)})(H(A),A.title),className:"p-2 rounded-full bg-slate-600 hover:bg-slate-700 text-white transition-colors",title:"Share via Email",children:(0,ea.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})})]})]}),(0,ea.jsx)("style",{children:"\n .article-content-links a,\n .article-blocks-content a {\n color: #2563eb;\n text-decoration: underline;\n }\n .article-content-links a:hover,\n .article-blocks-content a:hover {\n color: #1d4ed8;\n }\n "})]})]})})]}):(0,ea.jsx)("div",{className:"mb-8 p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center ".concat(l),style:i,children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Article Feed - Preview available after login"})})},oN=e=>{let{blocks:s,title:a,pageWidth:n="standard",theme:r,isQuickPreview:i=!0,pageId:o=null,tenantId:c=null,showNavigation:u=!0,refreshKey:m
2=0,siteTheme:h=null,headerMenu:x=null,footerMenu:p=null,previewToken:g=null,pages:f=[],subdomain:v=null,currentLanguage:b=null,defaultLanguage:j="en",enabledLanguages:y=null,children:N=null}=e;const[w,C]=(0,t.useState)(null),[k,D]=(0,t.useState)({header:null,footer:null}),[_,S]=(0,t.useState)({isOpen:!1,pageSlug:null,previewToken:null});(0,t.useEffect)(()=>{let e=null;const t=setTimeout(()=>{e=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&(t.target.classList.add("in-view"),e&&e.unobserve(t.target))})},{threshold:.1,rootMargin:"0px 0px -30px 0px"});document.querySelectorAll(".animate-on-scroll:not(.in-view)").forEach(t=>e.observe(t))},100);return()=>{clearTimeout(t),e&&e.disconnect()}},[s,m]);const E=null!==h?h:w,A=null!==x||null!==p?{header:x,footer:p}:k;(0,t.useEffect)(()=>{if(null!==h)return;let e=!0;return(async()=>{try{const[t,s]=await Promise.all([_l.get("/theme"),u?_l.get("/navigation"):Promise.resolve({data:[]})]);if(e){C(t.data);const e=s.data||[],a=e.find(e=>{var t;return"header"===e.location&&(e.is_global||o&&(null===(t=e.page_ids)||void 0===t?void 0:t.includes(o)))}),n=e.find(e=>{var t;return"footer"===e.location&&(e.is_global||o&&(null===(t=e.page_ids)||void 0===t?void 0:t.includes(o)))});D({header:a,footer:n})}}catch(t){console.error("Failed to fetch theme/navigation")}})(),()=>{e=!1}},[o,u,m,h]),(0,t.useEffect)(()=>{const e=e=>{const{slug:t}=e.detail||{};t&&S({isOpen:!0,pageSlug:t,previewToken:null})};return window.addEventListener("openPopupPage",e),()=>{window.removeEventListener("openPopupPage",e)}},[]);const F=e=>r&&!1===r.use_site_theme?r[e]:null===E||void 0===E?void 0:E[e],T=!r||!1!==r.use_site_theme,z=e=>((e,t)=>{if(!t||!e)return e;const s=[];let a=e.replace(/<mark([^>]*)style="([^"]*)"([^>]*)>/gi,(e,t,a,n)=>{const l="__MARK_PLACEHOLDER_".concat(s.length,"__");return s.push(e),l});const n=[];return a=a.replace(/<span([^>]*)style="([^"]*color[^"]*)"([^>]*)>/gi,(e,t,s,a)=>{const l="__SPAN_COLOR_PLACEHOLDER_".concat(n.length,"__");return n.push(e),l}),a=a.replace(/style="([^"]*)"/gi,(e,t)=>{const s=t.split(";").filter(e=>{const t=e.trim().toLowerCase();return!t.startsWith("color:")&&!t.startsWith("background-color:")&&!t.startsWith("background:")}).join(";").trim();return s?'style="'.concat(s,'"'):""}),s.forEach((e,t)=>{a=a.replace("__MARK_PLACEHOLDER_".concat(t,"__"),e)}),n.forEach((e,t)=>{a=a.replace("__SPAN_COLOR_PLACEHOLDER_".concat(t,"__"),e)}),a})(e,T),M=()=>{if(i&&"full"===n)return"max-w-7xl";switch(n){case"narrow":return"max-w-3xl";case"standard":default:return"max-w-5xl";case"wide":return"max-w-7xl";case"full":return"max-w-full"}},P=(e,a)=>{var n;if(!e)return null;const{type:r,content:o={},styles:u}=e,m=u||{},h=(null===o||void 0===o?void 0:o.presetStyles)||{},x=e=>{if(!e||"#"===e)return"#";if(e.startsWith("download:"))return e.substring(9);if(e.startsWith("mailto:")||e.startsWith("tel:"))return e;if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("#"))return e;if(e.includes("#")){const[t,s]=e.split("#"),a=t.startsWith("/")?t.substring(1):t;if(a&&f&&f.length>0){const e=f.find(e=>e.slug===a);if(e&&e.preview_token&&oy())return"/preview/".concat(e.preview_token,"#").concat(s)}return t.startsWith("/")?e:"/".concat(e)}const t=e.startsWith("/")?e.substring(1):e;if(f&&f.length>0){const e=f.find(e=>e.slug===t);if(e&&e.preview_token&&oy())return"/preview/".concat(e.preview_token)}return e.startsWith("/")?e:"/".concat(e)},p=e=>{if(!e||"#"===e||e.startsWith("download:")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("#"))return null;let t=e.startsWith("/")?e.substring(1):e;if(t.startsWith("preview/")&&(t=t.substring(8)),t=t.split("?")[0].split("#")[0],f&&f.length>0&&t){const e=f.find(e=>e.slug===t||e.full_path===t||e.page_id===t||e.preview_token===t);if(e&&e.isPopup)return t=>{t.preventDefault(),t.stopPropagation(),S({isOpen:!0,pageSlug:e.slug,previewToken:e.preview_token})}}return null},g=m.customCSS?"custom-block-".concat(a):"";let N=m.customCSS?"\n .".concat(g," { ").concat(m.customCSS," }\n "):"";const w=(()=>{const e=null===m||void 0===m?void 0:m.containerWidth,t=null===m||void 0===m?void 0:m.containerWidthPx,s=null===m||void 0===m?void 0:m.maxWidth;
2if("100vw"===s)return"";if(!(e&&"100%"!==e||"custom"===e&&t||s&&"none"!==s&&"100%"!==s))return"";const n="cw-mobile-".concat(a);return N+="\n @media (max-width: 767px) {\n .".concat(n," {\n width: 100% !important;\n max-width: 100% !important;\n margin-left: 0 !important;\n margin-right: 0 !important;\n }\n }\n "),n})(),C=!0===m.showAsCard,k=d(d(d(d({backgroundColor:C?m.backgroundColor||"#ffffff":m.backgroundColor||"transparent",borderColor:m.borderColor||(C?"#e2e8f0":"transparent"),borderWidth:m.borderWidth||(C?"1px":"0px"),borderStyle:m.borderWidth&&"0px"!==m.borderWidth||C?"solid":"none",borderRadius:m.borderRadius||(C?"12px":void 0),padding:m.padding||(C?"24px":"0px"),transition:"all ".concat(m.transitionDuration||"0.2s"," ease")},C&&!m.shadow?{boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)"}:{}),m.animation&&"none"!==m.animation?{animation:"".concat(m.animation," ").concat(m.animationDuration||"0.5s"," ease-out ").concat(m.animationDelay||"0s"," both")}:{}),(()=>{const e=m.containerWidth,t=m.containerWidthPx,s=m.maxWidth,a=m.containerAlign||"center";if("100vw"===s)return i?{width:"100%",maxWidth:"none"}:{width:"100vw",maxWidth:"none",marginLeft:"calc(-50vw + 50%)",marginRight:"calc(-50vw + 50%)"};let n={};"custom"===e&&t?n.width=t:e&&"100%"!==e&&(n.width=e),s&&"none"!==s&&(n.maxWidth=s);return(e&&"100%"!==e||s&&"none"!==s&&"100%"!==s)&&(n.display=n.display||"block","center"===a?(n.marginLeft="auto",n.marginRight="auto"):"flex-end"===a?(n.marginLeft="auto",n.marginRight="0"):(n.marginLeft="0",n.marginRight="auto")),n})()),(()=>{if(!h||!h.preset)return{};
2const{preset:e,icon:t,layout:s}=h;return l(h,ly)})()),D={none:"0px",small:"0.5rem",medium:"2rem",large:"4rem"},_=d(d(d(d({},k),(()=>{if(!o||!o.animation)return{};const e=o.animation;if(e.attention&&"none"!==e.attention){const t={pulse:"2s",bounce:"1s",shake:"0.8s",swing:"1.5s",float:"3s",glowPulse:"2s"};return{animation:"".concat(e.attention," ").concat(t[e.attention]||"2s"," ease-in-out infinite")}}return{}})()),"border-highlight"===m.hoverEffect?{border:"2px solid transparent","--highlight-color":m.highlightColor||"#6366f1"}:"glow"===m.hoverEffect?{"--glow-color":m.glowColor||"#6366f1"}:{}),(()=>{const e={};var t,s;m.spaceAbove&&"auto"!==m.spaceAbove&&(e.marginTop=null!==(t=D[m.spaceAbove])&&void 0!==t?t:"");m.spaceBelow&&"auto"!==m.spaceBelow&&(e.marginBottom=null!==(s=D[m.spaceBelow])&&void 0!==s?s:"");return e})()),A="".concat((()=>{switch(m.hoverEffect){case"shadow":return"hover:shadow-xl transition-shadow duration-300";case"lift":return"hover:-translate-y-1 hover:shadow-lg transition-all duration-300";case"glow":return"glow-effect transition-shadow duration-300";case"darken":return"hover:brightness-95 transition-all duration-300";case"scale":return"hover:scale-[1.02] transition-transform duration-300";case"border-highlight":return"border-highlight-effect transition-colors duration-300";default:return""}})()," ").concat((()=>{switch(m.clickEffect){case"scale-down":return"active:scale-[0.98] transition-transform";case"flash":return"active:opacity-70 transition-opacity";case"shake":return"active:animate-[shake_0.3s_ease-in-out]";case"ripple":return"ripple-effect";default:return""}})()," ").concat((()=>{switch(m.shadow){case"sm":return"shadow-sm";case"md":return"shadow-md";case"lg":return"shadow-lg";case"xl":return"shadow-xl";case"inner":return"shadow-inner";default:return""}})()," ").concat(g," ").concat(w," transition-all cursor-default"),T=()=>{var e;if(null===o||void 0===o||null===(e=o.blockButton)||void 0===e||!e.enabled)return null;const t=o.blockButton,s=Xj(t),a=Qj(t.size),n=Jj(t.hover),l=Kj(t.icon,"lg"===t.size?20:16,t.iconColor),r=t.iconPosition||"right",i=py(t.url),c=p(t.url);return(0,ea.jsx)("div",{style:{textAlign:t.align||"center",marginTop:"".concat(t.marginTop||16,"px")},children:(0,ea.jsxs)("a",{href:x(t.url)||"#",onClick:c||void 0,download:i?gy(t.url):void 0,target:c?"_self":void 0,className:"inline-flex items-center justify-center gap-2 ".concat(a," ").concat(t.fullWidth?"w-full":""," font-medium transition-colors transition-transform ").concat(n),style:d(d({},s),{},{display:"inline-flex",cursor:"pointer",WebkitAppearance:"none"}),children:[l&&"left"===r&&l,t.text||"Click Me",l&&"right"===r&&l]})})},M=(()=>{if(!o||!o.animation)return"";const e=o.animation;if(!e.entrance||"none"===e.entrance)return"";const t=["animate","animate-".concat(e.entrance)];return t.push("animate-".concat(e.speed||"normal")),e.delay&&"0"!==e.delay&&t.push("animate-delay-".concat(e.delay)),e.animateOnScroll&&t.push("animate-on-scroll"),t.join(" ")})(),P=(()=>{var e;const s=null===o||void 0===o?void 0:o.sectionHeader;if(!s)return null;const n=s.text&&String(s.text).trim();if(!(!0===s.enabled||void 0===s.enabled&&n))return null;const l=s.headingTag||"h2",r=Number(s.marginTop)||0,i=Number(null!==(e=s.marginBottom)&&void 0!==e?e:16),c="sh-mobile-".concat(a),d=Math.min(Math.round(.4*r),32),u=Math.min(Math.round(.4*i),24);N+="\n @media (max-width: 767px) {\n .".concat(c," {\n margin-top: ").concat(d,"px !important;\n margin-bottom: ").concat(u,"px !important;\n }\n }\n ");const m={fontSize:jy(s.fontSize||28),fontFamily:s.fontFamily||"inherit",fontWeight:s.fontWeight||"bold",color:s.color||"#1e293b",textAlign:s.align||"left",marginTop:"".concat(r,"px"),marginBottom:"".concat(i,"px"),minHeight:s.text?"auto":"".concat(s.spacerHeight||20,"px")};return t.createElement(l,{style:m,className:c},s.text||"")})(),B=N?(0,ea.jsx)("style",{children:N},"style-".concat(a)):null,R=e=>B||P?(0,ea.jsxs)(t.Fragment,{children:[B,P,e]},a):e;switch(r){case"heading":return R((0,ea.jsxs)("div",{className:"mb-6 ".concat(A," ").concat(M),style:_,children:[(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(z(o.html||"<h2>".concat(o.text||"Heading","</h2>")))},className:"heading-text-content",style:{fontFamily:o.fontFamily||"Manrope, sans-serif",fontSize:o.fontSize?jy(o.fontSize):void 0,color:o.textColor||void 0,overflowWrap:"anywhere",wordBreak:"break-word"}}),(0,ea.jsx)("style",{children:"\n .heading-text-content h1 { font-size: ".concat(o.fontSize?jy(o.fontSize):jy(F("h1_size")||48),"; font-weight: 700; line-height: 1.2; margin: 0; }\n .heading-text-content h2 { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("h2_size")||36),"; font-weight: 700; line-height: 1.3; margin: 0; }\n .heading-text-content h3 { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("h3_size")||28),"; font-weight: 600; line-height: 1.3; margin: 0; }\n .heading-text-content h4 { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("h4_size")||22),"; font-weight: 600; line-height: 1.4; margin: 0; }\n .heading-text-content h5 { font-size: ").concat(o.fontSize?jy(o.fontSize):"1.25rem","; font-weight: 600; line-height: 1.4; margin: 0; }\n .heading-text-content h6 { font-size: ").concat(o.fontSize?jy(o.fontSize):"1.125rem","; font-weight: 600; line-height: 1.4; margin: 0; }\n .heading-text-content p { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("h2_size")||36),"; font-weight: 700; margin: 0; }\n ")}),T()]},"block-".concat(a)));case"paragraph":const t=()=>{const e=null===h||void 0===h?void 0:h.icon;if(!e)return null;const t={info:{color:"#3b82f6",bgColor:"#eff6ff",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
2</svg>'},warning:{color:"#f59e0b",bgColor:"#fffbeb",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></svg>'},success:{color:"#22c55e",bgColor:"#f0fdf4",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>'},error:{color:"#ef4444",bgColor:"#fef2f2",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>'},quote:{color:"#6366f1",bgColor:"#eef2ff",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>'}}[e];return t?(0,ea.jsx)("div",{style:{color:t.color,marginRight:"12px",flexShrink:0},dangerouslySetInnerHTML:{__html:t.svg}}):null},r=null===h||void 0===h?void 0:h.icon;return R((0,ea.jsxs)("div",{className:"mb-4 ".concat(A," ").concat(M),style:d(d({},_),{},{display:r?"flex":"block",alignItems:r?"flex-start":void 0}),children:[t(),(0,ea.jsxs)("div",{style:{flex:r?1:void 0},children:[(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(z(o.html||"<p>Start typing...</p>"))},className:"leading-relaxed paragraph-text-content",style:{fontFamily:o.fontFamily||F("body_font")||void 0,fontSize:o.fontSize?jy(o.fontSize):jy(F("body_size")||16),color:o.textColor||F("body_color")||"#334155",overflowWrap:"anywhere",wordBreak:"break-word","--theme-h1-size":"".concat(F("h1_size")||48,"px"),"--theme-h2-size":"".concat(F("h2_size")||36,"px"),"--theme-h3-size":"".concat(F("h3_size")||28,"px"),"--theme-h4-size":"".concat(F("h4_size")||22,"px"),"--theme-body-size":"".concat(F("body_size")||16,"px")}}),(0,ea.jsx)("style",{children:"\n .paragraph-text-content h1 { font-size: ".concat(o.fontSize?jy(o.fontSize):jy(F("h1_size")||48),"; font-weight: 700; line-height: 1.2; margin: 0.75rem 0; }\n .paragraph-text-content h2 { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("h2_size")||36),"; font-weight: 700; line-height: 1.3; margin: 0.75rem 0; }\n .paragraph-text-content h3 { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("h3_size")||28),"; font-weight: 600; line-height: 1.3; margin: 0.75rem 0; }\n .paragraph-text-content h4 { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("h4_size")||22),"; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; }\n .paragraph-text-content h5 { font-size: ").concat(o.fontSize?jy(o.fontSize):"1.125rem","; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; }\n .paragraph-text-content h6 { font-size: ").concat(o.fontSize?jy(o.fontSize):"1rem","; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; }\n .paragraph-text-content p { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("body_size")||16),"; margin: 0.5rem 0; }\n .paragraph-text-content ul { list-style-type: disc; padding-left: 1.5rem; margin: 0.5rem 0; }\n .paragraph-text-content ol { list-style-type: decimal; padding-left: 1.5rem; margin: 0.5rem 0; }\n .paragraph-text-content li { font-size: ").concat(o.fontSize?jy(o.fontSize):jy(F("body_size")||16),"; margin: 0.25rem 0; display: list-item; }\n .paragraph-text-content ul ul { list-style-type: circle; }\n .paragraph-text-content ul ul ul { list-style-type: square; }\n .paragraph-text-content a { color: ").concat(F("link_color")||"#2563eb","; text-decoration: underline; }\n .paragraph-text-content a:hover { color: ").concat(F("link_hover_color")||"#1d4ed8","; }\n ")}),T()]})]},"block-".concat(a)));case"image":if(!o.url)return null;const u=m.imageSizeMode||"width",g=m.imageWidth||"100%",w=m.imageHeight||"300px",C=m.imageAlign||"center",D=!0===o.fullWidth,S=D&&!i,P=o.shapeMask||"none",B=o.shapeSize||300,I="none"!==P?d({width:"".concat(B,"px"),height:"".concat("ellipse"===P?1.25*B:B,"px"),maxWidth:"100%",borderRadius:"circle"===P||"ellipse"===P?"50%":"rounded"===P?"20px":"0",clipPath:"diamond"===P?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===P?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===P?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===P?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===P?"ellipse(50% 100% at 50% 100%)":"none",border:o.shapeBorderWidth?"".concat(o.shapeBorderWidth,"px solid ").concat(o.shapeBorderColor||"#ffffff"):"none",overflow:"hidden"},o.paddingSize?{paddingTop:"all"!==o.paddingSide&&"top"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px"),paddingRight:"all"!==o.paddingSide&&"right"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px"),paddingBottom:"all"!==o.paddingSide&&"bottom"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px"),paddingLeft:"all"!==o.paddingSide&&"left"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px")}:{}):null,O=o.linkUrl||null,U=!1!==o.linkNewTab?"_blank":"_self",H=!1!==o.linkNewTab?"noopener noreferrer":void 0,W="none"!==P?(0,ea.jsx)("div",{className:"inline-block",style:I,children:(0,ea.jsx)("img",{src:o.url,alt:o.alt||"",className:"w-full h-full object-cover"})}):(0,ea.jsx)("img",{src:o.url,alt:o.alt||"",className:"".concat(D?"":"rounded-lg"," ").concat(D?"w-full":"inline-block"),style:D?{width:"100%",height:"auto",maxHeight:"600px",objectFit:"cover"}:{width:"height"===u?"auto":g,height:"height"===u?w:"auto",maxWidth:"100%"}});return R((0,ea.jsxs)("div",{className:"mb-8 ".concat(A," ").concat(M),style:d(d({},_),{},{textAlign:S||D?"center":C,marginLeft:S?"calc(-50vw + 50%)":void 0,marginRight:S?"calc(-50vw + 50%)":void 0,width:S?"100vw":D?"100%":void 0}),children:[O?(0,ea.jsx)("a",{href:O,target:U,rel:H,className:"inline-block",children:W}):W,o.caption&&(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-3 text-center italic",children:o.caption}),T()]},"block-".concat(a)));case"button":const V=Kj(o.icon,"lg"===o.size||"xl"===o.size?20:16,o.iconColor),q="btn-".concat(e.id||a),$=py(o.url),G=p(o.url),K=(null===E||void 0===E?void 0:E.primary_color)||"#6366f1",Y=(null===E||void 0===E?void 0:E.link_hover_color)||(null===E||void 0===E?void 0:E.primary_color)||"#4f46e5",J=(null===E||void 0===E?void 0:E.secondary_color)||"#8b5cf6",Q=o.color||K,X=o.hoverColor||Y,Z=o.gradientColor||J;return R((0,ea.jsxs)("div",{className:"mb-6 ".concat(A," ").concat(M),style:d(d({},_),{},{textAlign:o.align||"left"}),children:[(0,ea.jsx)("style",{children:"\n #".concat(q,":hover {\n ").concat("solid"!==o.style&&o.style?"":"background-color: ".concat(X," !important;"),"\n ").concat("outline"===o.style?"border-color: ".concat(X," !important; color: ").concat(X," !important;"):"","\n ").concat("ghost"===o.style?"background-color: ".concat(Q,"15 !important;"):"","\n transform: translateY(-2px);\n box-shadow: 0 4px 12px ").concat(Q,"40;\n }\n ")}),(0,ea.jsxs)("a",{id:q,href:x(o.url)||"#",onClick:G||void 0,download:$?gy(o.url):void 0,target:G?"_self":o.openInNewTab?"_blank":"_self",rel:o.openInNewTab&&!G?"noopener noreferrer":"",className:"\n inline-flex items-center gap-2 font-semibold transition-all duration-200\n ".concat("sm"===o.size?"px-4 py-2 text-sm":"","\n ").concat("md"!==o.size&&o.size?"":"px-6 py-3 text-base","\n ").concat("lg"===o.size?"px-8 py-4 text-lg":"","\n ").concat("xl"===o.size?"px-10 py-5 text-xl":"","\n ").concat(o.fullWidth?"w-full justify-center":"","\n ").concat("square"===o.borderRadius?"rounded-none":"","\n ").concat("rounded"!==o.borderRadius&&o.borderRadius?"":"rounded-lg","\n ").concat("pill"===o.borderRadius?"rounded-full":"","\n "),style:d(d({},"gradient"===o.style?{background:"linear-gradient(135deg, ".concat(Q,", ").concat(Z,")"),color:o.textColor||"#ffffff"}:"soft"===o.style?{backgroundColor:"".concat(Q,"26"),color:Q}:{backgroundColor:"solid"!==o.style&&o.style?"transparent":Q,color:"solid"!==o.style&&o.style?Q:o.textColor||"#ffffff",border:"outline"===o.style?"2px solid ".concat(Q):"none"}),{},{textDecoration:"none"}),children:[V&&"left"===o.iconPosition&&(0,ea.jsx)("span",{className:"inline-flex items-center",children:V}),o.text||"Click Here",V&&("right"===o.iconPosition||!o.iconPosition)&&(0,ea.jsx)("span",{className:"inline-flex items-center",children:V})]})]},"block-".concat(a)));case"quote":{const e="20px 24px";return R((0,ea.jsxs)("blockquote",{className:"border-l-4 border-indigo-600 my-6 ".concat(A," ").concat(M),style:d(d({padding:e,fontFamily:o.fontFamily||"Merriweather, serif",fontSize:o.fontSize?"".concat(o.fontSize,"px"):void 0,fontStyle:o.fontStyle||"italic",fontWeight:o.fontWeight||"normal",color:o.color||"#334155",textAlign:o.align||"left"},_),m.padding?{}:{padding:e}),children:[(0,ea.jsx)("span",{"aria-hidden":"true",style:{fontFamily:"Georgia, serif",fontSize:"1.6em",lineHeight:0,verticalAlign:"-0.35em",marginRight:"0.18em",fontStyle:"normal",color:o.color||"#6366f1",o
2pacity:.45,userSelect:"none"},children:"\u201c"}),o.text||"",o.author&&(0,ea.jsxs)("footer",{className:"mt-3 text-sm not-italic",style:{opacity:.7},children:["\u2014 ",o.author]})]},"block-".concat(a)))}case"list":return R((0,ea.jsx)("ul",{className:"mb-6 space-y-2 list-disc list-inside text-lg text-slate-700 ".concat(A," ").concat(M),style:_,children:null===(n=o.items)||void 0===n?void 0:n.map((e,t)=>(0,ea.jsx)("li",{children:e},t))},"block-".concat(a)));case"code":return R((0,ea.jsx)("div",{className:"mb-6 ".concat(A," ").concat(M),style:_,children:(0,ea.jsx)(qg,{code:o.code||"",language:o.language||"javascript",theme:o.theme||"github-dark",showLineNumbers:!1!==o.showLineNumbers})},"block-".concat(a)));case"custom-html":return R((0,ea.jsx)("div",{className:"mb-6 ".concat(A," ").concat(M),style:_,dangerouslySetInnerHTML:{__html:o.html||""}},"block-".concat(a)));case"hero":const ee=o.slides||[],te=ee.length>0,se={imageUrl:o.imageUrl||"",headline:o.headline||"",subheadline:o.subheadline||"",buttonText:o.buttonText||"",buttonUrl:o.buttonUrl||"",headlineAnimation:o.headlineAnimation,subheadlineAnimation:o.subheadlineAnimation,buttonAnimation:o.buttonAnimation,useBackgroundColor:o.useBackgroundColor,backgroundColor:o.backgroundColor,textColor:o.textColor},ae=te?ee:[se],ne=(e=>{if("custom"!==e.overlay)return _y[e.overlay]||_y.dark;const t=e.overlayColor||"#000000",s=void 0!==e.overlayOpacity?e.overlayOpacity:50,a=t.replace("#",""),n=parseInt(a.substring(0,2),16),l=parseInt(a.substring(2,4),16),r=parseInt(a.substring(4,6),16);return{background:"rgba(".concat(n,", ").concat(l,", ").concat(r,", ").concat(s/100,")")}})(o),le=e=>"white"===e||"black"===e||"primary"===e,re="black"===o.textColor?"text-slate-900":"primary"===o.textColor?"text-indigo-600":le(o.textColor)?"text-white":"string"===typeof o.textColor&&o.textColor.startsWith("#")?"":"text-white",ie=o.width||"container",oe="full"===ie&&!i,ce=()=>{switch(ie){case"full":return{width:"100%"};case"large":return{width:"100%",maxWidth:"1200px",marginLeft:"auto",marginRight:"auto"};case"medium":return{width:"100%",maxWidth:"900px",marginLeft:"auto",marginRight:"auto"};case"small":return{width:"100%",maxWidth:"600px",marginLeft:"auto",marginRight:"auto"};default:return{width:"100%",maxWidth:"1280px",marginLeft:"auto",marginRight:"auto"}}};if(ae.length>1)return(0,ea.jsx)(wy,{slides:ae,overlay:o.overlay,overlayStyle:ne,textColorClass:re,defaultTextColor:o.textColor,textPositionH:o.textPositionH||"center",textPositionV:o.textPositionV||"middle",height:o.height||500,widthStyle:ce(),isFullWidth:oe,autoPlay:!1!==o.autoPlay,autoPlaySpeed:o.autoPlaySpeed||5e3,transitionEffect:o.transitionEffect||"fade",wrapperClass:A,blockStyle:_,pages:f},"block-".concat(a));const de=ae[0],ue=e=>e&&"none"!==e.entrance?"animate animate-".concat(e.entrance," animate-").concat(e.speed||"normal"," ").concat("0"!==e.delay?"animate-delay-".concat(e.delay):""):"";return(0,ea.jsxs)("div",{className:"relative overflow-hidden ".concat(oe?"":"mb-8"," ").concat(A," ").concat(M," hero-responsive"),style:d(d({},_),{},{borderRadius:m.borderRadius||(oe?void 0:"12px"),overflow:"hidden",minHeight:"".concat(o.height||500,"px")},ce()),children:["video"===de.backgroundType&&de.videoUrl?(0,ea.jsx)("div",{className:"absolute inset-0",children:de.videoUrl.includes("youtube.com")||de.videoUrl.includes("youtu.be")||de.videoUrl.includes("youtube-nocookie.com")?(0,ea.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(vy(de.videoUrl),"?autoplay=1&mute=").concat(!1!==de.videoMuted?1:0,"&loop=1&playlist=").concat(vy(de.videoUrl),"&controls=1&showinfo=0&modestbranding=1&rel=0"),className:"absolute inset-0 w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media; fullscreen",allowFullScreen:!0,title:"Video"}):de.videoUrl.includes("vimeo.com")?(0,ea.jsx)("iframe",{src:"https://player.vimeo.com/video/".concat(by(de.videoUrl),"?autoplay=1&muted=").concat(!1!==de.videoMuted?1:0,"&loop=1"),className:"absolute inset-0 w-full h-full",frameBorder:"0",allow:"autoplay; fullscreen",allowFullScreen:!0,title:"Video"}):(0,ea.jsx)("video",{src:de.videoUrl,autoPlay:!0,muted:!1!==de.videoMuted,loop:!1!==de.videoLoop,playsInl
2ine:!0,controls:!0,className:"absolute inset-0 w-full h-full object-cover"})}):"color"===de.backgroundType||de.useBackgroundColor?(0,ea.jsx)("div",{className:"absolute inset-0",style:{backgroundColor:de.backgroundColor||"#6366f1"}}):de.imageUrl?(0,ea.jsx)("img",{src:de.imageUrl,alt:"Hero background",className:"absolute inset-0 w-full h-full object-cover"}):(0,ea.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-600 to-purple-700"}),"none"!==o.overlay&&(0,ea.jsx)("div",{className:"absolute inset-0",style:ne}),(()=>{const e=e=>"string"===typeof e&&/^#[0-9a-fA-F]{3,8}$/.test(e.trim()),t=e(de.textColor)?de.textColor:e(o.textColor)?o.textColor:null,s=t?"":re,a=t?{color:t}:{};return(0,ea.jsx)("div",{className:"\n absolute inset-0 p-4 sm:p-8 md:p-12 flex flex-col\n ".concat("left"===o.textPositionH?"items-start text-left":"","\n ").concat("center"===o.textPositionH?"items-center text-center":"","\n ").concat("right"===o.textPositionH?"items-end text-right":"","\n ").concat("top"===o.textPositionV?"justify-start":"","\n ").concat("middle"===o.textPositionV?"justify-center":"","\n ").concat("bottom"===o.textPositionV?"justify-end":"","\n ").concat(s,"\n "),style:a,children:de.useHtml&&de.htmlContent?(0,ea.jsx)("div",{className:"hero-html-content w-full max-w-4xl",dangerouslySetInnerHTML:{__html:de.htmlContent}}):(0,ea.jsxs)(ea.Fragment,{children:[de.headline&&(0,ea.jsx)("h2",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-4 w-full max-w-3xl ".concat(ue(de.headlineAnimation)),style:d({textShadow:"2px 2px 4px rgba(0,0,0,0.3)"},de.headlineStyle||{}),children:de.headline}),de.subheadline&&(0,ea.jsx)("p",{className:"text-xl md:text-2xl mb-8 w-full max-w-2xl opacity-90 ".concat(ue(de.subheadlineAnimation)),style:d({textShadow:"1px 1px 2px rgba(0,0,0,0.3)"},de.subheadlineStyle||{}),children:de.subheadline}),de.buttonText&&(0,ea.jsxs)("a",{href:x(de.buttonUrl)||"#",onClick:p(de.buttonUrl),className:"inline-flex items-center justify-center gap-2 px-8 py-4 bg-white text-slate-900 rounded-lg font-semibold text-lg hover:bg-slate-100 transition-all transform hover:scale-105 shadow-lg ".concat(ue(de.buttonAnimation)),style:ey(de),children:[sy(de)&&"left"===ay(de)&&ny(de,20),de.buttonText,sy(de)&&"right"===ay(de)&&ny(de,20)]})]})})})()]},"block-".concat(a));case"two-column":return R((0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 mb-8 ".concat(A," ").concat(M),style:_,children:[(0,ea.jsx)("div",{className:"space-y-4 min-w-0",children:(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(z(o.leftHtml||"<p>Left column</p>"),{tighter:!0})},className:"text-lg leading-relaxed text-slate-700",style:{overflowWrap:"anywhere",wordBreak:"break-word"}})}),(0,ea.jsx)("div",{className:"space-y-4 min-w-0",children:(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(z(o.rightHtml||"<p>Right column</p>"),{tighter:!0})},className:"text-lg leading-relaxed text-slate-700",style:{overflowWrap:"anywhere",wordBreak:"break-word"}})})]},"block-".concat(a)));case"card-grid":case"columns":const me=o.cardsPerRow||o.columnCount||2,he=o.columns||[],xe=o.showAsCards||!1,pe=o.cardStyle||{},ge=(()=>{switch(o.blockWidth){case"full":return{width:"100vw",maxWidth:"none",marginLeft:"calc(-50vw + 50%)",marginRight:"calc(-50vw + 50%)",paddingLeft:"1rem",paddingRight:"1rem"};case"large":return{width:"100%",maxWidth:"1200px",margin:"0 auto"};case"medium":return{width:"100%",maxWidth:"900px",margin:"0 auto"};case"small":return{width:"100%",maxWidth:"600px",margin:"0 auto"};default:return{width:"100%",maxWidth:"none"}}})(),fe=()=>{const e=o.columnWidths;return Array.isArray(e)&&e.length===me?e.map(e=>"".concat(e,"fr")).join(" "):"1-2"===e?"1fr 2fr":"2-1"===e?"2fr 1fr":"1-1-2"===e?"1fr 1fr 2fr":"2-1-1"===e?"2fr 1fr 1fr":"1-2-1"===e?"1fr 2fr 1fr":"custom"===e&&Array.isArray(o.customWidths)?o.customWidths.map(e=>"".concat(e,"fr")).join(" "):"repeat(".concat(me,", 1fr)")},ve=()=>{const e=o.columnHeight||"auto";return"auto"===e?{}:"match"===e?{alignItems:"stretch",gridAutoRows:"1fr"}:{alignItems:"stretch",gridAutoRows:"".concat(e,"px")}},be=()=>{const e=o.columnHeight||"auto";return"auto"===e?{}:"match"===e?{height:"100%",minHeight:"100%"}:{minHeight:"".concat(e,"px"),height:"".concat(e,"px")}},je=e=>{switch(e){case"center":return{display:"flex",flexDirection:"column",justifyContent:"center",height:"100%"};case"bottom":return{display:"flex",flexDirection:"column",justifyContent:"flex-end",height:"100%"};default:return{}}},ye=xe?"bg-white ".concat(!1!==pe.shadow?"shadow-md":""):"",Ne=xe?{backgroundColor:pe.backgroundColor||"#ffffff",borderRadius:pe.borderRadius||m.borderRadius||"8px",padding:pe.padding||"16px"}:{},we=xe&&pe.animation||"none",Ce=xe&&!1!==pe.stagger,ke=["pulse","float","bounce","glowPulse","shake","swing"],De=(e,t)=>{const s=t.animation||we;if("none"===s)return{className:"",style:{}};const a=ke.includes(s),n=Ce?"".concat(.15*e,"s"):"0s";
2if(t.animateOnScroll&&!a)return{className:"animate animate-".concat(s," animate-on-scroll"),style:{animationDelay:n}};const l=a?"2s":"0.5s",r=a?"infinite":"1";return{className:"",style:{animation:"".concat(s," ").concat(l," ease-out ").concat(n," ").concat(r," both")}}},_e=e=>{const t={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2",lg:"px-6 py-3 text-lg"},s=Jj(e.buttonHover||"fade");return"inline-flex items-center justify-center gap-2 ".concat(t[e.buttonSize]||t.md," ").concat(e.buttonFullWidth?"w-full":""," font-medium transition-all ").concat(s)},Se=e=>Zj(e),Ee=o.paddingSize||0,Ae=o.paddingSides||["top","right","bottom","left"],Fe=Ee?{paddingTop:Ae.includes("top")?"".concat(Ee,"px"):"0",paddingRight:Ae.includes("right")?"".concat(Ee,"px"):"0",paddingBottom:Ae.includes("bottom")?"".concat(Ee,"px"):"0",paddingLeft:Ae.includes("left")?"".concat(Ee,"px"):"0"}:{},Te=Ee>24?"col-pad-mobile-".concat(a):"";if(Te){const e=.4,t=24,s=Math.min(Math.round(Ee*e),t);N+="\n @media (max-width: 767px) {\n .".concat(Te," {\n ").concat(Ae.includes("top")?"padding-top: ".concat(s,"px !important;"):"","\n ").concat(Ae.includes("right")?"padding-right: ".concat(s,"px !important;"):"","\n ").concat(Ae.includes("bottom")?"padding-bottom: ".concat(s,"px !important;"):"","\n ").concat(Ae.includes("left")?"padding-left: ".concat(s,"px !important;"):"","\n }\n }\n ")}return R((0,ea.jsx)("div",{className:"grid gap-6 mb-8 ".concat(A," ").concat(M," ").concat(Te," ").concat(2===me?"grid-cols-1 sm:grid-cols-2":3===me?"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3":4===me?"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4":5===me?"grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5":6===me?"grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-6":"grid-cols-1 sm:grid-cols-2"," ").concat(o.columnWidths?"columns-custom-widths":""),style:d(d(d(d(d({},_),Fe),ge),ve()),o.columnWidths?{gridTemplateColumns:fe()}:{}),children:he.map((e,t)=>{const s="".concat((()=>{switch(e.hoverEffect){case"shadow":return"hover:shadow-xl";case"lift":return"hover:-translate-y-1 hover:shadow-lg";case"scale":return"hover:scale-[1.02]";case"darken":return"hover:brightness-95";default:return""}})()," ").concat((()=>{switch(e.shadow){case"sm":return"shadow-sm";case"md":return"shadow-md";case"lg":return"shadow-lg";default:return""}})()," transition-all duration-300"),a=e.presetStyles||{},n=xe&&e.hasButton&&"outside"===e.buttonCardPosition,r=()=>{if(!e.hasButton)return null;const t=Number(e.buttonMarginTop),s=Number.isFinite(t)?Math.min(200,Math.max(0,t)):16,a=!(!e.hasColumnLink||!e.columnUrl)&&!n,l=a?"span":"a",r=p(e.buttonUrl),i=a?{}:{href:x(e.buttonUrl)||"#",download:py(e.buttonUrl)?gy(e.buttonUrl):void 0,onClick:r,target:e.buttonOpenInNewTab&&!r?"_blank":void 0,rel:e.buttonOpenInNewTab&&!r?"noopener noreferrer":void 0};return(0,ea.jsx)("div",{style:{textAlign:e.buttonAlign||"center",marginTop:"bottom"!==e.buttonVerticalAlign||n?"".concat(s,"px"):"auto",paddingTop:"bottom"!==e.buttonVerticalAlign||n?"0":"".concat(s,"px")},children:(0,ea.jsxs)(l,d(d({},i),{},{className:_e(e),style:d(d({},Se(e)),{},{display:"inline-flex",cursor:"pointer",WebkitAppearance:"none"}),children:[sy(e)&&"left"===ay(e)&&ny(e,"lg"===e.buttonSize?20:16),e.buttonText||"Click Me",sy(e)&&"right"===ay(e)&&ny(e,"lg"===e.buttonSize?20:16)]}))})},i=e.hasColumnLink&&e.columnUrl?x(e.columnUrl):null,c=e.hasColumnLink&&py(e.columnUrl),u=e.hasColumnLink?p(e.columnUrl):null,m=i?{href:i,download:c?gy(e.columnUrl):void 0,onClick:u,target:e.columnLinkNewTab&&!u?"_blank":void 0,rel:e.columnLinkNewTab&&!u?"noopener noreferrer":void 0}:{},h=i?"a":"div",g=De(t,e);return(0,ea.jsxs)("div",{className:"flex flex-col min-w-0 ".concat("match"===o.columnHeight?"h-full":""),style:"match"===o.columnHeight||o.columnHeight&&"auto"!==o.columnHeight?{height:"100%",minHeight:"100%"}:{},children:[(0,ea.jsxs)(h,d(d({},m),{},{className:"".concat(ye," ").concat(s," ").concat(g.className," ").concat(e.hasButton&&e.buttonVerticalAlign&&!n?"flex flex-col":""," ").concat(n?"flex-1":""," ").concat("match"===o.columnHeight||o.columnHeight&&"auto"!==o.columnHeight?"h-full flex-1":""," ").concat(i?"block cursor-pointer no-underline":""),style:d(d(d(d(d(d(d(d({},Ne),g.style),be()),{},{textAlign:e.textAlign||"left"},e.bgTransparent?{backgroundColor:"transparent"}:e.backgroundColor?{backgroundColor:e.backgroundColor}:{}),e.borderRadius>0?{borderRadius:"".concat(e.borderRadius,"px")}:{}),e.columnPadding?{padding:"".concat(e.columnPadding,"px")}:{}),{},{overflow:"hidden"},e.hasButton&&e.buttonVerticalAlign&&!n?{justifyContent:"top"===e.buttonVerticalAlign?"flex-start":"middle"===e.buttonVerticalAlign?"center":"space-between"}:{}),(()=>{if(!a||!a.preset)return{};
2const{preset:e,icon:t,layout:s}=a;return l(a,ry)})()),children:["avatar"===e.type&&(()=>{const t=e.avatarText&&e.avatarText.trim()?e.avatarText.trim().toUpperCase():(e.avatarTitle||"?").trim().charAt(0).toUpperCase()||"?",s=e.avatarColor||"var(--site-accent)";return(0,ea.jsxs)("div",{className:"text-center w-full",children:[(0,ea.jsx)("div",{className:"mx-auto mb-4 flex items-center justify-center font-bold text-white",style:{width:80,height:80,borderRadius:"9999px",backgroundColor:s,fontSize:t.length>1?"1.5rem":"2rem"},children:t}),e.avatarTitle&&(0,ea.jsx)("h3",{className:"font-semibold text-lg",style:{color:"var(--site-heading-color)"},children:e.avatarTitle}),e.avatarSubtitle&&(0,ea.jsx)("p",{className:"opacity-70 text-sm mt-1",style:{color:"var(--site-body-color)"},children:e.avatarSubtitle})]})})(),"text"===e.type&&(0,ea.jsxs)("div",{style:d({},je(e.verticalAlign)),children:[(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(z(e.html||"<p>Column content</p>"),{tighter:!0})},className:"leading-relaxed column-text-content",style:{color:e.textColor||F("body_color")||"#475569",textAlign:e.textAlign||"left",fontFamily:e.fontFamily||F("body_font")||"inherit",fontSize:e.fontSize?"".concat(e.fontSize,"px"):"".concat(F("body_size")||16,"px"),fontWeight:e.isBold?"bold":"inherit",overflowWrap:"anywhere",wordBreak:"break-word",minWidth:0}}),(0,ea.jsx)("style",{children:"\n .column-text-content h1 { font-size: ".concat(F("h1_size")||48,"px; font-weight: 700; line-height: 1.2; margin: 0.5rem 0; color: inherit; }\n .column-text-content h2 { font-size: ").concat(F("h2_size")||36,"px; font-weight: 700; line-height: 1.3; margin: 0.5rem 0; color: inherit; }\n .column-text-content h3 { font-size: ").concat(F("h3_size")||28,"px; font-weight: 600; line-height: 1.3; margin: 0.5rem 0; color: inherit; }\n .column-text-content h4 { font-size: ").concat(F("h4_size")||22,"px; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .column-text-content h5 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .column-text-content h6 { font-size: 1rem; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .column-text-content p { font-size: ").concat(F("body_size")||16,"px; margin: 0.5rem 0; color: inherit; }\n .column-text-content ul { list-style-type: disc; padding-left: 1.5rem; margin: 0.5rem 0; color: inherit; }\n .column-text-content ol { list-style-type: decimal; padding-left: 1.5rem; margin: 0.5rem 0; color: inherit; }\n .column-text-content li { font-size: ").concat(F("body_size")||16,'px; margin: 0.25rem 0; display: list-item; color: inherit; }\n .column-text-content ul ul { list-style-type: circle; }\n .column-text-content ul ul ul { list-style-type: square; }\n .column-text-content span:not([style*="color"]) { color: inherit; }\n .column-text-content a { color: ').concat(F("link_color")||"#2563eb","; text-decoration: underline; }\n .column-text-content a:hover { color: ").concat(F("link_hover_color")||"#1d4ed8","; }\n ")})]}),"image"===e.type&&e.imageUrl&&(()=>{const t=e.imageCorners||"rounded",s=(()=>{if("circle"===e.shapeMask||"ellipse"===e.shapeMask)return"50%";if("rounded"===e.shapeMask)return"20px";if(e.shapeMask&&"none"!==e.shapeMask)return"0";switch(t){case"square":return"0";case"pill":return"9999px";default:return"8px"}})();return(0,ea.jsxs)("div",{style:{textAlign:e.imageAlign||"center"},children:[(0,ea.jsx)("div",{className:"inline-block overflow-hidden",style:d({width:e.shapeMask&&"none"!==e.shapeMask?"".concat(e.shapeSize||200,"px"):"custom"===e.imageSizeMode?"".concat(e.imageWidth||200,"px"):"height"===e.imageSizeMode?"auto":"".concat(e.imageWidth||200,"px"),height:e.shapeMask&&"none"!==e.shapeMask?"ellipse"===e.shapeMask?"".concat(1.25*(e.shapeSize||200),"px"):"".concat(e.shapeSize||200,"px"):"custom"===e.imageSizeMode||"height"===e.imageSizeMode?"".concat(e.imageHeight||200,"px"):"auto",maxWidth:"100%",borderRadius:s,clipPath:"diamond"===e.shapeMask?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===e.shapeMask?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===e.shapeMask?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===e.shapeMask?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===e.shapeMask?"ellipse(50% 100% at 50% 100%)":"none",border:e.shapeBorderWidth&&e.shapeMask&&"none"!==e.shapeMask?"".concat(e.shapeBorderWidth,"px solid ").concat(e.shapeBorderColor||"#ffffff"):"none"},e.paddingSize?{paddingTop:"all"!==e.paddingSide&&"top"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingRight:"all"!==e.paddingSide&&"right"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingBottom:"all"!==e.paddingSide&&"bottom"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingLeft:"all"!==e.paddingSide&&"left"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px")}:{}),children:(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",className:"w-full h-full object-cover",style:{borderRadius:s}})}),e.imageCaption&&(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-2 italic",style:{textAlign:e.imageAlign||"center"},children:e.imageCaption})]})})(),"video"===e.type&&e.videoUrl&&(0,ea.jsx)("div",{className:"rounded-lg overflow-hidden",style:{height:"".concat(e.videoHeight||250,"px")},children:e.videoUrl.includes("youtube.com")||e.videoUrl.includes("youtu.be")||e.videoUrl.includes("youtube-nocookie.com")?(0,ea.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(vy(e.videoUrl),"?autoplay=").concat(!1!==e.videoAutoplay?1:0,"&mute=").concat(!1!==e.videoMuted?1:0,"&loop=").concat(!1!==e.videoLoop?1:0,"&playlist=").concat(vy(e.videoUrl),"&controls=").concat(!1!==e.videoControls?1:0),className:"w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0}):e.videoUrl.includes("vimeo.com")?(0,ea.jsx)("iframe",{src:"https://player.vimeo.com/video/".concat(by(e.videoUrl),"?autoplay=").concat(!1!==e.videoAutoplay?1:0,"&muted=").concat(!1!==e.videoMuted?1:0,"&loop=").concat(!1!==e.videoLoop?1:0,"&controls=").concat(!1!==e.videoControls?1:0),className:"w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0}):(0,ea.jsx)("video",{src:e.videoUrl,autoPlay:!1!==e.videoAutoplay,muted:!1!==e.videoMuted,loop:!1!==e.videoLoop,controls:!1!==e.videoControls,className:"w-full h-full object-cover"})}),"card"===e.type&&(0,ea.jsxs)("div",{className:"flex flex-col h-full",children:["top"===(e.imagePosition||"top")&&(0,ea.jsxs)(ea.Fragment,{children:["image"===(e.mediaType||"image")&&e.imageUrl&&(()=>{const t=e.shapeMask&&"none"!==e.shapeMask,s="custom"===e.cardImageSizeMode||"width"===e.cardImageSizeMode?"".concat(e.cardImageWidth||200,"px"):"100%",a="custom"!==e.cardImageSizeMode&&"height"!==e.cardImageSizeMode&&e.cardImageSizeMode||"auto"===e.cardImageHeight?"auto":"".concat(e.cardImageHeight||200,"px"),n="circle"===e.shapeMask||"ellipse"===e.shapeMask?"50%":"rounded"===e.shapeMask?"20px":t?"0":"8px",l="diamond"===e.shapeMask?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===e.shapeMask?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===e.shapeMask?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===e.shapeMask?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===e.shapeMask?"ellipse(50% 100% at 50% 100%)":"none";return(0,ea.jsx)("div",{className:"mb-4",style:{textAlign:e.textAlign||"left"},children:(0,ea.jsx)("div",{className:"inline-block overflow-hidden",style:{width:s,height:a,maxWidth:"100%",borderRadius:n,clipPath:l,border:t&&e.shapeBorderWidth?"".concat(e.shapeBorderWidth,"px solid ").concat(e.shapeBorderColor||"#ffffff"):"none"},children:(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",className:"w-full h-full",style:{objectFit:e.cardImageFit||"contain",borderRadius:n}})})})})(),"video"===e.mediaType&&e.videoUrl&&(0,ea.jsx)("div",{className:"mb-4 rounded-lg overflow-hidden",style:{height:"".concat(e.videoHeight||200,"px"),textAlign:e.textAlign||"left"},children:e.videoUrl.includes("youtube.com")||e.videoUrl.includes("youtu.be")||e.videoUrl.includes("youtube-nocookie.com")?(0,ea.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(vy(e.videoUrl),"?autoplay=").concat(!1!==e.videoAutoplay?1:0,"&mute=").concat(!1!==e.videoMuted?1:0,"&loop=").concat(!1!==e.videoLoop?1:0,"&playlist=").concat(vy(e.videoUrl),"&controls=").concat(!1!==e.videoControls?1:0),className:"w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0}):e.videoUrl.includes("vimeo.com")?(0,ea.jsx)("iframe",{src:"https://player.vimeo.com/video/".concat(by(e.videoUrl),"?autoplay=").concat(!1!==e.videoAutoplay?1:0,"&muted=").concat(!1!==e.videoMuted?1:0,"&loop=").concat(!1!==e.videoLoop?1:0,"&controls=").concat(!1!==e.videoControls?1:0),className:"w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0}):(0,ea.jsx)("video",{src:e.videoUrl,autoPlay:!1!==e.videoAutoplay,muted:!1!==e.videoMuted,loop:!1!==e.videoLoop,controls:!1!==e.videoControls,className:"w-full h-full object-cover"})})]}),(0,ea.jsx)("div",{className:"flex-grow card-text-content",dangerouslySetInnerHTML:{__html:yy(z(e.html||"<p>Card content</p>"),{tighter:!0})},style:d(d({color:e.textColor||F("body_color")||"#475569",textAlign:e.textAlign||"left"},e.fontSize&&"16"!==e.fontSize&&16!==e.fontSize?{fontSize:jy(e.fontSize)}:{}),{},{fontFamily:e.fontFamily||"inherit",overflowWrap:"anywhere",wordBreak:"break-word",minWidth:0})}),(0,ea.jsx)("style",{children:'\n .card-text-content h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.2; margin: 0.5rem 0; color: inherit; }\n .card-text-content h2 { font-size: 1.875rem; font-weight: 700; line-height: 1.3; margin: 0.5rem 0; color: inherit; }\n .card-text-content h3 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; margin: 0.5rem 0; color: inherit; }\n .card-text-content h4 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .card-text-content h5 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .card-text-content h6 { font-size: 1rem; font-weight: 600; line-height: 1.4; margin: 0.5rem 0; color: inherit; }\n .card-text-content p { margin: 0.5rem 0; color: inherit; }\n .card-text-content ul { list-style-type: disc; padding-left: 1.5rem; margin: 0.5rem 0; color: inherit; }\n .card-text-content ol { list-style-type: decimal; padding-left: 1.5rem; margin: 0.5rem 0; color: inherit; }\n .card-text-content li { margin: 0.25rem 0; display: list-item; color: inherit; }\n .card-text-content ul ul { list-style-type: circle; }\n .card-text-content ul ul ul { list-style-type: square; }\n .card-text-content span:not([style*="color"]) { color: inherit; }\n '}),"bottom"===e.imagePosition&&(0,ea.jsxs)(ea.Fragment,{children:["image"===(e.mediaType||"image")&&e.imageUrl&&(()=>{const t=e.shapeMask&&"none"!==e.shapeMask,s="custom"===e.cardImageSizeMode||"width"===e.cardImageSizeMode?"".concat(e.cardImageWidth||200,"px"):"100%",a="custom"!==e.cardImageSizeMode&&"height"!==e.cardImageSizeMode&&e.cardImageSizeMode||"auto"===e.cardImageHeight?"auto":"".concat(e.cardImageHeight||200,"px"),n="circle"===e.shapeMask||"ellipse"===e.shapeMask?"50%":"rounded"===e.shapeMask?"20px":t?"0":"8px",l="diamond"===e.shapeMask?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===e.shapeMask?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===e.shapeMask?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===e.shapeMask?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===e.shapeMask?"ellipse(50% 100% at 50% 100%)":"none";return(0,ea.jsx)("div",{className:"mt-4",style:{textAlign:e.textAlign||"left"},children:(0,ea.jsx)("div",{className:"inline-block overflow-hidden",style:{width:s,height:a,maxWidth:"100%",borderRadius:n,clipPath:l,border:t&&e.shapeBorderWidth?"".concat(e.shapeBorderWidth,"px solid ").concat(e.shapeBorderColor||"#ffffff"):"none"},children:(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",className:"w-full h-full",style:{objectFit:e.cardImageFit||"contain",borderRadius:n}})})})})(),"video"===e.mediaType&&e.videoUrl&&(0,ea.jsx)("div",{className:"mt-4 rounded-lg overflow-hidden",style:{height:"".concat(e.videoHeight||200,"px"),textAlign:e.textAlign||"left"},children:e.videoUrl.includes("youtube.com")||e.videoUrl.includes("youtu.be")||e.videoUrl.includes("youtube-nocookie.com")?(0,ea.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(vy(e.videoUrl),"?autoplay=").concat(!1!==e.videoAutoplay?1:0,"&mute=").concat(!1!==e.videoMuted?1:0,"&loop=").concat(!1!==e.videoLoop?1:0,"&playlist=").concat(vy(e.videoUrl),"&controls=").concat(!1!==e.videoControls?1:0),className:"w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0}):e.videoUrl.includes("vimeo.com")?(0,ea.jsx)("iframe",{src:"https://player.vimeo.com/video/".concat(by(e.videoUrl),"?autoplay=").concat(!1!==e.videoAutoplay?1:0,"&muted=").concat(!1!==e.videoMuted?1:0,"&loop=").concat(!1!==e.videoLoop?1:0,"&controls=").concat(!1!==e.videoControls?1:0),className:"w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0}):(0,ea.jsx)("video",{src:e.videoUrl,autoPlay:!1!==e.videoAutoplay,muted:!1!==e.videoMuted,loop:!1!==e.videoLoop,controls:!1!==e.videoControls,className:"w-full h-full object-cover"})})]})]}),e.hasButton&&!n&&r()]})),n&&r()]},t)})},"block-".concat(a)));case"image-text-row":const ze=o.slides||[],Me=ze.length>1,Pe=ze.length>0?ze:[{imageUrl:o.imageUrl||"",imageAlt:o.imageAlt||"",textHtml:o.textHtml||"<p>Text content</p>",imagePosition:o.imagePosition||"left",imageSizeMode:o.imageSizeMode||"width",imageWidth:o.imageWidth||300,imageHeight:o.imageHeight||200,imageAlign:o.imageAlign||"center",imageCorners:o.imageCorners||"rounded",shapeMask:o.shapeMask||"none",shapeSize:o.shapeSize||250,shapeBorderWidth:o.shapeBorderWidth||0,shapeBorderColor:o.shapeBorderColor||"#ffffff",paddingSide:o.paddingSide||"all",paddingSize:o.paddingSize||0}];if(Me)return R((0,ea.jsx)(Cy,{slides:Pe,autoPlay:!1!==o.autoPlay,autoPlaySpeed:o.autoPlaySpeed||5e3,showDots:!1!==o.showDots,showArrows:!1!==o.showArrows,wrapperClass:A,animationClass:M,blockStyle:k,processHtml:z,blockWidth:o.blockWidth||"container",pages:f,isQuickPreview:i},"block-".concat(a)));const Be=Pe[0],Re="left"===Be.imagePosition,Le=Be.shapeMask||"none",Ie=Be.shapeSize||250,Oe=(()=>{switch(o.blockWidth){case"full":return i?{width:"100%",maxWidth:"none"}:{width:"100vw",maxWidth:"none",marginLeft:"calc(-50vw + 50%)",marginRight:"calc(-50vw + 50%)",paddingLeft:"1rem",paddingRight:"1rem"};case"large":return{width:"100%",maxWidth:"1200px",margin:"0 auto"};case"medium":return{width:"100%",maxWidth:"900px",margin:"0 auto"};case"small":return{width:"100%",maxWidth:"600px",margin:"0 auto"};default:return{width:"100%",maxWidth:"none"}}})(),Ue=Be.imageCorners||"rounded",He=()=>{if("circle"===Le||"ellipse"===Le)return"50%";if("rounded"===Le)return"20px";if("none"!==Le)return"0";switch(Ue){case"square":return"0";case"pill":return"9999px";default:return"8px"}},We=d({width:"none"!==Le?"".concat(Ie,"px"):"custom"===Be.imageSizeMode?"".concat(Be.imageWidth||300,"px"):"height"===Be.imageSizeMode?"auto":"".concat(Be.imageWidth||300,"px"),height:"none"!==Le?"".concat("ellipse"===Le?1.25*Ie:Ie,"px"):"custom"===Be.imageSizeMode||"height"===Be.imageSizeMode?"".concat(Be.imageHeight||200,"px")
2:"auto",maxWidth:"100%",borderRadius:He(),clipPath:"diamond"===Le?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===Le?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===Le?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===Le?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===Le?"ellipse(50% 100% at 50% 100%)":"none",border:Be.shapeBorderWidth&&"none"!==Le?"".concat(Be.shapeBorderWidth,"px solid ").concat(Be.shapeBorderColor||"#ffffff"):"none",overflow:"hidden"},Be.paddingSize?{paddingTop:"all"!==Be.paddingSide&&"top"!==Be.paddingSide&&Be.paddingSide?"0":"".concat(Be.paddingSize,"px"),paddingRight:"all"!==Be.paddingSide&&"right"!==Be.paddingSide&&Be.paddingSide?"0":"".concat(Be.paddingSize,"px"),paddingBottom:"all"!==Be.paddingSide&&"bottom"!==Be.paddingSide&&Be.paddingSide?"0":"".concat(Be.paddingSize,"px"),paddingLeft:"all"!==Be.paddingSide&&"left"!==Be.paddingSide&&Be.paddingSide?"0":"".concat(Be.paddingSize,"px")}:{}),Ve=()=>(0,ea.jsx)("div",{style:{textAlign:Be.imageAlign||"center",minWidth:0,maxWidth:"100%"},children:(0,ea.jsx)("div",{className:"inline-block",style:d(d({},We),{},{maxWidth:"100%"}),children:(0,ea.jsx)("img",{src:Be.imageUrl,alt:Be.imageAlt||"",className:"w-full h-full object-cover",style:{borderRadius:He(),maxWidth:"100%"}})})});return R((0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 mb-8 items-center overflow-hidden ".concat(A," ").concat(M),style:d(d({},k),Oe),children:[Re&&Be.imageUrl&&Ve(),(0,ea.jsxs)("div",{className:"space-y-4 min-w-0",children:[(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(z(Be.textHtml||"<p>Text content</p>"),{tighter:!0})},className:"leading-relaxed image-text-slide-content",style:{textAlign:Be.textAlign||"left",color:Be.textColor||"#475569",fontSize:jy(Be.textSize||18),fontFamily:Be.fontFamily||"inherit",overflowWrap:"anywhere",wordBreak:"break-word",minWidth:0}}),(0,ea.jsx)("style",{children:iy(F)}),Be.hasButton&&(0,ea.jsx)("div",{style:{textAlign:Be.buttonAlign||"left",marginTop:"1rem"},children:(0,ea.jsxs)("a",{href:x(Be.buttonUrl)||"#",download:py(Be.buttonUrl)?gy(Be.buttonUrl):void 0,onClick:p(Be.buttonUrl),className:"inline-flex items-center justify-center gap-2 ".concat("sm"===Be.buttonSize?"px-3 py-1 text-sm":"lg"===Be.buttonSize?"px-6 py-3 text-lg":"px-4 py-2"," ").concat(Be.buttonFullWidth?"w-full":""," font-medium transition-all ").concat(Jj(Be.buttonHover||"fade")),style:Zj(Be),children:[sy(Be)&&"left"===ay(Be)&&ny(Be,"lg"===Be.buttonSize?20:16),Be.buttonText||"Learn More",sy(Be)&&"right"===ay(Be)&&ny(Be,"lg"===Be.buttonSize?20:16)]})})]}),!Re&&Be.imageUrl&&Ve()]},"block-".concat(a)));case"image-text-stack":const qe="top"===o.imagePosition,$e=o.shapeMask||"none",Ge=o.shapeSize||250,Ke=e=>{const t="top"===e?"mb-6":"mt-6";if("none"!==$e){const e=d({width:"".concat(Ge,"px"),height:"".concat("ellipse"===$e?1.25*Ge:Ge,"px"),maxWidth:"100%",borderRadius:"circle"===$e||"ellipse"===$e?"50%":"rounded"===$e?"20px":"0",clipPath:"diamond"===$e?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===$e?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===$e?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===$e?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===$e?"ellipse(50% 100% at 50% 100%)":"none",border:o.shapeBorderWidth?"".concat(o.shapeBorderWidth,"px solid ").concat(o.shapeBorderColor||"#ffffff"):"none",overflow:"hidden"},o.paddingSize?{paddingTop:"all"!==o.paddingSide&&"top"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px"),paddingRight:"all"!==o.paddingSide&&"right"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px"),paddingBottom:"all"!==o.paddingSide&&"bottom"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px"),paddingLeft:"all"!==o.paddingSide&&"left"!==o.paddingSide&&o.paddingSide?"0":"".concat(o.paddingSize,"px")}:{});return(0,ea.jsx)("div",{className:t,style:{textAlign:o.imageAlign||"center"},children:(0,ea.jsx)("div",{className:"inline-block",style:e,children:(0,ea.jsx)("img",{src:o.imageUrl,alt:o.imageAlt||"",className:"w-full h-full object-cover"})})})}{const e={width:"custom"===o.imageSizeMode?"".concat(o.imageWidth||300,"px"):"height"===o.imageSizeMode?"auto":"".concat(o.imageWidth||300,"px"),height:"custom"===o.imageSizeMode||"height"===o.imageSizeMode?"".concat(o.imageHeight||200,"px"):"auto",maxWidth:"100%"};return(0,ea.jsx)("div",{className:t,style:{textAlign:o.imageAlign||"center"},children:(0,ea.jsx)("img",{src:o.imageUrl,alt:o.imageAlt||"",className:"rounded-lg inline-block",style:e})})}};return R((0,ea.jsxs)("div",{className:"mb-8 ".concat(A," ").concat(M),style:_,children:[qe&&o.imageUrl&&Ke("top"),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:yy(z(o.textHtml||"<p>Text content</p>"))},className:"text-lg leading-relaxed text-slate-700 image-text-slide-content",style:{overflowWrap:"anywhere",wordBreak:"break-word"}}),(0,ea.jsx)("style",{children:iy(F)})]}),!qe&&o.imageUrl&&Ke("bottom")]},"block-".concat(a)));case"form":return R((0,ea.jsx)(Ey,{formId:o.formId,formName:o.formName,blockStyle:_,wrapperClass:A,animationClass:M,customStyle:o.style||{},enabledLanguages:y,defaultLanguage:j},"block-".concat(a)));case"video":{const t=o.videoUrl||"",s=o.width||"large",n=o.aspectRatio||"16:9",l=o.autoplay||!1,r=o.muted||!1,i=o.loop||!1,c=o.caption||"",d={full:"w-full",large:"max-w-4xl mx-auto",medium:"max-w-2xl mx-auto",small:"max-w-lg mx-auto"}[s]||"max-w-4xl mx-auto",u={"16:9":"56.25%","4:3":"75%","21:9":"42.85%","1:1":"100%"}[n]||"56.25%";let m=null;if(t.includes("youtube.com")||t.includes("youtu.be")||t.includes("youtube-nocookie.com")){const e=vy(t);if(e){const t=new URLSearchParams({rel:"0",modestbranding:"1",autoplay:l?"1":"0",mute:r?"1":"0",loop:i?"1":"0",controls:"1"});i&&t.set("playlist",e),m=(0,ea.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(e,"?").concat(t.toString()),className:"absolute inset-0 w-full h-full",frameBorder:"0",allow:"autoplay; encrypted-media; fullscreen; picture-in-picture",allowFullScreen:!0,title:"Video"})}}else if(t.includes("vimeo.com")){const e=by(t);e&&(m=(0,ea.jsx)("iframe",{src:"https://player.vimeo.com/video/".concat(e,"?autoplay=").concat(l?1:0,"&muted=").concat(r?1:0,"&loop=").concat(i?1:0),className:"absolute inset-0 w-full h-full",frameBorder:"0",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,title:"Video"}))}else t&&(m=(0,ea.jsx)("video",{src:t,controls:!0,autoPlay:l,muted:r,loop:i,playsInl
2ine:!0,className:"absolute inset-0 w-full h-full object-contain"}));return R(t?(0,ea.jsx)("div",{className:"".concat(d," px-4"),style:_,"data-testid":"video-embed-block",children:(0,ea.jsxs)("figure",{children:[(0,ea.jsx)("div",{className:"relative rounded-xl overflow-hidden",style:{paddingBottom:u},children:m}),c&&(0,ea.jsx)("figcaption",{className:"text-xs text-slate-500 mt-2 text-center italic",children:c})]})},e.id||a):(0,ea.jsx)("div",{className:"".concat(d," px-4"),style:_,children:(0,ea.jsx)("div",{className:"border-2 border-dashed border-slate-300 rounded-xl p-12 text-center text-slate-400",children:"No video URL provided"})},e.id||a))}case"gallery":const Ye=o.images||[],Je=o.layout||"grid-3",Qe=o.gap||"16",Xe=o.imageRadius||"8",Ze=o.aspectRatio||"auto",et=!1!==o.enableLightbox,tt=o.imageAnimation||"none",st=o.animationSpeed||"0.3",at=o.hoverEffect||"zoom",nt=!1!==o.staggerAnimation,lt=()=>{switch(Je){case"grid-2":return 2;case"grid-3":case"masonry":default:return 3;case"grid-4":case"featured":return 4}},rt=()=>{switch(at){case"zoom":return"hover:scale-105";case"brighten":return"hover:brightness-110";case"darken":return"hover:brightness-75";case"grayscale":return"grayscale hover:grayscale-0";default:return""}},it=e=>{if("none"===tt)return{};const t=nt?"".concat(.1*e,"s"):"0s";return{animation:"".concat(tt," ").concat(st,"s ease-out ").concat(t," both")}},ot=("grid-2"===Je||"grid-3"===Je)&&"auto"===Ze?"4/3":Ze;if(0===Ye.length)return R((0,ea.jsx)("div",{className:"mb-8 p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center ".concat(A),style:_,children:(0,ea.jsx)("p",{className:"text-slate-400",children:"No images in gallery"})},"block-".concat(a)));if("carousel"===Je)return R((0,ea.jsx)(ky,{images:Ye,enableLightbox:et,blockStyle:k,wrapperClass:A,renderGallery:e=>(0,ea.jsx)("div",{className:"overflow-x-auto pb-4",children:(0,ea.jsx)("div",{className:"flex gap-4",style:{gap:"".concat(Qe,"px")},children:Ye.map((t,s)=>(0,ea.jsx)("div",{className:"flex-shrink-0 w-80 cursor-pointer overflow-hidden transition-transform duration-300 ".concat(rt()),style:d({borderRadius:"".concat(Xe,"px")},it(s)),onClick:()=>e(s),children:(0,ea.jsx)("img",{src:t.url,alt:t.alt||"",className:"w-full h-48 object-cover transition-all duration-300"})},t.id||s))})})},"block-".concat(a)));if("featured"===Je&&Ye.length>0){const e=o.thumbnailPosition||"side";return R((0,ea.jsx)(Dy,{images:Ye,gap:Qe,radius:Xe,thumbnailPosition:e,blockStyle:k,wrapperClass:A,animationClass:"",enableLightbox:et},"block-".concat(a)))}const ct=lt(),dt="masonry"===Je;return R((0,ea.jsx)(ky,{images:Ye,enableLightbox:et,blockStyle:k,wrapperClass:A,renderGallery:e=>(0,ea.jsx)("div",{className:dt?"columns-1 sm:columns-2 lg:columns-3 gap-4":"grid grid-cols-1 sm:grid-cols-2 ".concat(2===ct?"lg:grid-cols-2":3===ct?"lg:grid-cols-3":4===ct?"lg:grid-cols-4":"lg:grid-cols-3"),style:dt?{columnGap:"".concat(Qe,"px")}:{gap:"".concat(Qe,"px")},children:Ye.map((t,s)=>(0,ea.jsx)("div",{className:"".concat(dt?"mb-4 break-inside-avoid":""," cursor-pointer overflow-hidden transition-transform duration-300 ").concat(rt()),style:d({borderRadius:"".concat(Xe,"px"),overflow:"hidden",aspectRatio:"auto"===ot||dt?void 0:ot},it(s)),onClick:()=>e(s),children:(0,ea.jsx)("img",{src:t.url,alt:t.alt||"",className:"w-full transition-all duration-300 ".concat("auto"===ot||dt?"":"h-full object-cover")})},t.id||s))})},"block-".concat(a)));case"ticker":const ut=o.items||[],mt=o.direction||"left",ht=o.speed||"medium",xt=o.animationStyle||"continuous",pt=!1!==o.pauseOnHover,gt=o.transparentBg?"transparent":o.backgroundColor||"#f8fafc",ft=o.itemSpacing||48,vt=o.itemHeight||48,bt=o.verticalPadding||16,jt=o.logoFilter||"none",yt=()=>{const e=3*("continuous"===xt?Math.max(ut.length,Math.ceil(2e3/(150+ft))):ut.length);switch(ht){case"slow":return 1.5*e;case"fast":return.5*e;default:return e}},Nt=()=>{switch(ht){case"slow":return 4e3;case"fast":return 1500;default:return 2500}};if(0===ut.length)return R((0,ea.jsx)("div",{className:"mb-8 p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center ".concat(A),style:_,children:(0,ea.jsx)("p",{className:"text-slate-400",children:"No items in ticker tape"})},"block-".concat(a)));const wt="\n @keyframes ticker-scroll-left {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n @keyframes ticker-scroll-right {\n 0% { transform: translateX(-50%); }\n 100% { transform: translateX(0); }\n }\n ",Ct=()=>{switch(jt){case"grayscale":return"grayscale";case"grayscale-hover":return"grayscale hover:grayscale-0 transition-all duration-300";default:return""}},kt=(e,t)=>
2{const s="image"===e.type?e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",style:{height:"".concat(vt,"px"),maxWidth:"150px",objectFit:"contain"},className:Ct()}):null:(0,ea.jsx)("span",{className:"text-slate-700 font-medium whitespace-nowrap text-lg",children:e.text||""});return s?e.link?(0,ea.jsx)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",className:"flex-shrink-0 hover:opacity-80 transition-opacity",style:{marginRight:"".concat(ft,"px")},children:s},t):(0,ea.jsx)("div",{className:"flex-shrink-0",style:{marginRight:"".concat(ft,"px")},children:s},t):null},Dt=150+ft,_t=Math.max(ut.length,Math.ceil(2e3/Dt)),St=Math.ceil(_t/ut.length),Et=[];for(let e=0;e<St;e++)Et.push(...ut);const At="continuous"===xt?[...Et,...Et]:ut;return R((0,ea.jsxs)("div",{className:"mb-8 overflow-hidden ".concat(A," ").concat(M),style:d(d({},k),{},{backgroundColor:gt,padding:"".concat(bt,"px 0")}),children:[(0,ea.jsx)("style",{children:wt}),"continuous"===xt?(0,ea.jsx)("div",{className:"flex items-center",style:{animation:"ticker-scroll-".concat(mt," ").concat(yt(),"s linear infinite"),animationPlayState:"running",width:"max-content"},onMouseEnter:e=>pt&&(e.currentTarget.style.animationPlayState="paused"),onMouseLeave:e=>pt&&(e.currentTarget.style.animationPlayState="running"),children:At.map((e,t)=>kt(e,t))}):(0,ea.jsx)(Ay,{items:ut,direction:mt,stepDuration:Nt(),pauseOnHover:pt,spacing:ft,renderItem:kt})]},"block-".concat(a)));case"article-feed":return R((0,ea.jsx)(iN,{content:o,styles:m,tenantId:c,wrapperClass:A,animationClass:M,blockStyle:_,currentLanguage:b,defaultLanguage:j},"block-".concat(a)));case"search":return(0,ea.jsx)(hy,{content:o,siteTheme:E,subdomain:v,wrapperClass:A,animationClass:M,blockStyle:_},"block-".concat(a));case"events-calendar":return R((0,ea.jsx)(rN,{content:o,styles:m,tenantId:c,subdomain:v,wrapperClass:A,animationClass:M,blockStyle:_},"block-".concat(a)));case"article-card":const Ft=o.articleSlug||o.articleId;let Tt;if(Ft){const e=window.location.hostname;Tt=(e.includes("emergentagent.com")||e.includes("localhost")||/^\d+\.\d+\.\d+\.\d+$/.test(e))&&v?"/site/".concat(v,"/article/").concat(Ft):v?"/article/".concat(Ft):"#"}else Tt="#";return"headline"===o.displayStyle?(0,ea.jsx)("div",{className:"".concat(A," ").concat(M),style:_,children:(0,ea.jsxs)("a",{href:Tt,className:"text-lg font-semibold hover:underline",style:{color:F("heading_color")||"#1e293b"},children:[o.articleTitle||"Article Title",!1!==o.showReadMore&&(0,ea.jsx)("span",{className:"ml-2",children:"\u2192"})]})},"block-".concat(a)):(0,ea.jsx)("div",{className:"".concat(A," ").concat(M),style:_,children:(0,ea.jsxs)("div",{className:"bg-white rounded-lg overflow-hidden border border-slate-200 shadow-sm max-w-2xl mx-auto",children:[!1!==o.showImage&&o.articleImage&&(0,ea.jsx)("a",{href:Tt,children:(0,ea.jsx)("img",{src:o.articleImage,alt:o.articleTitle||"",className:"w-full h-48 object-cover hover:opacity-90 transition-opacity"})}),(0,ea.jsxs)("div",{className:"p-5",children:[(0,ea.jsx)("a",{href:Tt,children:(0,ea.jsx)("h3",{className:"font-bold text-xl hover:underline",style:{color:F("heading_color")||"#1e293b",fontFamily:F("heading_font")||"inherit"},children:o.articleTitle||"Article Title"})}),!1!==o.showDate&&o.articleDate&&(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:new Date(o.articleDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),!1!==o.showExcerpt&&o.articleExcerpt&&(0,ea.jsx)("p",{className:"mt-3 line-clamp-3",style:{color:F("body_color")||"#475569",fontFamily:F("body_font")||"inherit"},children:o.articleExcerpt}),!1!==o.showReadMore&&(0,ea.jsxs)("a",{href:Tt,className:"inline-block mt-4 font-medium hover:underline",style:{color:F("accent_color")||"#4f46e5"},children:[o.readMoreText||"Read Full Article"," \u2192"]})]})]})},"block-".concat(a));case"testimonials":{const e=o.items||[],t=o.titleStyle||{},s=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)";return R((0,ea.jsx)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(A," ").concat(M),style:_,children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[o.title&&(0,ea.jsx)("h2",{className:"mb-10",style:{color:t.color||"var(--site-heading-color)",fontFamily:t.fontFamily||"var(--site-heading-font)",fontSize:jy(t.fontSize||36),fontWeight:t.fontWeight||"bold",textAlign:t.align||"center",lineHeight:1.2},children:o.title}),0===e.length?(0,ea.jsx)("div",{className:"p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"No testimonials yet"})}):(0,ea.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(e=>(0,ea.jsxs)("div",{className:"p-6",style:{backgroundColor:"var(--site-bg, #f8fafc)",color:"var(--site-body-color)",border:"1px solid var(--site-border-color)",borderRadius:"var(--site-radius)",boxShadow:"var(--site-shadow)"},children:[(0,ea.jsx)(Zl,{size:32,className:"mb-4 opacity-20",style:{color:s}}),(0,ea.jsxs)("p",{className:"text-lg mb-4 italic",children:["\u201c",e.quote,"\u201d"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[e.avatar&&(0,ea.jsx)("img",{src:e.avatar,alt:e.author||"",className:"w-12 h-12 rounded-full object-cover"}),(0,ea.jsxs)("div",{children:[e.author&&(0,ea.jsx)("p",{className:"font-semibold",style:{color:"var(--site-heading-color)"},children:e.author}),e.role&&(0,ea.jsx)("p",{className:"text-sm opacity-60",children:e.role})]})]})]},e.id))})]})},"block-".concat(a)))}case"pricing":{const e=o.items||[],t=o.titleStyle||{},s=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",n=m.borderRadius||"var(--site-radius)",l=parseInt(o.columnCount,10),r=Number.isFinite(l)&&l>=1&&l<=4?l:4,i=Math.min(e.length||1,r),c=1===i?"md:grid-cols-1":2===i?"md:grid-cols-2":3===i?"md:grid-cols-3":"md:grid-cols-4",u=m.borderColor&&m.borderColor.startsWith("#")?"".concat(m.borderColor,"1A"):"color-mix(in srgb, var(--site-accent) 10%, transparent)";return R((0,ea.jsx)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(A," ").concat(M),style:_,children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[o.title&&(0,ea.jsx)("h2",{className:"mb-10",style:{color:t.color||"var(--site-heading-color)",fontFamily:t.fontFamily||"var(--site-heading-font)",fontSize:jy(t.fontSize||36),fontWeight:t.fontWeight||"bold",textAlign:t.align||"center",lineHeight:1.2},children:o.title}),0===e.length?(0,ea.jsx)("div",{className:"p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"No pricing plans yet"})}):(0,ea.jsx)("div",{className:"grid ".concat(c," gap-6"),children:e.map(e=>{const t=e.buttonUrl?x(e.buttonUrl):"#",a=e.buttonUrl?p(e.buttonUrl):null;return(0,ea.jsxs)("div",{className:"p-6 flex flex-col ".concat(e.highlighted?"md:scale-105":""),style:d({backgroundColor:e.highlighted?u:"var(--site-bg, #f8fafc)",color:"var(--site-body-color)",border:"1px solid var(--site-border-color)",borderRadius:n,boxShadow:"var(--site-shadow)"},e.highlighted?{boxShadow:"0 0 0 2px ".concat(s,", var(--site-shadow)")}:{}),children:[e.highlighted&&(0,ea.jsx)("div",{className:"text-xs font-semibold text-white px-3 py-1 rounded-full mb-4 inline-block self-start",style:{backgroundColor:s},children:"Most Popular"}),(0,ea.jsx)("h3",{className:"text-xl font-bold mb-2",style:{color:"var(--site-heading-color)"},children:e.name}),(0,ea.jsxs)("div",{className:"mb-4",children:[(0,ea.jsx)("span",{className:"text-4xl font-bold",style:{color:s},children:e.price}),(0,ea.jsx)("span",{className:"opacity-60",children:e.period})]}),(0,ea.jsx)("ul",{className:"space-y-2 mb-6 flex-1",children:(e.features||[]).filter(e=>e&&e.trim()).map((e,t)=>(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)(Xl,{size:16,className:"mt-1 flex-shrink-0",style:{color:s}}),(0,ea.jsx)("span",{children:e})]},t))}),e.buttonText&&(0,ea.jsxs)("a",{href:t,onClick:a||void 0,className:"w-full py-3 font-semibold text-white transition-all hover:opacity-90 text-center inline-flex items-center justify-center gap-2 ".concat(ty(o)),style:{backgroundColor:s,borderRadius:o.buttonRadius?Yj(o.buttonRadius):"var(--site-button-radius)"},children:[sy(o)&&"left"===ay(o)&&ny(o,18),e.buttonText,sy(o)&&"right"===ay(o)&&ny(o,18)]})]},e.id)})})]})},"block-".concat(a)))}case"feature-comparison":{const t=o.titleStyle||{},s=o.plans||[],n=o.categories||[],l=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",r=e=>{const t=(null==e?"":String(e)).trim().toLowerCase();return"yes"===t||"true"===t||"\u2713"===t||"y"===t?(0,ea.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full",style:{backgroundColor:"".concat(l,"1A"),color:l},"aria-label":"Included",children:(0,ea.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ea.jsx)("polyline",{points:"4 11 8 15 16 6"})})}):"no"===t||"false"===t||"\u2717"===t||"x"===t||"n"===t||"-"===t||""===t?(0,ea.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full bg-slate-100 text-slate-400","aria-label":"Not included",children:(0,ea.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[(0,ea.jsx)("line",{x1:"5",y1:"5",x2:"15",y2:"15"}),(0,ea.jsx)("line",{x1:"15",y1:"5",x2:"5",y2:"15"})]})}):(0,ea.jsx)("span",{className:"text-sm",style:{color:"var(--site-body-color)"},children:e})};return R((0,ea.jsx)(cy,{block:e,content:o,plans:s,categories:n,accentColor:l,ts:t,renderValue:r,finalBlockStyle:_,wrapperClass:A,animationClass:M,index:a}))}case"plan-comparison":{const t=o.titleStyle||{},n=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)";let l,r;if("manual"===o.source)l=o.plans||[],r=o.rows||[];else{var L;const e=(s||[]).find(e=>{var t;return"pricing"===e.type&&((null===(t=e.content)||void 0===t?void 0:t.items)||[]).length>0}),t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=(e||[]).map(e=>({id:e.id,name:e.name,price:e.price,period:e.period,highlighted:!!e.highlighted,badge:e.highlighted?"Most Popular":"",buttonText:e.buttonText,buttonUrl:e.buttonUrl})),s=new Map;
2(e||[]).forEach(e=>{(e.features||[]).forEach(e=>{const t=(e||"").trim(),a=t.toLowerCase();a&&!s.has(a)&&s.set(a,t)})});const a=Array.from(s.entries()).map(t=>{let[s,a]=t;return{id:"row-".concat(s.replace(/[^a-z0-9]+/g,"-")),label:a,values:(e||[]).reduce((e,t)=>(e[t.id]=((e,t)=>(e.features||[]).some(e=>(e||"").trim().toLowerCase()===t))(t,s)?"yes":"no",e),{})}}).filter(e=>t.some(t=>"yes"===e.values[t.id]));return{plans:t,rows:a}}((null===e||void 0===e||null===(L=e.content)||void 0===L?void 0:L.items)||[]);l=t.plans,r=t.rows}return R((0,ea.jsx)(dy,{block:e,content:o,plans:l,rows:r,accentColor:n,ts:t,finalBlockStyle:_,wrapperClass:A,animationClass:M,index:a,resolveUrl:x,getPopupClickHandler:p}))}case"faq":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)";return R((0,ea.jsx)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(A," ").concat(M),style:_,children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto",children:[o.title&&(0,ea.jsx)("h2",{className:"mb-10",style:{color:e.color||"var(--site-heading-color)",fontFamily:e.fontFamily||"var(--site-heading-font)",fontSize:jy(e.fontSize||36),fontWeight:e.fontWeight||"bold",textAlign:e.align||"center",lineHeight:1.2},children:o.title}),(0,ea.jsx)(my,{items:o.items||[],accentColor:t,cardBg:"var(--site-bg, #ffffff)",bodyColor:"var(--site-body-color)"})]})},"block-".concat(a)))}case"cta":{const e=o.titleStyle||{},t=m.backgroundColor&&"transparent"!==m.backgroundColor,s={primary:{bg:"var(--site-primary)",fg:"#ffffff"},secondary:{bg:"var(--site-secondary)",fg:"#ffffff"},dark:{bg:"#1e293b",fg:"#ffffff"}},n=s[o.style]||s.primary,l=t?m.backgroundColor:n.bg,r=t?e.color||"#ffffff"
2:n.fg,i=o.buttonUrl?x(o.buttonUrl):"#",c=o.buttonUrl?p(o.buttonUrl):null,u=r,h=l;return R((0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(A," ").concat(M),style:d(d({},_),{},{backgroundColor:l,color:r}),children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto text-center pb-8",children:[o.title&&(0,ea.jsx)("h2",{className:"mb-4",style:{color:e.color||r,fontFamily:e.fontFamily||"var(--site-heading-font)",fontSize:jy(e.fontSize||36),fontWeight:e.fontWeight||"bold",textAlign:e.align||"center",lineHeight:1.2},children:o.title}),o.subtitle&&(0,ea.jsx)("p",{className:"text-lg opacity-90 mb-8",children:o.subtitle}),o.buttonText&&(0,ea.jsxs)("a",{href:i,onClick:c||void 0,className:"inline-flex items-center justify-center gap-2 px-8 py-4 font-semibold transition-all hover:scale-105 ".concat(ty(o)),style:{backgroundColor:u,color:h,borderRadius:o.buttonRadius?Yj(o.buttonRadius):"var(--site-button-radius)"},children:[sy(o)&&"left"===ay(o)&&ny(o,18),o.buttonText,sy(o)&&"right"===ay(o)&&ny(o,18)]})]})},"block-".concat(a)))}case"team":{const e=o.members||[],t=o.titleStyle||{},s=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",n=Math.min(e.length||1,4),l=1===n?"lg:grid-cols-1":2===n?"lg:grid-cols-2":3===n?"lg:grid-cols-3":"lg:grid-cols-4";return R((0,ea.jsx)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(A," ").concat(M),style:_,children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[o.title&&(0,ea.jsx)("h2",{className:"mb-10",style:{color:t.color||"var(--site-heading-color)",fontFamily:t.fontFamily||"var(--site-heading-font)",fontSize:jy(t.fontSize||36),fontWeight:t.fontWeight||"bold",textAlign:t.align||"center",lineHeight:1.2},children:o.title}),0===e.length?(0,ea.jsx)("div",{className:"p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"No team members yet"})}):(0,ea.jsx)("div",{className:"grid md:grid-cols-2 ".concat(l," gap-6"),children:e.map(e=>{var t,a;return(0,ea.jsxs)("div",{className:"text-center p-6",style:{backgroundColor:"var(--site-bg, #ffffff)",color:"var(--site-body-color)",border:"1px solid var(--site-border-color)",borderRadius:"var(--site-radius)",boxShadow:"var(--site-shadow)"},children:[e.image?(0,ea.jsx)("img",{src:e.image,alt:e.name||"",className:"w-24 h-24 rounded-full mx-auto mb-4 object-cover shadow-md"}):(0,ea.jsx)("div",{className:"w-24 h-24 rounded-full mx-auto mb-4 flex items-center justify-center text-2xl font-bold text-white",style:{backgroundColor:s},children:(null===(t=e.name)||void 0===t||null===(a=t.charAt(0))||void 0===a?void 0:a.toUpperCase())||"?"}),e.name&&(0,ea.jsx)("h3",{className:"font-semibold text-lg",style:{color:"var(--site-heading-color)"},children:e.name}),e.role&&(0,ea.jsx)("p",{className:"opacity-60",children:e.role}),e.bio&&(0,ea.jsx)("p",{className:"mt-2 text-sm opacity-80",children:e.bio})]},e.id)})})]})},"block-".concat(a)))}case"stats":{const e=o.items||[],t=o.titleStyle||{},s=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",n=m.backgroundColor&&"transparent"!==m.backgroundColor,l=n?m.backgroundColor:s,r=n?"var(--site-body-color)":"#ffffff",i=Math.min(e.length||1,4),c=1===i?"md:grid-cols-1":2===i?"md:grid-cols-2":3===i?"md:grid-cols-3":"md:grid-cols-4";return R((0,ea.jsx)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(A," ").concat(M),style:d(d({},_),{},{backgroundColor:l,color:r}),children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[o.title&&(0,ea.jsx)("h2",{className:"mb-10",style:{color:t.color||r,fontFamily:t.fontFamily||"var(--site-heading-font)",fontSize:jy(t.fontSize||36),fontWeight:t.fontWeight||"bold",textAlign:t.align||"center",lineHeight:1.2},children:o.title}),0===e.length?(0,ea.jsx)("div",{className:"p-8 bg-white/10 border-2 border-dashed border-white/30 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"opacity-70",children:"No statistics yet"})}):(0,ea.jsx)("div",{className:"grid grid-cols-2 ".concat(c," gap-8"),style:{fontFamily:o.statFontFamily&&"inherit"!==o.statFontFamily?o.statFontFamily:void 0},children:e.map(e=>(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"text-4xl md:text-5xl font-bold mb-2",style:{color:o.statValueColor||r},children:e.value}),(0,ea.jsx)("div",{style:{color:o.statLabelColor||r,opacity:o.statLabelColor?1:.8},children:e.label})]},e.id))})]})},"block-".concat(a)))}case"logo-cloud":{const e=(o.logos||[]).filter(e=>e&&(e.imageUrl||e.name)),t=o.titleStyle||{},s={3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6"}[o.columns||5]||"md:grid-cols-5",n="lc-".concat(a),l=e=>e?/^(https?:|\/|#|mailto:|tel:)/i.test(e)?e:"https://".concat(e):"#";return R((0,ea.jsxs)("section",{className:"py-8 px-4 md:py-16 md:px-6 ".concat(A," ").concat(M),style:_,children:[(0,ea.jsx)("style",{children:"\n .".concat(n," img { transition: filter .3s ease, opacity .3s ease; }\n ").concat(!1!==o.grayscale?".".concat(n," img { filter: grayscale(100%); opacity: .6; } .").concat(n," a:hover img, .").concat(n," .lc-item:hover img { filter: grayscale(0); opacity: 1; }"):"","\n ")}),(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[o.title&&(0,ea.jsx)("h2",{className:"mb-10",style:{color:t.color||"var(--site-heading-color)",fontFamily:t.fontFamily||"var(--site-heading-font)",fontSize:jy(t.fontSize||30),fontWeight:t.fontWeight||"bold",textAlign:t.align||"center",lineHeight:1.2},children:o.title}),0===e.length?(0,ea.jsx)("div",{className:"p-8 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"No logos yet \u2014 add client / partner logos"})}):(0,ea.jsx)("div",{className:"".concat(n," grid grid-cols-2 ").concat(s," gap-x-8 gap-y-10 items-center"),children:e.map((e,t)=>{const s=e.imageUrl?(0,ea.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,ea.jsx)("img",{src:e.imageUrl,alt:e.name||"",className:"max-h-12 w-auto object-contain"}),e.name&&(0,ea.jsx)("span",{className:"text-xs font-medium opacity-60",style:{color:"var(--site-body-color)"},children:e.name})]}):(0,ea.jsx)("span",{className:"text-lg font-semibold opacity-60",style:{color:"var(--site-body-color)"},children:e.name});return e.link?(0,ea.jsx)("a",{href:l(e.link),target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center",children:s}
2,e.id||t):(0,ea.jsx)("div",{className:"lc-item flex items-center justify-center",children:s},e.id||t)})})]})]},"block-".concat(a)))}case"hero-spotlight":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.primaryButtonColor||t,n=o.secondaryButtonColor||"#ffffff",l=m.backgroundColor&&"transparent"!==m.backgroundColor?m.backgroundColor:"#0b1020",r="hs-".concat(a),i=o.height||560,c=(e=>{const t=e.textPositionH||"center",s=e.textPositionV||"middle";return{items:"left"===t?"items-start":"right"===t?"items-end":"items-center",text:"left"===t?"text-left":"right"===t?"text-right":"text-center",justify:"top"===s?"justify-start":"bottom"===s?"justify-end":"justify-center",alignFlex:"left"===t?"flex-start":"right"===t?"flex-end":"center"}})(o),u=o.textColor||"#ffffff",h=Py(o,u),x=By(o,"".concat(u,"b8")),p=e=>e?/^(https?:|\/|#|mailto:|tel:)/i.test(e)?e:"https://".concat(e):"#",g=(()=>{switch(o.overlay){case"dark":return"rgba(0,0,0,0.5)";case"darker":return"rgba(0,0,0,0.7)";case"light":return"rgba(255,255,255,0.5)";case"gradient-dark":return"linear-gradient(to top, rgba(0,0,0,0.8), transparent)";case"gradient-primary":return"linear-gradient(135deg, rgba(99,102,241,0.8), rgba(168,85,247,0.8))";case"gradient-warm":return"linear-gradient(135deg, rgba(251,146,60,0.8), rgba(251,113,133,0.8))";case"gradient-cool":return"linear-gradient(135deg, rgba(56,189,248,0.8), rgba(99,102,241,0.8))";default:return null}})();return R((0,ea.jsxs)("section",{className:"".concat(r," relative overflow-hidden ").concat(A," ").concat(M),style:d(d(d({},_),zy(o.width)),{},{backgroundColor:l,minHeight:"".concat(i,"px")}),children:[(0,ea.jsx)("style",{children:"\n @keyframes hsUp-".concat(r," { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }\n @keyframes hsGlow-").concat(r," { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }\n .").concat(r,"::before { content: ''; position: absolute; top: -25%; left: 50%; width: 900px; height: 900px; transform: translateX(-50%); background: radial-gradient(circle, ").concat(t,"40 0%, transparent 60%); animation: hsGlow-").concat(r," 6s ease-in-out infinite; pointer-events: none; }\n .").concat(r," .hs-grid { position: absolute; inset: 0; background-image: linear-gradient(").concat(t,"14 1px, transparent 1px), linear-gradient(90deg, ").concat(t,"14 1px, transparent 1px); background-size: 44px 44px; -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%); mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%); pointer-events: none; }\n .").concat(r," .hs-anim { opacity: 0; animation: hsUp-").concat(r," .7s cubic-bezier(.16,1,.3,1) forwards; }\n ")}),(0,ea.jsx)("div",{className:"hs-grid"}),g&&(0,ea.jsx)("div",{className:"absolute inset-0 pointer-events-none",style:{background:g}}),(0,ea.jsxs)("div",{className:"relative max-w-4xl mx-auto px-6 flex flex-col ".concat(c.items," ").concat(c.text," ").concat(c.justify),style:{minHeight:"".concat(i,"px"),paddingTop:"64px",paddingBottom:"64px"},children:[o.eyebrow&&(0,ea.jsx)("span",{className:"hs-anim inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-semibold mb-6",style:{animationDelay:"0ms",color:"#fff",backgroundColor:t},children:o.eyebrow}),o.headline&&(0,ea.jsx)("h1",{className:"hs-anim font-extrabold tracking-tight w-full max-w-3xl",style:{animationDelay:"120ms",color:h.color||e.color||u,fontSize:h.fontSize||jy(56),lineHeight:1.1,fontFamily:h.fontFamily||(e.fontFamily&&"inherit"!==e.fontFamily?e.fontFamily:"var(--site-heading-font)"),fontWeight:h.fontWeight||e.fontWeight||void 0,textAlign:e.align||void 0},children:o.headline}),o.subheadline&&(0,ea.jsx)("p",{className:"hs-anim mt-5 w-full max-w-2xl",style:{animationDelay:"260ms",color:x.color||"".concat(u,"b8"),fontSize:x.fontSize||jy(18),lineHeight:1.6,fontFamily:x.fontFamily||void 0,fontWeight:x.fontWeight||void 0},children:o.subheadline}),(o.primaryButtonText||o.secondaryButtonText)&&(0,ea.jsxs)("div",{className:"hs-anim flex flex-wrap gap-3 mt-8",style:{animationDelay:"400ms",justifyContent:c.alignFlex},children:[o.primaryButtonText&&(0,ea.jsx)("a",{href:p(o.primaryButtonUrl),className:"px-6 py-3 rounded-lg font-semibold transition-transform hover:-translate-y-0.5",style:{backgroundColor:s,color:o.primaryButtonTextColor||"#fff",boxShadow:"0 10px 30px -10px ".concat(s)},children:o.primaryButtonText}),o.secondaryButtonText&&(0,ea.jsx)("a",{href:p(o.secondaryButtonUrl),className:"px-6 py-3 rounded-lg font-semibold transition-colors hover:bg-white/10",style:{color:n,border:"1px solid ".concat(n,"40")},children:o.secondaryButtonText})]})]})]},"block-".concat(a)))}case"countdown":{const e=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)";
2return R((0,ea.jsx)(eN,{content:o,accentColor:e,headStyle:Fy(o.titleStyle||{}),finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"before-after":return R((0,ea.jsx)(lN,{content:o,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)));case"hero-tabs":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Ry,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"hero-feature-cards":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)",n=(o.features||[]).filter(e=>e),l=o.accentColor||t,r=o.cardTextColor||"#ffffff";return R((0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(A," ").concat(M),style:d(d({},_),My(o)),children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[o.headline&&(0,ea.jsxs)("h1",{className:"max-w-3xl",style:d(d({fontSize:jy(52),lineHeight:1.1},Fy(e)),Py(o)),children:[o.headline,o.accentWord&&(0,ea.jsxs)("span",{style:{color:l},children:[" ",o.accentWord]})]}),o.subtitle&&(0,ea.jsx)("p",{className:"mt-5 max-w-2xl",style:d({color:s,fontSize:jy(18),lineHeight:1.6},By(o)),children:o.subtitle}),o.ctaText&&(0,ea.jsxs)("a",{href:Ty(o.ctaUrl),className:"inline-flex items-center justify-center gap-2 mt-7 px-7 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(o)),style:{backgroundColor:t,color:o.buttonTextColor||"#fff",borderRadius:Yj(o.buttonRadius)},children:[sy(o)&&"left"===ay(o)&&ny(o,18),o.ctaText,sy(o)&&"right"===ay(o)&&ny(o,18)]}),n.length>0&&(0,ea.jsx)("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-5 mt-12",children:n.map((e,s)=>(0,ea.jsxs)("a",{href:Ty(e.link),className:"group relative block rounded-2xl overflow-hidden h-56 transition-transform hover:-translate-y-1",style:{boxShadow:"0 16px 50px -20px ".concat(t,"66")},children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:e.title||"",className:"absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}):(0,ea.jsx)("div",{className:"absolute inset-0 bg-slate-200"}),(0,ea.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(to top, rgba(0,0,0,.7), transparent 60%)"}}),(0,ea.jsx)("span",{className:"absolute bottom-4 left-4 right-4 font-semibold",style:d({color:r,fontSize:jy(18)},e.titleStyle||{}),children:e.title})]},e.id||s))})]})},"block-".concat(a)))}case"hero-split-stats":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)",n=(o.images||[]).filter(e=>e&&e.imageUrl).map(e=>e.imageUrl),l=(o.stats||[]).filter(e=>e),r=o.statColor||t;return R((0,ea.jsx)("section",{className:"py-10 px-4 md:py-20 md:px-6 ".concat(A," ").concat(M),style:d(d({},_),My(o)),children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto grid lg:grid-cols-2 gap-12 items-center",children:[(0,ea.jsxs)("div",{children:[o.headline&&(0,ea.jsx)("h1",{style:d(d({fontSize:jy(50),lineHeight:1.1},Fy(e)),Py(o)),children:o.headline}),o.subtitle&&(0,ea.jsx)("p",{className:"mt-5 max-w-xl",style:d({color:s,fontSize:jy(18),lineHeight:1.6},By(o)),children:o.subtitle}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3 mt-7",children:[o.primaryButtonText&&(0,ea.jsx)("a",{href:Ty(o.primaryButtonUrl),className:"px-6 py-3 rounded-lg font-semibold transition-transform hover:-translate-y-0.5",style:{backgroundColor:t,color:o.buttonTextColor||"#fff"},children:o.primaryButtonText}),o.secondaryButtonText&&(0,ea.jsx)("a",{href:Ty(o.secondaryButtonUrl),className:"px-6 py-3 rounded-lg font-semibold",style:{color:o.secondaryButtonTextColor||"var(--site-heading-color)",border:"1px solid ".concat(t,"55")},children:o.secondaryButtonText})]}),l.length>0&&(0,ea.jsx)("div",{className:"flex flex-wrap gap-8 mt-10",children:l.map((e,t)=>(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"font-extrabold",style:d({color:r,fontSize:jy(30)},e.valueStyle||{}),children:e.value}),(0,ea.jsx)("div",{className:"text-sm",style:d({color:s},e.labelStyle||{}),children:e.label})]},t))})]}),(0,ea.jsx)("div",{className:"grid grid-cols-2 gap-4",children:0===n.length?i?(0,ea.jsx)("div",{className:"col-span-2 h-64 roun
2ded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",children:"Add up to 3 images"}):null:(0,ea.jsxs)(ea.Fragment,{children:[n[0]&&(0,ea.jsx)("img",{src:n[0],alt:"",className:"rounded-2xl object-cover w-full h-64 row-span-2",style:{height:"100%"}}),n[1]&&(0,ea.jsx)("img",{src:n[1],alt:"",className:"rounded-2xl object-cover w-full h-[120px]"}),n[2]&&(0,ea.jsx)("img",{src:n[2],alt:"",className:"rounded-2xl object-cover w-full h-[120px]"})]})})]})},"block-".concat(a)))}case"hero-split-cards":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)",n="hsc-".concat(a),l=o.accentColor||t;return R((0,ea.jsxs)("section",{className:"".concat(n," relative overflow-hidden py-10 px-4 md:py-20 md:px-6 ").concat(A," ").concat(M),style:d(d({},_),My(o)),children:[(0,ea.jsx)("style",{children:".".concat(n," .hsc-grid{position:absolute;inset:0;background-image:linear-gradient(").concat(t,"12 1px,transparent 1px),linear-gradient(90deg,").concat(t,"12 1px,transparent 1px);background-size:40px 40px;-webkit-mask-image:radial-gradient(circle at 30% 40%,#000,transparent 80%);mask-image:radial-gradient(circle at 30% 40%,#000,transparent 80%);pointer-events:none;}")}),(0,ea.jsx)("div",{className:"hsc-grid"}),(0,ea.jsxs)("div",{className:"relative max-w-6xl mx-auto grid lg:grid-cols-2 gap-12 items-center",children:[(0,ea.jsxs)("div",{children:[o.headline&&(0,ea.jsxs)("h1",{style:d(d({fontSize:jy(50),lineHeight:1.1},Fy(e)),Py(o)),children:[o.headline,o.accentWord&&(0,ea.jsxs)("span",{style:{color:l},children:[" ",o.accentWord]})]}),o.subtitle&&(0,ea.jsx)("p",{className:"mt-5 max-w-xl",style:d({color:s,fontSize:jy(18),lineHeight:1.6},By(o)),children:o.subtitle}),o.buttonText&&(0,ea.jsxs)("a",{href:Ty(o.buttonUrl),className:"inline-flex items-center justify-center gap-2 mt-7 px-7 py-3 font-semibold transition-all hover:-translate-y-0.5 ".concat(ty(o)),style:{backgroundColor:t,color:o.buttonTextColor||"#fff",borderRadius:Yj(o.buttonRadius)},children:[sy(o)&&"left"===ay(o)&&ny(o,18),o.buttonText,sy(o)&&"right"===ay(o)&&ny(o,18)]})]}),(0,ea.jsxs)("div",{className:"relative h-[360px]",children:[o.imageUrl2&&(0,ea.jsx)("img",{src:o.imageUrl2,alt:"",className:"absolute rounded-2xl object-cover shadow-xl",style:{width:"62%",height:"70%",right:0,top:0,transform:"rotate(4deg)"}}),o.imageUrl1&&(0,ea.jsx)("img",{src:o.imageUrl1,alt:"",className:"absolute rounded-2xl object-cover shadow-2xl",style:{width:"62%",height:"70%",left:0,bottom:0,transform:"rotate(-4deg)",border:"4px solid ".concat(t)}}),!o.imageUrl1&&!o.imageUrl2&&i&&(0,ea.jsx)("div",{className:"absolute inset-0 rounded-2xl bg-slate-100 border-2 border-dashed border-slate-200 flex items-center justify-center text-slate-400",children:"Add two layered images"})]})]})]},"block-".concat(a)))}case"expandable-tabs":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Iy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"sparkles":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"#6366f1";return R((0,ea.jsx)(Oy,{content:o,accent:t,headStyle:Fy(e),finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"gallery-carousel":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Uy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"testimonial-deck":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Wy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"liquid-glass":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"#6366f1";return R((0,ea.jsx)(Vy,{content:o,accent:t,headStyle:Fy(e),finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"testimonials-columns":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(qy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M,scopeId:"tc-".concat(a)},"block-".concat(a)))}case"typewriter":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)";return R((0,ea.jsx)($y,{content:o,accent:t,headStyle:Fy(e),finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"gooey-text":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-heading-color)";return R((0,ea.jsx)(Gy,{content:o,accent:t,headStyle:Fy(e),finalBlockStyle:_,wrapperClass:A,animationClass:M,scopeId:"goo-".concat(a)},"block-".concat(a)))}case"text-cycle":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)";return R((0,ea.jsx)(Ky,{content:o,accent:t,headStyle:Fy(e),finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"circular-testimonials":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Yy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"stagger-testimonials":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Jy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"steps-icons":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(tN,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"steps-cards":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(sN,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"steps-grid-image":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(aN,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"steps-timeline-image":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(nN,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"handwriting-text":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Qy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M,scopeId:"hw-".concat(a)},"block-".concat(a)))}case"typewriter-smooth":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Xy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M,scopeId:"tws-".concat(a)},"block-".concat(a)))}case"folder-gallery":{const e=o.titleStyle||{},t=m.borderColor&&"transparent"!==m.borderColor?m.borderColor:"var(--site-accent)",s=o.subtitleColor||"var(--site-body-color)";return R((0,ea.jsx)(Zy,{content:o,accent:t,headStyle:Fy(e),subColor:s,finalBlockStyle:_,wrapperClass:A,animationClass:M},"block-".concat(a)))}case"unsubscribe":return(0,ea.jsx)("div",{className:"".concat(A," ").concat(M," text-center"),style:k,children:(0,ea.jsx)("a",{href:"{{unsubscribe_url}}",className:"text-sm text-slate-500 hover:text-slate-700 underline",children:o.text||"Unsubscribe from this newsletter"})},"block-".concat(a));default:return null}},B={background:(()=>{const e=F("background_type")||"solid";return"linear-gradient"===e?"linear-gradient(".concat(F("gradient_direction")||"to bottom",", ").concat(F("gradient_start")||"#6366f1",", ").concat(F("gradient_end")||"#8b5cf6",")"):"radial-gradient"===e?"radial-gradient(circle, ".concat(F("gradient_start")||"#6366f1",", ").concat(F("gradient_end")||"#8b5cf6",")"):F("background_color")||"#ffffff"})(),fontFamily:F("body_font")||"Inter, sans-serif",minHeight:s&&s.length>0?"400px":void 0},R=(e,t)=>{S({isOpen:!0,pageSlug:e,previewToken:t})};return null!==h||E||r&&!1===r.use_site_theme?(0,ea.jsxs)("div",{className:"flex flex-col min-h-full",children:[u&&A.header&&(0,ea.jsx)(Sy,{menu:A.header,location:"header",siteTheme:E,previewToken:g,pages:f,onPopupOpen:R,subdomain:v,currentLanguage:b,defaultLanguage:j,tenantId:c}),(0,ea.jsx)("div",{className:"flex-1 ".concat(i?"flex justify-center py-8":""),children:(0,ea.jsxs)("div",{className:"preview-theme-scope w-full ".concat(i?"".concat(M()," py-12 px-8 rounded-xl shadow-lg border border-slate-200 overflow-hidden quick-preview-mode"):"overflow-x-hidden"),"data-testid":"preview-renderer",style:B,children:[(0,ea.jsxs)("style",{children:[(()=>{const e=(e,t)=>
2F(e)||t,t={pill:"999px",sharp:"0px",rounded:"8px",default:"8px"},s=t[e("button_style","rounded")]||t.default,a={none:"0px",sm:"6px",md:"12px",lg:"20px",xl:"28px"}[e("border_radius","md")]||"12px",n={none:"none",subtle:"0 1px 2px rgba(0,0,0,0.05), 0 1px 4px rgba(0,0,0,0.04)",medium:"0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.05)",dramatic:"0 20px 25px -5px rgba(0,0,0,0.10), 0 10px 10px -5px rgba(0,0,0,0.04)"},l=n[e("shadow_preset","medium")]||n.medium;return"\n .preview-theme-scope {\n --site-primary: ".concat(e("primary_color","#4f46e5"),";\n --site-secondary: ").concat(e("secondary_color","#8b5cf6"),";\n --site-accent: ").concat(e("accent_color",e("primary_color","#4f46e5")),";\n --site-heading-color: ").concat(e("heading_color","#1e293b"),";\n --site-body-color: ").concat(e("body_color","#475569"),";\n --site-muted-color: ").concat(e("muted_color","#94a3b8"),";\n --site-border-color: ").concat(e("border_color","#e2e8f0"),";\n --site-link-color: ").concat(e("link_color","#2563eb"),";\n --site-link-hover-color: ").concat(e("link_hover_color",e("link_color","#1d4ed8")),";\n --site-bg: ").concat(e("background_color","#ffffff"),";\n --site-heading-font: ").concat(e("heading_font","Manrope, sans-serif"),";\n --site-body-font: ").concat(e("body_font","Inter, sans-serif"),";\n --site-h1-size: ").concat(e("h1_size",48),"px;\n --site-h2-size: ").concat(e("h2_size",36),"px;\n --site-h3-size: ").concat(e("h3_size",28),"px;\n --site-h4-size: ").concat(e("h4_size",22),"px;\n --site-body-size: ").concat(e("body_size",16),"px;\n --site-radius: ").concat(a,";\n --site-button-radius: ").concat(s,";\n --site-shadow: ").concat(l,';\n }\n\n /* Shape & Style \u2014 apply site radius + shadow to common block elements.\n The :not([style*="border-radius"]) (and similar) means an inline style\n set by the user on a specific block ALWAYS wins. This rule only\n affects elements that haven\'t explicitly overridden these props. */\n .preview-theme-scope img:not([style*="border-radius"]) {\n border-radius: var(--site-radius);\n }\n .preview-theme-scope .block-card:not([style*="border-radius"]),\n .preview-theme-scope .pricing-card:not([style*="border-radius"]),\n .preview-theme-scope .testimonial-card:not([style*="border-radius"]) {\n border-radius: var(--site-radius);\n box-shadow: var(--site-shadow);\n }\n /* Form inputs + textareas inside blocks also follow the site radius */\n .preview-theme-scope input:not([style*="border-radius"]),\n .preview-theme-scope textarea:not([style*="border-radius"]),\n .preview-theme-scope select:not([style*="border-radius"]) {\n border-radius: var(--site-radius);\n }\n ')})(),'\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fadeInUp {\n from { opacity: 0; transform: translateY(30px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fadeInDown {\n from { opacity: 0; transform: translateY(-30px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes slideLeft {\n from { opacity: 0; transform: translateX(50px); }\n to { opacity: 1; transform: translateX(0); }\n }\n @keyframes slideRight {\n from { opacity: 0; transform: translateX(-50px); }\n to { opacity: 1; transform: translateX(0); }\n }\n @keyframes zoomIn {\n from { opacity: 0; transform: scale(0.8); }\n to { opacity: 1; transform: scale(1); }\n }\n @keyframes bounce {\n 0%, 20%, 53%, 100% { transform: translateY(0); }\n 40%, 43% { transform: translateY(-20px); }\n 70% { transform: translateY(-10px); }\n 90% { transform: translateY(-4px); }\n }\n @keyframes shake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }\n 20%, 40%, 60%, 80% { transform: translateX(2px); }\n }\n .full-width-banner {\n margin-left: calc(-50vw + 50%);\n margin-right: calc(-50vw + 50%);\n width: 100vw;\n }\n .quick-preview-mode .full-width-banner {\n margin-left: 0;\n margin-right: 0;\n width: 100%;\n }\n\n /* \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n Mobile-responsive block spacing overrides (< 768px).\n Blocks in the CMS often have desktop-tuned Tailwind margin\n classes (mb-8, mb-12, mb-16) plus inline styles like\n minHeight: 500px, padding: 80px. On phones this leaves\n huge white gaps between blocks. These rules shrink those\n to sane mobile values ONLY on narrow viewports \u2014 desktop\n is unaffected.\n Scope with .preview-theme-scope so we don\'t touch the\n admin chrome or unrelated site regions.\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n @media (max-width: 767px) {\n /* Tighten between-block gaps */\n .preview-theme-scope .mb-16 { margin-bottom: 0.75rem !important; }\n .preview-theme-scope .mb-12 { margin-bottom: 0.75rem !important; }\n .preview-theme-scope .mb-8 { margin-bottom: 0.5rem !important; }\n .preview-theme-scope .mb-6 { margin-bottom: 0.5rem !important; }\n /* Cap the mobile height of hero-style blocks so a\n "Height: 600px" desktop hero doesn\'t consume most of the\n mobile viewport. Uses attribute matcher on inline style\n to only target elements that actually set minHeight in px. */\n .preview-theme-scope [style*="min-height:"].hero-responsive,\n .preview-theme-scope [style*="minHeight:"].hero-responsive {\n min-height: 320px !important;\n }\n /* Columns Block on mobile:\n The Columns block uses grid-auto-rows: 1fr +\n align-items: stretch (inline) so that all cards in a row\n have the same visual height on de
2sktop. On mobile the grid\n collapses to 1 column (5 stacked rows) but the 1fr rule\n still forces every row to the SAME height as the tallest\n one \u2014 so a "Coming soon" card gets padded out by ~120px of\n empty white space to match a longer neighbour. Override\n both properties on mobile so each card uses its natural\n content height. Desktop stretching stays intact. */\n .preview-theme-scope .grid[class*="grid-cols-1"] {\n grid-auto-rows: auto !important;\n align-items: start !important;\n }\n .preview-theme-scope .grid[class*="grid-cols-1"] > *,\n .preview-theme-scope .grid[class*="grid-cols-1"] > * > * {\n height: auto !important;\n min-height: 0 !important;\n }\n }\n ']}),a&&(0,ea.jsx)("div",{className:"".concat(i?"":"".concat(M()," mx-auto px-6")),children:(0,ea.jsx)("h1",{className:"text-5xl font-bold mb-8",style:{fontFamily:F("heading_font")||"Manrope, sans-serif",color:F("heading_color")||"#1e293b"},children:a})}),(0,ea.jsx)("div",{className:"prose prose-lg max-w-none",style:{color:F("body_color")||"#475569",fontFamily:F("body_font")||"Inter, sans-serif","--tw-prose-body":F("body_color")||"#475569","--tw-prose-headings":F("heading_color")||"#1e293b"},children:s.filter(e=>!1!==e.isPublished).map((e,t)=>{var s,a,n;const l=((null===(s=e.content)||void 0===s?void 0:s.width)||"").toLowerCase(),r=((null===(a=e.content)||void 0===a?void 0:a.blockWidth)||"").toLowerCase(),o=l||r,c="full"===o&&"heading"!==e.type,d=(null===(n=e.content)||void 0===n?void 0:n.anchor_id)||(e=>{var t;let s="";var a,n;if("heading"===e.type)s=(null===(a=e.content)||void 0===a||null===(n=a.html)||void 0===n?void 0:n.replace(/<[^>]*>/g,""))||"";else if("hero"===e.type){var l;s=(null===(l=e.content)||void 0===l?void 0:l.headline)||""}else if("paragraph"===e.type){var r,i;s=(null===(r=e.content)||void 0===r||null===(i=r.html)||void 0===i?void 0:i.replace(/<[^>]*>/g,"").substring(0,50))||""}else if("quote"===e.type){var o,c;s=(null===(o=e.content)||void 0===o||null===(c=o.html)||void 0===c?void 0:c.replace(/<[^>]*>/g,"").substring(0,50))||""}else if("form"===e.type){var d;s=(null===(d=e.content)||void 0===d?void 0:d.formName)||"form"}else if("gallery"===e.type)s="gallery";else if("article-feed"===e.type){var u;s=(null===(u=e.content)||void 0===u?void 0:u.heading)||"articles"}return s?s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").substring(0,50)||e.type:"".concat(e.type,"-").concat((null===(t=e.id)||void 0===t?void 0:t.split("-").pop())||"block")})(e),u=o,m=(()=>{switch(u){case"large":return"mx-auto w-full px-3 sm:px-6 max-w-full sm:max-w-[75%]";case"medium":return"mx-auto w-full px-3 sm:px-6 max-w-full sm:max-w-[60%]";case"small":return"mx-auto w-full px-3 sm:px-6 max-w-full sm:max-w-[45%]";default:return null}})();if(i||!(c&&!i)){const s=m||"".concat(M()," mx-auto w-full px-3 sm:px-6");return(0,ea.jsx)("div",{id:d,className:s,children:P(e,t)},"wrapper-".concat(t))}return(0,ea.jsx)("div",{id:d,children:P(e,t)},"block-".concat(t))})},"blocks-container-".concat(m))]})}),N,u&&A.footer&&(0,ea.jsx)(Sy,{menu:A.footer,location:"footer",siteTheme:E,previewToken:g,pages:f,onPopupOpen:R,subdomain:v,currentLanguage:b,defaultLanguage:j,tenantId:c}),(0,ea.jsx)(dN,{pageSlug:_.pageSlug,previewToken:_.previewToken,isOpen:_.isOpen,onClose:()=>S({isOpen:!1,pageSlug:null,previewToken:null}),siteTheme:E,pages:f,subdomain:v,currentLanguage:b,defaultLanguage:j,tenantId:c}),u&&c&&(0,ea.jsx)(Dj,{tenantId:c})]}):(0,ea.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,ea.jsx)("div",{className:"animate-pulse text-slate-400",children:"Loading theme..."})})},cN=oN,dN=e=>{let{pageSlug:s,previewToken:a,isOpen:n,onClose:l,siteTheme:r,pages:i=[],isPreviewMode:o=!1,subdomain:c=null,currentLanguage:d=null,defaultLanguage:u="en",tenantId:m=null}=e;const[h,x]=(0,t.useState)(null),[p,g]=(0,t.useState)(!0),[f,v]=(0,t.useState)(null),[b,j]=(0,t.useState)(null),[y,N]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!n)return x(null),j(null),g(!0),void v(null);(async()=>{try{let t;if(g(!0),v(null),a)t=await _l.get("/public/preview/".concat(a)),x(t.data.page);else if(s&&c)t=await _l.get("/public/tenant/".concat(c,"/page/").concat(s)),x(t.data.page);
2else if(s)try{t=await _l.get("/pages/by-slug/".concat(s)),x(t.data)}catch(e){const t=i.find(e=>e.slug===s);if(!t)throw e;console.warn("Could not fetch page directly, attempting public fallback"),v("Failed to load page - try refreshing")}}catch(K2){console.error("Failed to load popup page:",K2),v("Failed to load page")}finally{g(!1)}})()},[n,s,a,c,i]),(0,t.useEffect)(()=>{if(!h||!d||d===u)return void j(null);const e=h.blocks||h.content||[];if(0===e.length)return;(async()=>{N(!0);try{const t=await fetch("".concat("","/api/translation/translate-blocks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blocks:e,target_language:d,tenant_id:m,source_language:u})});if(t.ok){const e=await t.json();e.translated_blocks&&j(e.translated_blocks)}}catch(K2){console.error("[PopupPageModal] Translation error:",K2)}finally{N(!1)}})()},[h,d,u,m]),(0,t.useEffect)(()=>{const e=e=>{"Escape"===e.key&&n&&l()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n,l]),(0,t.useEffect)(()=>(document.body.style.overflow=n?"hidden":"",()=>{document.body.style.overflow=""}),[n]),!n)return null;const w=b||(null===h||void 0===h?void 0:h.blocks)||(null===h||void 0===h?void 0:h.content)||[];return(0,ea.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center","data-testid":"popup-page-modal",children:[(0,ea.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:l}),(0,ea.jsxs)("div",{className:"relative w-full max-w-4xl max-h-[90vh] mx-4 bg-white rounded-xl shadow-2xl overflow-hidden",children:[(0,ea.jsx)("button",{onClick:l,className:"absolute top-4 right-4 z-10 p-2 bg-white/90 hover:bg-white rounded-full shadow-lg transition-colors","data-testid":"popup-close-button",children:(0,ea.jsx)(sr,{size:24,className:"text-slate-600"})}),(0,ea.jsxs)("div",{className:"overflow-y-auto max-h-[90vh] p-6",children:[p&&(0,ea.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})}),f&&(0,ea.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ea.jsx)("p",{className:"text-red-500",children:f})}),y&&!p&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 mb-4",children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-indigo-600"}),(0,ea.jsx)("span",{children:"Translating..."})]}),!p&&!f&&h&&(0,ea.jsx)(cN,{blocks:w,siteTheme:r,pageTheme:h.theme,pageWidth:h.pageWidth||"standard",pages:i,isPopup:!0,currentLanguage:d,defaultLanguage:u,tenantId:m})]})]})]})},uN={star:$l,zap:Gl,shield:Kl,mail:Yl,phone:Jl,location:Ql,check:Xl},mN=e=>{var s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N,w,C,k,D,_,S,E,A,F,T,z,M,P,B,R,L,I,O,U,H,W,V,q,$;let{tenantData:G,subdomain:K,isSubdomainMode:Y=!1}=e;const{tenantId:J}=je(),[Q,X]=(0,t.useState)(null),[Z,ee]=(0,t.useState)(null),[te,se]=(0,t.useState)(!Y),[ae,ne]=(0,t.useState)(null),[le,re]=(0,t.useState)({name:"",email:"",message:""}),[ie,oe]=(0,t.useState)(!1),[ce,de]=(0,t.useState)(!1),[ue,me]=(0,t.useState)(null),[he,xe]=(0,t.useState)(!1),[pe,ge]=(0,t.useState)({isOpen:!1,pageSlug:null,previewToken:null}),fe=(null===G||void 0===G?void 0:G.pages)||[],ve=e=>{if(!e||"#"===e||e.startsWith("download:")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("#")||e.startsWith("mailto:")||e.startsWith("tel:"))return null;let t=e.startsWith("/")?e.substring(1):e;if(t=t.split("?")[0].split("#")[0],!t||!fe.length)return null;const s=fe.find(e=>e.slug===t||e.full_path===t||e.page_id===t||e.preview_token===t);return s&&s.isPopup?e=>{e.preventDefault(),e.stopPropagation(),ge({isOpen:!0,pageSlug:s.slug,previewToken:s.preview_token})}:null},be=e=>{if(!e)return"#";const t=String(e).trim();return t.startsWith("download:")?t.replace(/^download:/,""):/^(https?:\/\/|mailto:|tel:|#|\/)/i.test(t)?t:/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/.*)?$/i.test(t)?"https://".concat(t):"/".concat(t)},[ye,Ne]=(0,t.useState)(null),[we,Ce]=(0,t.useState)({}),[ke,De]=(0,t.useState)({}),_e=(null===G||void 0===G?void 0:G.branding)||{},Se=_e.translation_enabled||(null===G||void 0===G?void 0:G.translation_enabled),Ee=_e.default_language||(null===G||void 0===G?void 0:G.translation_default_language)||"en",Ae=_e.enabled_languages||(null===G||void 0===G?void 0:G.translation_languages)||[],Fe=null===G||void 0===G?void 0:G.tenant_id;(0,t.useEffect)(()=>
2{if(Se&&Ae.length>0){const e=lg(),t=Ae.includes(e)?e:Ee;Ne(t)}},[Se,Ae,Ee]);const Te=e=>{Ne(e)};(0,t.useEffect)(()=>{var e;if(!ye||ye===Ee||null===Z||void 0===Z||null===(e=Z.items)||void 0===e||!e.length)return void Ce({});const t=Z.items.map(e=>e.label).filter(Boolean);if(0===t.length)return;(async()=>{try{const e=await fetch("".concat("","/api/translation/translate-texts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texts:t,target_language:ye,tenant_id:Fe,source_language:Ee})});if(e.ok){const t=await e.json();if(t.translated_texts){const e={};Z.items.forEach((s,a)=>{e[s.item_id]=t.translated_texts[a]||s.label}),Ce(e)}}}catch(K2){console.error("[LandingPage] Nav translation error:",K2)}})()},[ye,Ee,Z,Fe]),(0,t.useEffect)(()=>{if(!ye||ye===Ee||!Q)return void De({});(async()=>{const e=(()=>{const e={},t=Q.hero||{},s=Q.features||{},a=Q.testimonials||{},n=Q.faq||{},l=Q.footer||{},r=Q.about||{};return t.headline&&(e.hero_headline=t.headline),t.subheadline&&(e.hero_subheadline=t.subheadline),t.cta_text&&(e.hero_cta=t.cta_text),r.title&&(e.about_title=r.title),r.content&&(e.about_content=r.content),s.title&&(e.features_title=s.title),s.items&&s.items.forEach((t,s)=>{t.title&&(e["feature_".concat(s,"_title")]=t.title),t.description&&(e["feature_".concat(s,"_desc")]=t.description)}),a.title&&(e.testimonials_title=a.title),a.items&&a.items.forEach((t,s)=>{t.quote&&(e["testimonial_".concat(s,"_quote")]=t.quote)}),n.title&&(e.faq_title=n.title),n.items&&n.items.forEach((t,s)=>{t.question&&(e["faq_".concat(s,"_question")]=t.question),t.answer&&(e["faq_".concat(s,"_answer")]=t.answer)}),l.text&&(e.footer_text=l.text),e})(),t=Object.keys(e),s=Object.values(e);if(0!==s.length)try{const a=await fetch("".concat("","/api/translation/translate-texts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texts:s,target_language:ye,tenant_id:Fe,source_language:Ee})});if(a.ok){const s=await a.json();if(s.translated_texts){const a={};t.forEach((t,n)=>{a[t]=s.translated_texts[n]||e[t]}),De(a)}}}catch(K2){console.error("[LandingPage] Section translation error:",K2)}})()},[ye,Ee,Q,Fe]);const ze=(e,t)=>ke[e]||t,Me=e=>we[e.item_id]||e.label,Pe=(0,t.useRef)(null),Be=((0,t.useRef)(null),(0,t.useCallback)(e=>{Pe.current&&!Pe.current.contains(e.target)&&xe(!1)},[]));(0,t.useEffect)(()=>(he&&(document.addEventListener("mousedown",Be),document.addEventListener("touchstart",Be)),()=>{document.removeEventListener("mousedown",Be),document.removeEventListener("touchstart",Be)}),[he,Be]),(0,t.useEffect)(()=>{const e=null===G||void 0===G?void 0:G.branding;return e&&!1!==e.show_platform_branding?document.body.classList.add("show-dynatex-badge"):document.body.classList.remove("show-dynatex-badge"),()=>{document.body.classList.remove("show-dynatex-badge")}},[G]),(0,t.useEffect)(()=>{var e,t,s,a;Y&&G&&(X(G.landing_page),se(!1),null!==(e=G.landing_page)&&void 0!==e&&null!==(t=e.navigation)&&void 0!==t&&t.enabled&&null!==(s=G.landing_page)&&void 0!==s&&null!==(a=s.navigation)&&void 0!==a&&a.menu_id&&_l.get("/public/navigation/".concat(G.landing_page.navigation.menu_id)).then(e=>ee(e.data)).catch(e=>console.error("Failed to fetch navigation menu:",e)))},[Y,G]),(0,t.useEffect)(()=>{var e;const t=null===Q||void 0===Q||null===(e=Q.branding)||void 0===e?void 0:e.favicon_url;if(t)return["icon","shortcut icon","apple-touch-icon"].forEach(e=>{let s=document.querySelector('link[rel="'.concat(e,'"]'));s||(s=document.createElement("link"),s.rel=e,document.head.appendChild(s)),s.href=t}),()=>{["icon","shortcut icon","apple-touch-icon"].forEach(e=>{const t=document.querySelector('link[rel="'.concat(e,'"]'));t&&(t.href="".concat("","/favicon.png"))})}},[null===Q||void 0===Q||null===(s=Q.branding)||void 0===s?void 0:s.favicon_url]),(0,t.useEffect)(()=>{J&&!Y&&(async()=>{if(!Y)try{var e,t;const s=await _l.get("/public/site/".concat(J));if(X(s.data),null!==(e=s.data.navigation)&&void 0!==e&&e.enabled&&null!==(t=s.data.navigation)&&void 0!==t&&t.menu_id)try{const e=await _l.get("/public/navigation/".concat(s.data.navigation.menu_id));ee(e.data)}catch(n){console.error("Failed to fetch navigation menu:",n)}}catch(K2){var s,a;ne((null===(s=K2.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Landing page not found")}finally{se(!1)}})()},[J,Y]);const Re=e=>{var t;return"external"===e.link_type?e.link_value||"#":"anchor"===e.link_type?"#".concat((null===(t=e.link_value)||void 0===t?void 0:t.replace(/^#/,""))||""):"#"},Le=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(e.is_button){const s=e.button_bg_color||"#4f46e5",a=e.button_text_color||"#ffffff",n=e.button_style||"solid",l="pill"===e.button_border_radius?"9999px":"square"===e.button_border_radius?"2px":"6px";let r;return r="outline"===n?{background:"transparent",color:s,border:"1.5px solid ".concat(s),borderRadius:l}:"ghost"===n?{background:"".concat(s,"18"),color:s,borderRadius:l}:{backgroundColor:s,color:a,borderRadius:l},(0,ea.jsx)("a",{href:Re(e),target:e.target||"_self",onClick:t,className:"inline-flex items-center px-4 py-1.5 font-semibold transition-all hover:opacity-80",style:r,children:Me(e)},e.item_id)}return(0,ea.jsx)("a",{href:Re(e),target:e.target||"_self",onClick:t,className:"hover:opacity-80 transition-opacity font-medium",children:Me(e)},e.item_id)};if(te)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)(ql,{className:"animate-spin mx-auto mb-4 text-indigo-600",size:48}),(0,ea.jsx)("p",{className:"text-slate-600",children:"Loading..."})]})});if(ae)return(0,ea.jsxs)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:[(0,ea.jsx)(As,{children:(0,ea.jsx)("title",{children:"Page Not Found"})}),(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Page Not Found"}),(0,ea.jsx)("p",{className:"text-slate-600",children:ae})]})]});if(!Q)return null;
2const{hero:Ie,about:Oe,features:Ue,blocks:He,contact:We,footer:Ve,theme:qe,tenant_name:$e}=Q,Ge=e=>"string"===typeof e?e.replace(/<[^>]*>/g,"").trim():"",Ke=Ge(Q.meta_title)||$e||Ge(null===Ie||void 0===Ie?void 0:Ie.headline)||"Welcome",Ye=Ge(Q.meta_description)||Ge(null===Ie||void 0===Ie?void 0:Ie.subheadline)||"",Je=(0,ea.jsxs)(As,{children:[(0,ea.jsx)("title",{children:Ke}),Ye&&(0,ea.jsx)("meta",{name:"description",content:Ye.slice(0,160)}),(null===qe||void 0===qe?void 0:qe.primary_color)&&(0,ea.jsx)("meta",{name:"theme-color",content:qe.primary_color}),"undefined"!==typeof window&&(0,ea.jsx)("link",{rel:"manifest",href:"/api/public/manifest.webmanifest?domain=".concat(encodeURIComponent(window.location.hostname))})]});if(Q.use_html_mode){var Qe,Xe,Ze,et,tt,st,at,nt,lt,rt,it,ot,ct,dt,ut,mt,ht,xt,pt,gt,ft,vt,bt,jt,yt,Nt,wt,Ct,kt,Dt,_t,St,Et,At,Ft,Tt,zt,Mt,Pt,Bt,Rt,Lt,It,Ot,Ut,Ht;const e=Q.html_sections||[];if(0===e.length&&Q.custom_html)return(0,ea.jsxs)(ea.Fragment,{children:[Je,Q.custom_css&&(0,ea.jsx)("style",{dangerouslySetInnerHTML:{__html:Q.custom_css}}),(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:Q.custom_html}})]});const t=e.filter(e=>!e.draft);return(0,ea.jsxs)("div",{className:"min-h-screen",style:{backgroundColor:(null===qe||void 0===qe?void 0:qe.background_color)||"#ffffff",color:(null===qe||void 0===qe?void 0:qe.text_color)||"#1e293b"},children:[Je,Q.custom_css&&(0,ea.jsx)("style",{dangerouslySetInnerHTML:{__html:Q.custom_css}}),Se&&Ae.length>0&&ye&&"hidden"!==((null===qe||void 0===qe?void 0:qe.language_selector_position)||"floating")&&("top_bar"===((null===qe||void 0===qe?void 0:qe.language_selector_position)||"floating")?(0,ea.jsx)("div",{className:"sticky top-0 z-[100] w-full bg-slate-50 border-b border-slate-200 flex justify-end items-center px-4 py-1.5",children:(0,ea.jsx)(rg,{currentLanguage:ye,onLanguageChange:Te,enabledLanguages:Ae,variant:"compact"})}):(0,ea.jsx)("div",{className:"fixed bottom-4 left-4 md:top-4 md:right-4 md:bottom-auto md:left-auto z-[100]",children:(0,ea.jsx)(rg,{currentLanguage:ye,onLanguageChange:Te,enabledLanguages:Ae,variant:"compact"})})),(null===(Qe=Q.navigation)||void 0===Qe?void 0:Qe.enabled)&&Z&&(0,ea.jsx)("nav",{ref:Pe,className:"w-full z-50 ".concat(null!==(Xe=Q.navigation)&&void 0!==Xe&&Xe.sticky?"sticky top-0":""," ").concat(null!==(Ze=Q.navigation)&&void 0!==Ze&&Ze.transparent?"bg-transparent":""),style:{backgroundColor:null!==(et=Q.navigation)&&void 0!==et&&et.transparent?"transparent":(null===(tt=Q.navigation)||void 0===tt?void 0:tt.background_color)||(null===qe||void 0===qe?void 0:qe.primary_color)||"#4F46E5",color:(null===(st=Q.navigation)||void 0===st?void 0:st.text_color)||"#ffffff"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto px-6 py-4",children:[(0,ea.jsxs)("div",{className:"flex items-center ".concat("hamburger"===Z.style&&"center"===Z.hamburger_align?"justify-between relative":"justify-between"),children:[(0,ea.jsx)("a",{href:"/","aria-label":"Go to homepage","data-testid":"landing-nav-logo-link-top",className:"flex items-center gap-2 hover:opacity-80 transition-opacity ".concat("hamburger"===Z.style&&"left"===Z.hamburger_align?"order-last":""),children:null!==(at=Q.navigation)&&void 0!==at&&at.logo_url?(0,ea.jsx)("img",{src:Q.navigation.logo_url,alt:"Logo",className:"h-10 w-auto"}):(0,ea.jsx)("span",{className:"text-xl font-bold",children:(null===(nt=Q.navigation)||void 0===nt?void 0:nt.logo_text)||$e||"Company"})}),"hamburger"===Z.style?(0,ea.jsxs)(ea.Fragment,{children:["left"===Z.hamburger_align&&(0,ea.jsx)("button",{className:"p-2 hover:bg-white/10 rounded-lg transition-colors order-first",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})}),"center"===Z.hamburger_align&&(0,ea.jsx)("button",{className:"p-2 hover:bg-white/10 rounded-lg transition-colors absolute left-1/2 transform -translate-x-1/2",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})}),("right"===Z.hamburger_align||!Z.hamburger_align)&&(0,ea.jsx)("button",{className:"p-2 hover:bg-white/10 rounded-lg transition-colors",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"hidden md:flex items-center gap-8",children:null===(lt=Z.items)||void 0===lt?void 0:lt.map(e=>Le(e))}),(0,ea.jsx)("button",{className:"md:hidden p-2",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})})]})]}),he&&(0,ea.jsx)("div",{className:"".concat("hamburger"===Z.style?"":"md:hidden"," mt-4 pb-4 border-t border-white/20 pt-4"),children:(0,ea.jsx)("div",{className:"flex flex-col gap-4",children:null===(rt=Z.items)||void 0===rt?void 0:rt.map(e=>Le(e,()=>xe(!1)))})})]})}),t.map(e=>{var t;const s=e.anchor_id||(null===(t=e.name)||void 0===t?void 0:t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))||e.id;return(0,ea.jsxs)("div",{id:s,children:[e.css&&(0,ea.jsx)("style",{dangerouslySetInnerHTML:{__html:e.css}}),(0,ea.jsx)("div",{dangerouslySetInnerHTML:{__html:e.html||""}})]},e.id)}),!1!==(null===Ve||void 0===Ve?void 0:Ve.enabled)&&(0,ea.jsx)("footer",{className:"py-12 px-6",
2style:{backgroundColor:(null===Ve||void 0===Ve?void 0:Ve.background_color)||(null===qe||void 0===qe?void 0:qe.primary_color)||"#4F46E5",color:(null===Ve||void 0===Ve?void 0:Ve.text_color)||"#ffffff"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:["centered"===(null===Ve||void 0===Ve?void 0:Ve.style)&&(0,ea.jsxs)("div",{className:"text-center space-y-6",children:[null!==Ve&&void 0!==Ve&&Ve.logo_url?(0,ea.jsx)("img",{src:Ve.logo_url,alt:"Logo",className:"h-12 mx-auto"}):(null===Ve||void 0===Ve?void 0:Ve.company_name)&&(0,ea.jsx)("h3",{className:"text-2xl font-bold",children:Ve.company_name}),(null===Ve||void 0===Ve?void 0:Ve.tagline)&&(0,ea.jsx)("p",{className:"opacity-80 max-w-md mx-auto",children:Ve.tagline}),((null===Ve||void 0===Ve||null===(it=Ve.social_links)||void 0===it?void 0:it.facebook)||(null===Ve||void 0===Ve||null===(ot=Ve.social_links)||void 0===ot?void 0:ot.twitter)||(null===Ve||void 0===Ve||null===(ct=Ve.social_links)||void 0===ct?void 0:ct.instagram)||(null===Ve||void 0===Ve||null===(dt=Ve.social_links)||void 0===dt?void 0:dt.linkedin)||(null===Ve||void 0===Ve||null===(ut=Ve.social_links)||void 0===ut?void 0:ut.youtube)||(null===Ve||void 0===Ve||null===(mt=Ve.social_links)||void 0===mt?void 0:mt.bluesky))&&(0,ea.jsxs)("div",{className:"flex justify-center gap-4",children:[(null===Ve||void 0===Ve||null===(ht=Ve.social_links)||void 0===ht?void 0:ht.facebook)&&(0,ea.jsx)("a",{href:Ve.social_links.facebook,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(nr,{size:24})}),(null===Ve||void 0===Ve||null===(xt=Ve.social_links)||void 0===xt?void 0:xt.twitter)&&(0,ea.jsx)("a",{href:Ve.social_links.twitter,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(lr,{size:24})}),(null===Ve||void 0===Ve||null===(pt=Ve.social_links)||void 0===pt?void 0:pt.instagram)&&(0,ea.jsx)("a",{href:Ve.social_links.instagram,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(rr,{size:24})}),(null===Ve||void 0===Ve||null===(gt=Ve.social_links)||void 0===gt?void 0:gt.linkedin)&&(0,ea.jsx)("a",{href:Ve.social_links.linkedin,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(ir,{size:24})}),(null===Ve||void 0===Ve||null===(ft=Ve.social_links)||void 0===ft?void 0:ft.youtube)&&(0,ea.jsx)("a",{href:Ve.social_links.youtube,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(or,{size:24})}),(null===Ve||void 0===Ve||null===(vt=Ve.social_links)||void 0===vt?void 0:vt.bluesky)&&(0,ea.jsx)("a",{href:Ve.social_links.bluesky,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(mr,{size:24})})]}),((null===Ve||void 0===Ve||null===(bt=Ve.contact_info)||void 0===bt?void 0:bt.email)||(null===Ve||void 0===Ve||null===(jt=Ve.contact_info)||void 0===jt?void 0:jt.phone)||(null===Ve||void 0===Ve||null===(yt=Ve.contact_info)||void 0===yt?void 0:yt.address))&&(0,ea.jsxs)("div",{className:"flex flex-wrap justify-center gap-6 text-sm opacity-80",children:[(null===Ve||void 0===Ve||null===(Nt=Ve.contact_info)||void 0===Nt?void 0:Nt.email)&&(0,ea.jsxs)("a",{href:"mailto:".concat(Ve.contact_info.email),className:"flex items-center gap-2 hover:opacity-100",children:[(0,ea.jsx)(Yl,{size:16})," ",Ve.contact_info.email]}),(null===Ve||void 0===Ve||null===(wt=Ve.contact_info)||void 0===wt?void 0:wt.phone)&&(0,ea.jsxs)("a",{href:"tel:".concat(Ve.contact_info.phone),className:"flex items-center gap-2 hover:opacity-100",children:[(0,ea.jsx)(Jl,{size:16})," ",Ve.contact_info.phone]}),(null===Ve||void 0===Ve||null===(Ct=Ve.contact_info)||void 0===Ct?void 0:Ct.address)&&(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Ql,{size:16})," ",Ve.contact_info.address]})]})]}),("simple"===(null===Ve||void 0===Ve?void 0:Ve.style)||!(null!==Ve&&void 0!==Ve&&Ve.style))&&(0,ea.jsx)("div",{className:"text-center space-y-4",children:((null===Ve||void 0===Ve||null===(kt=Ve.social_links)||void 0===kt?void 0:kt.facebook)||(null===Ve||void 0===Ve||null===(Dt=Ve.social_links)||void 0===Dt?void 0:Dt.twitter)||(null===Ve||void 0===Ve||null===(_t=Ve.social_links)||void 0===_t?void 0:_t.instagram)||(null===Ve||void 0===Ve||null===(St=Ve.social_links)||void 0===St?void 0:St.linkedin)||(null===Ve||void 0===Ve||null===(Et=Ve.social_links)||void 0===Et?void 0:Et.youtube))&&(0,ea.jsxs)("div",{className:"flex justify-center gap-4 mb-4",children:[(null===Ve||void 0===Ve||null===(At=Ve.social_links)||void 0===At?void 0:At.facebook)&&(0,ea.jsx)("a",{href:Ve.social_links.facebook,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(nr,{size:20})}),(null===Ve||void 0===Ve||null===(Ft=Ve.social_links)||void 0===Ft?void 0:Ft.twitter)&&(0,ea.jsx)("a",{href:Ve.social_links.twitter,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(lr,{size:20})}),(null===Ve||void 0===Ve||null===(Tt=Ve.social_links)||void 0===Tt?void 0:Tt.instagram)&&(0,ea.jsx)("a",{href:Ve.social_links.instagram,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(rr,{size:20})}),(null===Ve||void 0===Ve||null===(zt=Ve.social_links)||void 0===zt?void 0:zt.linkedin)&&(0,ea.jsx)("a",{href:Ve.social_links.linkedin,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(ir,{size:20})}),(null===Ve||void 0===Ve||null===(Mt=Ve.social_links)||void 0===Mt?void 0:Mt.youtube)&&(0,ea.jsx)("a",{href:Ve.social_links.youtube,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(or,{size:20})})]})}),"columns"===(null===Ve||void 0===Ve?void 0:Ve.style)&&(0,ea.jsxs)("div",{className:"grid md:grid-cols-4 gap-8 mb-8",children:[(0,ea.jsxs)("div",{className:"space-y-4",children:[null!==Ve&&void 0!==Ve&&Ve.logo_url?(0,ea.jsx)("img",{src:Ve.logo_url,alt:"Logo",className:"h-10"}):(null===Ve||void 0===Ve?void 0:Ve.company_name)&&(0,ea.jsx)("h3",{className:"text-xl font-bold",children:Ve.company_name}),(null===Ve||void 0===Ve?void 0:Ve.tagline)&&(0,ea.jsx)("p",{className:"opacity-80 text-sm",children:Ve.tagline}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(null===Ve||void 0===Ve||null===(Pt=Ve.social_links)||void 0===Pt?void 0:Pt.facebook)&&(0,ea.jsx)("a",{href:Ve.social_links.facebook,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(nr,{size:20})}),(null===Ve||void 0===Ve||null===(Bt=Ve.social_links)||void 0===Bt?void 0:Bt.twitter)&&(0,ea.jsx)("a",{href:Ve.social_links.twitter,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(lr,{size:20})}),(null===Ve||void 0===Ve||null===(Rt=Ve.social_links)||void 0===Rt?void 0:Rt.instagram)&&(0,ea.jsx)("a",{href:Ve.social_links.instagram,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(rr,{size:20})}),(null===Ve||void 0===Ve||null===(Lt=Ve.social_links)||void 0===Lt?void 0:Lt.linkedin)&&(0,ea.jsx)("a",{href:Ve.social_links.linkedin,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(ir,{size:20})}),(null===Ve||void 0===Ve||null===(It=Ve.social_links)||void 0===It?void 0:It.youtube)&&(0,ea.jsx)("a",{href:Ve.social_links.youtube,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(or,{size:20})})]})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)("h4",{className:"font-semibold",children:"Contact"}),(null===Ve||void 0===Ve||null===(Ot=Ve.contact_info)||void 0===Ot?void 0:Ot.email)&&(0,ea.jsxs)("a",{href:"mailto:".concat(Ve.contact_info.email),className:"flex items-center gap-2 text-sm opacity-80 hover:opacity-100",children:[(0,ea.jsx)(Yl,{size:16})," ",Ve.contact_info.email]}),(null===Ve||void 0===Ve||null===(Ut=Ve.contact_info)||void 0===Ut?void 0:Ut.phone)&&(0,ea.jsxs)("a",{href:"tel:".concat(Ve.contact_info.phone),className:"flex items-center gap-2 text-sm opacity-80 hover:opacity-100",children:[(0,ea.jsx)(Jl,{size:16})," ",Ve.contact_info.phone]}),(null===Ve||void 0===Ve||null===(Ht=Ve.contact_info)||void 0===Ht?void 0:Ht.address)&&(0,ea.jsxs)("span",{className:"flex items-center gap-2 text-sm opacity-80",children:[(0,ea.jsx)(Ql,{size:16})," ",Ve.contact_info.address]})]})]}),(0,ea.jsx)("div",{className:"text-center pt-6 border-t border-white/20",children:(0,ea.jsx)("p",{className:"opacity-80 text-sm",children:(null===Ve||void 0===Ve?void 0:Ve.copyright)||"\xa9 ".concat((new Date).getFullYear()," ").concat($e||"Company",". All rights reserved.")})})]})})]})}return(0,ea.jsxs)("div",{className:"min-h-screen",style:{backgroundColor:(null===qe||void 0===qe?void 0:qe.background_color)||"#ffffff",color:(null===qe||void 0===qe?void 0:qe.text_color)||"#1e293b"},children:[Je,(null===(a=Q.navigation)||void 0===a?void 0:a.enabled)&&Z&&(0,ea.jsx)("nav",{ref:Pe,className:"w-full z-50 ".concat(null!==(n=Q.navigation)&&void 0!==n&&n.sticky?"sticky top-0":""," ").concat(null!==(l=Q.navigation)&&void 0!==l&&l.transparent?"bg-transparent":""),style:{backgroundColor:null!==(r=Q.navigation)&&void 0!==r&&r.transparent?"transparent":(null===Ie||void 0===Ie?void 0:Ie.background_color)||(null===qe||void 0===qe?void 0:qe.primary_color)||"#4F46E5",color:(null===Ie||void 0===Ie?void 0:Ie.text_color)||"#ffffff"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto px-6 py-4",children:[(0,ea.jsxs)("div",{className:"flex items-center ".concat("hamburger"===Z.style&&"center"===Z.hamburger_align?"justify-between relative":"justify-between"),children:[(0,ea.jsx)("a",{href:"/","aria-label":"Go to homepage","data-testid":"landing-nav-logo-link-bottom",className:"flex items-center gap-2 hover:opacity-80 transition-opacity ".concat("hamburger"===Z.style&&"left"===Z.hamburger_align?"order-last":""),children:null!==(i=Q.navigation)&&void 0!==i&&i.logo_url?(0,ea.jsx)("img",{src:Q.navigation.logo_url,alt:"Logo",className:"h-10 w-auto"}):(0,ea.jsx)("span",{className:"text-xl font-bold",children:(null===(o=Q.navigation)||void 0===o?void 0:o.logo_text)||$e||"Company"})}),"hamburger"===Z.style?(0,ea.jsxs)(ea.Fragment,{children:["left"===Z.hamburger_align&&(0,ea.jsx)("button",{className:"p-2 hover:bg-white/10 rounded-lg transition-colors order-first",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})}),"center"===Z.hamburger_align&&(0,ea.jsx)("button",{className:"p-2 hover:bg-white/10 rounded-lg transition-colors absolute left-1/2 transform -translate-x-1/2",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})}),("right"===Z.hamburger_align||!Z.hamburger_align)&&(0,ea.jsx)("button",{className:"p-2 hover:bg-white/10 rounded-lg transition-colors",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"hidden md:flex items-center gap-8",children:null===(c=Z.items)||void 0===c?void 0:c.map(e=>Le(e))}),(0,ea.jsx)("button",{className:"md:hidden p-2",onClick:()=>xe(!he),children:he?(0,ea.jsx)(sr,{size:24}):(0,ea.jsx)(ar,{size:24})})]})]}),he&&(0,ea.jsx)("div",{className:"".concat("hamburger"===Z.style?"":"md:hidden"," mt-4 pb-4 border-t border-white/20 pt-4"),children:(0,ea.jsx)("div",{className:"flex flex-col gap-4",children:null===(u=Z.items)||void 0===u?void 0:u.map(e=>Le(e,()=>xe(!1)))})})]})}),Se&&Ae.length>
20&&ye&&"hidden"!==((null===qe||void 0===qe?void 0:qe.language_selector_position)||"floating")&&("top_bar"===((null===qe||void 0===qe?void 0:qe.language_selector_position)||"floating")?(0,ea.jsx)("div",{className:"sticky top-0 z-[100] w-full bg-slate-50 border-b border-slate-200 flex justify-end items-center px-4 py-1.5",children:(0,ea.jsx)(rg,{currentLanguage:ye,onLanguageChange:Te,enabledLanguages:Ae,variant:"compact"})}):(0,ea.jsx)("div",{className:"fixed bottom-4 left-4 md:top-4 md:right-4 md:bottom-auto md:left-auto z-[100]",children:(0,ea.jsx)(rg,{currentLanguage:ye,onLanguageChange:Te,enabledLanguages:Ae,variant:"compact"})})),(0,ea.jsx)("section",{id:"hero",className:"min-h-[70vh] flex items-center px-6 py-20 ".concat(null!==Ie&&void 0!==Ie&&Ie.image_url&&"background"===(null===Ie||void 0===Ie?void 0:Ie.image_position)?"relative":""),style:d({backgroundColor:(null===Ie||void 0===Ie?void 0:Ie.background_color)||(null===qe||void 0===qe?void 0:qe.primary_color)||"#4F46E5",color:(null===Ie||void 0===Ie?void 0:Ie.text_color)||"#ffffff"},null!==Ie&&void 0!==Ie&&Ie.image_url&&"background"===(null===Ie||void 0===Ie?void 0:Ie.image_position)?{backgroundImage:"linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url(".concat(Ie.image_url,")"),backgroundSize:"cover",backgroundPosition:"center"}:{}),children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto w-full ".concat(null!==Ie&&void 0!==Ie&&Ie.image_url&&"background"!==(null===Ie||void 0===Ie?void 0:Ie.image_position)?"grid md:grid-cols-2 gap-12 items-center":""),children:[(0,ea.jsxs)("div",{className:"".concat(null!==Ie&&void 0!==Ie&&Ie.image_url&&"left"===(null===Ie||void 0===Ie?void 0:Ie.image_position)?"order-2":"order-1"," ").concat(null!==Ie&&void 0!==Ie&&Ie.image_url&&"background"!==(null===Ie||void 0===Ie?void 0:Ie.image_position)?"":"text-center max-w-4xl mx-auto"),children:[(0,ea.jsx)("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-6 leading-tight",style:{fontFamily:"Manrope, sans-serif"},children:ze("hero_headline",(null===Ie||void 0===Ie?void 0:Ie.headline)||"Welcome")}),(0,ea.jsx)("p",{className:"text-lg md:text-xl opacity-90 mb-8 whitespace-pre-line",children:ze("hero_subheadline",(null===Ie||void 0===Ie?void 0:Ie.subheadline)||"")}),(null===Ie||void 0===Ie?void 0:Ie.cta_text)&&(0,ea.jsx)("a",{href:null!==Ie&&void 0!==Ie&&Ie.cta_url?be(Ie.cta_url):"#contact",onClick:ve(null===Ie||void 0===Ie?void 0:Ie.cta_url)||void 0,className:"inline-block px-8 py-4 rounded-lg text-lg font-semibold transition-all hover:opacity-90 hover:scale-105",style:{backgroundColor:(null===Ie||void 0===Ie?void 0:Ie.text_color)||"#ffffff",color:(null===Ie||void 0===Ie?void 0:Ie.background_color)||(null===qe||void 0===qe?void 0:qe.primary_color)||"#4F46E5"},children:ze("hero_cta",Ie.cta_text)})]}),(null===Ie||void 0===Ie?void 0:Ie.image_url)&&"background"!==(null===Ie||void 0===Ie?void 0:Ie.image_position)&&(0,ea.jsx)("div",{className:"".concat("left"===(null===Ie||void 0===Ie?void 0:Ie.image_position)?"order-1":"order-2"),children:(0,ea.jsx)("img",{src:Ie.image_url,alt:"Hero",className:"w-full max-w-lg mx-auto rounded-lg shadow-2xl"})})]})}),(null===Oe||void 0===Oe?void 0:Oe.enabled)&&(0,ea.jsx)("section",{id:"about",className:"py-20 px-6",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-8 text-center",style:{color:null===qe||void 0===qe?void 0:qe.primary_color},children:ze("about_title",(null===Oe||void 0===Oe?void 0:Oe.title)||"About Us")}),(0,ea.jsxs)("div",{className:"grid ".concat(null!==Oe&&void 0!==Oe&&Oe.image_url?"md:grid-cols-2":"grid-cols-1"," gap-8 items-center"),children:[(0,ea.jsx)("div",{className:"text-lg leading-relaxed whitespace-pre-line",children:ze("about_content",(null===Oe||void 0===Oe?void 0:Oe.content)||"")}),(null===Oe||void 0===Oe?void 0:Oe.image_url)&&(0,ea.jsx)("img",{src:Oe.image_url,alt:"About",className:"rounded-lg shadow-lg w-full"})]})]})}),(null===Ue||void 0===Ue?void 0:Ue.enabled)&&(null===Ue||void 0===Ue||null===(m=Ue.items)||void 0===m?void 0:m.length)>0&&(0,ea.jsx)("section",{id:"features",className:"py-20 px-6",style:{backgroundColor:"#ffffff"===(null===qe||void 0===qe?void 0:qe.background_color)?"#f8fafc":"rgba(255,255,255,0.05)"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-12 text-center",style:{color:null===qe||void 0===qe?void 0:qe.primary_color},children:ze("features_title",(null===Ue||void 0===Ue?void 0:Ue.title)||"What We Offer")}),(0,ea.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:Ue.items.map((e,t)=>{const s=uN[e.icon]||$l;return(0,ea.jsxs)("div",{className:"p-6 rounded-xl shadow-md hover:shadow-lg transition-shadow",style:{backgroundColor:(null===qe||void 0===qe?void 0:qe.background_color)||"#ffffff"},children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center mb-4",style:{backgroundColor:"".concat(null===qe||void 0===qe?void 0:qe.primary_color,"20")},children:(0,ea.jsx)(s,{size:24,style:{color:null===qe||void 0===qe?void 0:qe.primary_color}})}),(0,ea.jsx)("h3",{className:"text-xl font-semibold mb-2",children:ze("feature_".concat(t,"_title"),e.title)}),(0,ea.jsx)("p",{className:"opacity-80",children:ze("feature_".concat(t,"_desc"),e.description)})]},e.id||t)})})]})}),null===He||void 0===He?void 0:He.map(e=>((e,t)=>
2{var s,a,n,l,r,i,o,c,u;if(!e.enabled)return null;switch(e.type){case"text":return(0,ea.jsx)("section",{className:"py-16 px-6",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto text-".concat(e.alignment||"center"),children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-6",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.title}),(0,ea.jsx)("div",{className:"text-lg leading-relaxed whitespace-pre-line opacity-80",children:e.content})]})},e.id);case"image":return(0,ea.jsx)("section",{className:"py-16 px-6",children:(0,ea.jsx)("div",{className:"max-w-4xl mx-auto",children:e.url&&(0,ea.jsxs)("figure",{children:[(0,ea.jsx)("img",{src:e.url,alt:e.alt||"",className:"rounded-lg shadow-lg mx-auto ".concat("full"===e.width?"w-full":"max-w-2xl")}),e.caption&&(0,ea.jsx)("figcaption",{className:"text-center mt-4 text-sm opacity-60",children:e.caption})]})})},e.id);case"gallery":return(0,ea.jsx)("section",{className:"py-16 px-6",style:{backgroundColor:"#ffffff"===(null===t||void 0===t?void 0:t.background_color)?"#f8fafc":"rgba(255,255,255,0.05)"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-10 text-center",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.title}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-".concat(e.columns||3," gap-4"),children:null===(s=e.images)||void 0===s?void 0:s.filter(e=>e.url).map(e=>(0,ea.jsx)("img",{src:e.url,alt:e.alt||"",className:"rounded-lg shadow-md w-full h-48 object-cover hover:scale-105 transition-transform"},e.id))})]})},e.id);case"testimonials":return(0,ea.jsx)("section",{className:"py-16 px-6",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-10 text-center",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.title}),(0,ea.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:null===(a=e.items)||void 0===a?void 0:a.map(e=>(0,ea.jsxs)("div",{className:"p-6 rounded-xl shadow-md",style:{backgroundColor:"#ffffff"===(null===t||void 0===t?void 0:t.background_color)?"#f8fafc":"rgba(255,255,255,0.1)"},children:[(0,ea.jsx)(Zl,{size:32,className:"mb-4 opacity-20",style:{color:null===t||void 0===t?void 0:t.primary_color}}),(0,ea.jsxs)("p",{className:"text-lg mb-4 italic",children:["\u201c",e.quote,"\u201d"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[e.avatar&&(0,ea.jsx)("img",{src:e.avatar,alt:e.author,className:"w-12 h-12 rounded-full object-cover"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold",children:e.author}),e.role&&(0,ea.jsx)("p",{className:"text-sm opacity-60",children:e.role})]})]})]},e.id))})]})},e.id);case"faq":return(0,ea.jsx)("section",{className:"py-16 px-6",style:{backgroundColor:"#ffffff"===(null===t||void 0===t?void 0:t.background_color)?"#f8fafc":"rgba(255,255,255,0.05)"},children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto",children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-10 text-center",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.title}),(0,ea.jsx)("div",{className:"space-y-4",children:null===(n=e.items)||void 0===n?void 0:n.map(e=>(0,ea.jsxs)("div",{className:"border rounded-lg overflow-hidden",style:{backgroundColor:(null===t||void 0===t?void 0:t.background_color)||"#ffffff"},children:[(0,ea.jsxs)("button",{className:"w-full px-6 py-4 flex items-center justify-between text-left font-medium",onClick:()=>me(ue===e.id?null:e.id),children:[(0,ea.jsx)("span",{children:e.question}),ue===e.id?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]}),ue===e.id&&(0,ea.jsx)("div",{className:"px-6 pb-4 opacity-80",children:e.answer})]},e.id))})]})},e.id);case"pricing":return(0,ea.jsx)("section",{className:"py-16 px-6",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-10 text-center",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.title}),(0,ea.jsx)("div",{className:"grid md:grid-cols-".concat(Math.min((null===(l=e.items)||void 0===l?void 0:l.length)||1,3)," gap-6"),children:null===(r=e.items)||void 0===r?void 0:r.map(e=>{var s;return(0,ea.jsxs)("div",{className:"p-6 rounded-xl shadow-md ".concat(e.highlighted?"ring-2 scale-105":""),style:{backgroundColor:e.highlighted?"".concat(null===t||void 0===t?void 0:t.primary_color,"10"):"#ffffff"===(null===t||void 0===t?void 0:t.background_color)?"#f8fafc":"rgba(255,255,255,0.1)",ringColor:null===t||void 0===t?void 0:t.primary_color},children:[e.highlighted&&(0,ea.jsx)("div",{className:"text-xs font-semibold text-white px-3 py-1 rounded-full mb-4 inline-block",style:{backgroundColor:null===t||void 0===t?void 0:t.primary_color},children:"Most Popular"}),(0,ea.jsx)("h3",{className:"text-xl font-bold mb-2",children:e.name}),(0,ea.jsxs)("div",{className:"mb-4",children:[(0,ea.jsx)("span",{className:"text-4xl font-bold",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.price}),(0,ea.jsx)("span",{className:"opacity-60",children:e.period})]}),(0,ea.jsx)("ul",{className:"space-y-2 mb-6",children:null===(s=e.features)||void 0===s?void 0:s.map((e,s)=>(0,ea.jsxs)("li",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Xl,{size:16,style:{color:null===t||void 0===t?void 0:t.primary_color}}),(0,ea.jsx)("span",{children:e})]},s))}),(0,ea.jsx)("a",d(d({href:e.checkout_url?e.checkout_url:e.button_url?be(e.button_url):"#"},e.checkout_url?{target:"_blank",rel:"noopener noreferrer"}:{}),{},{onClick:e.checkout_url?void 0:ve(e.button_url)||void 0,className:"block w-full py-3 rounded-lg font-semibold text-white text-center transition-opacity hover:opacity-90",style:{backgroundColor:null===t||void 0===t?void 0:t.primary_color},"data-testid":"tenant-pricing-cta-".concat(e.id||""),children:e.button_text||"Get Started"}))]},e.id)})})]})},e.id);case"video":const m=(e=>{if(!e)return null;const t=e.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]+)/);if(t)return"https://www.youtube.com/embed/".concat(t[1]);const s=e.match(/vimeo\.com\/(\d+)/);return s?"https://player.vimeo.com/video/".concat(s[1]):e})(e.url);return(0,ea.jsx)("section",{className:"py-16 px-6",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-8 text-center",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.title}),m&&(0,ea.jsx)("div",{className:"aspect-video rounded-xl overflow-hidden shadow-lg",children:(0,ea.jsx)("iframe",{src:m,title:e.title||"Video",className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})},e.id);case"cta":const h={primary:{backgroundColor:null===t||void 0===t?void 0:t.primary_color,color:"#ffffff"},secondary:{backgroundColor:null===t||void 0===t?void 0:t.secondary_color,color:"#ffffff"},dark:{backgroundColor:"#1e293b",color:"#ffffff"}},x=h[e.style]||h.primary,p=ve(e.button_url);return(0,ea.jsx)("section",{className:"py-20 px-6",style:x,children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto text-center",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:e.title}),e.subtitle&&(0,ea.jsx)("p",{className:"text-lg opacity-90 mb-8",children:e.subt
2itle}),e.button_text&&(0,ea.jsx)("a",{href:e.button_url?be(e.button_url):"#",onClick:p||void 0,className:"inline-block px-8 py-4 rounded-lg font-semibold transition-all hover:scale-105",style:{backgroundColor:x.color,color:x.backgroundColor},children:e.button_text})]})},e.id);case"team":return(0,ea.jsx)("section",{className:"py-16 px-6",style:{backgroundColor:"#ffffff"===(null===t||void 0===t?void 0:t.background_color)?"#f8fafc":"rgba(255,255,255,0.05)"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-10 text-center",style:{color:null===t||void 0===t?void 0:t.primary_color},children:e.title}),(0,ea.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-".concat(Math.min((null===(i=e.members)||void 0===i?void 0:i.length)||1,4)," gap-6"),children:null===(o=e.members)||void 0===o?void 0:o.map(e=>{var s;return(0,ea.jsxs)("div",{className:"text-center p-6 rounded-xl",style:{backgroundColor:(null===t||void 0===t?void 0:t.background_color)||"#ffffff"},children:[e.image?(0,ea.jsx)("img",{src:e.image,alt:e.name,className:"w-24 h-24 rounded-full mx-auto mb-4 object-cover shadow-md"}):(0,ea.jsx)("div",{className:"w-24 h-24 rounded-full mx-auto mb-4 flex items-center justify-center text-2xl font-bold text-white",style:{backgroundColor:null===t||void 0===t?void 0:t.primary_color},children:(null===(s=e.name)||void 0===s?void 0:s.charAt(0))||"?"}),(0,ea.jsx)("h3",{className:"font-semibold text-lg",children:e.name}),e.role&&(0,ea.jsx)("p",{className:"opacity-60",children:e.role}),e.bio&&(0,ea.jsx)("p",{className:"mt-2 text-sm opacity-80",children:e.bio})]},e.id)})})]})},e.id);case"stats":return(0,ea.jsx)("section",{className:"py-16 px-6",style:{backgroundColor:null===t||void 0===t?void 0:t.primary_color,color:"#ffffff"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[e.title&&(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-10 text-center",children:e.title}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-".concat(Math.min((null===(c=e.items)||void 0===c?void 0:c.length)||1,4)," gap-8"),children:null===(u=e.items)||void 0===u?void 0:u.map(e=>(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"text-4xl md:text-5xl font-bold mb-2",children:e.value}),(0,ea.jsx)("div",{className:"opacity-80",children:e.label})]},e.id))})]})},e.id);case"html":return(0,ea.jsxs)("section",{className:e.full_width?"":"px-6 py-16",children:[e.css&&(0,ea.jsx)("style",{dangerouslySetInnerHTML:{__html:e.css}}),(0,ea.jsx)("div",{className:e.full_width?"":"max-w-6xl mx-auto",dangerouslySetInnerHTML:{__html:e.html||""}})]},e.id);default:return null}})(e,qe)),(null===We||void 0===We?void 0:We.enabled)&&(0,ea.jsx)("section",{id:"contact",className:"py-20 px-6",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-12 text-center",style:{color:null===qe||void 0===qe?void 0:qe.primary_color},children:(null===We||void 0===We?void 0:We.title)||"Get in Touch"}),(0,ea.jsxs)("div",{className:"grid ".concat(null!==We&&void 0!==We&&We.show_form?"md:grid-cols-2":"grid-cols-1"," gap-12"),children:[(0,ea.jsxs)("div",{className:"space-y-6",children:[(null===We||void 0===We?void 0:We.email)&&(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center",style:{backgroundColor:"".concat(null===qe||void 0===qe?void 0:qe.primary_color,"20")},children:(0,ea.jsx)(Yl,{size:24,style:{color:null===qe||void 0===qe?void 0:qe.primary_color}})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm opacity-60",children:"Email"}),(0,ea.jsx)("a",{href:"mailto:".concat(We.email),className:"font-medium hover:underline",style:{color:null===qe||void 0===qe?void 0:qe.primary_color},children:We.email})]})]}),(null===We||void 0===We?void 0:We.phone)&&(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center",style:{backgroundColor:"".concat(null===qe||void 0===qe?void 0:qe.primary_color,"20")},children:(0,ea.jsx)(Jl,{size:24,style:{color:null===qe||void 0===qe?void 0:qe.primary_color}})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm opacity-60",children:"Phone"}),(0,ea.jsx)("a",{href:"tel:".concat(We.phone),className:"font-medium hover:underline",style:{color:null===qe||void 0===qe?void 0:qe.primary_color},children:We.phone})]})]}),(null===We||void 0===We?void 0:We.address)&&(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center",style:{backgroundColor:"".concat(null===qe||void 0===qe?void 0:qe.primary_color,"20")},children:(0,ea.jsx)(Ql,{size:24,style:{color:null===qe||void 0===qe?void 0:qe.primary_color}})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm opacity-60",children:"Address"}),(0,ea.jsx)("p",{className:"font-medium whitespace-pre-line",children:We.address})]})]})]}),(null===We||void 0===We?void 0:We.show_form)&&(0,ea.jsx)("div",{className:"p-6 rounded-xl shadow-md",style:{backgroundColor:"#ffffff"===(null===qe||void 0===qe?void 0:qe.background_color)?"#f8fafc":"rgba(255,255,255,0.05)"},children:ie?(0,ea.jsxs)("div",{className:"text-center py-8",children:[(0,ea.jsx)(cr,{size:48,className:"mx-auto mb-4",style:{color:null===qe||void 0===qe?void 0:qe.primary_color}}),(0,ea.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"Thank You!"}),(0,ea.jsx)("p",{className:"opacity-80",children:"We'll get back to you soon."})]}):(0,ea.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),de(!0),await new Promise(e=>setTimeout(e,1e3)),oe(!0),de(!1)},className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Name"}),(0,ea.jsx)("input",{type:"text",value:le.name,onChange:e=>re(d(d({},le),{},{name:e.target.value})),required:!0,className:"w-full px-4 py-2 rounded-lg border focus:outline-none focus:ring-2",style:{borderColor:"#e2e8f0"}})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Email"}),(0,ea.jsx)("input",{type:"email",value:le.email,onChange:e=>re(d(d({},le),{},{email:e.target.value})),required:!0,className:"w-full px-4 py-2 rounded-lg border focus:outline-none focus:ring-2",style:{borderColor:"#e2e8f0"}})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Message"}),(0,ea.jsx)("textarea",{value:le.message,onChange:e=>re(d(d({},le),{},{message:e.target.value})),required:!0,rows:4,className:"w-full px-4 py-2 rounded-lg border focus:outline-none focus:ring-2",style:{borderColor:"#e2e8f0"}})]}),(0,ea.jsx)("button",{type:"submit",disabled:ce,className:"w-full py-3 rounded-lg font-semibold text-white flex items-center justify-center gap-2 hover:opacity-90 transition-opacity disabled:opacity-50",style:{backgroundColor:null===qe||void 0===qe?void 0:qe.primary_color},children:ce?(0,ea.jsx)(ql,{className:"animate-spin",size:20}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(dr,{size:20}),"Send Message"]})})]})})]})]})}),!1!==(null===Ve||void 0===Ve?void 0:Ve.enabled)&&(0,ea.jsx)("footer",{className:"py-12 px-6",
2style:{backgroundColor:(null===Ve||void 0===Ve?void 0:Ve.background_color)||(null===Ie||void 0===Ie?void 0:Ie.background_color)||(null===qe||void 0===qe?void 0:qe.primary_color),color:(null===Ve||void 0===Ve?void 0:Ve.text_color)||(null===Ie||void 0===Ie?void 0:Ie.text_color)||"#ffffff"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:["centered"===(null===Ve||void 0===Ve?void 0:Ve.style)&&(0,ea.jsxs)("div",{className:"text-center space-y-6",children:[null!==Ve&&void 0!==Ve&&Ve.logo_url?(0,ea.jsx)("img",{src:Ve.logo_url,alt:"Logo",className:"h-12 mx-auto"}):(null===Ve||void 0===Ve?void 0:Ve.company_name)&&(0,ea.jsx)("h3",{className:"text-2xl font-bold",children:Ve.company_name}),(null===Ve||void 0===Ve?void 0:Ve.tagline)&&(0,ea.jsx)("p",{className:"opacity-80 max-w-md mx-auto",children:Ve.tagline}),((null===Ve||void 0===Ve||null===(h=Ve.social_links)||void 0===h?void 0:h.facebook)||(null===Ve||void 0===Ve||null===(x=Ve.social_links)||void 0===x?void 0:x.twitter)||(null===Ve||void 0===Ve||null===(p=Ve.social_links)||void 0===p?void 0:p.instagram)||(null===Ve||void 0===Ve||null===(g=Ve.social_links)||void 0===g?void 0:g.linkedin)||(null===Ve||void 0===Ve||null===(f=Ve.social_links)||void 0===f?void 0:f.youtube))&&(0,ea.jsxs)("div",{className:"flex justify-center gap-4",children:[(null===Ve||void 0===Ve||null===(v=Ve.social_links)||void 0===v?void 0:v.facebook)&&(0,ea.jsx)("a",{href:Ve.social_links.facebook,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(nr,{size:24})}),(null===Ve||void 0===Ve||null===(b=Ve.social_links)||void 0===b?void 0:b.twitter)&&(0,ea.jsx)("a",{href:Ve.social_links.twitter,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(lr,{size:24})}),(null===Ve||void 0===Ve||null===(j=Ve.social_links)||void 0===j?void 0:j.instagram)&&(0,ea.jsx)("a",{href:Ve.social_links.instagram,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(rr,{size:24})}),(null===Ve||void 0===Ve||null===(y=Ve.social_links)||void 0===y?void 0:y.linkedin)&&(0,ea.jsx)("a",{href:Ve.social_links.linkedin,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(ir,{size:24})}),(null===Ve||void 0===Ve||null===(N=Ve.social_links)||void 0===N?void 0:N.youtube)&&(0,ea.jsx)("a",{href:Ve.social_links.youtube,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(or,{size:24})})]}),((null===Ve||void 0===Ve||null===(w=Ve.contact_info)||void 0===w?void 0:w.email)||(null===Ve||void 0===Ve||null===(C=Ve.contact_info)||void 0===C?void 0:C.phone)||(null===Ve||void 0===Ve||null===(k=Ve.contact_info)||void 0===k?void 0:k.address))&&(0,ea.jsxs)("div",{className:"flex flex-wrap justify-center gap-6 text-sm opacity-80",children:[(null===Ve||void 0===Ve||null===(D=Ve.contact_info)||void 0===D?void 0:D.email)&&(0,ea.jsxs)("a",{href:"mailto:".concat(Ve.contact_info.email),className:"flex items-center gap-2 hover:opacity-100",children:[(0,ea.jsx)(Yl,{size:16})," ",Ve.contact_info.email]}),(null===Ve||void 0===Ve||null===(_=Ve.contact_info)||void 0===_?void 0:_.phone)&&(0,ea.jsxs)("a",{href:"tel:".concat(Ve.contact_info.phone),className:"flex items-center gap-2 hover:opacity-100",children:[(0,ea.jsx)(Jl,{size:16})," ",Ve.contact_info.phone]}),(null===Ve||void 0===Ve||null===(S=Ve.contact_info)||void 0===S?void 0:S.address)&&(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Ql,{size:16})," ",Ve.contact_info.address]})]})]}),("simple"===(null===Ve||void 0===Ve?void 0:Ve.style)||!(null!==Ve&&void 0!==Ve&&Ve.style))&&(0,ea.jsx)("div",{className:"text-center space-y-4",children:((null===Ve||void 0===Ve||null===(E=Ve.social_links)||void 0===E?void 0:E.facebook)||(null===Ve||void 0===Ve||null===(A=Ve.social_links)||void 0===A?void 0:A.twitter)||(null===Ve||void 0===Ve||null===(F=Ve.social_links)||void 0===F?void 0:F.instagram)||(null===Ve||void 0===Ve||null===(T=Ve.social_links)||void 0===T?void 0:T.linkedin)||(null===Ve||void 0===Ve||null===(z=Ve.social_links)||void 0===z?void 0:z.youtube))&&(0,ea.jsxs)("div",{className:"flex justify-center gap-4 mb-4",children:[(null===Ve||void 0===Ve||null===(M=Ve.social_links)||void 0===M?void 0:M.facebook)&&(0,ea.jsx)("a",{href:Ve.social_links.facebook,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(nr,{size:20})}),(null===Ve||void 0===Ve||null===(P=Ve.social_links)||void 0===P?void 0:P.twitter)&&(0,ea.jsx)("a",{href:Ve.social_links.twitter,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(lr,{size:20})}),(null===Ve||void 0===Ve||null===(B=Ve.social_links)||void 0===B?void 0:B.instagram)&&(0,ea.jsx)("a",{href:Ve.social_links.instagram,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(rr,{size:20})}),(null===Ve||void 0===Ve||null===(R=Ve.social_links)||void 0===R?void 0:R.linkedin)&&(0,ea.jsx)("a",{href:Ve.social_links.linkedin,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(ir,{size:20})}),(null===Ve||void 0===Ve||null===(L=Ve.social_links)||void 0===L?void 0:L.youtube)&&(0,ea.jsx)("a",{href:Ve.social_links.youtube,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(or,{size:20})})]})}),"columns"===(null===Ve||void 0===Ve?void 0:Ve.style)&&(0,ea.jsxs)("div",{className:"grid md:grid-cols-4 gap-8 mb-8",children:[(0,ea.jsxs)("div",{className:"space-y-4",children:[null!==Ve&&void 0!==Ve&&Ve.logo_url?(0,ea.jsx)("img",{src:Ve.logo_url,alt:"Logo",className:"h-10"}):(null===Ve||void 0===Ve?void 0:Ve.company_name)&&(0,ea.jsx)("h3",{className:"text-xl font-bold",children:Ve.company_name}),(null===Ve||void 0===Ve?void 0:Ve.tagline)&&(0,ea.jsx)("p",{className:"opacity-80 text-sm",children:Ve.tagline}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(null===Ve||void 0===Ve||null===(I=Ve.social_links)||void 0===I?void 0:I.facebook)&&(0,ea.jsx)("a",{href:Ve.social_links.facebook,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(nr,{size:20})}),(null===Ve||void 0===Ve||null===(O=Ve.social_links)||void 0===O?void 0:O.twitter)&&(0,ea.jsx)("a",{href:Ve.social_links.twitter,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(lr,{size:20})}),(null===Ve||void 0===Ve||null===(U=Ve.social_links)||void 0===U?void 0:U.instagram)&&(0,ea.jsx)("a",{href:Ve.social_links.instagram,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(rr,{size:20})}),(null===Ve||void 0===Ve||null===(H=Ve.social_links)||void 0===H?void 0:H.linkedin)&&(0,ea.jsx)("a",{href:Ve.social_links.linkedin,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(ir,{size:20})}),(null===Ve||void 0===Ve||null===(W=Ve.social_links)||void 0===W?void 0:W.youtube)&&(0,ea.jsx)("a",{href:Ve.social_links.youtube,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:(0,ea.jsx)(or,{size:20})})]})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)("h4",{className:"font-semibold",children:"Contact"}),(null===Ve||void 0===Ve||null===(V=Ve.contact_info)||void 0===V?void 0:V.email)&&(0,ea.jsxs)("a",{href:"mailto:".concat(Ve.contact_info.email),className:"flex items-center gap-2 text-sm opacity-80 hover:opacity-100",children:[(0,ea.jsx)(Yl,{size:16})," ",Ve.contact_info.email]}),(null===Ve||void 0===Ve||null===(q=Ve.contact_info)||void 0===q?void 0:q.phone)&&(0,ea.jsxs)("a",{href:"tel:".concat(Ve.contact_info.phone),className:"flex items-center gap-2 text-sm opacity-80 hover:opacity-100",children:[(0,ea.jsx)(Jl,{size:16})," ",Ve.contact_info.phone]}),(null===Ve||void 0===Ve||null===($=Ve.contact_info)||void 0===$?void 0:$.address)&&(0,ea.jsxs)("span",{className:"flex items-center gap-2 text-sm opacity-80",children:[(0,ea.jsx)(Ql,{size:16})," ",Ve.contact_info.address]})]})]}),(0,ea.jsx)("div",{className:"text-center pt-6 border-t border-white/20",children:(0,ea.jsx)("p",{className:"opacity-80 text-sm",children:(null===Ve||void 0===Ve?void 0:Ve.copyright)||"\xa9 ".concat((new Date).getFullYear()," ").concat($e||"Company",". All rights reserved.")})})]})}),(0,ea.jsx)(dN,{pageSlug:pe.pageSlug,previewToken:pe.previewToken,isOpen:pe.isOpen,onClose:()=>ge({isOpen:!1,pageSlug:null,previewToken:null}),siteTheme:qe,pages:fe,subdomain:K,currentLanguage:ye,defaultLanguage:Ee,tenantId:Fe})]})},hN="nexuscms_cookie_consent",xN=e=>{let{settings:s={}}=e;const[a,n]=(0,t.useState)(!1),{enabled:l=!1,message:r='We use cookies to enhance your browsing experience and analyse site traffic. By clicking "Accept", you consent to the use of cookies.',accept_text:i="Accept",decline_text:o="Decline",privacy_url:c="",privacy_text:d="Privacy Policy",position:u="bottom",bg_color:m="#1e293b",text_color:h="#f8fafc",button_bg:x="#4f46e5",button_text_color:p="#ffffff",show_decline:g=!0}=s;(0,t.useEffect)(()=>
2{if(!l)return;if(!localStorage.getItem(hN)){const e=setTimeout(()=>n(!0),800);return()=>clearTimeout(e)}},[l]);if(!l||!a)return null;const f="top"===u;return(0,ea.jsxs)("div",{"data-testid":"cookie-consent-banner",className:"fixed left-0 right-0 z-[9999] px-4 py-0",style:{[f?"top":"bottom"]:0,animation:"cookieBannerSlide 0.4s ease-out"},children:[(0,ea.jsx)("style",{children:"\n @keyframes cookieBannerSlide {\n from { \n opacity: 0;\n transform: translateY(".concat(f?"-100%":"100%",");\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n ")}),(0,ea.jsx)("div",{className:"max-w-6xl mx-auto rounded-t-xl shadow-2xl",style:{backgroundColor:m,color:h,borderTop:f?"none":"3px solid ".concat(x),borderBottom:f?"3px solid ".concat(x):"none"},children:(0,ea.jsxs)("div",{className:"relative px-6 py-4",children:[(0,ea.jsx)("button",{onClick:()=>{n(!1)},className:"absolute top-3 right-3 p-1 rounded-full hover:bg-white/10 transition-colors","aria-label":"Close","data-testid":"cookie-close-btn",children:(0,ea.jsx)(sr,{size:16,style:{color:h,opacity:.6}})}),(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4 pr-8",children:[(0,ea.jsxs)("div",{className:"flex-1 text-sm leading-relaxed",style:{color:h,opacity:.9},children:[r,c&&(0,ea.jsxs)(ea.Fragment,{children:[" ",(0,ea.jsx)("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"underline hover:no-underline font-medium",style:{color:h},"data-testid":"cookie-privacy-link",children:d})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[g&&(0,ea.jsx)("button",{onClick:()=>{localStorage.setItem(hN,JSON.stringify({consent:"declined",date:(new Date).toISOString()})),n(!1)},className:"px-4 py-2 text-sm font-medium rounded-lg border transition-colors hover:bg-white/10",style:{color:h,borderColor:"".concat(h,"40")},"data-testid":"cookie-decline-btn",children:o}),(0,ea.jsx)("button",{onClick:()=>{localStorage.setItem(hN,JSON.stringify({consent:"accepted",date:(new Date).toISOString()})),n(!1)},className:"px-5 py-2 text-sm font-semibold rounded-lg transition-colors hover:opacity-90",style:{backgroundColor:x,color:p},"data-testid":"cookie-accept-btn",children:i})]})]})]})})]})},pN=()=>{let e=sessionStorage.getItem("analytics_session_id");return e||(e="sess_"+Math.random().toString(36).substring(2,15)+Date.now().toString(36),sessionStorage.setItem("analytics_session_id",e)),e},gN=new Set,fN=e=>{var s,a;let{pageData:n,subdomain:l}=e;console.log("[PublicTenantPage] Received pageData:",n),console.log("[PublicTenantPage] isArticle flag:",null===n||void 0===n?void 0:n.isArticle),console.log("[PublicTenantPage] article data:",null===n||void 0===n?void 0:n.article);const{page:r,article:i,isArticle:o,tenant_id:c,tenant_name:u,theme:m,branding:h,menus:x,all_pages:p,reseller_branding:g}=n;(0,t.useEffect)(()=>{const e=null===h||void 0===h?void 0:h.favicon_url;if(e)return["icon","shortcut icon","apple-touch-icon"].forEach(t=>{let s=document.querySelector('link[rel="'.concat(t,'"]'));s||(s=document.createElement("link"),s.rel=t,document.head.appendChild(s)),s.href=e}),()=>{["icon","shortcut icon","apple-touch-icon"].forEach(e=>{const t=document.querySelector('link[rel="'.concat(e,'"]'));t&&(t.href="".concat("","/favicon.png"))})}},[null===h||void 0===h?void 0:h.favicon_url]),(0,t.useEffect)(()=>{c&&!1!==(null===h||void 0===h?void 0:h.enable_builtin_analytics)&&(async(e,t,s)=>{try{var a,n;const l="".concat(t,":").concat(s.page_id||s.article_id||s.page_slug||"home");if(gN.has(l))return;gN.add(l),setTimeout(()=>gN.delete(l),5e3),await fetch("".concat("","/api/public/track/pageview?tenant_id=").concat(t),{method:"POST",headers:{"Content-Type":"application/json","X-Tenant-Subdomain":e},body:JSON.stringify(d(d({},s),{},{session_id:pN(),referrer:document.referrer||null,user_agent:navigator.userAgent,screen_width:null===(a=window.screen)||void 0===a?void 0:a.width,screen_height:null===(n=window.screen)||void 0===n?void 0:n.height,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}))})}catch(G2){}})(l,c,{page_id:(null===r||void 0===r?void 0:r.page_id)||null,page_slug:(null===r||void 0===r?void 0:r.slug)||null,article_id:(null===i||void 0===i?void 0:i.article_id)||null,page_type:o?"article":"home"===(null===r||void 0===r?void 0:r.slug)?"landing":"page"})},[c,null===r||void 0===r?void 0:r.page_id,null===i||void 0===i?void 0:i.article_id,l,o,null===r||void 0===r?void 0:r.slug,null===h||void 0===h?void 0:h.enable_builtin_analytics]);const[f,v]=(0,t.useState)("en"),[b,j]=(0,t.useState)(null),[y,N]=(0,t.useState)(!1),w=!0===(null===h||void 0===h?void 0:h.translation_enabled),C=(null===h||void 0===h?void 0:h.enabled_languages)||null,k=(null===h||void 0===h?void 0:h.default_language)||"en",D=(null===h||void 0===h?void 0:h.translation_mode)||"selector";(0,t.useEffect)(()=>
2{if(w){const e=new URLSearchParams(window.location.search).get("lang");if(e&&ag[e])return v(e),void localStorage.setItem("nexus_language",e);const t=localStorage.getItem("nexus_language")||localStorage.getItem("nexuscms_language_preference");if(t&&ag[t])v(t);else if("auto"===D){const e=lg();v(e!==k&&ag[e]?e:k)}else v(k)}},[w,k,D]),(0,t.useEffect)(()=>{(async()=>{if(!w||f===k)return void j(null);const e=(null===r||void 0===r?void 0:r.blocks)||(null===i||void 0===i?void 0:i.blocks),t=(null===r||void 0===r?void 0:r.page_id)||(null===i||void 0===i?void 0:i.article_id);if(e&&t){N(!0);try{const t=await fetch("".concat("","/api/translation/translate-blocks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blocks:e,target_language:f,tenant_id:c})});if(t.ok){const e=await t.json();e.translated_blocks&&(j(e.translated_blocks),console.log("[Translation] Content translated to ".concat(f)))}else console.warn("[Translation] Failed to fetch translation"),j(null)}catch(s){console.error("[Translation] Error:",s),j(null)}finally{N(!1)}}else j(null)})()},[f,null===r||void 0===r?void 0:r.page_id,null===r||void 0===r?void 0:r.blocks,null===i||void 0===i?void 0:i.article_id,null===i||void 0===i?void 0:i.blocks,l,w,k,c]);const _=e=>{v(e);try{localStorage.setItem("nexus_language",e),localStorage.setItem("nexuscms_language_preference",e)}catch(G2){}},S=b||(null===r||void 0===r?void 0:r.blocks)||[];(0,t.useEffect)(()=>{const e=document.getElementById("dynatex-badge");if(e&&g){e.href=g.website_url||"#";const t=e.querySelector("span");t&&(t.textContent="Made by ".concat(g.company_name),t.style.color=g.primary_color||"#4F46E5")}return h&&!1!==h.show_platform_branding?document.body.classList.add("show-dynatex-badge"):document.body.classList.remove("show-dynatex-badge"),()=>{document.body.classList.remove("show-dynatex-badge");const e=document.getElementById("dynatex-badge");if(e){e.href="https://www.dynatexsaas.com/";const t=e.querySelector("span");t&&(t.textContent="Made by DynatexSaaS",t.style.color="#374151")}}},[h,g]),(0,t.useEffect)(()=>{const e=()=>{const e=window.location.hash;if(e){const t=decodeURIComponent(e.substring(1));setTimeout(()=>{const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100)}};return e(),window.addEventListener("hashchange",e),()=>{window.removeEventListener("hashchange",e)}},[r,i]);const E=(null===(s=n.page)||void 0===s?void 0:s.page_id)||(null===(a=n.article)||void 0===a?void 0:a.article_id)||null,A=e=>{const t=(x||[]).filter(t=>t.location===e),s=t.find(e=>{var t;return E&&(null===(t=e.page_ids)||void 0===t?void 0:t.includes(E))});return s||(t.find(e=>e.is_global)||null)},F=A("header"),T=A("footer");if(o&&n.article){const e=n.article,t=e.article_nav_mode||(!1===e.show_site_navigation?"none":"site_nav");console.log("[PublicTenantPage] Rendering ARTICLE, nav mode:",t);const s=e.meta_title||e.title||"Article",a="".concat(s," | ").concat(u),r=e.meta_description||e.excerpt||"",i=e.og_image||e.image_url||(null===h||void 0===h?void 0:h.logo_url)||"",o="undefined"!==typeof window?window.location.href:"",d=(0,ea.jsxs)("article",{className:"max-w-4xl mx-auto px-4 py-8 md:py-12 bg-white rounded-lg my-8 shadow-sm",children:[e.image_url&&(0,ea.jsxs)("figure",{className:"mb-8",children:[(0,ea.jsx)("img",{src:e.image_url,alt:e.image_alt||e.title,className:"w-full h-64 md:h-96 object-cover rounded-lg"}),e.image_caption&&(0,ea.jsx)("figcaption",{className:"text-xs text-slate-500 mt-2 text-center italic",children:e.image_caption})]}),(0,ea.jsxs)("header",{className:"mb-8",children:[(0,ea.jsx)("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold mb-4",style:{color:(null===m||void 0===m?void 0:m.heading_color)||"#1e293b",fontFamily:(null===m||void 0===m?void 0:m.heading_font)||"inherit"},children:e.title}),e.show_date&&e.date||e.category?(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-sm",style:{color:(null===m||void 0===m?void 0:m.body_color)||"#64748b"},children:[e.show_date&&e.date&&(0,ea.jsx)("time",{dateTime:e.date,children:new Date(e.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),e.category&&(0,ea.jsx)("span",{className:"px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:null!==m&&void 0!==m&&m.accent_color?"".concat(m.accent_color,"20"):"#e0e7ff",color:(null===m||void 0===m?void 0:m.accent_color)||"#4f46e5"},children:e.category})]}):null]}),S&&S.length>0||e.blocks&&e.blocks.length>0?(0,ea.jsxs)("div",{className:"prose prose-lg max-w-none",style:{color:(null===m||void 0===m?void 0:m.body_color)||"#475569",fontFamily:(null===m||void 0===m?void 0:m.body_font)||"inherit"},children:[y&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 mb-4",children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-indigo-600"}),(0,ea.jsx)("span",{children:"Translating..."})]}),(0,ea.jsx)(cN,{blocks:b||e.blocks,siteTheme:m||{},showNavigation:!1,isQuickPreview:!1,tenantId:c,subdomain:l,currentLanguage:f,defaultLanguage:k,enabledLanguages:C,pages:p||[]})]}):e.content_html?(0,ea.jsx)("div",{className:"prose prose-lg max-w-none",style:{color:(null===m||void 0===m?void 0:m.body_color)||"#475569",fontFamily:(null===m||void 0===m?void 0:m.body_font)||"inherit"},dangerouslySetInnerHTML:{__html:e.content_html}}
2):(0,ea.jsx)("p",{className:"text-slate-400 italic",children:"No content"})]});return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(As,{children:[(0,ea.jsx)("title",{children:a}),r&&(0,ea.jsx)("meta",{name:"description",content:r}),(0,ea.jsx)("link",{rel:"canonical",href:o}),(0,ea.jsx)("meta",{name:"robots",content:"index, follow"}),(0,ea.jsx)("meta",{property:"og:type",content:"article"}),(0,ea.jsx)("meta",{property:"og:title",content:s}),r&&(0,ea.jsx)("meta",{property:"og:description",content:r}),i&&(0,ea.jsx)("meta",{property:"og:image",content:i}),(0,ea.jsx)("meta",{property:"og:url",content:o}),u&&(0,ea.jsx)("meta",{property:"og:site_name",content:u}),e.date&&(0,ea.jsx)("meta",{property:"article:published_time",content:e.date}),(0,ea.jsx)("meta",{name:"twitter:card",content:i?"summary_large_image":"summary"}),(0,ea.jsx)("meta",{name:"twitter:title",content:s}),r&&(0,ea.jsx)("meta",{name:"twitter:description",content:r}),i&&(0,ea.jsx)("meta",{name:"twitter:image",content:i})]}),"site_nav"===t?(0,ea.jsx)(cN,{blocks:[],siteTheme:m||{},headerMenu:F,footerMenu:T,showNavigation:!0,isQuickPreview:!1,tenantId:c,pages:p||[],subdomain:l,currentLanguage:f,defaultLanguage:k,children:d}):(0,ea.jsxs)("div",{className:"min-h-screen flex flex-col",style:{backgroundColor:(null===m||void 0===m?void 0:m.backgroundColor)||"#ffffff"},children:["back_link"===t&&(0,ea.jsx)("div",{className:"bg-white/80 backdrop-blur-sm border-b sticky top-0 z-50",children:(0,ea.jsx)("div",{className:"max-w-4xl mx-auto px-4 py-3",children:(0,ea.jsxs)("a",{href:"/",className:"inline-flex items-center text-sm font-medium hover:underline",style:{color:(null===m||void 0===m?void 0:m.accent_color)||"#4f46e5"},children:[(0,ea.jsx)("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),"Back to ",u||"Site"]})})}),(0,ea.jsx)("main",{className:"flex-grow",children:d})]}),(0,ea.jsx)(xN,{settings:null===h||void 0===h?void 0:h.cookie_consent})]})}const z=null===r||void 0===r||!r.title||"home"===(null===r||void 0===r?void 0:r.slug)||null!==r&&void 0!==r&&r.isHomepage?u||"Page":"".concat(r.title," | ").concat(u),M=(null===r||void 0===r?void 0:r.meta_description)||"",P=(null===r||void 0===r?void 0:r.og_title)||z,B=(null===r||void 0===r?void 0:r.og_description)||M,R=(null===r||void 0===r?void 0:r.og_image)||(null===h||void 0===h?void 0:h.logo_url)||"",L=(null===r||void 0===r?void 0:r.canonical_url)||("undefined"!==typeof window?window.location.href:""),I=(null===r||void 0===r?void 0:r.noindex)||!1;if(!r)return console.log("[PublicTenantPage] No page found, showing 404. isArticle was:",o,"article was:",i),(0,ea.jsxs)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:[(0,ea.jsxs)(As,{children:[(0,ea.jsxs)("title",{children:["Page Not Found | ",u||"Site"]}),(0,ea.jsx)("meta",{name:"robots",content:"noindex"})]}),(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Page Not Found"}),(0,ea.jsx)("p",{className:"text-slate-600",children:"This page does not exist or has not been published."})]})]});const O=r.theme||m||{};return console.log("[PublicTenantPage] Rendering PAGE with navigation:",{headerMenu:!!F,footerMenu:!!T}),(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(As,{children:[(0,ea.jsx)("title",{children:z}),M&&(0,ea.jsx)("meta",{name:"description",content:M}),L&&(0,ea.jsx)("link",{rel:"canonical",href:L}),I?(0,ea.jsx)("meta",{name:"robots",content:"noindex, nofollow"}):(0,ea.jsx)("meta",{name:"robots",content:"index, follow"}),(0,ea.jsx)("meta",{property:"og:type",content:"website"}),(0,ea.jsx)("meta",{property:"og:title",content:P}),B&&(0,ea.jsx)("meta",{property:"og:description",content:B}),R&&(0,ea.jsx)("meta",{property:"og:image",content:R}),L&&(0,ea.jsx)("meta",{property:"og:url",content:L}),u&&(0,ea.jsx)("meta",{property:"og:site_name",content:u}),(0,ea.jsx)("meta",{name:"twitter:card",content:R?"summary_large_image":"summary"}),(0,ea.jsx)("meta",{name:"twitter:title",content:P}),B&&(0,ea.jsx)("meta",{name:"twitter:description",content:B}),R&&(0,ea.jsx)("meta",{name:"twitter:image",content:R}),(0,ea.jsx)("html",{lang:f}),(null===O||void 0===O?void 0:O.primary_color)&&(0,ea.jsx)("meta",{name:"theme-color",content:O.primary_color}),"undefined"!==typeof window&&(0,ea.jsx)("link",{rel:"manifest",href:"/api/public/manifest.webmanifest?domain=".concat(encodeURIComponent(window.location.hostname))})]}
2),w&&"hidden"!==((null===m||void 0===m?void 0:m.language_selector_position)||"floating")&&("top_bar"===((null===m||void 0===m?void 0:m.language_selector_position)||"floating")?(0,ea.jsx)("div",{className:"sticky top-0 z-40 w-full bg-slate-50 border-b border-slate-200 flex justify-end items-center px-4 py-1.5",children:(0,ea.jsx)(rg,{currentLanguage:f,onLanguageChange:_,enabledLanguages:C,variant:"compact",className:y?"opacity-50 pointer-events-none":""})}):(0,ea.jsx)("div",{className:"fixed bottom-4 left-4 md:top-4 md:right-4 md:bottom-auto md:left-auto z-50",children:(0,ea.jsx)(rg,{currentLanguage:f,onLanguageChange:_,enabledLanguages:C,variant:"compact",className:y?"opacity-50 pointer-events-none":""})})),y&&(0,ea.jsxs)("div",{className:"fixed bottom-16 left-4 md:top-16 md:right-4 md:bottom-auto md:left-auto z-50 bg-white shadow-lg rounded-lg px-3 py-2 flex items-center gap-2 text-sm text-slate-600",children:[(0,ea.jsxs)("svg",{className:"animate-spin h-4 w-4 text-indigo-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,ea.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,ea.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Translating..."]}),(0,ea.jsx)(cN,{blocks:S,title:null,pageWidth:r.pageWidth||"standard",theme:O,siteTheme:m||O||{},headerMenu:F,footerMenu:T,showNavigation:!0,isQuickPreview:!1,tenantId:c,pages:p||[],subdomain:l,currentLanguage:f,defaultLanguage:k,enabledLanguages:C}),(0,ea.jsx)(xN,{settings:null===h||void 0===h?void 0:h.cookie_consent})]})},vN=[{code:"eu",name:"Europe",domain:"eu.nexuscms.ai",flag:"\ud83c\uddea\ud83c\uddfa",city:"Frankfurt, Germany"},{code:"us",name:"United States",domain:"us.nexuscms.ai",flag:"\ud83c\uddfa\ud83c\uddf8",city:"New York, USA"},{code:"ap",name:"Asia Pacific",domain:"ap.nexuscms.ai",flag:"\ud83c\udf0f",city:"Singapore"},{code:"au",name:"Australia",domain:"au.nexuscms.ai",flag:"\ud83c\udde6\ud83c\uddfa",city:"Sydney, Australia"}],bN=()=>{var e;const s=(0,t.useMemo)(()=>{try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone||"";if(e.includes("Europe")||e.includes("Africa"))return"eu";if(e.includes("Australia"))return"au";if(e.includes("Asia")||e.includes("Pacific"))return"ap";if(e.includes("America"))return"us"}catch(e){}return"us"},[]),[a,n]=(0,t.useState)(!1);(0,t.useEffect)(()=>{const e=new Image;e.onload=()=>n(!0),e.onerror=()=>n(!0),e.src="/region-bg.jpg"},[]);const l=(null===(e=vN.find(e=>e.code===s))||void 0===e?void 0:e.name)||"";return(0,ea.jsxs)("div",{className:"relative min-h-screen overflow-hidden",children:[(0,ea.jsx)(As,{children:(0,ea.jsx)("title",{children:"Choose your region | Nexus CMS"})}),(0,ea.jsx)("div",{"aria-hidden":"true",className:"fixed inset-0 z-0 pointer-events-none select-none transition-opacity duration-500",style:{backgroundImage:a?"url('/region-bg.jpg')":"linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%)",backgroundSize:"cover",backgroundPosition:"center top",backgroundRepeat:"no-repeat",filter:"blur(8px) saturate(1.05)",transform:"scale(1.05)",opacity:a?1:.85}}),(0,ea.jsx)("div",{"aria-hidden":"true",className:"fixed inset-0 z-[1] pointer-events-none",style:{background:"linear-gradient(135deg, rgba(15,23,42,0.55) 0%, rgba(30,27,75,0.45) 50%, rgba(15,23,42,0.55) 100%)"}}),(0,ea.jsx)("div",{className:"relative z-[2] min-h-screen flex items-center justify-center p-6",children:(0,ea.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"region-title",className:"w-full max-w-[640px] bg-white/95 border border-white/40 rounded-3xl shadow-[0_30px_80px_-20px_rgba(15,23,42,0.45)] backdrop-blur-xl backdrop-saturate-150 px-9 pt-10 pb-8 animate-[popIn_0.4s_cubic-bezier(0.16,1,0.3,1)_both]",style:{animation:"popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both"},children:[(0,ea.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-7",children:[(0,ea.jsx)("div",{className:"w-11 h-11 rounded-xl bg-indigo-600 flex items-center justify-center shadow-lg shadow-indigo-600/30",children:(0,ea.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-6 h-6",children:[(0,ea.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,ea.jsx)("path",{d:"M3 9h18"}),(0,ea.jsx)("path",{d:"M9 21V9"})]})}),(0,ea.jsx)("div",{className:"text-[22px] font-bold text-slate-900 tracking-tight",children:"Nexus CMS"})]}),(0,ea.jsx)("h1",{id:"region-title",className:"text-[1.75rem] sm:text-3xl font-bold text-slate-900 text-center mb-2 tracking-tight leading-tight",children:"Select Your Region"}),(0,ea.jsx)("p",{className:"text-[15px] text-slate-500 text-center mb-6 max-w-md mx-auto",children:"Choose your nearest data center for the best performance."}),l&&(0,ea.jsx)("div",{className:"mx-auto mb-5 max-w-sm rounded-xl border border-indigo-200 bg-indigo-50/50 px-4 py-2.5 text-center",children:(0,ea.jsxs)("span",{className:"text-[13px] text-slate-600 font-medium",children:["Recommended for you: ",(0,ea.jsx)("strong",{className:"text-indigo-600 font-semibold",children:l})]})}),(0,ea.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:vN.map(e=>{const t=e.code===s;return(0,ea.jsxs)("button",{onClick:()=>(e=>{window.location.href="https://".concat(e)})(e.domain),"data-testid":"region-".concat(e.code),className:"relative text-left rounded-2xl border bg-white px-4 py-4 transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_12px_24px_-12px_rgba(79,70,229,0.35)] focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 ".concat(t?"border-indigo-600 bg-indigo-50/40 shadow-[0_0_0_3px_rgba(79,70,229,0.12)]":"border-slate-200 hover:border-indigo-400 hover:bg-indigo-50/30"),children:[t&&(0,ea.jsx)("span",{className:"absolute -top-2.5 right-3 inline-flex items-center rounded-full bg-indigo-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Recommended"}),(0,ea.jsx)("div",{className:"text-[28px] leading-none mb-1.5",children:e.flag}),(0,ea.jsx)("div",{className:"font-semibold text-[15px] text-slate-900",children:e.name}),(0,ea.jsx)("div",{className:"text-[12.5px] text-slate-500",children:e.city})]},e.code)})}),(0,ea.jsx)("p",{className:"text-center text-[12px] text-slate-500",children:"Your data will be stored in the region you choose."}),(0,ea.jsxs)("p",{className:"text-center text-[11px] text-slate-400 mt-4",children:["\xa9 ",(new Date).getFullYear()," Nexus CMS. All rights reserved."]})]})}),(0,ea.jsx)("style",{children:"\n @keyframes popIn {\n from { opacity: 0; transform: translateY(12px) scale(0.96); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n "})]})},jN="nexuscms_consent",yN=e=>{try{localStorage.setItem(jN,JSON.stringify({decision:e,ts:Date.now()}))}catch(G2){}},NN=(e,t,s)=>{if(!e||!e.trim()||!t)return[];const a=document.createElement("div");a.innerHTML=e;const n=[];
2return Array.prototype.slice.call(a.childNodes).forEach(e=>{let a=e;if("SCRIPT"===e.tagName){const t=document.createElement("script");for(let s=0;s<e.attributes.length;s+=1){const a=e.attributes[s];t.setAttribute(a.name,a.value)}t.text=e.textContent||"",a=t}a.setAttribute&&a.setAttribute("data-nexuscms-custom",s),t.appendChild(a),n.push(a)}),n},wN=e=>{let{subdomain:s,domain:a}=e;const[n,l]=(0,t.useState)(null),[r,i]=(0,t.useState)(!1),o=(0,t.useRef)(!1),c=(0,t.useRef)([]),d=e=>{if(!e||o.current)return;const t=(e.custom_head_html||"").trim(),s=(e.custom_body_html||"").trim();if(!t&&!s)return;const a=[...NN(t,document.head,"head"),...NN(s,document.body,"body")];c.current=a,o.current=!0};(0,t.useEffect)(()=>{let e=!1;const t={};if(s&&(t.subdomain=s),a&&(t.domain=a),t.subdomain||t.domain)return _l.get("/public/custom-code",{params:t}).then(t=>{e||l(t.data||{})}).catch(e=>{console.warn("[TenantCustomCode] Failed to load custom code:",e)}),()=>{e=!0}},[s,a]),(0,t.useEffect)(()=>{if(!n)return;const e=(n.custom_head_html||"").trim(),t=(n.custom_body_html||"").trim(),s=e||t;if(!n.cookie_banner_enabled)return s&&d(n),void i(!1);const a=(()=>{try{const e=localStorage.getItem(jN);if(!e)return null;const t=JSON.parse(e);return t&&t.decision&&t.ts?Date.now()-t.ts>15552e6?null:t.decision:null}catch(G2){return null}})();"accept"===a?(s&&d(n),i(!1)):i("reject"!==a)},[n]),(0,t.useEffect)(()=>()=>{c.current.forEach(e=>{try{e&&e.parentNode&&e.parentNode.removeChild(e)}catch(G2){}}),c.current=[]},[]);if(!n||!r)return null;const u=n.cookie_banner_title||"We use cookies",m=n.cookie_banner_message||"We use cookies to enhance your browsing experience and analyse our traffic. By clicking Accept, you consent to our use of cookies.",h=n.cookie_banner_accept_text||"Accept all",x=n.cookie_banner_reject_text||"Reject",p=(n.cookie_banner_policy_url||"").trim();return(0,ea.jsxs)("div",{"data-testid":"cookie-consent-banner",role:"dialog","aria-live":"polite","aria-label":"Cookie consent",style:{position:"fixed",left:"16px",right:"16px",bottom:"16px",zIndex:2147483646,background:"#0f172a",color:"#fff",borderRadius:"12px",padding:"16px 20px",boxShadow:"0 10px 40px rgba(0,0,0,0.25)",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif",display:"flex",flexDirection:"column",gap:"12px",maxWidth:"520px"},children:[(0,ea.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[(0,ea.jsx)("strong",{style:{fontSize:"15px",fontWeight:600},children:u}),(0,ea.jsxs)("p",{style:{margin:0,fontSize:"13px",lineHeight:1.5,opacity:.9},children:[m,p&&(0,ea.jsxs)(ea.Fragment,{children:[" ",(0,ea.jsx)("a",{href:p,style:{color:"#fff",textDecoration:"underline"},rel:"noopener noreferrer",children:"Learn more"})]})]})]}),(0,ea.jsxs)("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[(0,ea.jsx)("button",{type:"button","data-testid":"cookie-consent-accept",onClick:()=>{yN("accept"),i(!1),d(n)},style:{flex:1,minWidth:"120px",padding:"9px 16px",fontSize:"13px",fontWeight:600,border:0,borderRadius:"8px",background:"#6366f1",color:"#fff",cursor:"pointer"},children:h}),(0,ea.jsx)("button",{type:"button","data-testid":"cookie-consent-reject",onClick:()=>{yN("reject"),i(!1)},style:{flex:1,minWidth:"120px",padding:"9px 16px",fontSize:"13px",fontWeight:500,border:"1px solid rgba(255,255,255,0.2)",borderRadius:"8px",background:"transparent",color:"#fff",cursor:"pointer"},children:x})]})]})},CN="nexuscms.ai",kN=["www","app","admin","api","mail","email","eu","apac","ap","au","us"],DN=["emergentagent.com","localhost"],_N=()=>{const e=window.location.hostname;return DN.some(t=>e.includes(t))||/^\d+\.\d+\.\d+\.\d+$/.test(e)},SN=()=>{const e=window.location.pathname;if(["/login","/register","/dashboard","/pages","/templates","/newsletters","/media","/team","/settings","/users","/articles","/article","/forms","/navigation","/redirects","/api","/site","/reseller","/organization","/audit","/payment","/forgot-password"].some(t=>e===t||e.startsWith(t+"/")))return null;const t=e.replace(/^\//,"").replace(/\/$/,"");return t||null},EN=e=>{let{children:s}=e;const[a,n]=(0,t.useState)(null),[l,r]=(0,t.useState)(null),[i,o]=(0,t.useState)(null),[c,u]=(0,t.useState)(null),[m,h]=(0,t.useState)(null),[x,p]=(0,t.useState)(null),[g,f]=(0,t.useState)(!0),[v,b]=(0,t.useState)(null),[j,y]=(0,t.useState)(!1),[N,w]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{(async()=>
2{if(console.log("[SubdomainRouter] Starting check. Hostname:",window.location.hostname,"Path:",window.location.pathname),(()=>{const e=window.location.hostname;return e===CN||e==="www.".concat(CN)})())return w(!0),void f(!1);const e=(()=>{const e=window.location.hostname;return _N()||e===CN||e.endsWith(".".concat(CN))?null:e.replace(/^www\./,"")})();if(console.log("[SubdomainRouter] Detected custom domain:",e),e){r(e);const s=SN();u(s);try{const t=(await _l.get("/public/tenant-by-domain/".concat(e))).data;o(t.site_slug);const a=window.location.pathname,n=a.match(/^\/article\/(.+)$/);if(console.log("[SubdomainRouter] Path:",a,"Article match:",n),n){const e=n[1];console.log("[SubdomainRouter] Article route detected, slug:",e);try{const s=await _l.get("/public/site/".concat(t.site_slug,"/article/").concat(e));console.log("[SubdomainRouter] Article API response:",s.data);const a=d(d({},s.data),{},{isArticle:!0,tenant_name:t.name});console.log("[SubdomainRouter] Setting pageData with isArticle:",a),p(a),h({tenant_name:t.name,theme:s.data.theme})}catch(i){console.error("[SubdomainRouter] Article fetch error:",i),b("Article not found")}}else if("landing"===s){const e=await _l.get("/public/tenant/".concat(t.site_slug));h(e.data),y(!0)}else if(s){const e=await _l.get("/public/tenant/".concat(t.site_slug,"/page/").concat(s));if(e.data.redirect)return console.log("[SubdomainRouter] Redirect detected, navigating to:",e.data.target_path),void(window.location.href=e.data.target_path);p(e.data),h({tenant_name:e.data.tenant_name,theme:e.data.theme})}else try{const e=await _l.get("/public/tenant/".concat(t.site_slug,"/homepage"));p(e.data),h({tenant_name:e.data.tenant_name,theme:e.data.theme})}catch(c){console.log("No homepage found, falling back to Landing Page");const e=await _l.get("/public/tenant/".concat(t.site_slug));h(e.data),y(!0)}}catch(K2){var t;console.error("Failed to load tenant by custom domain:",K2),404===(null===(t=K2.response)||void 0===t?void 0:t.status)?b(s?"Page not found":"Site not found"):b("Failed to load site")}finally{f(!1)}return}const s=(()=>{const e=window.location.hostname;if(_N())return null;if(!e.endsWith(".".concat(CN)))return null;const t=e.slice(0,-12);if(!t)return null;const s=t.split(".");if(1===s.length)return kN.includes(s[0].toLowerCase())?null:s[0].toLowerCase();const a=s[s.length-1].toLowerCase();if(kN.includes(a)){const e=s.slice(0,-1).join(".").toLowerCase();return!e||kN.includes(e)?null:e}return t.toLowerCase()})();if(!s)return void f(!1);n(s);const a=SN();u(a);try{const e=window.location.pathname.match(/^\/article\/(.+)$/);if(e){const t=e[1];console.log("[SubdomainRouter] Subdomain article route detected, slug:",t);try{const e=await _l.get("/public/site/".concat(s,"/article/").concat(t)),a=d(d({},e.data),{},{isArticle:!0});p(a),h({tenant_name:e.data.tenant_name,theme:e.data.theme})}catch(i){console.error("[SubdomainRouter] Article fetch error:",i),b("Article not found")}}else if("landing"===a){const e=await _l.get("/public/tenant/".concat(s));h(e.data),y(!0)}else if(a){const e=await _l.get("/public/tenant/".concat(s,"/page/").concat(a));if(e.data.redirect)return console.log("[SubdomainRouter] Redirect detected, navigating to:",e.data.target_path),void(window.location.href=e.data.target_path);p(e.data),h({tenant_name:e.data.tenant_name,theme:e.data.theme})}else try{const e=await _l.get("/public/tenant/".concat(s,"/homepage"));p(e.data),h({tenant_name:e.data.tenant_name,theme:e.data.theme})}catch(c){console.log("No homepage found, falling back to Landing Page");const e=await _l.get("/public/tenant/".concat(s));h(e.data),y(!0)}}catch(K2){var l;console.error("Failed to load tenant:",K2),404===(null===(l=K2.response)||void 0===l?void 0:l.status)?b(a?"Page not found":"Site not found"):b("Failed to load site")}finally{f(!1)}})()},[]),N?(0,ea.jsx)(bN,{}):g?(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)(ql,{className:"h-8 w-8 animate-spin text-indigo-600 mx-auto mb-4"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading..."})]})}):v?(0,ea.jsxs)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:[(0,ea.jsx)(As,{children:(0,ea.jsxs)("title",{children:["Page not found"===v?"Page not found":"Site not found"," | Nexus CMS"]})})," ",(0,ea.jsxs)("div",{className:"text-center max-w-md mx-auto px-4",children:[(0,ea.jsx)("h1",{className:"text-4xl font-bold text-slate-900 mb-4",children:"404"}),(0,ea.jsx)("p",{className:"text-xl text-slate-600 mb-2",children:v}),(0,ea.jsx)("p",{className:"text-slate-500 mb-6",children:"Page not found"===v?"The page you're looking for doesn't exist or hasn't been published.":"The site you're looking for doesn't exist or has been removed."}),a&&(0,ea.jsx)("a",{href:"/",className:"inline-flex items-center px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 mr-3",children:"Back to Home"}),(0,ea.jsx)("a",{href:"https://".concat(CN),className:"inline-flex items-center px-4 py-2 border border-slate-300 text-slate-700 rounded-lg hover:bg-slate-50",children:"Go to NexusCMS"})]})]}):(a||l)&&x&&!j?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(fN,{pageData:x,subdomain:i||a}),(0,ea.jsx)(wN,{subdomain:a,domain:l})]}):(a||l)&&m&&j?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(mN,{tenantData:m,subdomain:i||a,isSubdomainMode:!0}),(0,ea.jsx)(wN,{subdomain:a,domain:l})]}):s},AN=Vl("triangle-alert",[["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"}]]),FN=18e5,TN=e=>{let{children:s}=e;const{user:a,logout:n}=Al(),[l,r]=(0,t.useState)(!1),[i,o]=(0,t.useState)(60),c=(0,t.useRef)(null),d=(0,t.useRef)(null),u=(0,t.useRef)(null),m=(0,t.useRef)(Date.now()),h=(0,t.useCallback)(()=>{m.current=Date.now(),c.current&&clearTimeout(c.current),d.current&&clearTimeout(d.current),u.current&&clearInterval(u.current),l&&(r(!1),o(60)),a&&(d.current=setTimeout(()=>{r(!0),o(60),u.current=setInterval(()=>{o(e=>e<=1?(clearInterval(u.current),0):e-1)},1e3)},174e4),c.current=setTimeout(()=>{x()},FN))},[a,l]),x=(0,t.useCallback)(()=>{c.current&&clearTimeout(c.current),d.current&&clearTimeout(d.current),u.current&&clearInterval(u.current),r(!1),n()},[n]),p=(0,t.useCallback)(()=>{r(!1),o(60),h()}
2,[h]);return(0,t.useEffect)(()=>{if(!a)return;const e=["mousedown","mousemove","keydown","scroll","touchstart","click"];let t=null;const s=()=>{t||(t=setTimeout(()=>{l||h(),t=null},1e3))};return e.forEach(e=>{document.addEventListener(e,s,{passive:!0})}),h(),()=>{e.forEach(e=>{document.removeEventListener(e,s)}),c.current&&clearTimeout(c.current),d.current&&clearTimeout(d.current),u.current&&clearInterval(u.current),t&&clearTimeout(t)}},[a,h,l]),(0,t.useEffect)(()=>{0===i&&l&&x()},[i,l,x]),(0,ea.jsxs)(ea.Fragment,{children:[s,l&&(0,ea.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[9999]","data-testid":"inactivity-warning",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl shadow-2xl p-6 max-w-md mx-4 animate-in fade-in zoom-in duration-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-amber-100 rounded-full flex items-center justify-center",children:(0,ea.jsx)(AN,{className:"text-amber-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-900",children:"Session Timeout Warning"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"You've been inactive for a while"})]})]}),(0,ea.jsx)("div",{className:"bg-slate-50 rounded-lg p-4 mb-6",children:(0,ea.jsxs)("div",{className:"flex items-center justify-center gap-2 text-slate-700",children:[(0,ea.jsx)(Kg,{size:20}),(0,ea.jsxs)("span",{className:"text-lg",children:["You'll be logged out in"," ",(0,ea.jsx)("span",{className:"font-bold text-amber-600",children:i})," ","seconds"]})]})}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsx)("button",{onClick:p,className:"flex-1 px-4 py-3 bg-indigo-600 text-white rounded-lg font-medium hover:bg-indigo-700 transition-colors","data-testid":"stay-logged-in-btn",children:"Stay Logged In"}),(0,ea.jsx)("button",{onClick:x,className:"px-4 py-3 border border-slate-300 text-slate-700 rounded-lg font-medium hover:bg-slate-50 transition-colors","data-testid":"logout-now-btn",children:"Logout Now"})]})]})})]})};class zN extends t.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t}),console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"max-w-md w-full bg-white rounded-lg shadow-lg p-8 text-center",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)("svg",{className:"w-8 h-8 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,ea.jsx)("h2",{className:"text-xl font-semibold text-slate-800 mb-2",children:"Something went wrong"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"We encountered an unexpected error. Please try refreshing the page."}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)("button",{onClick:()=>window.location.reload(),className:"w-full px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors",children:"Refresh Page"}),(0,ea.jsx)("button",{onClick:()=>window.history.back(),className:"w-full px-4 py-2 border border-slate-300 text-slate-700 rounded-lg hover:bg-slate-50 transition-colors",children:"Go Back"})]}),!1]})}):this.props.children}}const MN=zN,PN=["className","type"],BN=t.forwardRef((e,t)=>{let{className:s,type:a}=e,n=l(e,PN);return(0,ea.jsx)("input",d({type:a,className:Np("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:t},n))});BN.displayName="Input";const RN=Vl("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),LN=Vl("eye-off",[["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"}]]),IN=Vl("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"}]]),ON=[{tier_key:"free",name:"Freemium",description:"Try it out, free forever",price_monthly:0,features:[{text:"1 website"},{text:"250 MB storage"},{text:"Community support"}]},{tier_key:"basic",name:"Starter",description:"For small sites",price_monthly:29,features:[{text:"20 pages"},{text:"5 GB storage"},{text:"Email support"}]},{tier_key:"pro",name:"Pro",description:"For growing teams",price_monthly:99,is_popular:!0,features:[{text:"100 pages"},{text:"50 GB storage"},{text:"Custom domain + API"},{text:"Priority support"}]},{tier_key:"enterprise",name:"Enterprise",description:"For large organizations",contact_sales:!0,features:[{text:"Unlimited everything"},{text:"SSO / SAML"},{text:"Dedicated support"}]}],UN=()=>{const{branding:e,loading:s,refreshBranding:a}=Bl(),n=ge(),l=new URLSearchParams(n.search),r="/signup"===n.pathname||"1"===l.get("signup"),i=l.get("plan")||null,[o,c]=(0,t.useState)(!r),[u,m]=(0,t.useState)(i),[h,x]=(0,t.useState)(!!i),[p,g]=(0,t.useState)(ON),[f,v]=(0,t.useState)({email:"",password:"",full_name:"",tenant_name:""}),[b,j]=(0,t.useState)(!1),[y,N]=(0,t.useState)(!1),{login:w,register:C,verify2FA:k}=Al(),D=be();(0,t.useEffect)(()=>{(async()=>{try{var e;const t=await _l.get("/public/landing-page"),s=null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.pricing_tiers;Array.isArray(s)&&s.length&&g(s)}catch(G2){}})()},[]);const _={free:"Freemium",freemium:"Freemium",basic:"Starter",starter:"Starter",pro:"Pro",enterprise:"Enterprise"},S=(null===e||void 0===e?void 0:e.support_email)||"[email protected]",E=e=>{const t=(e.tier_key||e.tier_id||"").toString().toLowerCase().trim();if(["free","freemium"].includes(t))return"free";if(["basic","starter"].includes(t))return"basic";if("pro"===t)return"pro";if("enterprise"===t)return"enterprise";const s=(e.name||"").toLowerCase();return s.includes("free")?"free":s.includes("starter")||s.includes("basic")?"basic":s.includes("pro")?"pro":s.includes("enterprise")||e.contact_sales?"enterprise":e.price_monthly?"pro":"free"},A=e=>!!e.contact_sales||"enterprise"===E(e),F=_[(u||"").toLowerCase()]||"your plan",T="free"===u||"freemium"===u,[z,M]=(0,t.useState)(!1),[P,B]=(0,t.useState)(""),[R,L]=(0,t.useState)(""),I=e.primary_color||"#4F46E5",O=e.secondary_color||"#7C3AED";return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center p-4",style:{background:"linear-gradient(135deg, ".concat(I,"15 0%, ").concat(O,"10 100%)")},children:(0,ea.jsxs)("div",{className:"w-full max-w-md",children:[(0,ea.jsxs)("div",{className:"text-center mb-8",children:[e.logo_url?(0,ea.jsx)("img",{src:e.logo_url,alt:e.company_name,className:"h-12 mx-auto mb-4 object-contain"}):(0,ea.jsx)("h1",{className:"text-4xl font-bold mb-2",style:{fontFamily:"Manrope, sans-serif",color:I},children:e.company_name}),(0,ea.jsx)("p",{className:"text-slate-600",children:e.is_reseller?"Content Management Platform":"Multi-tenant CMS Platform"})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl shadow-lg p-8","data-testid":"login-form",children:[z?(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"text-center mb-6",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(RN,{className:"text-indigo-600",size:32})}),(0,ea.jsx)("h2",{className:"text-xl font-semibold",children:"Two-Factor Authentication"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,ea.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),!R||R.length<6)qs.error("Please enter a valid 6-digit code");else{j(!0);try{var t;const e=await k(P,R);e.warning&&qs.warning(e.warning),qs.success("Welcome back!"),a(),null!==(t=e.user)&&void 0!==t&&t.reseller_id?D("/reseller/dashboard"):D("/dashboard")}catch(l){var s,n;qs.error((null===(s=l.response)||void 0===s||null===(n=s.data)||void 0===n?void 0:n.detail)||"Invalid 2FA code")}finally{j(!1)}}},className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"twoFactorCode",children:"Authentication Code"}),(0,ea.jsx)(BN,{id:"twoFactorCode",type:"text",maxLength:8,placeholder:"000000",value:R,onChange:e=>L(e.target.value.replace(/[^0-9A-Za-z-]/g,"")),className:"text-center text-2xl tracking-widest",autoFocus:!0}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"You can also use a backup code"})]}),(0,ea.jsx)(sg,{type:"submit",className:"w-full",style:{backgroundColor:I}
2,disabled:b,children:b?"Verifying...":"Verify"}),(0,ea.jsx)("button",{type:"button",onClick:()=>{M(!1),B(""),L("")},className:"w-full text-sm text-slate-500 hover:text-slate-700",children:"\u2190 Back to login"})]})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex gap-4 mb-6",children:[(0,ea.jsx)("button",{onClick:()=>c(!0),"data-testid":"login-tab",className:"flex-1 py-2 font-semibold rounded-lg transition-all",style:{backgroundColor:o?I:"#f1f5f9",color:o?"white":"#64748b"},children:"Login"}),(0,ea.jsx)("button",{onClick:()=>c(!1),"data-testid":"register-tab",className:"flex-1 py-2 font-semibold rounded-lg transition-all",style:{backgroundColor:o?"#f1f5f9":I,color:o?"#64748b":"white"},children:"Sign Up"})]}),o||h?(0,ea.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),j(!0);try{if(o){const e=await w(f.email,f.password);if(e.requires_2fa)return M(!0),B(e.temp_token),qs.info("Please enter your 2FA code"),void j(!1);qs.success("Welcome back!"),a(),e.reseller_id?D("/reseller/dashboard"):D("/dashboard")}else await C(f.email,f.password,f.full_name,f.tenant_name,u),qs.success("Account created successfully!"),D("/dashboard")}catch(n){var t,s;qs.error((null===(t=n.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Authentication failed")}finally{j(!1)}},className:"space-y-4",children:[!o&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-indigo-50 border border-indigo-100","data-testid":"selected-plan-banner",children:[(0,ea.jsxs)("div",{className:"text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Signing up for "}),(0,ea.jsx)("span",{className:"font-semibold text-indigo-700",children:F}),!T&&(0,ea.jsx)("span",{className:"text-slate-500",children:" \xb7 14-day free trial"})]}),(0,ea.jsxs)("button",{type:"button",onClick:()=>{m(null),x(!1)},className:"text-xs flex items-center gap-1 text-indigo-600 hover:underline","data-testid":"change-plan-btn",children:[(0,ea.jsx)(_j,{size:12})," Change"]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"full_name",children:"Full Name"}),(0,ea.jsx)(BN,{id:"full_name",type:"text",value:f.full_name,onChange:e=>v(d(d({},f),{},{full_name:e.target.value})),required:!o,"data-testid":"full-name-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"tenant_name",children:"Company/Organization Name"}),(0,ea.jsx)(BN,{id:"tenant_name",type:"text",value:f.tenant_name,onChange:e=>v(d(d({},f),{},{tenant_name:e.target.value})),required:!o,"data-testid":"tenant-name-input"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"email",children:"Email"}),(0,ea.jsx)(BN,{id:"email",type:"email",value:f.email,onChange:e=>v(d(d({},f),{},{email:e.target.value})),required:!0,"data-testid":"email-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"password",children:"Password"}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(BN,{id:"password",type:y?"text":"password",value:f.password,onChange:e=>v(d(d({},f),{},{password:e.target.value})),required:!0,className:"pr-10","data-testid":"password-input"}),(0,ea.jsx)("button",{type:"button",onClick:()=>N(e=>!e),"aria-label":y?"Hide password":"Show password","aria-pressed":y,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-slate-400 hover:text-slate-700 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-indigo-500","data-testid":"toggle-password-visibility",children:y?(0,ea.jsx)(LN,{size:16}):(0,ea.jsx)(IN,{size:16})})]})]}),o&&(0,ea.jsx)("div",{className:"text-right",children:(0,ea.jsx)("a",{href:"/forgot-password",className:"text-sm hover:underline",style:{color:I},"data-testid":"forgot-password-link",children:"Forgot password?"})}),(0,ea.jsx)(sg,{type:"submit",className:"w-full",style:{backgroundColor:I},disabled:b,"data-testid":"submit-button",children:b?"Please wait...":o?"Login":"Create Account"})]}):(0,ea.jsxs)("div",{className:"space-y-3","data-testid":"plan-selector",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-600",children:["Choose a plan to get started. Paid plans include a ",(0,ea.jsx)("span",{className:"font-semibold",children:"14-day free trial"})," \u2014 no charge today, cancel anytime."]}),p.map((e,t)=>
2{const s=E(e),a=A(e),n="free"!==s&&!a,l=a?"Custom":"free"!==s&&e.price_monthly?"$".concat(e.price_monthly):"Free";return(0,ea.jsxs)("button",{type:"button",onClick:()=>(e=>{A(e)?window.location.href="mailto:".concat(S,"?subject=").concat(encodeURIComponent("Enterprise plan enquiry")):(m(E(e)),x(!0))})(e),"data-testid":"plan-option-".concat(s),className:"w-full text-left p-4 rounded-xl border-2 transition-all hover:shadow-md ".concat(e.is_popular?"border-indigo-400 bg-indigo-50/40":"border-slate-200 hover:border-indigo-300"),children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"font-semibold text-slate-900",children:e.name||_[s]}),e.is_popular&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold px-2 py-0.5 rounded-full text-white",style:{backgroundColor:I},children:[(0,ea.jsx)($g,{size:11})," Recommended"]})]}),e.description&&(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:e.description}),(0,ea.jsx)("ul",{className:"mt-2 space-y-1",children:(e.features||[]).slice(0,4).map((e,t)=>(0,ea.jsxs)("li",{className:"flex items-center gap-1.5 text-xs text-slate-600",children:[(0,ea.jsx)(Xl,{size:13,className:"text-emerald-500 flex-shrink-0"})," ",e.text||e]},t))})]}),(0,ea.jsxs)("div",{className:"text-right flex-shrink-0",children:[(0,ea.jsx)("div",{className:"text-lg font-bold text-slate-900",children:l}),n&&(0,ea.jsx)("div",{className:"text-[11px] text-slate-400",children:"/mo after trial"})]})]}),(0,ea.jsx)("div",{className:"mt-3 text-sm font-medium",style:{color:I},children:a?"Contact sales \u2192":"free"===s?"Start free \u2192":"Start ".concat(e.name||_[s]," trial \u2192")})]},e.tier_key||e.tier_id||"".concat(s,"-").concat(t))}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 text-center",children:"You can upgrade or downgrade anytime from your dashboard."})]})]}),e.is_reseller&&e.support_email&&(0,ea.jsx)("div",{className:"mt-6 pt-4 border-t text-center",children:(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Need help? Contact ",(0,ea.jsx)("a",{href:"mailto:".concat(e.support_email),className:"text-indigo-600 hover:underline",children:e.support_email})]})})]}),e.is_reseller&&(0,ea.jsx)("div",{className:"text-center mt-4",children:(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:["Powered by ",(0,ea.jsx)("span",{className:"font-medium",children:"Nexus CMS"})]})})]})})},HN=()=>{const[e,s]=(0,t.useState)(""),[a,n]=(0,t.useState)(!1),[l,r]=(0,t.useState)(!1),[i,o]=(0,t.useState)("");return(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50 flex items-center justify-center p-4",children:(0,ea.jsx)("div",{className:"w-full max-w-md",children:(0,ea.jsx)("div",{className:"bg-white rounded-2xl shadow-xl p-8",children:l?(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(cr,{className:"text-green-600",size:32})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Check Your Email"}),(0,ea.jsxs)("p",{className:"text-slate-600 mb-6",children:["If an account exists for ",(0,ea.jsx)("strong",{children:e}),", you'll receive a password reset link shortly."]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-6",children:"Don't see it? Check your spam folder."}),(0,ea.jsx)(Nt,{to:"/login",children:(0,ea.jsx)(sg,{className:"w-full bg-indigo-600 hover:bg-indigo-700",children:"Return to Login"})})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"text-center mb-6",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(Yl,{className:"text-indigo-600",size:32})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Forgot Password?"}),(0,ea.jsx)("p",{className:"text-slate-600",children:"No worries! Enter your email and we'll send you a reset link."})]}),(0,ea.jsxs)("form",{onSubmit:async t=>{t.preventDefault(),n(!0),o("");try{await _l.post("/auth/forgot-password",{email:e}),r(!0)}catch(K2){o("Something went wrong. Please try again.")}finally{n(!1)}},className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"email",children:"Email Address"}
2),(0,ea.jsx)(BN,{id:"email",type:"email",value:e,onChange:e=>s(e.target.value),placeholder:"[email protected]",required:!0,"data-testid":"forgot-email-input"})]}),i&&(0,ea.jsx)("p",{className:"text-sm text-red-600",children:i}),(0,ea.jsx)(sg,{type:"submit",className:"w-full bg-indigo-600 hover:bg-indigo-700",disabled:a,"data-testid":"forgot-submit-btn",children:a?"Sending...":"Send Reset Link"})]}),(0,ea.jsx)("div",{className:"mt-6 text-center",children:(0,ea.jsxs)(Nt,{to:"/login",className:"text-sm text-indigo-600 hover:underline inline-flex items-center gap-1","data-testid":"back-to-login",children:[(0,ea.jsx)(_j,{size:14}),"Back to Login"]})})]})})})})},WN=Vl("circle-alert",[["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"}]]),VN=()=>{const[e]=_t(),s=be(),a=e.get("token"),[n,l]=(0,t.useState)(""),[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)(!1),[d,u]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[x,p]=(0,t.useState)(!0),[g,f]=(0,t.useState)(!1),[v,b]=(0,t.useState)(""),[j,y]=(0,t.useState)(!1),[N,w]=(0,t.useState)("");(0,t.useEffect)(()=>{(async()=>{if(!a)return p(!1),void f(!1);try{const e=await _l.get("/auth/verify-reset-token?token=".concat(a));f(e.data.valid),b(e.data.email||"")}catch(K2){f(!1)}finally{p(!1)}})()},[a]);return x?(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50 flex items-center justify-center p-4",children:(0,ea.jsx)("div",{className:"w-full max-w-md",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-8 text-center",children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto mb-4"}),(0,ea.jsx)("p",{className:"text-slate-600",children:"Verifying reset link..."})]})})}):g?j?(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50 flex items-center justify-center p-4",children:(0,ea.jsx)("div",{className:"w-full max-w-md",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-8 text-center",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(cr,{className:"text-green-600",size:32})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Password Reset!"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"Your password has been successfully reset. You can now log in with your new password."}),(0,ea.jsx)(sg,{className:"w-full bg-indigo-600 hover:bg-indigo-700",onClick:()=>s("/login"),children:"Go to Login"})]})})}):(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50 flex items-center justify-center p-4",children:(0,ea.jsx)("div",{className:"w-full max-w-md",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-8",children:[(0,ea.jsxs)("div",{className:"text-center mb-6",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(Lj,{className:"text-indigo-600",size:32})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Reset Your Password"}),v&&(0,ea.jsxs)("p",{className:"text-slate-600",children:["Enter a new password for ",(0,ea.jsx)("strong",{children:v})]})]}),(0,ea.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),w(""),n.length<6)w("Password must be at least 6 characters");else if(n===r){h(!0);try{await _l.post("/auth/reset-password",{token:a,new_password:n}),y(!0)}catch(K2){var t,s;w((null===(t=K2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to reset password. The link may have expired.")}finally{h(!1)}}else w("Passwords do not match")},className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"password",children:"New Password"}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(BN,{id:"password",type:o?"text":"password",value:n,onChange:e=>l(e.target.value),placeholder:"At least 6 characters",required:!0,className:"pr-10","data-testid":"new-password-input"}),(0,ea.jsx)("button",{type:"button",onClick:()=>c(e=>!e),"aria-label":o?"Hide password":"Show password","aria-pressed":o,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-slate-400 hover:text-slate-700 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-indigo-500","data-testid":"toggle-new-password-visibility",children:o?(0,ea.jsx)(LN,{size:16}):(0,ea.jsx)(IN,{size:16})})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"confirmPassword",children:"Confirm New Password"}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(BN,{id:"confirmPassword",type:d?"text":"password",value:r,onChange:e=>i(e.target.value),placeholder:"Re-enter your password",required:!0,className:"pr-10","data-testid":"confirm-password-input"}),(0,ea.jsx)("button",{type:"button",onClick:()=>u(e=>!e),"aria-label":d?"Hide password":"Show password","aria-pressed":d,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-slate-400 hover:text-slate-700 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-indigo-500","data-testid":"toggle-confirm-password-visibility",children:d?(0,ea.jsx)(LN,{size:16}):(0,ea.jsx)(IN,{size:16})})]})]}),N&&(0,ea.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:(0,ea.jsx)("p",{className:"text-sm text-red-600",children:N})}),(0,ea.jsx)(sg,{type:"submit",className:"w-full bg-indigo-600 hover:bg-indigo-700",disabled:m,"data-testid":"reset-password-btn",children:m?"Resetting...":"Reset Password"})]}),(0,ea.jsx)("div",{className:"mt-6 text-center",children:(0,ea.jsxs)(Nt,{to:"/login",className:"text-sm text-indigo-600 hover:underline inline-flex items-center gap-1",children:[(0,ea.jsx)(_j,{size:14}),"Back to Login"]})})]})})}):(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50 flex items-center justify-center p-4",children:(0,ea.jsx)("div",{className:"w-full max-w-md",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-8 text-center",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(WN,{className:"text-red-600",size:32})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Invalid or Expired Link"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"This password reset link is invali
2d or has expired. Please request a new one."}),(0,ea.jsx)(Nt,{to:"/forgot-password",children:(0,ea.jsx)(sg,{className:"w-full bg-indigo-600 hover:bg-indigo-700",children:"Request New Link"})}),(0,ea.jsx)("div",{className:"mt-4",children:(0,ea.jsxs)(Nt,{to:"/login",className:"text-sm text-indigo-600 hover:underline inline-flex items-center gap-1",children:[(0,ea.jsx)(_j,{size:14}),"Back to Login"]})})]})})})},qN=Vl("file-text",[["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"}]]),$N=Vl("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"}]]),GN=Vl("trending-up",[["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"}]]),KN=["className"],YN=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,KN);return(0,ea.jsx)("textarea",d({className:Np("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:t},a))});YN.displayName="Textarea";const JN=["__scopeCheckbox","onKeyDown","onClick"],QN=["__scopeCheckbox","name","checked","defaultChecked","required","disabled","value","onCheckedChange","form"],XN=["__scopeCheckbox","forceMount"],ZN=["__scopeCheckbox"];var ew="Checkbox",[tw,sw]=jr(ew),[aw,nw]=tw(ew);function lw(e){const{__scopeCheckbox:s,checked:a,children:n,defaultChecked:l,disabled:r,form:i,name:o,onCheckedChange:c,required:u,value:m="on",internal_do_not_use_render:h}=e,[x,p]=Cr({prop:a,defaultProp:null!==l&&void 0!==l&&l,onChange:c,caller:ew}),[g,f]=t.useState(null),[v,b]=t.useState(null),j=t.useRef(!1),y=!g||(!!i||!!g.closest("form")),N={checked:x,disabled:r,setChecked:p,control:g,setControl:f,name:o,form:i,value:m,hasConsumerStoppedPropagationRef:j,required:u,defaultChecked:!xw(l)&&l,isFormControl:y,bubbleInput:v,setBubbleInput:b};return(0,ea.jsx)(aw,d(d({scope:s},N),{},{children:hw(h)?h(N):n}))}var rw="CheckboxTrigger",iw=t.forwardRef((e,s)=>{let{__scopeCheckbox:a,onKeyDown:n,onClick:r}=e,i=l(e,JN);const{control:o,value:c,disabled:u,checked:m,required:h,setControl:x,setChecked:p,hasConsumerStoppedPropagationRef:g,isFormControl:f,bubbleInput:v}=nw(rw,a),b=fr(s,x),j=t.useRef(m);return t.useEffect(()=>{const e=null===o||void 0===o?void 0:o.form;if(e){const t=()=>p(j.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[o,p]),(0,ea.jsx)(Tr.button,d(d({type:"button",role:"checkbox","aria-checked":xw(m)?"mixed":m,"aria-required":h,"data-state":pw(m),"data-disabled":u?"":void 0,disabled:u,value:c},i),{},{ref:b,onKeyDown:xr(n,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:xr(r,e=>{p(e=>!!xw(e)||!e),v&&f&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}))});iw.displayName=rw;var ow=t.forwardRef((e,t)=>{const{__scopeCheckbox:s,name:a,checked:n,defaultChecked:r,required:i,disabled:o,value:c,onCheckedChange:u,form:m}=e,h=l(e,QN);return(0,ea.jsx)(lw,{__scopeCheckbox:s,checked:n,defaultChecked:r,disabled:o,required:i,onCheckedChange:u,name:a,form:m,value:c,internal_do_not_use_render:e=>{let{isFormControl:a}=e;return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(iw,d(d({},h),{},{ref:t,__scopeCheckbox:s})),a&&(0,ea.jsx)(mw,{__scopeCheckbox:s})]})}})});ow.displayName=ew;var cw="CheckboxIndicator",dw=t.forwardRef((e,t)=>{const{__scopeCheckbox:s,forceMount:a}=e,n=l(e,XN),r=nw(cw,s);return(0,ea.jsx)(Jc,{present:a||xw(r.checked)||!0===r.checked,children:(0,ea.jsx)(Tr.span,d(d({"data-state":pw(r.checked),"data-disabled":r.disabled?"":void 0},n),{},{ref:t,style:d({pointerEvents:"none"},e.style)}))})});dw.displayName=cw;var uw="CheckboxBubbleInput",mw=t.forwardRef((e,s)=>{let{__scopeCheckbox:a}=e,n=l(e,ZN);const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:c,required:u,disabled:m,name:h,value:x,form:p,bubbleInput:g,setBubbleInput:f}=nw(uw,a),v=fr(s,f),b=df(o),j=Nc(r);t.useEffect(()=>{const e=g;if(!e)return;const t=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(t,"checked").set,a=!i.
2current;if(b!==o&&s){const t=new Event("click",{bubbles:a});e.indeterminate=xw(o),s.call(e,!xw(o)&&o),e.dispatchEvent(t)}},[g,b,o,i]);const y=t.useRef(!xw(o)&&o);return(0,ea.jsx)(Tr.input,d(d({type:"checkbox","aria-hidden":!0,defaultChecked:null!==c&&void 0!==c?c:y.current,required:u,disabled:m,name:h,value:x,form:p},n),{},{tabIndex:-1,ref:v,style:d(d(d({},n.style),j),{},{position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"})}))});function hw(e){return"function"===typeof e}function xw(e){return"indeterminate"===e}function pw(e){return xw(e)?"indeterminate":e?"checked":"unchecked"}mw.displayName=uw;const gw=["className"],fw=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,gw);return(0,ea.jsx)(ow,d(d({ref:t,className:Np("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s)},a),{},{children:(0,ea.jsx)(dw,{className:Np("flex items-center justify-center text-current"),children:(0,ea.jsx)(Xl,{className:"h-4 w-4"})})}))});fw.displayName=ow.displayName;const vw=Vl("layout-dashboard",[["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"}]]),bw=Vl("dollar-sign",[["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"}]]),jw=Vl("newspaper",[["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M18 14h-8",key:"sponae"}],["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-4 0v-9a2 2 0 0 1 2-2h2",key:"39pd36"}],["rect",{width:"8",height:"4",x:"10",y:"6",rx:"1",key:"aywv1n"}]]),yw=Vl("clipboard-list",[["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"}]]),Nw=Vl("calendar-days",[["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"}]]),ww=Vl("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"}]]),Cw=Vl("chart-column",[["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"}]]),kw=Vl("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"}]]),Dw=Vl("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["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:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]),_w=Vl("layout-template",[["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"}]]),Sw=Vl("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"}
2],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]),Ew=Vl("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"}]]),Aw=Vl("circle-help",[["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"}]]),Fw=Vl("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"}]]),Tw=Vl("user-x",[["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"}]]),zw=Vl("log-out",[["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"}]]),Mw=Vl("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"}]]),Pw=Vl("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"}]]),Bw=Vl("building-2",[["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"}]]),Rw=Vl("user-cog",[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Lw=Vl("scroll-text",[["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"}]]);var Iw=Symbol("radix.slottable");function Ow(e){const t=e=>{let{children:t}=e;return(0,ea.jsx)(ea.Fragment,{children:t})};return t.displayName="".concat(e,".Slottable"),t.__radixId=Iw,t}const Uw=["__scopeTooltip"],Hw=["forceMount","side"],Ww=["__scopeTooltip","children","aria-label","onEscapeKeyDown","onPointerDownOutside"],Vw=["__scopeTooltip"];var[qw,$w]=jr("Tooltip",[Sc]),Gw=Sc(),Kw="TooltipProvider",Yw=700,Jw="tooltip.open",[Qw,Xw]=qw(Kw),Zw=e=>{const{__scopeTooltip:s,delayDuration:a=Yw,skipDelayDuration:n=300,disableHoverableContent:l=!1,children:r}=e,i=t.useRef(!0),o=t.useRef(!1),c=t.useRef(0);return t.useEffect(()=>{const e=c.current;return()=>window.clearTimeout(e)},[]),(0,ea.jsx)(Qw,{scope:s,isOpenDelayedRef:i,delayDuration:a,onOpen:t.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:t.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:o,onPointerInTransitChange:t.useCallback(e=>{o.current=e},[]),disableHoverableContent:l,children:r})};Zw.displayName=Kw;var eC="Tooltip",[tC,sC]=qw(eC),aC=e=>{const{__scopeTooltip:s,children:a,open:n,defaultOpen:l,onOpenChange:r,disableHoverableContent:i,delayDuration:o}=e,c=Xw(eC,e.__scopeTooltip),u=Gw(s),[m,h]=t.useState(null),x=ki(),p=t.useRef(0),g=null!==i&&void 0!==i?i:c.disableHoverableContent,f=null!==o&&void 0!==o?o:c.delayDuration,v=t.useRef(!1),[b,j]=Cr({prop:n,defaultProp:null!==l&&void 0!==l&&l,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Jw))):c.onClose(),null===r||void 0===r||r(e)},caller:eC}),y=t.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),N=t.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,j(!0)},[j]),w=t.useCallback(()=>{window.clearTimeout(p.current),p.current=0,j(!1)},[j]),C=t.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,j(!0),p.current=0},f)},[f,j]);return t.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,ea.jsx)(Vc,d(d({},u),{},{children:(0,ea.jsx)(tC,{scope:s,contentId:x,open:b,stateAttribute:y,trigger:m,onTriggerChange:h,onTriggerEnter:t.useCallback(()=>{c.isOpenDelayedRef.current?C():N()},[c.isOpenDelayedRef,C,N]),onTriggerLeave:t.useCallback(()=>{g?w():(window.clearTimeout(p.current),p.current=0)},[w,g]),onOpen:N,onClose:w,disableHoverableContent:g,children:a})}))};aC.displayName=eC;var nC="TooltipTrigger",lC=t.forwardRef((e,s)=>{const{__scopeTooltip:a}=e,n=l(e,Uw),r=sC(nC,a),i=Xw(nC,a),o=Gw(a),c=fr(s,t.useRef(null),r.onTriggerChange),u=t.useRef(!1),m=t.useRef(!1),h=t.useCallback(()=>u.current=!1,[]);return t.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),(0,ea.jsx)(qc,d(d({asChild:!0},o),{},{children:(0,ea.jsx)(Tr.button,d(d({"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute},n),{},{ref:c,onPointerMove:xr(e.onPointerMove,e=>{"touch"!==e.pointerType&&(m.current||i.isPointerInTransitRef.current||(r.onTriggerEnter(),m.current=!0))}),onPointerLeave:xr(e.onPointerLeave,()=>{r.onTriggerLeave(),m.current=!1}),onPointerDown:xr(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:xr(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:xr(e.onBlur,r.onClose),onClick:xr(e.onClick,r.onClose)}))}))});lC.displayName=nC;var rC="TooltipPortal",[iC,oC]=qw(rC,{forceMount:void 0}),cC=e=>{const{__scopeTooltip:t,forceMount:s,children:a,container:n}=e,l=sC(rC,t);return(0,ea.jsx)(iC,{scope:t,forceMount:s,children:(0,ea.jsx)(Jc,{present:s||l.open,children:(0,ea.jsx)(Yc,{asChild:!0,container:n,children:a})})})};cC.displayName=rC;var dC="TooltipContent",uC=t.forwardRef((e,t)=>
2{const s=oC(dC,e.__scopeTooltip),{forceMount:a=s.forceMount,side:n="top"}=e,r=l(e,Hw),i=sC(dC,e.__scopeTooltip);return(0,ea.jsx)(Jc,{present:a||i.open,children:i.disableHoverableContent?(0,ea.jsx)(gC,d(d({side:n},r),{},{ref:t})):(0,ea.jsx)(mC,d(d({side:n},r),{},{ref:t}))})}),mC=t.forwardRef((e,s)=>{const a=sC(dC,e.__scopeTooltip),n=Xw(dC,e.__scopeTooltip),l=t.useRef(null),r=fr(s,l),[i,o]=t.useState(null),{trigger:c,onClose:u}=a,m=l.current,{onPointerInTransitChange:h}=n,x=t.useCallback(()=>{o(null),h(!1)},[h]),p=t.useCallback((e,t)=>{const s=e.currentTarget,a={x:e.clientX,y:e.clientY},n=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;const a=[];switch(t){case"top":a.push({x:e.x-s,y:e.y+s},{x:e.x+s,y:e.y+s});break;case"bottom":a.push({x:e.x-s,y:e.y-s},{x:e.x+s,y:e.y-s});break;case"left":a.push({x:e.x+s,y:e.y-s},{x:e.x+s,y:e.y+s});break;case"right":a.push({x:e.x-s,y:e.y-s},{x:e.x-s,y:e.y+s})}return a}(a,function(e,t){const s=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(s,a,n,l)){case l:return"left";case n:return"right";case s:return"top";case a:return"bottom";default:throw new Error("unreachable")}}(a,s.getBoundingClientRect())),l=function(e){const t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const s=e[a];for(;t.length>=2;){const e=t[t.length-1],a=t[t.length-2];if(!((e.x-a.x)*(s.y-a.y)>=(e.y-a.y)*(s.x-a.x)))break;t.pop()}t.push(s)}t.pop();const s=[];for(let a=e.length-1;a>=0;a--){const t=e[a];for(;s.length>=2;){const e=s[s.length-1],a=s[s.length-2];if(!((e.x-a.x)*(t.y-a.y)>=(e.y-a.y)*(t.x-a.x)))break;s.pop()}s.push(t)}return s.pop(),1===t.length&&1===s.length&&t[0].x===s[0].x&&t[0].y===s[0].y?t:t.concat(s)}(t)}([...n,...function(e){const{top:t,right:s,bottom:a,left:n}=e;return[{x:n,y:t},{x:s,y:t},{x:s,y:a},{x:n,y:a}]}(t.getBoundingClientRect())]);o(l),h(!0)},[h]);return t.useEffect(()=>()=>x(),[x]),t.useEffect(()=>{if(c&&m){const e=e=>p(e,m),t=e=>p(e,c);return c.addEventListener("pointerleave",e),m.addEventListener("pointerleave",t),()=>{c.removeEventListener("pointerleave",e),m.removeEventListener("pointerleave",t)}}},[c,m,p,x]),t.useEffect(()=>{if(i){const e=e=>{const t=e.target,s={x:e.clientX,y:e.clientY},a=(null===c||void 0===c?void 0:c.contains(t))||(null===m||void 0===m?void 0:m.contains(t)),n=!function(e,t){const{x:s,y:a}=e;let n=!1;for(let l=0,r=t.length-1;l<t.length;r=l++){const e=t[l],i=t[r],o=e.x,c=e.y,d=i.x,u=i.y;c>a!==u>a&&s<(d-o)*(a-c)/(u-c)+o&&(n=!n)}return n}(s,i);a?x():n&&(x(),u())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,m,i,u,x]),(0,ea.jsx)(gC,d(d({},e),{},{ref:r}))}),[hC,xC]=qw(eC,{isInside:!1}),pC=Ow("TooltipContent"),gC=t.forwardRef((e,s)=>{const{__scopeTooltip:a,children:n,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:o}=e,c=l(e,Ww),u=sC(dC,a),m=Gw(a),{onClose:h}=u;return t.useEffect(()=>(document.addEventListener(Jw,h),()=>document.removeEventListener(Jw,h)),[h]),t.useEffect(()=>{if(u.trigger){const e=e=>{const t=e.target;null!==t&&void 0!==t&&t.contains(u.trigger)&&h()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[u.trigger,h]),(0,ea.jsx)(li,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:h,children:(0,ea.jsxs)($c,d(d(d({"data-state":u.stateAttribute},m),c),{},{ref:s,style:d(d({},c.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:[(0,ea.jsx)(pC,{children:n}),(0,ea.jsx)(hC,{scope:a,isInside:!0,children:(0,ea.jsx)(hf,{id:u.contentId,role:"tooltip",children:r||n})})]}))})});uC.displayName=dC;var fC="TooltipArrow",vC=t.forwardRef((e,t)=>
2{const{__scopeTooltip:s}=e,a=l(e,Vw),n=Gw(s);return xC(fC,s).isInside?null:(0,ea.jsx)(Gc,d(d(d({},n),a),{},{ref:t}))});vC.displayName=fC;var bC=cC,jC=uC;const yC=["className","sideOffset"],NC=Zw,wC=aC,CC=lC,kC=t.forwardRef((e,t)=>{let{className:s,sideOffset:a=4}=e,n=l(e,yC);return(0,ea.jsx)(bC,{children:(0,ea.jsx)(jC,d({ref:t,sideOffset:a,className:Np("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground 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 origin-[--radix-tooltip-content-transform-origin]",s)},n))})});kC.displayName=jC.displayName;const DC=e=>{let{children:t,content:s,side:a="top",delayDuration:n=200,className:l=""}=e;return s?(0,ea.jsx)(NC,{delayDuration:n,children:(0,ea.jsxs)(wC,{children:[(0,ea.jsx)(CC,{asChild:!0,children:t}),(0,ea.jsx)(kC,{side:a,className:l,children:(0,ea.jsx)("p",{children:s})})]})}):t},_C=["className","variant"],SC=Zp("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function EC(e){let{className:t,variant:s}=e,a=l(e,_C);return(0,ea.jsx)("div",d({className:Np(SC({variant:s}),t)},a))}const AC=()=>{const{user:e,login:s}=Al(),[a,n]=(0,t.useState)([]),[l,r]=(0,t.useState)(null),[i,o]=(0,t.useState)(!1),[c,d]=(0,t.useState)([]);(0,t.useEffect)(()=>{u(),m()},[]);const u=async()=>{try{const e=await _l.get("/tenant-memberships");n(e.data.tenants||[]),r(e.data.current_tenant_id)}catch(e){console.error("Failed to fetch tenants:",e)}},m=async()=>{try{const e=await _l.get("/tenant-memberships/invitations");d(e.data.invitations||[])}catch(e){console.error("Failed to fetch invitations:",e)}},h=a.find(e=>e.tenant_id===l),x=a.filter(e=>e.tenant_id!==l);return a.length<=1&&0===c.length?null:(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsxs)(sg,{variant:"ghost",className:"flex items-center gap-2 px-3 py-2 h-auto",disabled:i,"data-testid":"tenant-switcher",children:[(0,ea.jsx)(Bw,{size:16,className:"text-slate-500"}),(0,ea.jsxs)("div",{className:"flex flex-col items-start",children:[(0,ea.jsx)("span",{className:"text-sm font-medium truncate max-w-[150px]",children:(null===h||void 0===h?void 0:h.tenant_name)||"My Organization"}),h&&!h.is_primary&&(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"Guest Access"})]}),(0,ea.jsx)(tr,{size:14,className:"text-slate-400"}),c.length>0&&(0,ea.jsx)(EC,{variant:"destructive",className:"h-5 w-5 p-0 flex items-center justify-center text-xs",children:c.length})]})}),(0,ea.jsxs)(Bp,{align:"start",className:"w-72",children:[(0,ea.jsx)(Lp,{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Organizations"}),h&&(0,ea.jsxs)(Rp,{className:"flex items-center justify-between py-3 cursor-default bg-slate-50","data-testid":"current-tenant",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Bw,{size:16,className:"text-indigo-600"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:h.tenant_name}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 capitalize",children:h.role})]})]}),(0,ea.jsx)(Xl,{size:16,className:"text-indigo-600"})]}),x.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Ip,{}),x.map(e=>(0,ea.jsx)(Rp,{onClick:()=>(async e=>{if(e!==l){o(!0);try{const t=await _l.post("/tenant-memberships/switch/".concat(e)),{access_token:a,tenant_name:n,role:l}=t.data;localStorage.setItem("token",a);const i=await _l.get("/auth/me");s(a,i.data),qs.success("Switched to ".concat(n)),r(e),window.location.reload()}catch(n){var t,a;qs.error((null===(t=n.response)||void 0===t||null===(a=t.data)||void 0===a?void 0:a.detail)||"Failed to switch organization")}finally{o(!1)}}})(e.tenant_id),className:"flex items-center justify-between py-3 cursor-pointer","data-testid":"tenant-".concat(e.tenant_id),children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Bw,{size:16,className:"text-slate-400"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:e.tenant_name}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500 capitalize",children:[e.role,!e.is_primary&&" \u2022 Guest"]})]})]})},e.tenant_id))]}),c.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Ip,{}),(0,ea.jsx)(Lp,{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Pending Invitations"}),c.map(e=>(0,ea.jsxs)("div",{className:"px-2 py-3 border-b last:border-0",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(Bj,{size:14,className:"text-amber-500"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-sm",children:e.tenant_name}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Invited by ",e.invited_by_name," \u2022 ",e.role]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{size:"sm",variant:"outline",className:"flex-1 h-7 text-xs",onClick:()=>(async e=>{try{await _l.post("/tenant-memberships/invitations/".concat(e,"/decline")),qs.success("Invitation declined"),m()}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to decline invitation")}})(e.membership_id),children:"Decline"}),(0,ea.jsx)(sg,{size:"sm",className:"flex-1 h-7 text-xs",onClick:()=>(async e=>{try{const t=await _l.post("/tenant-memberships/invitations/".concat(e,"/accept"));qs.success(t.data.message),u(),m()}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to accept invitation")}})(e.membership_id),children:"Accept"})]})]},e.membership_id))]})]})]})},FC=Vl("infinity",[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]),TC=Vl("calendar-clock",[["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"}
2],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]),zC=["children"],MC=["children"];function PC(e){const s=BC(e),a=t.forwardRef((e,a)=>{const{children:n}=e,r=l(e,zC),i=t.Children.toArray(n),o=i.find(LC);if(o){const e=o.props.children,n=i.map(s=>s===o?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:s);return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null}))}return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:n}))});return a.displayName="".concat(e,".Slot"),a}function BC(e){const s=t.forwardRef((e,s)=>{const{children:a}=e,n=l(e,MC);if(t.isValidElement(a)){const e=function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),l=function(e,t){const s=d({},t);for(const a in t){const n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?s[a]=function(){const e=l(...arguments);return n(...arguments),e}:n&&(s[a]=n):"style"===a?s[a]=d(d({},n),l):"className"===a&&(s[a]=[n,l].filter(Boolean).join(" "))}return d(d({},e),s)}(n,a.props);return a.type!==t.Fragment&&(l.ref=s?gr(s,e):e),t.cloneElement(a,l)}return t.Children.count(a)>1?t.Children.only(null):null});return s.displayName="".concat(e,".SlotClone"),s}var RC=Symbol("radix.slottable");function LC(e){return t.isValidElement(e)&&"function"===typeof e.type&&"__radixId"in e.type&&e.type.__radixId===RC}const IC=["__scopeDialog"],OC=["forceMount"],UC=["__scopeDialog"],HC=["forceMount"],WC=["__scopeDialog","trapFocus","onOpenAutoFocus","onCloseAutoFocus"],VC=["__scopeDialog"],qC=["__scopeDialog"],$C=["__scopeDialog"];var GC="Dialog",[KC,YC]=jr(GC),[JC,QC]=KC(GC),XC=e=>{const{__scopeDialog:s,children:a,open:n,defaultOpen:l,onOpenChange:r,modal:i=!0}=e,o=t.useRef(null),c=t.useRef(null),[d,u]=Cr({prop:n,defaultProp:null!==l&&void 0!==l&&l,onChange:r,caller:GC});return(0,ea.jsx)(JC,{scope:s,triggerRef:o,contentRef:c,contentId:ki(),titleId:ki(),descriptionId:ki(),open:d,onOpenChange:u,onOpenToggle:t.useCallback(()=>u(e=>!e),[u]),modal:i,children:a})};XC.displayName=GC;var ZC="DialogTrigger",ek=t.forwardRef((e,t)=>{const{__scopeDialog:s}=e,a=l(e,IC),n=QC(ZC,s),r=fr(t,n.triggerRef);return(0,ea.jsx)(Tr.button,d(d({type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":jk(n.open)},a),{},{ref:r,onClick:xr(e.onClick,n.onOpenToggle)}))});ek.displayName=ZC;var tk="DialogPortal",[sk,ak]=KC(tk,{forceMount:void 0}),nk=e=>{const{__scopeDialog:s,forceMount:a,children:n,container:l}=e,r=QC(tk,s);return(0,ea.jsx)(sk,{scope:s,forceMount:a,children:t.Children.map(n,e=>(0,ea.jsx)(Jc,{present:a||r.open,children:(0,ea.jsx)(Yc,{asChild:!0,container:l,children:e})}))})};nk.displayName=tk;var lk="DialogOverlay",rk=t.forwardRef((e,t)=>{const s=ak(lk,e.__scopeDialog),{forceMount:a=s.forceMount}=e,n=l(e,OC),r=QC(lk,e.__scopeDialog);return r.modal?(0,ea.jsx)(Jc,{present:a||r.open,children:(0,ea.jsx)(ok,d(d({},n),{},{ref:t}))}):null});rk.displayName=lk;var ik=PC("DialogOverlay.RemoveScroll"),ok=t.forwardRef((e,t)=>{const{__scopeDialog:s}=e,a=l(e,UC),n=QC(lk,s);return(0,ea.jsx)(Nu,{as:ik,allowPinchZoom:!0,shards:[n.contentRef],children:(0,ea.jsx)(Tr.div,d(d({"data-state":jk(n.open)},a),{},{ref:t,style:d({pointerEvents:"auto"},a.style)}))})}),ck="DialogContent",dk=t.forwardRef((e,t)=>{const s=ak(ck,e.__scopeDialog),{forceMount:a=s.forceMount}=e,n=l(e,HC),r=QC(ck,e.__scopeDialog);return(0,ea.jsx)(Jc,{present:a||r.open,children:r.modal?(0,ea.jsx)(uk,d(d({},n),{},{ref:t})):(0,ea.jsx)(mk,d(d({},n),{},{ref:t}))})});dk.displayName=ck;var uk=t.forwardRef((e,s)=>{const a=QC(ck,e.__scopeDialog),n=t.useRef(null),l=fr(s,a.contentRef,n);return t.useEffect(()=>{const e=n.current;if(e)return Fd(e)},[]),(0,ea.jsx)(hk,d(d({},e),{},{ref:l,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xr(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null===(t=a.triggerRef.current)||void 0===t||t.focus()}),onPointerDownOutside:xr(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,s=0===t.button&&!0===t.ctrlKey;(2===t.button||s)&&e.preventDefault()}),onFocusOutside:xr(e.onFocusOutside,e=>e.preventDefault())}))}),mk=t.forwardRef((e,s)=>{const a=QC(ck,e.__scopeDialog),n=t.useRef(!1),l=t.useRef(!1);return(0,ea.jsx)(hk,d(d({},e),{},{ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var s,r;(null===(s=e.onCloseAutoFocus)||void 0===s||s.call(e,t),t.defaultPrevented)||(n.current||null===(r=a.triggerRef.current)||void 0===r||r.focus(),t.preventDefault());n.current=!1,l.current=!1},onInteractOutside:t=>{var s,r;null===(s=e.onInteractOutside)||void 0===s||s.call(e,t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(l.current=!0));const i=t.target;(null===(r=a.triggerRef.current)||void 0===r?void 0:r.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&l.current&&t.preventDefault()}}))}),hk=t.forwardRef((e,s)=>{const{__scopeDialog:a,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:i}=e,o=l(e,WC),c=QC(ck,a),u=t.useRef(null),m=fr(s,u);return di(),(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(gi,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:i,children:(0,ea.jsx)(li,d(d({role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":jk(c.open)},o),{},{ref:m,onDismiss:()=>c.onOpenChange(!1)}))}),(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Ck,{titleId:c.titleId}),(0,ea.jsx)(kk,{contentRef:u,descriptionId:c.descriptionId})]})]})}),xk="DialogTitle",pk=t.forwardRef((e,t)=>
2{const{__scopeDialog:s}=e,a=l(e,VC),n=QC(xk,s);return(0,ea.jsx)(Tr.h2,d(d({id:n.titleId},a),{},{ref:t}))});pk.displayName=xk;var gk="DialogDescription",fk=t.forwardRef((e,t)=>{const{__scopeDialog:s}=e,a=l(e,qC),n=QC(gk,s);return(0,ea.jsx)(Tr.p,d(d({id:n.descriptionId},a),{},{ref:t}))});fk.displayName=gk;var vk="DialogClose",bk=t.forwardRef((e,t)=>{const{__scopeDialog:s}=e,a=l(e,$C),n=QC(vk,s);return(0,ea.jsx)(Tr.button,d(d({type:"button"},a),{},{ref:t,onClick:xr(e.onClick,()=>n.onOpenChange(!1))}))});function jk(e){return e?"open":"closed"}bk.displayName=vk;var yk="DialogTitleWarning",[Nk,wk]=function(e,s){const a=t.createContext(s),n=e=>{const{children:s}=e,n=l(e,vr),r=t.useMemo(()=>n,Object.values(n));return(0,ea.jsx)(a.Provider,{value:r,children:s})};return n.displayName=e+"Provider",[n,function(n){const l=t.useContext(a);if(l)return l;if(void 0!==s)return s;throw new Error("`".concat(n,"` must be used within `").concat(e,"`"))}]}(yk,{contentName:ck,titleName:xk,docsSlug:"dialog"}),Ck=e=>{let{titleId:s}=e;const a=wk(yk),n="`".concat(a.contentName,"` requires a `").concat(a.titleName,"` for the component to be accessible for screen reader users.\n\nIf you want to hide the `").concat(a.titleName,"`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/").concat(a.docsSlug);return t.useEffect(()=>{if(s){document.getElementById(s)||console.error(n)}},[n,s]),null},kk=e=>{let{contentRef:s,descriptionId:a}=e;const n=wk("DialogDescriptionWarning"),l="Warning: Missing `Description` or `aria-describedby={undefined}` for {".concat(n.contentName,"}.");return t.useEffect(()=>{var e;const t=null===(e=s.current)||void 0===e?void 0:e.getAttribute("aria-describedby");if(a&&t){document.getElementById(a)||console.warn(l)}},[l,s,a]),null},Dk=XC,_k=ek,Sk=nk,Ek=rk,Ak=dk,Fk=pk,Tk=fk,zk=bk;const Mk=["className"],Pk=["className","children"],Bk=["className"],Rk=["className"],Lk=["className"],Ik=["className"],Ok=Dk,Uk=Sk,Hk=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Mk);return(0,ea.jsx)(Ek,d({ref:t,className:Np("fixed inset-0 z-[60] 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",s)},a))});Hk.displayName=Ek.displayName;const Wk=t.forwardRef((e,t)=>{let{className:s,children:a}=e,n=l(e,Pk);return(0,ea.jsxs)(Uk,{children:[(0,ea.jsx)(Hk,{}),(0,ea.jsxs)(Ak,d(d({ref:t,className:Np("fixed left-[50%] top-[50%] z-[60] 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",s)},n),{},{children:[a,(0,ea.jsxs)(zk,{className:"absolute right-4 top-4 roun
2ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,ea.jsx)(sr,{className:"h-4 w-4"}),(0,ea.jsx)("span",{className:"sr-only",children:"Close"})]})]}))]})});Wk.displayName=Ak.displayName;const Vk=e=>{let{className:t}=e,s=l(e,Bk);return(0,ea.jsx)("div",d({className:Np("flex flex-col space-y-1.5 text-center sm:text-left",t)},s))};Vk.displayName="DialogHeader";const qk=e=>{let{className:t}=e,s=l(e,Rk);return(0,ea.jsx)("div",d({className:Np("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},s))};qk.displayName="DialogFooter";const $k=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Lk);return(0,ea.jsx)(Fk,d({ref:t,className:Np("text-lg font-semibold leading-none tracking-tight",s)},a))});$k.displayName=Fk.displayName;const Gk=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Ik);return(0,ea.jsx)(Tk,d({ref:t,className:Np("text-sm text-muted-foreground",s)},a))});Gk.displayName=Tk.displayName;const Kk=e=>{let{open:s,onOpenChange:a}=e;const[n,l]=(0,t.useState)(null),[r,i]=(0,t.useState)([]),[o,c]=(0,t.useState)(!0),[d,u]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!s)return;let e=!1;return(async()=>{c(!0);try{const[t,s]=await Promise.all([_l.get("/ai/credits"),_l.get("/ai/packages")]);e||(l(t.data),i(s.data.packages||[]))}catch(G2){e||qs.error("Failed to load AI Generations")}finally{e||c(!1)}})(),()=>{e=!0}},[s]);const m=null===n||void 0===n?void 0:n.unlimited,h=null!==n&&void 0!==n&&n.resets_on?new Date(n.resets_on).toLocaleDateString(void 0,{month:"short",day:"numeric"}):null,x=n&&n.monthly_limit>0?Math.min(100,Math.round(n.monthly_used/n.monthly_limit*100)):0;return(0,ea.jsx)(Ok,{open:s,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-md","data-testid":"ai-generations-panel",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)($g,{size:18,className:"text-violet-600"}),"AI Generations"]}),(0,ea.jsx)(Gk,{children:"Used by the AI Writing Assistant. 1 generation = 1 prompt or refine."})]}),o?(0,ea.jsx)("div",{className:"flex justify-center py-10",children:(0,ea.jsx)(ql,{className:"animate-spin text-violet-600"})}):(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)("div",{className:"rounded-xl border border-slate-200 bg-gradient-to-br from-violet-50 to-white p-4",children:m?(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-violet-700","data-testid":"ai-gen-unlimited",children:[(0,ea.jsx)(FC,{size:22}),(0,ea.jsx)("span",{className:"text-lg font-semibold",children:"Unlimited generations"})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:"Available now"}),(0,ea.jsx)("span",{className:"text-2xl font-bold text-slate-900","data-testid":"ai-gen-total",children:n.total_remaining})]}),(0,ea.jsxs)("div",{className:"mt-3",children:[(0,ea.jsxs)("div",{className:"flex justify-between text-xs text-slate-500 mb-1",children:[(0,ea.jsx)("span",{children:"Monthly plan allowance"}),(0,ea.jsxs)("span",{children:[n.monthly_used," / ",n.monthly_limit," used"]})]}),(0,ea.jsx)("div",{className:"h-2 w-full rounded-full bg-slate-200 overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full rounded-full bg-violet-500 transition-all",style:{width:"".concat(x,"%")}})}),h&&(0,ea.jsxs)("div",{className:"mt-1.5 flex items-center gap-1 text-[11px] text-slate-400",children:[(0,ea.jsx)(TC,{size:11})," Resets ",h]})]}),(0,ea.jsxs)("div",{className:"mt-3 flex items-center justify-between border-t border-slate-100 pt-2 text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Top-up balance (never expires)"}),(0,ea.jsx)("span",{className:"font-semibold text-slate-800","data-testid":"ai-gen-topup",children:n.topup_balance})]})]})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-400",children:"Need more? Top-up packs"}),(0,ea.jsx)("div",{className:"space-y-2",children:r.map(e=>{var t,s,a;return(0,ea.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 p-3 hover:border-violet-300 transition-colors","data-testid":"ai-gen-p
2ack-".concat(e.id),children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1.5 font-semibold text-slate-800",children:[(0,ea.jsx)(Gl,{size:14,className:"text-violet-500"}),e.credits.toLocaleString()," generations"]}),(0,ea.jsxs)("div",{className:"text-xs text-slate-400",children:["$",e.price," \xb7 $",null!==(t=null===(s=e.per_generation)||void 0===s||null===(a=s.toFixed)||void 0===a?void 0:a.call(s,3))&&void 0!==t?t:e.per_generation," each"]})]}),(0,ea.jsx)(sg,{size:"sm",onClick:()=>(async e=>{u(e);try{const{data:t}=await _l.post("/ai/purchase-credits?package=".concat(e));window.open(t.url,"_blank"),qs.success("Opening secure checkout\u2026")}catch(G2){var t,s;qs.error((null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to start checkout")}finally{u(null)}})(e.id),disabled:d===e.id,className:"bg-violet-600 hover:bg-violet-700","data-testid":"ai-gen-buy-".concat(e.id),children:d===e.id?(0,ea.jsx)(ql,{size:14,className:"animate-spin"}):"$".concat(e.price)})]},e.id)})})]})]})]})})},Yk=()=>{const{user:e}=Al(),[s,a]=(0,t.useState)(null),[n,l]=(0,t.useState)(!0),[r,i]=(0,t.useState)(null),o=(0,t.useCallback)(async()=>{if(null!==e&&void 0!==e&&e.tenant_id)try{l(!0);const e=await _l.get("/tenant/usage");a(e.data),i(null)}catch(K2){var t,s;console.error("Failed to fetch usage:",K2),i((null===(t=K2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to load usage data")}finally{l(!1)}else l(!1)},[e]);(0,t.useEffect)(()=>{o()},[o]);const c=(0,t.useCallback)(e=>{if(null===s||void 0===s||!s.usage)return!0;const t=s.usage[e];return!t||(t.allowed||t.unlimited)},[s]),d=(0,t.useCallback)(e=>{if(null===s||void 0===s||!s.usage)return null;const t=s.usage[e];return t?t.unlimited?-1:t.remaining:null},[s]),u=(0,t.useCallback)(e=>{if(null===s||void 0===s||!s.usage)return null;const t=s.usage[e];return t?t.limit:null},[s]),m=(0,t.useCallback)(e=>{if(null===s||void 0===s||!s.usage)return null;const t=s.usage[e];return t?t.current:null},[s]),h=(0,t.useCallback)(e=>{if(null===s||void 0===s||!s.usage)return null;const t=s.usage[e];return t?t.upgrade_message:null},[s]),x=(0,t.useCallback)(e=>null===s||void 0===s||!s.features||!1!==s.features[e],[s]),p=(0,t.useCallback)(()=>(null===s||void 0===s?void 0:s.forced_branding)||!1,[s]),g=(0,t.useCallback)(async e=>{try{return(await _l.get("/tenant/check-limit/".concat(e))).data}catch(K2){return console.error("Failed to check limit:",K2),{allowed:!0}}},[]);return{usage:s,isLoading:n,error:r,refresh:o,canCreate:c,getRemaining:d,getLimit:u,getCurrent:m,getUpgradeMessage:h,isFeatureAvailable:x,shouldShowBranding:p,checkLimit:g,planLevel:null===s||void 0===s?void 0:s.plan_level,planName:null===s||void 0===s?void 0:s.plan_name}},Jk=Yk,Qk=new Set(["/dashboard","/landing-page","/navigation","/forms","/media","/help","/settings","/affiliate/dashboard","/affiliate/apply","/marketplace"]),Xk=new Set(["/domain-settings"]),Zk=()=>{const e=ge(),{user:s,logout:a,isImpersonating:n,stopImpersonation:l}=Al(),{branding:r}=Bl(),[i,o]=(0,t.useState)(null),[c,d]=(0,t.useState)(!1),[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(new Set),p="admin"===(null===s||void 0===s?void 0:s.role)||"super_admin"===(null===s||void 0===s?void 0:s.role)||"master_admin"===(null===s||void 0===s?void 0:s.role),g=!n&&("super_admin"===(null===s||void 0===s?void 0:s.role)||"master_admin"===(null===s||void 0===s?void 0:s.role)),f=!n&&"master_admin"===(null===s||void 0===s?void 0:s.role),v=((null===s||void 0===s?void 0:s.reseller_id)&&(null===s||void 0===s||s.reseller_role),null===s||void 0===s?void 0:s.reseller_id),{planLevel:b}=Yk(),j=(b||(null===s||void 0===s?void 0:s.plan)||"freemium").toLowerCase(),y="freemium"===j||"free"===j,N=r.primary_color||"#4F46E5",w=r.company_name||"Nexus CMS";if((0,t.useEffect)(()=>{const e=async()=>{try{const e=await _l.get("/ai/credits");o(e.data)}catch(e){console.error("Failed to fetch AI credits:",e)}};if(s&&!v){e();const t=setInterval(e,3e4);return()=>clearInterval(t)}},[s,v]),(0,t.useEffect)(()=>{if(!s||v)return;let e=!1;return(async()=>{try{var t;const s=await _l.get("/affiliate/status");e||m(!(null===(t=s.data)||void 0===t||!t.is_affiliate))}catch(G2){e||m(!1)}})(),()=>{e=!0}},[s,v]),v){const t=[{name:"Dashboard",path:"/reseller/dashboard",icon:vw},{name:"Customers",path:"/reseller/dashboard?tab=customers",icon:Bj},{name:"Billing",path:"/reseller/billing",icon:bw}],i=[{name:"Site Overview",path:"/dashboard",icon:vw},{name:"Pages",path:"/pages",icon:qN},{name:"Articles",path:"/articles",icon:jw},{name:"Newsletters",path:"/newsletters",icon:Yl},{name:"Navigation",path:"/navigation",icon:ar},{name:"Forms",path:"/forms",icon:yw},{name:"Events",path:"/events",icon:Nw},{name:"Popups",path:"/popups",icon:ww},{name:"Media Library",path:"/media",icon:$N},{name:"Analytics",path:"/analytics",icon:Cw},{name:"AI Assistant",path:"/ai-assistant",icon:kw},{name:"Taptile",path:"/taptile",icon:RN},{name:"Landing Page",path:"/landing-page",icon:hr},{name:"Team",path:"/team",icon:Bj},{name:"Site Theme",path:"/theme-settings",icon:Dw},{name:"Templates",path:"/templates",icon:_w},{name:"Redirects",path:"/redirects",icon:bj},{name:"Custom Domain",path:"/domain-settings",icon:hr,roleColor:"admin"},{name:"Compliance",path:"/compliance",icon:Sw,roleColor:"admin"},{name:"Security",path:"/security-settings",icon:Kl},{name:"API Keys",path:"/api-keys",icon:Ew}
2,{name:"Help & Tutorials",path:"/help",icon:Aw},{name:"Settings",path:"/settings",icon:Oj}],o=e.pathname+(e.search||""),c=t=>t===o||("/reseller/dashboard"===t&&"/reseller/dashboard"===e.pathname&&!e.search||"/reseller/dashboard"!==t&&!t.includes("?")&&e.pathname===t),d=(e,t)=>t?"text-white":"admin"===e.roleColor?"text-red-400 hover:text-red-300 hover:bg-red-900/30":"text-slate-300 hover:bg-slate-800 hover:text-white",u=e=>{const t=e.icon,s=c(e.path);return(0,ea.jsxs)(Nt,{to:e.path,"data-testid":"sidebar-link-".concat(e.name.toLowerCase().replace(/\s+/g,"-")),className:"flex items-center gap-3 px-4 py-3 rounded-lg mb-1 transition-all ".concat(d(e,s)),style:s?{backgroundColor:N}:{},children:[(0,ea.jsx)(t,{size:20}),(0,ea.jsx)("span",{children:e.name})]},e.path+e.name)};return(0,ea.jsxs)("div",{className:"w-64 bg-slate-900 min-h-screen sticky top-0 text-white flex flex-col relative","data-testid":"sidebar",children:[n&&(()=>{const e="master_admin"===(null===s||void 0===s?void 0:s.impersonator_role),t=e?"bg-rose-500 text-rose-950":"bg-amber-500 text-amber-900",a=e?"bg-rose-600 hover:bg-rose-700":"bg-amber-600 hover:bg-amber-700",n=e?Fw:Tw,r=e?"Master Admin":"Super Admin";return(0,ea.jsxs)("div",{className:"".concat(t," px-4 py-2 text-sm"),"data-testid":"impersonation-banner",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(n,{size:16}),(0,ea.jsx)("span",{className:"font-medium",children:"Impersonating"})]}),(0,ea.jsx)("button",{onClick:l,className:"px-2 py-1 ".concat(a," text-white text-xs rounded font-medium transition-colors"),"data-testid":"stop-impersonation-btn",children:"Stop"})]}),(0,ea.jsx)("p",{className:"text-xs mt-1 opacity-90",children:null===s||void 0===s?void 0:s.email}),(null===s||void 0===s?void 0:s.impersonator_email)&&(0,ea.jsxs)("p",{className:"text-[11px] mt-0.5 opacity-90 flex items-center gap-1","data-testid":"impersonator-role-badge",children:[(0,ea.jsx)(n,{size:11}),(0,ea.jsxs)("span",{children:["via ",r,": ",s.impersonator_email]})]})]})})(),(0,ea.jsxs)("div",{className:"p-6",children:[r.logo_url?(0,ea.jsx)("img",{src:r.logo_url,alt:w,className:"h-8 object-contain mb-2"}):(0,ea.jsx)("h1",{className:"text-2xl font-bold tracking-tight",style:{fontFamily:"Manrope, sans-serif"},children:w&&"Nexus CMS"!==w?w:"Reseller Portal"}),(0,ea.jsx)("p",{className:"text-sm text-slate-400 mt-1",children:null===s||void 0===s?void 0:s.email})]}),(0,ea.jsxs)("nav",{className:"flex-1 px-4 overflow-y-auto pb-20",children:[(0,ea.jsx)("p",{className:"px-4 text-[11px] font-semibold uppercase tracking-wider text-slate-500 mb-2",children:"Reseller"}),t.map(u),(0,ea.jsx)("p",{className:"px-4 mt-5 text-[11px] font-semibold uppercase tracking-wider text-slate-500 mb-2",children:"Demo Workspace"}),i.map(u)]}),(0,ea.jsx)("div",{className:"absolute bottom-0 left-0 right-0 p-4 border-t border-slate-800 bg-slate-900",children:(0,ea.jsxs)("button",{onClick:a,"data-testid":"logout-button",className:"flex items-center gap-3 px-4 py-3 rounded-lg text-slate-300 hover:bg-slate-800 hover:text-white transition-all w-full",children:[(0,ea.jsx)(zw,{size:20}),(0,ea.jsx)("span",{children:"Logout"})]})})]})}const C=[{name:"Dashboard",path:"/dashboard",icon:vw,tooltip:"View your overview and stats"},{name:"Events",path:"/events",icon:Nw,tooltip:"Create events, calendars and audience groups"}],k=[{label:"Content",items:[{name:"Pages",path:"/pages",icon:qN,tooltip:"Create and manage web pages"},{name:"Articles",path:"/articles",icon:jw,tooltip:"Write and publish articles"},{name:"Newsletters",path:"/newsletters",icon:Yl,tooltip:"Create and send newsletters"},{name:"Forms",path:"/forms",icon:yw,tooltip:"Build and manage forms"},{name:"Popups",path:"/popups",icon:ww,tooltip:"Show announcements or forms when visitors open a page"},{name:"Media Library",path:"/media",icon:$N,tooltip:"Upload and manage files"}]},{label:"Design",items:[{name:"Navigation",path:"/navigation",icon:ar,tooltip:"Configure site navigation"},{name:"Landing Page",path:"/landing-page",icon:hr,tooltip:"Edit your site landing page"}
2,{name:"Site Theme",path:"/theme-settings",icon:Dw,tooltip:"Customize colors and branding"},{name:"Templates",path:"/templates",icon:_w,tooltip:"Manage page templates"}]},{label:"Grow",items:[{name:"Analytics",path:"/analytics",icon:Cw,tooltip:"Track performance and growth"},{name:"Marketplace",path:"/marketplace",icon:Mw,tooltip:"Discover trusted partners and tools"},{name:u?"Affiliate":"Become an Affiliate",path:u?"/affiliate/dashboard":"/affiliate/apply",icon:Pw,tooltip:u?"Your affiliate dashboard and referral link":"Earn commissions by referring customers"}]},{label:"Integrations",items:[{name:"AI Chatbots",path:"/ai-assistant",icon:kw,tooltip:"Set up your website AI chatbot (Pro & above)"},{name:"Taptile",path:"/taptile",icon:RN,tooltip:"Manage your Taptile app inside Nexus"},{name:"Stripe Payments",path:"/stripe-payments",icon:Aj,tooltip:"Connect Stripe to receive event ticket payouts directly"}]},{label:"Advanced",items:[{name:"Security",path:"/security-settings",icon:Kl,tooltip:"Manage 2FA and view audit logs"},{name:"API Keys",path:"/api-keys",icon:Ew,tooltip:"Generate API keys for headless integrations"},{name:"API Docs",path:"/api-docs",icon:Uj,tooltip:"API documentation for developers"},{name:"Redirects",path:"/redirects",icon:bj,tooltip:"Manage URL redirects"}]},{label:"Account",items:[{name:"Team",path:"/team",icon:Bj,tooltip:"Manage team members"},{name:"Settings",path:"/settings",icon:Oj,tooltip:"Account settings and billing"},{name:"Help & Tutorials",path:"/help",icon:Aw,tooltip:"Get help and learn the platform"}]}];(0,t.useEffect)(()=>{const t=k.find(t=>t.items.some(t=>t.path===e.pathname));t&&x(e=>new Set([...e,t.label]))},[e.pathname]);const D=p?[{name:"Organization Access",path:"/organization-members",icon:Bw,tooltip:"Manage who has access to this organization",roleColor:"admin"},{name:"Custom Domain",path:"/domain-settings",icon:hr,tooltip:"Configure your domain",roleColor:"admin"},{name:"Compliance",path:"/compliance",icon:Sw,tooltip:"View compliance documents",roleColor:"admin"}]:[],_=g&&!v?[{name:"User Management",path:"/users",icon:Rw,tooltip:"Manage all platform users",roleColor:"super_admin"},{name:"Audit Logs",path:"/audit-logs",icon:Lw,tooltip:"View tenant activity logs",roleColor:"super_admin"},{name:"Resellers",path:"/resellers",icon:Bw,tooltip:"Manage reseller accounts",roleColor:"super_admin"},{name:"Affiliates",path:"/affiliates",icon:Pw,tooltip:"Manage affiliate program",roleColor:"super_admin"},{name:"Go Live Requests",path:"/go-live-requests",icon:Mj,tooltip:"Review tenants ready to launch",roleColor:"super_admin"}]:[],S=f&&!v?[{name:"CMS Landing",path:"/cms/landing-page",icon:Fw,tooltip:"Edit the main CMS marketing landing page",roleColor:"master_admin"},{name:"Plan Limits",path:"/plan-limits",icon:Kl,tooltip:"Configure per-plan usage caps & feature access",roleColor:"master_admin"},{name:"AI Bots",path:"/admin/ai-bots",icon:kw,tooltip:"Fleet view of every tenant AI bot \u2014 usage & cost",roleColor:"master_admin"}]:[],E=(e,t)=>t?"text-white":"admin"===e.roleColor?"text-red-400 hover:text-red-300":"super_admin"===e.roleColor?"text-amber-400 hover:text-amber-300":"master_admin"===e.roleColor?"text-rose-400 hover:text-rose-300":"text-slate-300 hover:text-white",A=e=>"admin"===e.roleColor?"hover:bg-red-900/30":"super_admin"===e.roleColor?"hover:bg-amber-900/30":"master_admin"===e.roleColor?"hover:bg-rose-900/30":"hover:bg-slate-800",F=t=>e.pathname===t;return(0,ea.jsxs)("div",{className:"w-64 bg-slate-900 min-h-screen sticky top-0 text-white flex flex-col relative","data-testid":"sidebar",children:[n&&(()=>{const e="master_admin"===(null===s||void 0===s?void 0:s.impersonator_role),t=e?"bg-rose-500 text-rose-950":"bg-amber-500 text-amber-900",a=e?"bg-rose-600 hover:bg-rose-700":"bg-amber-600 hover:bg-amber-700",n=e?Fw:Tw,r=e?"Master Admin":"Super Admin";return(0,ea.jsxs)("div",{className:"".concat(t," px-4 py-2 text-sm"),"data-testid":"impersonation-banner",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(n,{size:16}),(0,ea.jsx)("span",{className:"font-medium",children:"Impersonating"})]}),(0,ea.jsx)("button",{onClick:l,className:"px-2 py-1 ".concat(a," text-white text-xs rounded font-medium transition-colors"),"data-testid":"stop-impersonation-btn",children:"Stop"})]}),(0,ea.jsx)("p",{className:"text-xs mt-1 opacity-90",children:null===s||void 0===s?void 0:s.email}),(null===s||void 0===s?void 0:s.impersonator_email)&&(0,ea.jsxs)("p",{className:"text-[11px] mt-0.5 opacity-90 flex items-center gap-1","data-testid":"impersonator-role-badge",children:[(0,ea.jsx)(n,{size:11}),(0,ea.jsxs)("span",{children:["via ",r,": ",s.impersonator_email]})]})]})})(),(0,ea.jsxs)("div",{className:"p-6",children:[r.logo_url?(0,ea.jsx)("img",{src:r.logo_url,alt:w,className:"h-8 object-contain mb-2"}):(0,ea.jsx)("h1",{className:"text-2xl font-bold tracking-tight",style:{fontFamily:"Manrope, sans-serif"},children:w}),(0,ea.jsx)("p",{className:"text-sm text-slate-400 mt-1",children:null===s||void 0===s?void 0:s.email}),(null===s||void 0===s?void 0:s.tenant_name)&&(0,ea.jsxs)("p",{className:"text-xs text-slate-500 flex items-center gap-1 mt-0.5",children:[(0,ea.jsx)(Bw,{size:12}),s.tenant_name]}),(0,ea.jsx)("div",{className:"mt-2",children:(0,ea.jsx)(AC,{})}),(null===s||void 0===s?void 0:s.plan)&&(0,ea.jsxs)("span",{className:"inline-flex items-center mt-2 px-2 py-0.5 rounded text-xs font-medium capitalize ".concat("enterprise"===s.plan?"bg-purple-500/20 text-purple-300":"pro"===s.plan?"bg-indigo-500/20 text-indigo-300":"starter"===s.plan?"bg-green-500/20 text-green-300":"bg-slate-500/20 text-slate-400"),children:[s.plan," Plan"]}),null!==i&&!y&&(0,ea.jsxs)("button",{type:"button",onClick:()=>d(!0),className:"flex items-center gap-1.5 mt-2 px-2 py-1 bg-amber-500/20 rounded text-xs text-amber-300 hover:bg-amber-500/30 transition-colors w-full","data-testid":"sidebar-ai-generations-badge",title:"View & top up your AI Generations",children:[(0,ea.jsx)($g,{size:12}),(0,ea.jsx)("span",{children:i.unlimited?"Unlimited AI Generations":"".concat(i.total_remaining," AI Generations")})]})]}),(0,ea.jsx)(Kk,{open:c,onOpenChange:d}),(0,ea.jsxs)("nav",{className:"flex-1 px-4 overflow-y-auto pb-20",children:[C.map(e=>{const t=e.icon,s=y&&!Qk.has(e.path),a="sidebar-link-".concat(e.name.toLowerCase().replace(/\s+/g,"-"));return s?(0,ea.jsx)(DC,{content:"Upgrade your plan to unlock this feature",side:"right",children:(0,ea.jsxs)(Nt,{to:"/settings","data-testid":"".concat(a,"-locked"),className:"flex items-center justify-between gap-3 px-4 py-3 rounded-lg mb-1 transition-all text-slate-500 hover:bg-slate-800/40 hover:text-slate-400 opacity-50 cursor-pointer","aria-disabled":"true",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-3",children:[(0,ea.jsx)(t,{size:20}),(0,ea.jsx)("span",{children:e.name})]}),(0,ea.jsx)(Lj,{size:14,className:"opacity-70"})]})},e.path):(0,ea.jsx)(DC,{content:e.tooltip,side:"right",children:(0,ea.jsxs)(Nt,{to:e.path,"data-testid":a,className:"flex items-center gap-3 px-4 py-3 rounded-lg mb-1 transition-all ".concat(F(e.path)?"text-white":"text-slate-300 hover:bg-slate-800 hover:text-white"),style:F(e.path)?{backgroundColor:N}:{},children:[(0,ea.jsx)(t,{size:20}),(0,ea.jsx)("span",{children:e.name})]})},e.path)}),k.map(e=>{const t=h.has(e.label),s=e.items.some(e=>F(e.path));return(0,ea.jsxs)("div",{className:"mb-1",children:[(0,ea.jsxs)("button",{onClick:()=>{return t=e.label,void x(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},"data-testid":"sidebar-group-".concat(e.label.toLowerCase().replace(/\s+/g,"-")),className:"w-full flex items-center justify-between px-4 py-2.5 rounded-lg transition-all text-left ".concat(s?"text-white font-medium":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"),style:s&&!t?{backgroundColor:"".concat(N,"33")}:{},children:[(0,ea.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:e.label}),t?(0,ea.jsx)(tr,{size:14,className:"opacity-60"}):(0,ea.jsx)(ax,{size:14,className:"opacity-60"})]}),t&&(0,ea.jsx)("div",{className:"ml-2 border-l border-slate-700 pl-2",children:e.items.map(e=>{const t=e.icon,s=y&&!Qk.has(e.path),a="sidebar-link-".concat(e.name.toLowerCase().replace(/\s+/g,"-"));return s?(0,ea.jsx)(DC,{content:"Upgrade your plan to unlock this feature",side:"right",children:(0,ea.jsxs)(Nt,{to:"/settings","data-testid":"".concat(a,"-locked"),className:"flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg mb-0.5 transition-all text-slate-500 hover:bg-slate-800/40 hover:text-slate-400 opacity-50 cursor-pointer","aria-disabled":"true",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-3",children:[(0,ea.jsx)(t,{size:18}),(0,ea.jsx)("span",{className:"text-sm",children:e.name})]}),(0,ea.jsx)(Lj,{size:13,className:"opacity-70"})]})},e.path):(0,ea.jsx)(DC,{content:e.tooltip,side:"right",children:(0,ea.jsxs)(Nt,{to:e.path,"data-testid":a,className:"flex items-center gap-3 px-3 py-2.5 rounded-lg mb-0.5 transition-all ".concat(F(e.path)?"text-white":"text-slate-300 hover:bg-slate-800 hover:text-white"),style:F(e.path)?{backgroundColor:N}:{},children:[(0,ea.jsx)(t,{size:18}),(0,ea.jsx)("span",{className:"text-sm",children:e.name})]})},e.path)})})]},e.label)}),D.length>0&&(()=>{const e=y?D.filter(e=>Xk.has(e.path)):D;return 0===e.length?null:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"mt-4 mb-2 px-4 flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider text-red-400",children:"Admin"}),(0,ea.jsx)("div",{className:"flex-1 h-px bg-red-800/50"})]}),e.map((e,t)=>{const s=e.icon;return(0,ea.jsx)(DC,{content:e.tooltip,side:"right",children:(0,ea.jsxs)(Nt,{to:e.path,"data-testid":"sidebar-link-".concat(e.name.toLowerCase().replace(/\s+/g,"-")),className:"flex items-center gap-3 px-4 py-3 rounded-lg mb-1 transition-all ".concat(F(e.path)?"text-white":"".concat(E(e,!1)," ").concat(A(e))),style:F(e.path)?{backgroundColor:"#dc2626"}:{},children:[(0,ea.jsx)(s,{size:20}),(0,ea.jsx)("span",{children:e.name})]})},"admin-".concat(e.path,"-").concat(t))})]})})(),_.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"mt-4 mb-2 px-4 flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400",children:"Super Admin"}),(0,ea.jsx)("div",{className:"flex-1 h-px bg-amber-800/50"})]}),_.map((e,t)=>{const s=e.icon;return(0,ea.jsx)(DC,{content:e.tooltip,side:"right",children:(0,ea.jsxs)(Nt,{to:e.path,"data-testid":"sidebar-link-".concat(e.name.toLowerCase().replace(/\s+/g,"-")),className:"flex items-center gap-3 px-4 py-3 rounded-lg mb-1 transition-all ".concat(F(e.path)?"text-white":"".concat(E(e,!1)," ").concat(A(e))),style:F(e.path)?{backgroundColor:"#d97706"}:{},children:[(0,ea.jsx)(s,{size:20}),(0,ea.jsx)("span",{children:e.name})]})},"super-".concat(e.path,"-").concat(t))})]}),S.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"mt-4 mb-2 px-4 flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider text-rose-400",children:"Master Admin"}),(0,ea.jsx)("div",{className:"flex-1 h-px bg-rose-800/50"})]}),S.map((e,t)=>{const s=e.icon;return(0,ea.jsx)(DC,{content:e.tooltip,side:"right",children:(0,ea.jsxs)(Nt,{to:e.path,"data-testid":"sidebar-link-".concat(e.name.toLowerCase().replace(/\s+/g,"-")),className:"flex items-center gap-3 px-4 py-3 rounded-lg mb-1 transition-all ".concat(F(e.path)?"text-white":"".concat(E(e,!1)," ").concat(A(e))),style:F(e.path)?{backgroundColor:"#e11d48"}:{},children:[(0,ea.jsx)(s,{size:20}),(0,ea.jsx)("span",{children:e.name})]})},"master-".concat(e.path,"-").concat(t))})]})]}),(0,ea.jsx)("div",{className:"absolute bottom-0 left-0 right-0 p-4 border-t border-slate-800 bg-slate-900",children:(0,ea.jsxs)("button",{onClick:a,"data-testid":"logout-button",className:"flex items-center gap-3 px-4 py-3 rounded-lg text-slate-300 hover:bg-slate-800 hover:text-white transition-all w-full",children:[(0,ea.jsx)(zw,{size:20}),(0,ea.jsx)("span",{children:"Logout"})]})})]})}
2,eD=["className"],tD=["className"],sD=["className"],aD=["className"],nD=["className"],lD=["className"],rD=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,eD);return(0,ea.jsx)("div",d({ref:t,className:Np("rounded-xl border bg-card text-card-foreground shadow",s)},a))});rD.displayName="Card";const iD=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,tD);return(0,ea.jsx)("div",d({ref:t,className:Np("flex flex-col space-y-1.5 p-6",s)},a))});iD.displayName="CardHeader";const oD=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,sD);return(0,ea.jsx)("div",d({ref:t,className:Np("font-semibold leading-none tracking-tight",s)},a))});oD.displayName="CardTitle";const cD=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,aD);return(0,ea.jsx)("div",d({ref:t,className:Np("text-sm text-muted-foreground",s)},a))});cD.displayName="CardDescription";const dD=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,nD);return(0,ea.jsx)("div",d({ref:t,className:Np("p-6 pt-0",s)},a))});dD.displayName="CardContent";t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,lD);return(0,ea.jsx)("div",d({ref:t,className:Np("flex items-center p-6 pt-0",s)},a))}).displayName="CardFooter";const uD=Vl("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),mD=Vl("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),hD="nexus_onboard_freemium",xD=()=>{var e,s,a,n,l,r,i,o,c,u,m;const h=be(),[x,p]=(0,t.useState)(null),[g,f]=(0,t.useState)(()=>"1"===localStorage.getItem("".concat(hD,"_dismissed"))),[v,b]=(0,t.useState)(()=>{try{return JSON.parse(localStorage.getItem("".concat(hD,"_clicked"))||"{}")}catch(e){return{}}});if((0,t.useEffect)(()=>{(async()=>{try{const[e,t]=await Promise.all([_l.get("/tenant/usage").catch(()=>({data:{}})),_l.get("/tenant/branding").catch(()=>({data:{}}))]);p({usage:e.data,branding:t.data})}catch(e){p({usage:{},branding:{}})}})()},[]),g||!x)return null;const j=null===(e=x.usage)||void 0===e?void 0:e.plan_level;if("freemium"!==j&&"free"!==j)return null;const y=(e,t)=>{const s=d(d({},v),{},{[e]:!0});b(s),localStorage.setItem("".concat(hD,"_clicked"),JSON.stringify(s)),t&&h(t)},N=!(null===(s=x.branding)||void 0===s||!s.logo_url),w=((null===(a=x.usage)||void 0===a||null===(n=a.usage)||void 0===n||null===(l=n.assets)||void 0===l?void 0:l.current)||0)>0||((null===(r=x.usage)||void 0===r||null===(i=r.usage)||void 0===i||null===(o=i.storage)||void 0===o?void 0:o.used_mb)||0)>0,C=((null===(c=x.usage)||void 0===c||null===(u=c.usage)||void 0===u||null===(m=u.forms)||void 0===m?void 0:m.current)||0)>0,k=[{key:"landing",label:"Personalize your landing page",desc:"Add your headline, colors and content.",done:!!v.landing,action:()=>y("landing","/landing-page"),cta:"Customize"},{key:"logo",label:"Add your logo & favicon",desc:"Make the site feel like yours.",done:N,action:()=>y("logo","/theme-settings"),cta:"Add logo"},{key:"media",label:"Upload your first image",desc:"Build your media library.",done:w,action:()=>y("media","/media"),cta:"Upload"},{key:"form",label:"Create a contact form",desc:"Start capturing leads.",done:C,action:()=>y("form","/forms"),cta:"Create form"},{key:"golive",label:"Publish & go live",desc:"Request to launch your site.",done:!!v.golive,action:()=>y("golive",null),cta:"How?"}],D=k.filter(e=>e.done).length,_=Math.round(D/k.length*100);return(0,ea.jsx)(rD,{className:"mb-8 border-indigo-200 bg-gradient-to-br from-indigo-50 to-white","data-testid":"freemium-onboarding",children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-xl bg-indigo-600 flex items-center justify-center",children:(0,ea.jsx)($g,{className:"text-white",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h3",{className:"text-lg font-semibold text-slate-900",children:["Get started \u2014 ",D,"/",k.length," done"]}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"A few quick steps to launch your free site."})]})]}),(0,ea.jsx)("button",{onClick:()=>{f(!0),localStorage.setItem("".concat(hD,"_dismissed"),"1")},className:"text-slate-400 hover:text-slate-600","data-testid":"dismiss-onboarding","aria-label":"Dismiss",children:(0,ea.jsx)(sr,{size:18})})]}),(0,ea.jsx)("div",{className:"w-full h-2 bg-indigo-100 rounded-full overflow-hidden mb-5",role:"progressbar","aria-valuenow":_,"aria-valuemin":0,"aria-valuemax":100,children:(0,ea.jsx)("div",{className:"h-full bg-indigo-600 transition-all duration-500",style:{width:"".concat(_,"%")}})}),(0,ea.jsx)("div",{className:"space-y-2",children:k.map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-3 p-3 rounded-lg bg-white border border-slate-100","data-testid":"onboarding-step-".concat(e.key),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[e.done?(0,ea.jsx)(uD,{className:"text-emerald-500 flex-shrink-0",size:20}):(0,ea.jsx)(nx,{className:"text-slate-300 flex-shrink-0",size:20}),(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsx)("p",{className:"text-sm font-medium ".concat(e.done?"text-slate-400 line-through":"text-slate-800"),children:e.label}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 truncate",children:e.desc})]})]}),!e.done&&(0,ea.jsx)(sg,{size:"sm",variant:"outline",onClick:e.action,className:"flex-shrink-0","data-testid":"onboarding-cta-".concat(e.key),children:e.cta})]},e.key))}),(0,ea.jsxs)("div",{className:"mt-5 flex items-center justify-between rounded-lg bg-indigo-600 text-white p-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold",children:"Need pages, newsletters & more?"}),(0,ea.jsx)("p",{className:"text-sm text-indigo-100",children:"Upgrade to unlock the full builder."})]}),(0,ea.jsxs)(sg,{onClick:()=>h("/settings#billing-management-section"),className:"bg-white text-indigo-700 hover:bg-indigo-50","data-testid":"onboarding-upgrade-btn",children:["Upgrade ",(0,ea.jsx)(mD,{size:16,className:"ml-1"})]})]})]})})},pD=[{id:"pages",label:"Created and published key pages (Home, About, Contact)"},{id:"branding",label:"Uploaded logo and set brand colors in Site Theme"},{id:"navigation",label:"Set up header and footer navigation menus"},{id:"content",label:"Added content to pages (text, images, etc.)"},{id:"domain",label:"Have a custom domain ready (e.g., myschool.com.au)"},{id:"tested",label:"Previewed and tested pages on different devices"}],gD=e=>{let{isOpen:s,onClose:a}=e;const[n,l]=(0,t.useState)([]),[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)(!1),[d,u]=(0,t.useState)(!1);return s?(0,ea.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto shadow-xl",children:[(0,ea.jsxs)("div",{className:"p-6 border-b border-slate-200 flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-emerald-100 rounded-full flex items-center justify-center",children:(0,ea.jsx)(Mj,{className:"w-5 h-5 text-emerald-600"})}),(0,ea.jsx)("h2",{className:"text-xl font-bold text-slate-900",children:"Ready to Go Live?"})]}),(0,ea.jsx)("button",{onClick:a,className:"text-slate-400 hover:text-slate-600",children:(0,ea.jsx)(sr,{size:24})})]}),(0,ea.jsx)("div",{className:"p-6",children:d?(0,ea.jsxs)("div",{className:"text-center py-8",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-emerald-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(Xl,{className:"w-8 h-8 text-emerald-600"})}),(0,ea.jsx)("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Request Submitted!"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"We've received your Go Live request. Our team will review it and contact you within 1-2 business days."}),(0,ea.jsx)("h4",{className:"font-semibold text-slate-900 mb-3",children:"What happens next?"}),(0,ea.jsxs)("ul",{className:"text-left text-sm text-slate-600 space-y-2 max-w-sm mx-auto",children:[(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"1."}),"Our team will review your site"]}),(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"2."}),"We'll help you set up your custom domain"]}),(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"3."}),"DNS configuration and SSL setup"]}),(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"4."}),"Final checks and your site goes live! \ud83c\udf89"]})]}),(0,ea.jsx)(sg,{onClick:a,className:"mt-6",children:"Close"})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"Before we lau
2nch your site, let's make sure everything is ready. Check off the items you've completed:"}),(0,ea.jsx)("div",{className:"space-y-3 mb-6",children:pD.map(e=>(0,ea.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg hover:bg-slate-50",children:[(0,ea.jsx)(fw,{id:e.id,checked:n.includes(e.id),onCheckedChange:t=>((e,t)=>{l(t?[...n,e]:n.filter(t=>t!==e))})(e.id,t)}),(0,ea.jsx)(tf,{htmlFor:e.id,className:"text-sm text-slate-700 cursor-pointer leading-relaxed",children:e.label})]},e.id))}),(0,ea.jsxs)("div",{className:"mb-6",children:[(0,ea.jsx)(tf,{htmlFor:"notes",className:"text-sm font-medium text-slate-700 mb-2 block",children:"Additional notes or questions (optional)"}),(0,ea.jsx)(YN,{id:"notes",value:r,onChange:e=>i(e.target.value),placeholder:"e.g., I'd like help setting up my domain, or I have questions about...",rows:3})]}),(0,ea.jsxs)("div",{className:"mb-6 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-700",children:"Checklist Progress"}),(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:[n.length," of ",pD.length]})]}),(0,ea.jsx)("div",{className:"w-full bg-slate-200 rounded-full h-2",children:(0,ea.jsx)("div",{className:"bg-emerald-500 h-2 rounded-full transition-all duration-300",style:{width:"".concat(n.length/pD.length*100,"%")}})})]}),(0,ea.jsx)(sg,{onClick:async()=>{c(!0);try{const e=pD.filter(e=>n.includes(e.id)).map(e=>e.label);await _l.post("/tenant/go-live-request",{checklist_completed:e,notes:r||null}),u(!0),qs.success("Go Live request submitted!")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to submit request")}finally{c(!1)}},disabled:o,className:"w-full bg-emerald-600 hover:bg-emerald-700",children:o?"Submitting...":"\ud83d\ude80 Submit Go Live Request"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 text-center mt-4",children:"Don't worry if you haven't completed everything \u2013 we'll help you get there!"})]})})]})}):null},fD=()=>{const[e,s]=(0,t.useState)(null),[a,n]=(0,t.useState)(!0),[l,r]=(0,t.useState)(!1);(0,t.useEffect)(()=>{i()},[]);const i=async()=>{try{const e=await _l.get("/stats");s(e.data)}catch(e){console.error("Failed to fetch stats:",e)}finally{n(!1)}},o=e?[{label:"Pages",value:e.pages_count,icon:qN,color:"indigo",link:"/pages",tooltip:"Total web pages created in your workspace"},{label:"Newsletters",value:e.newsletters_count,icon:Yl,color:"emerald",link:"/newsletters",tooltip:"Email campaigns created"},{label:"Media Files",value:e.media_count,icon:$N,color:"purple",link:"/media",tooltip:"Images and files in your library"},{label:"Team Members",value:e.team_count,icon:Bj,color:"blue",link:"/team",tooltip:"People with access to this workspace"},{label:"Emails Sent",value:e.total_emails_sent,icon:GN,color:"amber",link:"/newsletters",tooltip:"Total newsletter emails delivered"}]:[];return(0,ea.jsxs)("div",{className:"flex","data-testid":"dashboard-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-4xl font-bold mb-2",style:{fontFamily:"Manrope, sans-serif"},children:"Dashboard"}),(0,ea.jsx)("p",{className:"text-slate-600",children:"Welcome back! Here's your overview"})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsx)(DC,{content:"Request to make your site live",children:(0,ea.jsxs)(sg,{onClick:()=>r(!0),className:"bg-emerald-600 hover:bg-emerald-700","data-testid":"go-live-button",children:[(0,ea.jsx)(Mj,{size:18,className:"mr-2"}),"Ready to Go Live"]})}),(0,ea.jsx)(DC,{content:"Create a new web page",children:(0,ea.jsx)(Nt,{to:"/pages/new",children:(0,ea.jsxs)(sg,{className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"create-page-button",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"New Page"]})})}),(0,ea.jsx)(DC,{content:"Create a new email newsletter",children:(0,ea.jsx)(Nt,{to:"/newsletters/new",children:(0,ea.jsxs)(sg,{variant:"outline","data-testid":"create-newsletter-button",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"New Newsletter"]})})})]})]}),(0,ea.jsx)(xD,{}),a?(0,ea.jsx)("div",{className:"text-center py-12",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading stats..."})}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-5 ga
2p-4 mb-8",children:o.map(e=>{const t=e.icon;return(0,ea.jsx)(DC,{content:e.tooltip,children:(0,ea.jsxs)(Nt,{to:e.link,"data-testid":"stat-card-".concat(e.label.toLowerCase().replace(" ","-")),className:"bg-white border border-slate-200 rounded-xl p-6 hover:shadow-lg transition-all",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-".concat(e.color,"-100 flex items-center justify-center mb-4"),children:(0,ea.jsx)(t,{className:"text-".concat(e.color,"-600"),size:24})}),(0,ea.jsx)("p",{className:"text-3xl font-bold mb-1",children:e.value}),(0,ea.jsx)("p",{className:"text-slate-600 text-sm",children:e.label})]})},e.label)})}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsx)("h3",{className:"text-xl font-semibold mb-4",style:{fontFamily:"Manrope, sans-serif"},children:"Recent Pages"}),e.recent_pages&&e.recent_pages.length>0?(0,ea.jsx)("div",{className:"space-y-3",children:e.recent_pages.map(e=>(0,ea.jsx)(Nt,{to:"/pages/".concat(e.page_id),"data-testid":"recent-page-".concat(e.page_id),className:"block p-3 hover:bg-slate-50 rounded-lg transition-colors",children:(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"font-medium",children:e.title}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[e.status," \u2022 ",new Date(e.updated_at).toLocaleDateString()]})]}),(0,ea.jsx)("span",{className:"px-3 py-1 rounded-full text-xs ".concat("published"===e.status?"bg-emerald-100 text-emerald-700":"bg-slate-100 text-slate-700"),children:e.status})]})},e.page_id))}):(0,ea.jsx)("p",{className:"text-slate-500 text-center py-6",children:"No pages yet"})]}),(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsx)("h3",{className:"text-xl font-semibold mb-4",style:{fontFamily:"Manrope, sans-serif"},children:"Quick Actions"}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(Nt,{to:"/pages/new","data-testid":"quick-action-page",children:(0,ea.jsxs)(sg,{variant:"outline",className:"w-full justify-start",children:[(0,ea.jsx)(qN,{size:18,className:"mr-3"}),"Create New Page"]})}),(0,ea.jsx)(Nt,{to:"/newsletters/new","data-testid":"quick-action-newsletter",children:(0,ea.jsxs)(sg,{variant:"outline",className:"w-full justify-start",children:[(0,ea.jsx)(Yl,{size:18,className:"mr-3"}),"Create Newsletter"]})}),(0,ea.jsx)(Nt,{to:"/media","data-testid":"quick-action-media",children:(0,ea.jsxs)(sg,{variant:"outline",className:"w-full justify-start",children:[(0,ea.jsx)($N,{size:18,className:"mr-3"}),"Upload Media"]})}),(0,ea.jsx)(Nt,{to:"/team","data-testid":"quick-action-team",children:(0,ea.jsxs)(sg,{variant:"outline",className:"w-full justify-start",children:[(0,ea.jsx)(Bj,{size:18,className:"mr-3"}),"Invite Team Member"]})})]})]})]})]})]})}),(0,ea.jsx)(gD,{isOpen:l,onClose:()=>r(!1)})]})},vD=Vl("folder-plus",[["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"}]]),bD=Vl("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"}]]),jD=Vl("folder-open",[["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"}]]),yD=Vl("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"}]]),ND=Vl("square-pen",[["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"}]]),wD=Vl("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
2],["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"}]]),CD=Vl("arrow-up-down",[["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"}]]),kD=Vl("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),DD=Vl("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"}]]),_D=Vl("move-right",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),SD=[{value:"all",label:"All Statuses"},{value:"draft",label:"Draft"},{value:"published",label:"Published"},{value:"archived",label:"Archived"}],ED=[{value:"updated_at",label:"Recently Updated"},{value:"created_at",label:"Recently Created"},{value:"title",label:"Title (A-Z)"},{value:"slug",label:"Slug (A-Z)"},{value:"author_name",label:"Author (A-Z)"}],AD=[10,20,50,100],FD=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#64748b"],TD=()=>{const[e,s]=(0,t.useState)([]),[a,n]=(0,t.useState)([]),[l,r]=(0,t.useState)(!0),[i,o]=(0,t.useState)(""),[c,d]=(0,t.useState)("all"),[u,m]=(0,t.useState)("all"),[h,x]=(0,t.useState)("all"),[p,g]=(0,t.useState)("updated_at"),[f,v]=(0,t.useState)("desc"),[b,j]=(0,t.useState)(1),[y,N]=(0,t.useState)(10),[w,C]=(0,t.useState)(0),[k,D]=(0,t.useState)(!1),[_,S]=(0,t.useState)(null),[E,A]=(0,t.useState)([]),[F,T]=(0,t.useState)(!1),[z,M]=(0,t.useState)(null),[P,B]=(0,t.useState)(""),[R,L]=(0,t.useState)("#6366f1"),[I,O]=(0,t.useState)(!1),[U,H]=(0,t.useState)(null),W=(0,t.useCallback)(async()=>
2{try{const e=await _l.get("/page-folders");A(e.data||[])}catch(e){console.error("Failed to fetch folders:",e)}},[]),V=(0,t.useCallback)(async()=>{r(!0);try{const e=await _l.get("/pages");let t=e.data;if(n(e.data),"all"!==u&&(t="none"===u?t.filter(e=>!e.folder_id):t.filter(e=>e.folder_id===u)),i){const e=i.toLowerCase();t=t.filter(t=>(t.title||"").toLowerCase().includes(e)||t.slug.toLowerCase().includes(e)||(t.author_name||"").toLowerCase().includes(e))}"all"!==c&&(t=t.filter(e=>e.status===c)),"all"!==h&&(t=t.filter(e=>(e.author_name||"Unknown")===h)),t.sort((e,t)=>{let s,a;switch(p){case"title":s=(e.title||"").toLowerCase(),a=(t.title||"").toLowerCase();break;case"slug":s=e.slug.toLowerCase(),a=t.slug.toLowerCase();break;case"author_name":s=(e.author_name||"").toLowerCase(),a=(t.author_name||"").toLowerCase();break;case"created_at":s=new Date(e.created_at),a=new Date(t.created_at);break;default:s=new Date(e.updated_at),a=new Date(t.updated_at)}return"asc"===f?s>a?1:-1:s<a?1:-1}),C(t.length);const a=(b-1)*y,l=t.slice(a,a+y);s(l)}catch(e){console.error("Failed to fetch pages:",e),qs.error("Failed to load pages")}finally{r(!1)}},[i,c,u,h,p,f,b,y]);(0,t.useEffect)(()=>{W()},[W]),(0,t.useEffect)(()=>{V()},[V]),(0,t.useEffect)(()=>{j(1)},[i,c,u,h,p,f,y]);const q=async(e,t)=>{try{await _l.put("/pages/".concat(e.page_id,"/move-to-folder"),null,{params:{folder_id:t||""}}),qs.success("Page moved ".concat(t?"to folder":"out of folder")),V(),W()}catch(s){qs.error("Failed to move page")}},$=e=>{const t={published:"bg-green-100 text-green-700 border-green-200",draft:"bg-amber-100 text-amber-700 border-amber-200",archived:"bg-slate-100 text-slate-700 border-slate-200"};return t[e]||t.draft},G=Math.ceil(w/y);return(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50","data-testid":"pages-list-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 p-8",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold text-slate-900 flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(qN,{className:"text-indigo-600",size:32}),"Pages"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Manage your website pages"})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>{M(null),B(""),L("#6366f1"),T(!0)},className:"gap-2",children:[(0,ea.jsx)(vD,{size:18}),"New Folder"]}),(0,ea.jsx)(Nt,{to:"/pages/new",children:(0,ea.jsxs)(sg,{className:"bg-indigo-600 hover:bg-indigo-700 gap-2","data-testid":"create-page-button",children:[(0,ea.jsx)(Vj,{size:18}),"Create Page"]})})]})]}),E.length>0&&(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 mb-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-500 mr-2",children:"Folders:"}),(0,ea.jsxs)("button",{onClick:()=>m("all"),className:"px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ".concat("all"===u?"bg-indigo-100 text-indigo-700":"bg-slate-100 text-slate-600 hover:bg-slate-200"),children:[(0,ea.jsx)(bD,{size:14}),"All Pages (",a.length,")"]}),(0,ea.jsxs)("button",{onClick:()=>m("none"),className:"px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ".concat("none"===u?"bg-slate-200 text-slate-800":"bg-slate-100 text-slate-600 hover:bg-slate-200"),children:[(0,ea.jsx)(qN,{size:14}),"Unfiled (",a.filter(e=>!e.folder_id).length,")"]}),E.map(e=>(0,ea.jsxs)("div",{className:"relative group",children:[(0,ea.jsxs)("button",{onClick:()=>m(e.folder_id),className:"px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ".concat(u===e.folder_id?"ring-2 ring-offset-1":"hover:opacity-80"),style:{backgroundColor:"".concat(e.color,"20"),color:e.color,ringColor:e.color},children:[(0,ea.jsx)(jD,{size:14}),e.name," (",e.page_count||0,")"]}),(0,ea.jsx)("div",{className:"absolute right-0 top-0 -translate-y-1/2 translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)("button",{className:"p-1 rounded-full bg-white shadow-sm border border-slate-200 hover:bg-slate-50",children:(0,ea.jsx)(yD,{size:12})})}),(0,ea.jsxs)(Bp,{align:"end",children:[(0,ea.jsxs)(Rp,{onClick:()=>(e=>{M(e),B(e.name),L(e.color||"#6366f1"),T(!0)})(e),children:[(0,ea.jsx)(ND,{size:14,className:"mr-2"}),"Edit Folder"]}),(0,ea.jsxs)(Rp,{onClick:()=>{H(e),O(!0)},className:"text-red-600",children:[(0,ea.jsx)(wD,{size:14,className:"mr-2"}),"Delete Folder"]})]})]})})]},e.folder_id))]})}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 mb-6",children:(0,ea.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,ea.jsxs)("div",{className:"relative flex-1 min-w-64",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search pages...",value:i,onChange:e=>o(e.target.value),className:"pl-10","data-testid":"search-input"})]}),(0,ea.jsxs)(eb,{value:p,onValueChange:g,children:[(0,ea.jsxs)(sb,{className:"w-48",children:[(0,ea.jsx)(CD,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Sort by"})]}),(0,ea.jsx)(lb,{children:ED.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsxs)(eb,{value:c,onValueChange:d,children:[(0,ea.jsxs)(sb,{className:"w-40",children:[(0,ea.jsx)(kD,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Status"})]}),(0,ea.jsx)(lb,{children:SD.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsxs)(eb,{value:h,onValueChange:x,children:[(0,ea.jsxs)(sb,{className:"w-44","data-testid":"author-filter",children:[(0,ea.jsx)(Pj,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Author"})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Authors"}),[...new Set(a.map(e=>e.author_name||"Unknown"))].sort().map(e=>(0,ea.jsx)(rb,{value:e,children:e},e))]})]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>v("asc"===f?"desc":"asc"),children:"asc"===f?"\u2191 Asc":"\u2193 Desc"})]})}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:l?(0,ea.jsx)("div",{className:"p-12 text-center text-slate-500",children:"Loading pages..."}):0===e.length?(0,ea.jsxs)("div",{className:"p-12 text-center",children:[(0,ea.jsx)(qN,{size:48,className:"mx-auto text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-700 mb-1",children:"No pages found"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:i||"all"!==c||"all"!==u?"Try adjusting your filters":"Create your first page to get started"}),!i&&"all"===c&&"all"===u&&(0,ea.jsx)(Nt,{to:"/pages/new",children:(0,ea.jsxs)(sg,{className:"bg-indigo-600 hover:bg-indigo-700",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Create Page"]})})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"px-6 py-3 text-left text-xs font-semibold text-slate-600 uppercase tracking-wider",children:"Page"}),(0,ea.jsx)("th",{className:"px-6 py-3 text-left text-xs font-semibold text-slate-600 uppercase tracking-wider",children:"Folder"}),(0,ea.jsx)("th",{className:"px-6 py-3 text-left text-xs font-semibold text-slate-600 uppercase tracking-wider",children:"Status"}),(0,ea.jsx)("th",{className:"px-6 py-3 text-left text-xs font-semibold text-slate-600 uppercase tracking-wider",children:"Author"}),(0,ea.jsx)("th",{className:"px-6 py-3 text-left text-xs font-semibold text-slate-600 uppercase tracking-wider",children:"Updated"}),(0,ea.jsx)("th",{className:"px-6 py-3 text-right text-xs font-semibold text-slate-600 uppercase tracking-wider",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-100",children:e.map(e=>{const t=(e=>e.folder_id?E.find(t=>t.folder_id===e.folder_id):null)(e);return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50 transition-colors","data-testid":"page-row-".concat(e.page_id),children:[(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)("div",{className:"p-2 rounded-lg bg-indigo-50 text-indigo-600",children:(0,ea.jsx)(qN,{size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(Nt,{to:"/pages/".concat(e.page_id),className:"font-medium text-slate-900 hover:text-indigo-600 transition-colors",children:e.title||"Untitled"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:["/",e.slug]}
2),e.isHomepage&&(0,ea.jsx)("span",{className:"px-1.5 py-0.5 text-xs font-medium bg-blue-100 text-blue-700 rounded",children:"Home"}),e.isPopup&&(0,ea.jsx)("span",{className:"px-1.5 py-0.5 text-xs font-medium bg-purple-100 text-purple-700 rounded",children:"Popup"})]})]})]})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:t?(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium",style:{backgroundColor:"".concat(t.color,"20"),color:t.color},children:[(0,ea.jsx)(bD,{size:12}),t.name]}):(0,ea.jsx)("span",{className:"text-slate-400 text-sm",children:"\u2014"})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)("span",{className:"px-2.5 py-1 text-xs font-medium rounded-full border ".concat($(e.status)),children:e.status})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,ea.jsx)(Pj,{size:14}),e.author_name||"Unknown"]})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-500",children:[(0,ea.jsx)(yj,{size:14}),new Date(e.updated_at).toLocaleDateString()]})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-right",children:(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm","data-testid":"page-actions-".concat(e.page_id),children:(0,ea.jsx)(yD,{size:18})})}),(0,ea.jsxs)(Bp,{align:"end",children:[(0,ea.jsx)(Rp,{asChild:!0,children:(0,ea.jsxs)(Nt,{to:"/pages/".concat(e.page_id),className:"flex items-center",children:[(0,ea.jsx)(ND,{size:14,className:"mr-2"}),"Edit"]})}),(0,ea.jsx)(Rp,{asChild:!0,children:(0,ea.jsxs)("a",{href:"/preview/".concat(e.preview_token),target:"_blank",rel:"noopener noreferrer",className:"flex items-center",children:[(0,ea.jsx)(IN,{size:14,className:"mr-2"}),"Preview"]})}),(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{try{const t={title:"".concat(e.title||"Untitled"," (Copy)"),slug:"".concat(e.slug,"-copy-").concat(Date.now()),blocks:e.blocks,status:"draft",pageWidth:e.pageWidth,theme:e.theme,folder_id:e.folder_id};await _l.post("/pages",t),qs.success("Page duplicated successfully"),V()}catch(t){qs.error("Failed to duplicate page")}})(e),children:[(0,ea.jsx)(DD,{size:14,className:"mr-2"}),"Duplicate"]}),(0,ea.jsx)(Ip,{}),(0,ea.jsxs)(zp,{children:[(0,ea.jsxs)(Mp,{children:[(0,ea.jsx)(_D,{size:14,className:"mr-2"}),"Move to Folder"]}),(0,ea.jsxs)(Pp,{children:[(0,ea.jsxs)(Rp,{onClick:()=>q(e,null),children:[(0,ea.jsx)(sr,{size:14,className:"mr-2"}),"No Folder"]}),(0,ea.jsx)(Ip,{}),E.map(t=>(0,ea.jsxs)(Rp,{onClick:()=>q(e,t.folder_id),disabled:e.folder_id===t.folder_id,children:[(0,ea.jsx)(bD,{size:14,className:"mr-2",style:{color:t.color}}),t.name]},t.folder_id))]})]}),(0,ea.jsx)(Ip,{}),(0,ea.jsxs)(Rp,{onClick:()=>{S(e),D(!0)},className:"text-red-600",children:[(0,ea.jsx)(wD,{size:14,className:"mr-2"}),"Delete"]})]})]})})]},e.page_id)})})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-t border-slate-200 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)("span",{className:"text-sm text-slate-600",children:["Showing ",(b-1)*y+1," to ",Math.min(b*y,w)," of ",w," pages"]}),(0,ea.jsxs)(eb,{value:y.toString(),onValueChange:e=>N(parseInt(e)),children:[(0,ea.jsx)(sb,{className:"w-20 h-8",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:AD.map(e=>(0,ea.jsx)(rb,{value:e.toString(),children:e},e))})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>j(e=>Math.max(1,e-1)),disabled:b<=1,children:[(0,ea.jsx)(vj,{size:16}),"Previous"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>j(e=>Math.min(G,e+1)),disabled:b>=G,children:["Next",(0,ea.jsx)(ax,{size:16})]})]})]})]})})]})}),(0,ea.jsx)(Ok,{open:k,onOpenChange:D,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Delete Page"}),(0,ea.jsxs)(Gk,{children:['Are you sure you want to delete "',(null===_||void 0===_?void 0:_.title)||"Untitled",'"? This action cannot be undone.']})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:async()=>
2{if(_)try{await _l.delete("/pages/".concat(_.page_id)),qs.success("Page deleted successfully"),D(!1),S(null),V()}catch(e){qs.error("Failed to delete page")}},children:"Delete"})]})]})}),(0,ea.jsx)(Ok,{open:F,onOpenChange:T,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:z?"Edit Folder":"Create New Folder"}),(0,ea.jsx)(Gk,{children:z?"Update the folder name and color.":"Create a folder to organize your pages. Folders do not affect page URLs."})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Folder Name"}),(0,ea.jsx)(BN,{value:P,onChange:e=>B(e.target.value),placeholder:"e.g., Blog Posts, Products, Events"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Color"}),(0,ea.jsx)("div",{className:"flex gap-2 flex-wrap",children:FD.map(e=>(0,ea.jsx)("button",{onClick:()=>L(e),className:"w-8 h-8 rounded-full transition-transform ".concat(R===e?"ring-2 ring-offset-2 scale-110":"hover:scale-105"),style:{backgroundColor:e,ringColor:e}},e))})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-4 p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsx)(bD,{size:20,style:{color:R}}),(0,ea.jsx)("span",{className:"font-medium",style:{color:R},children:P||"Folder Name"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:z?async()=>{if(P.trim()&&z)try{await _l.put("/page-folders/".concat(z.folder_id),{name:P,color:R}),qs.success("Folder updated successfully"),T(!1),M(null),B(""),L("#6366f1"),W()}catch(e){qs.error("Failed to update folder")}}:async()=>{if(P.trim())try{await _l.post("/page-folders",{name:P,color:R}),qs.success("Folder created successfully"),T(!1),B(""),L("#6366f1"),W()}catch(e){qs.error("Failed to create folder")}},disabled:!P.trim(),children:z?"Save Changes":"Create Folder"})]})]})}),(0,ea.jsx)(Ok,{open:I,onOpenChange:O,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Delete Folder"}),(0,ea.jsxs)(Gk,{children:['Are you sure you want to delete the folder "',null===U||void 0===U?void 0:U.name,'"? Pages in this folder will be moved to "Unfiled". This action cannot be undone.']})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:async()=>{if(U)try{await _l.delete("/page-folders/".concat(U.folder_id)),qs.success("Folder deleted successfully"),O(!1),H(null),u===U.folder_id&&m("all"),W(),V()}catch(e){qs.error("Failed to delete folder")}},children:"Delete Folder"})]})]})})]})},zD=Vl("pen-line",[["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"}]]),MD=Vl("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"}]]),PD=Vl("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"}]]),BD=Vl("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"}]]),RD=e=>"string"===typeof e&&e.startsWith("data:image"),LD={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};async function ID(e){if(!Array.isArray(e))return{blocks:e,uploaded:0};const t=new Map;let s=0;const a=async e=>{if(t.has(e))return t.get(e);try{const a=await async function(e){const t=await(await fetch(e)).blob(),s=(t.type||"image/png").toLowerCase(),a=LD[s]||"png",n=new File([t],"pasted-".concat(Date.now(),".").concat(a),{type:s}),l=new FormData;return l.append("file",n),(await _l.post("/media/upload",l,{headers:{"Content-Type":"multipart/form-data"}})).data.url}(e);return t.set(e,a),s+=1,a}catch(G2){return t.set(e,e),e}},n=async e=>{if(Array.isArray(e)){const t=[];for(const s of e)t.push(await n(s));return t}if(e&&"object"===typeof e){const t={};for(const[s,l]of Object.entries(e))t[s]=RD(l)?await a(l):await n(l);return t}return e};return{blocks:await n(e),uploaded:s}}const OD="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;function UD(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function HD(e){return"nodeType"in e}function WD(e){var t,s;return e?UD(e)?e:HD(e)&&null!=(t=null==(s=e.ownerDocument)?void 0:s.defaultView)?t:window:window}function VD(e){const{Document:t}=WD(e);return e instanceof t}function qD(e){return!UD(e)&&e instanceof WD(e).HTMLElement}function $D(e){return e instanceof WD(e).SVGElement}function GD(e){return e?UD(e)?e.document:HD(e)?VD(e)?e:qD(e)||$D(e)?e.ownerDocument:document:document:document}const KD=OD?t.useLayoutEffect:t.useEffect;function YD(e){const s=(0,t.useRef)(e);return KD(()=>{s.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return null==s.current?void 0:s.current(...t)},[])}function JD(e,s){void 0===s&&(s=[e]);const a=(0,t.useRef)(e);return KD(()=>{a.current!==e&&(a.current=e)},s),a}function QD(e,s){const a=(0,t.useRef)();return(0,t.useMemo)(()=>{const t=e(a.current);return a.current=t,t},[...s])}function XD(e){const s=YD(e),a=(0,t.useRef)(null),n=(0,t.useCallback)(e=>{e!==a.current&&(null==s||s(e,a.current)),a.current=e},[]);return[a,n]}function ZD(e){const s=(0,t.useRef)();return(0,t.useEffect)(()=>{s.current=e},[e]),s.current}let e_={};function t_(e,s){return(0,t.useMemo)(()=>
2{if(s)return s;const t=null==e_[e]?0:e_[e]+1;return e_[e]=t,e+"-"+t},[e,s])}function s_(e){return function(t){for(var s=arguments.length,a=new Array(s>1?s-1:0),n=1;n<s;n++)a[n-1]=arguments[n];return a.reduce((t,s)=>{const a=Object.entries(s);for(const[n,l]of a){const s=t[n];null!=s&&(t[n]=s+e*l)}return t},d({},t))}}const a_=s_(1),n_=s_(-1);function l_(e){if(!e)return!1;const{KeyboardEvent:t}=WD(e.target);return t&&e instanceof t}function r_(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=WD(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const i_=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[i_.Translate.toString(e),i_.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:a}=e;return t+" "+s+"ms "+a}}}),o_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function c_(e){return e.matches(o_)?e:e.querySelector(o_)}const d_={display:"none"};function u_(e){let{id:s,value:a}=e;return t.createElement("div",{id:s,style:d_},a)}function m_(e){let{id:s,announcement:a,ariaLiveType:n="assertive"}=e;return t.createElement("div",{id:s,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":n,"aria-atomic":!0},a)}const h_=["transform"],x_=["id","accessibility","autoScroll","children","sensors","collisionDetection","measuring","modifiers"],p_=(0,t.createContext)(null);const g_={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},f_={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was moved over droppable area "+s.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was dropped over droppable area "+s.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function v_(e){let{announcements:s=f_,container:a,hiddenTextDescribedById:n,screenReaderInstructions:l=g_}=e;const{announce:r,announcement:i}=function(){const[e,s]=(0,t.useState)("");return{announce:(0,t.useCallback)(e=>{null!=e&&s(e)},[]),announcement:e}}(),o=t_("DndLiveRegion"),[c,d]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{d(!0)},[]),function(e){const s=(0,t.useContext)(p_);(0,t.useEffect)(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(e)},[e,s])}((0,t.useMemo)(()=>({onDragStart(e){let{active:t}=e;r(s.onDragStart({active:t}))},onDragMove(e){let{active:t,over:a}=e;s.onDragMove&&r(s.onDragMove({active:t,over:a}))},onDragOver(e){let{active:t,over:a}=e;r(s.onDragOver({active:t,over:a}))},onDragEnd(e){let{active:t,over:a}=e;r(s.onDragEnd({active:t,over:a}))},onDragCancel(e){let{active:t,over:a}=e;r(s.onDragCancel({active:t,over:a}))}}),[r,s])),!c)return null;const u=t.createElement(t.Fragment,null,t.createElement(u_,{id:n,value:l.draggable}),t.createElement(m_,{id:o,announcement:i}));return a?(0,Ts.createPortal)(u,a):u}var b_;function j_(){}function y_(e,s){return(0,t.useMemo)(()=>({sensor:e,options:null!=s?s:{}}),[e,s])}function N_(){for(var e=arguments.length,s=new Array(e),a=0;a<e;a++)s[a]=arguments[a];return(0,t.useMemo)(()=>[...s].filter(e=>null!=e),[...s])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(b_||(b_={}));const w_=Object.freeze({x:0,y:0});function C_(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function k_(e,t){let{data:{value:s}}=e,{data:{value:a}}=t;return s-a}function D_(e,t){let{data:{value:s}}=e,{data:{value:a}}=t;return a-s}function __(e){let{left:t,top:s,height:a,width:n}=e;return[{x:t,y:s},{x:t+n,y:s},{x:t,y:s+a},{x:t+n,y:s+a}]}function S_(e,t){if(!e||0===e.length)return null;const[s]=e;return t?s[t]:s}function E_(e,t,s){return void 0===t&&(t=e.left),void 0===s&&(s=e.top),{x:t+.5*e.width,y:s+.5*e.height}}const A_=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:a}=e;const n=E_(t,t.left,t.top),l=[];for(const r of a){const{id:e}=r,t=s.get(e);if(t){const s=C_(E_(t),n);l.push({id:e,data:{droppableContainer:r,value:s}})}}return l.sort(k_)};function F_(e,t){const s=Math.max(t.top,e.top),a=Math.max(t.left,e.left),n=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),r=n-a,i=l-s;if(a<n&&s<l){const s=t.width*t.height,a=e.width*e.height,n=r*i;return Number((n/(s+a-n)).toFixed(4))}return 0}const T_=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:a}=e;const n=[];for(const l of a){const{id:e}=l,a=s.get(e);if(a){const s=F_(a,t);s>0&&n.push({id:e,data:{droppableContainer:l,value:s}})}}return n.sort(D_)};function z_(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:w_}function M_(e){return function(t){for(var s=arguments.length,a=new Array(s>1?s-1:0),n=1;n<s;n++)a[n-1]=arguments[n];return a.reduce((t,s)=>d(d({},t),{},{top:t.top+e*s.y,bottom:t.bottom+e*s.y,left:t.left+e*s.x,right:t.right+e*s.x}),d({},t))}}const P_=M_(1);function B_(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const R_={ignoreTransform:!1};function L_(e,t){void 0===t&&(t=R_);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:a}=WD(e).getComputedStyle(e);t&&(s=function(e,t,s){const a=B_(t);if(!a)return e;const{scaleX:n,scaleY:l,x:r,y:i}=a,o=e.left-r-(1-n)*parseFloat(s),c=e.top-i-(1-l)*parseFloat(s.slice(s.indexOf(" ")+1)),d=n?e.width/n:e.width,u=l?e.height/l:e.height;return{width:d,height:u,top:c,right:o+d,bottom:c+u,left:o}}(s,t,a))}const{top:a,left:n,width:l,height:r,bottom:i,right:o}=s;return{top:a,left:n,width:l,height:r,bottom:i,right:o}}function I_(e){return L_(e,{ignoreTransform:!0})}function O_(e,t){const s=[];return e?function a(n){if(null!=t&&s.length>=t)return s;if(!n)return s;if(VD(n)&&null!=n.scrollingElement&&!s.includes(n.scrollingElement))return s.push(n.scrollingElement),s;if(!qD(n)||$D(n))return s;if(s.includes(n))return s;const l=WD(e).getComputedStyle(n);return n!==e&&function(e,t){void 0===t&&(t=WD(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const a=t[e];return"string"===typeof a&&s.test(a)})}(n,l)&&s.push(n),function(e,t){return void 0===t&&(t=WD(e).getComputedStyle(e)),"fixed"===t.position}(n,l)?s:a(n.parentNode)}(e):s}function U_(e){const[t]=O_(e,1);return null!=t?t:null}function H_(e){return OD&&e?UD(e)?e:HD(e)?VD(e)||e===GD(e).scrollingElement?window:qD(e)?e:null:null:null}function W_(e){return UD(e)?e.scrollX:e.scrollLeft}function V_(e){return UD(e)?e.scrollY:e.scrollTop}function q_(e){return{x:W_(e),y:V_(e)}}var $_;function G_(e){return!(!OD||!e)&&e===document.scrollingElement}function K_(e){const t={x:0,y:0},s=G_(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-s.width,y:e.scrollHeight-s.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=a.y,isRight:e.scrollLeft>=a.x,maxScroll:a,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}($_||($_={}));const Y_={x:.2,y:.2};function J_(e,t,s,a,n){let{top:l,left:r,right:i,bottom:o}=s;void 0===a&&(a=10),void 0===n&&(n=Y_);
vendor: 1,083 bytes, line 2
2const{isTop:c,isBottom:d,isLeft:u,isRight:m}=K_(e),h={x:0,y:0},x={x:0,y:0},p=t.height*n.y,g=t.width*n.x;return!c&&l<=t.top+p?(h.y=$_.Backward,x.y=a*Math.abs((t.top+p-l)/p)):!d&&o>=t.bottom-p&&(h.y=$_.Forward,x.y=a*Math.abs((t.bottom-p-o)/p)),!m&&i>=t.right-g?(h.x=$_.Forward,x.x=a*Math.abs((t.right-g-i)/g)):!u&&r<=t.left+g&&(h.x=$_.Backward,x.x=a*Math.abs((t.left+g-r)/g)),{direction:h,speed:x}}function Q_(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:s,right:a,bottom:n}=e.getBoundingClientRect();return{top:t,left:s,right:a,bottom:n,width:e.clientWidth,height:e.clientHeight}}function X_(e){return e.reduce((e,t)=>a_(e,q_(t)),w_)}function Z_(e,t){if(void 0===t&&(t=L_),!e)return;const{top:s,left:a,bottom:n,right:l}=t(e);U_(e)&&(n<=0||l<=0||s>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const eS=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+W_(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>
2e+V_(t),0)}]];class tS{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=O_(t),a=X_(s);this.rect=d({},e),this.width=e.width,this.height=e.height;for(const[n,l,r]of eS)for(const e of l)Object.defineProperty(this,e,{get:()=>{const t=r(s),l=a[n]-t;return this.rect[e]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class sS{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,s){var a;null==(a=this.target)||a.addEventListener(e,t,s),this.listeners.push([e,t,s])}}function aS(e,t){const s=Math.abs(e.x),a=Math.abs(e.y);return"number"===typeof t?Math.sqrt(s**2+a**2)>t:"x"in t&&"y"in t?s>t.x&&a>t.y:"x"in t?s>t.x:"y"in t&&a>t.y}var nS,lS;function rS(e){e.preventDefault()}function iS(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(nS||(nS={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(lS||(lS={}));const oS={start:[lS.Space,lS.Enter],cancel:[lS.Esc],end:[lS.Space,lS.Enter,lS.Tab]},cS=(e,t)=>{let{currentCoordinates:s}=t;switch(e.code){case lS.Right:return d(d({},s),{},{x:s.x+25});case lS.Left:return d(d({},s),{},{x:s.x-25});case lS.Down:return d(d({},s),{},{y:s.y+25});case lS.Up:return d(d({},s),{},{y:s.y-25})}};class dS{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new sS(GD(t)),this.windowListeners=new sS(WD(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(nS.Resize,this.handleCancel),this.windowListeners.add(nS.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(nS.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,s=e.node.current;s&&Z_(s),t(w_)}handleKeyDown(e){if(l_(e)){const{active:t,context:s,options:a}=this.props,{keyboardCodes:n=oS,coordinateGetter:l=cS,scrollBehavior:r="smooth"}=a,{code:i}=e;if(n.end.includes(i))return void this.handleEnd(e);if(n.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:o}=s.current,c=o?{x:o.left,y:o.top}:w_;this.referenceCoordinates||(this.referenceCoordinates=c);const d=l(e,{active:t,context:s.current,currentCoordinates:c});if(d){const t=n_(d,c),a={x:0,y:0},{scrollableAncestors:n}=s.current;for(const s of n){const n=e.code,{isTop:l,isRight:i,isLeft:o,isBottom:c,maxScroll:u,minScroll:m}=K_(s),h=Q_(s),x={x:Math.min(n===lS.Right?h.right-h.width/2:h.right,Math.max(n===lS.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(n===lS.Down?h.bottom-h.height/2:h.bottom,Math.max(n===lS.Down?h.top:h.top+h.height/2,d.y))},p=n===lS.Right&&!i||n===lS.Left&&!o,g=n===lS.Down&&!c||n===lS.Up&&!l;if(p&&x.x!==d.x){const e=s.scrollLeft+t.x,l=n===lS.Right&&e<=u.x||n===lS.Left&&e>=m.x;if(l&&!t.y)return void s.scrollTo({left:e,behavior:r});a.x=l?s.scrollLeft-e:n===lS.Right?s.scrollLeft-u.x:s.scrollLeft-m.x,a.x&&s.scrollBy({left:-a.x,behavior:r});break}if(g&&x.y!==d.y){const e=s.scrollTop+t.y,l=n===lS.Down&&e<=u.y||n===lS.Up&&e>=m.y;if(l&&!t.x)return void s.scrollTo({top:e,behavior:r});a.y=l?s.scrollTop-e:n===lS.Down?s.scrollTop-u.y:s.scrollTop-m.y,a.y&&s.scrollBy({top:-a.y,behavior:r});break}}this.handleMove(e,a_(n_(d,this.referenceCoordinates),a))}}}handleMove(e,t){const{onMove:s}=this.props;e.preventDefault(),s(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function uS(e){return Boolean(e&&"distance"in e)}function mS(e){return Boolean(e&&"delay"in e)}dS.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:a=oS,onActivation:n}=t,{active:l}=s;const{code:r}=e.nativeEvent;if(a.start.includes(r)){const t=l.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}return!1}}];class hS{constructor(e,t,s){var a;void 0===s&&(s=function(e){const{EventTarget:t}=WD(e);return e instanceof t?e:GD(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:n}=e,{target:l}=n;this.props=e,this.events=t,this.document=GD(l),this.documentListeners=new sS(this.document),this.listeners=new sS(s),this.windowListeners=new sS(WD(l)),this.initialCoordinates=null!=(a=r_(n))?a:w_,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:s}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(nS.Resize,this.handleCancel),this.windowListeners.add(nS.DragStart,rS),this.windowListeners.add(nS.VisibilityChange,this.handleCancel),this.windowListeners.add(nS.ContextMenu,rS),this.documentListeners.add(nS.Keydown,this.handleKeydown),t){if(null!=s&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();
2if(mS(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(uS(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:s,onPending:a}=this.props;a(s,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(nS.Click,iS,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(nS.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:s,initialCoordinates:a,props:n}=this,{onMove:l,options:{activationConstraint:r}}=n;if(!a)return;const i=null!=(t=r_(e))?t:w_,o=n_(a,i);if(!s&&r){if(uS(r)){if(null!=r.tolerance&&aS(o,r.tolerance))return this.handleCancel();if(aS(o,r.distance))return this.handleStart()}return mS(r)&&aS(o,r.tolerance)?this.handleCancel():void this.handlePending(r,o)}e.cancelable&&e.preventDefault(),l(i)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===lS.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const xS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class pS extends hS{constructor(e){const{event:t}=e,s=GD(t.target);super(e,xS,s)}}pS.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:a}=t;return!(!s.isPrimary||0!==s.button)&&(null==a||a({event:s}),!0)}}];const gS={move:{name:"mousemove"},end:{name:"mouseup"}};var fS;!function(e){e[e.RightClick=2]="RightClick"}(fS||(fS={}));(class extends hS{constructor(e){super(e,gS,GD(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:a}=t;return s.button!==fS.RightClick&&(null==a||a({event:s}),!0)}}];const vS={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var bS,jS;function yS(e){let{acceleration:s,activator:a=bS.Pointer,canScroll:n,draggingRect:l,enabled:r,interval:i=5,order:o=jS.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:m,threshold:h}=e;const x=function(e){let{delta:t,disabled:s}=e;const a=ZD(t);return QD(e=>{if(s||!a||!e)return NS;const n={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[$_.Backward]:e.x[$_.Backward]||-1===n.x,[$_.Forward]:e.x[$_.Forward]||1===n.x},y:{[$_.Backward]:e.y[$_.Backward]||-1===n.y,[$_.Forward]:e.y[$_.Forward]||1===n.y}}},[s,t,a])}({delta:m,disabled:!r}),[p,g]=function(){const e=(0,t.useRef)(null);return[(0,t.useCallback)((t,s)=>{e.current=setInterval(t,s)},[]),(0,t.useCallback)(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),f=(0,t.useRef)({x:0,y:0}),v=(0,t.useRef)({x:0,y:0}),b=(0,t.useMemo)(()=>{switch(a){case bS.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case bS.DraggableRect:return l}},[a,l,c]),j=(0,t.useRef)(null),y=(0,t.useCallback)(()=>{const e=j.current;if(!e)return;const t=f.current.x*v.current.x,s=f.current.y*v.current.y;e.scrollBy(t,s)},[]),N=(0,t.useMemo)(()=>o===jS.TreeOrder?[...d].reverse():d,[o,d]);(0,t.useEffect)(()=>
2{if(r&&d.length&&b){for(const e of N){if(!1===(null==n?void 0:n(e)))continue;const t=d.indexOf(e),a=u[t];if(!a)continue;const{direction:l,speed:r}=J_(e,a,b,s,h);for(const e of["x","y"])x[e][l[e]]||(r[e]=0,l[e]=0);if(r.x>0||r.y>0)return g(),j.current=e,p(y,i),f.current=r,void(v.current=l)}f.current={x:0,y:0},v.current={x:0,y:0},g()}else g()},[s,y,n,g,r,i,JSON.stringify(b),JSON.stringify(x),p,d,N,u,JSON.stringify(h)])}(class extends hS{constructor(e){super(e,vS)}static setup(){return window.addEventListener(vS.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(vS.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:a}=t;const{touches:n}=s;return!(n.length>1)&&(null==a||a({event:s}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(bS||(bS={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(jS||(jS={}));const NS={x:{[$_.Backward]:!1,[$_.Forward]:!1},y:{[$_.Backward]:!1,[$_.Forward]:!1}};var wS,CS;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(wS||(wS={})),function(e){e.Optimized="optimized"}(CS||(CS={}));const kS=new Map;function DS(e,t){return QD(s=>e?s||("function"===typeof t?t(e):e):null,[t,e])}function _S(e){let{callback:s,disabled:a}=e;const n=YD(s),l=(0,t.useMemo)(()=>{if(a||"undefined"===typeof window||"undefined"===typeof window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(n)},[a]);return(0,t.useEffect)(()=>()=>null==l?void 0:l.disconnect(),[l]),l}function SS(e){return new tS(L_(e),e)}function ES(e,s,a){void 0===s&&(s=SS);const[n,l]=(0,t.useState)(null);function r(){l(t=>{if(!e)return null;var n;if(!1===e.isConnected)return null!=(n=null!=t?t:a)?n:null;const l=s(e);return JSON.stringify(t)===JSON.stringify(l)?t:l})}const i=function(e){let{callback:s,disabled:a}=e;const n=YD(s),l=(0,t.useMemo)(()=>{if(a||"undefined"===typeof window||"undefined"===typeof window.MutationObserver)return;const{MutationObserver:e}=window;return new e(n)},[n,a]);return(0,t.useEffect)(()=>()=>null==l?void 0:l.disconnect(),[l]),l}({callback(t){if(e)for(const s of t){const{type:t,target:a}=s;if("childList"===t&&a instanceof HTMLElement&&a.contains(e)){r();break}}}}),o=_S({callback:r});return KD(()=>{r(),e?(null==o||o.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==o||o.disconnect(),null==i||i.disconnect())},[e]),n}const AS=[];function FS(e,s){void 0===s&&(s=[]);const a=(0,t.useRef)(null);return(0,t.useEffect)(()=>{a.current=null},s),(0,t.useEffect)(()=>{const t=e!==w_;t&&!a.current&&(a.current=e),!t&&a.current&&(a.current=null)},[e]),a.current?n_(e,a.current):w_}function TS(e){return(0,t.useMemo)(()=>e?function(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}(e):null,[e])}const zS=[];function MS(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return qD(t)?t:e}const PS=[{sensor:pS,options:{}},{sensor:dS,options:{}}],BS={current:{}},RS={draggable:{measure:I_},droppable:{measure:I_,strategy:wS.WhileDragging,frequency:CS.Optimized},dragOverlay:{measure:L_}};class LS extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,s;return null!=(t=null==(s=this.get(e))?void 0:s.node.current)?t:void 0}}const IS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new LS,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:j_},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:RS,measureDroppableContainers:j_,windowRect:null,measuringScheduled:!1},OS={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:j_,draggableNodes:new Map,over:null,measureDroppableContainers:j_},US=(0,t.createContext)(OS),HS=(0,t.createContext)(IS);function WS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new LS}}}function VS(e,t){switch(t.type){case b_.DragStart:return d(d({},e),{},{draggable:d(d({},e.draggable),{},{initialCoordinates:t.initialCoordinates,active:t.active})});case b_.DragMove:return null==e.draggable.active?e:d(d({},e),{},{draggable:d(d({},e.draggable),{},{translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}})});case b_.DragEnd:case b_.DragCancel:return d(d({},e),{},{draggable:d(d({},e.draggable),{},{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}})});case b_.RegisterDroppable:{const{element:s}=t,{id:a}
2=s,n=new LS(e.droppable.containers);return n.set(a,s),d(d({},e),{},{droppable:d(d({},e.droppable),{},{containers:n})})}case b_.SetDroppableDisabled:{const{id:s,key:a,disabled:n}=t,l=e.droppable.containers.get(s);if(!l||a!==l.key)return e;const r=new LS(e.droppable.containers);return r.set(s,d(d({},l),{},{disabled:n})),d(d({},e),{},{droppable:d(d({},e.droppable),{},{containers:r})})}case b_.UnregisterDroppable:{const{id:s,key:a}=t,n=e.droppable.containers.get(s);if(!n||a!==n.key)return e;const l=new LS(e.droppable.containers);return l.delete(s),d(d({},e),{},{droppable:d(d({},e.droppable),{},{containers:l})})}default:return e}}function qS(e){let{disabled:s}=e;const{active:a,activatorEvent:n,draggableNodes:l}=(0,t.useContext)(US),r=ZD(n),i=ZD(null==a?void 0:a.id);return(0,t.useEffect)(()=>{if(!s&&!n&&r&&null!=i){if(!l_(r))return;if(document.activeElement===r.target)return;const e=l.get(i);if(!e)return;const{activatorNode:t,node:s}=e;if(!t.current&&!s.current)return;requestAnimationFrame(()=>{for(const e of[t.current,s.current]){if(!e)continue;const t=c_(e);if(t){t.focus();break}}})}},[n,s,l,i,r]),null}function $S(e,t){let{transform:s}=t,a=l(t,h_);return null!=e&&e.length?e.reduce((e,t)=>t(d({transform:e},a)),s):s}const GS=(0,t.createContext)(d(d({},w_),{},{scaleX:1,scaleY:1}));var KS;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(KS||(KS={}));const YS=(0,t.memo)(function(e){var s,a,n,r;let{id:i,accessibility:o,autoScroll:c=!0,children:u,sensors:m=PS,collisionDetection:h=T_,measuring:x,modifiers:p}=e,g=l(e,x_);const f=(0,t.useReducer)(VS,void 0,WS),[v,b]=f,[j,y]=function(){const[e]=(0,t.useState)(()=>new Set),s=(0,t.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,t.useCallback)(t=>{let{type:s,event:a}=t;e.forEach(e=>{var t;return null==(t=e[s])?void 0:t.call(e,a)})},[e]),s]}(),[N,w]=(0,t.useState)(KS.Uninitialized),C=N===KS.Initialized,{draggable:{active:k,nodes:D,translate:_},droppable:{containers:S}}=v,E=null!=k?D.get(k):null,A=(0,t.useRef)({initial:null,translated:null}),F=(0,t.useMemo)(()=>{var e;return null!=k?{id:k,data:null!=(e=null==E?void 0:E.data)?e:BS,rect:A}:null},[k,E]),T=(0,t.useRef)(null),[z,M]=(0,t.useState)(null),[P,B]=(0,t.useState)(null),R=JD(g,Object.values(g)),L=t_("DndDescribedBy",i),I=(0,t.useMemo)(()=>S.getEnabled(),[S]),O=(U=x,(0,t.useMemo)(()=>({draggable:d(d({},RS.draggable),null==U?void 0:U.draggable),droppable:d(d({},RS.droppable),null==U?void 0:U.droppable),dragOverlay:d(d({},RS.dragOverlay),null==U?void 0:U.dragOverlay)}),[null==U?void 0:U.draggable,null==U?void 0:U.droppable,null==U?void 0:U.dragOverlay]));var U;const{droppableRects:H,measureDroppableContainers:W,measuringScheduled:V}=function(e,s){let{dragging:a,dependencies:n,config:l}=s;const[r,i]=(0,t.useState)(null),{frequency:o,measure:c,strategy:d}=l,u=(0,t.useRef)(e),m=function(){switch(d){case wS.Always:return!1;case wS.BeforeDragging:return a;default:return!a}}(),h=JD(m),x=(0,t.useCallback)(function(e){void 0===e&&(e=[]),h.current||i(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[h]),p=(0,t.useRef)(null),g=QD(t=>{if(m&&!a)return kS;if(!t||t===kS||u.current!==e||null!=r){const t=new Map;for(let s of e){if(!s)continue;if(r&&r.length>0&&!r.includes(s.id)&&s.rect.current){t.set(s.id,s.rect.current);continue}const e=s.node.current,a=e?new tS(c(e),e):null;s.rect.current=a,a&&t.set(s.id,a)}return t}return t},[e,r,a,m,c]);return(0,t.useEffect)(()=>{u.current=e},[e]),(0,t.useEffect)(()=>{m||x()},[a,m]),(0,t.useEffect)(()=>{r&&r.length>0&&i(null)},[JSON.stringify(r)]),(0,t.useEffect)(()=>{m||"number"!==typeof o||null!==p.current||(p.current=setTimeout(()=>{x(),p.current=null},o))},[o,m,x,...n]),{droppableRects:g,measureDroppableContainers:x,measuringScheduled:null!=r}}(I,{dragging:C,dependencies:[_.x,_.y],config:O.droppable}),q=function(e,t){const s=null!=t?e.get(t):void 0,a=s?s.node.current:null;return QD(e=>{var s;return null==t?null:null!=(s=null!=a?a:e)?s:null},[a,t])}(D,k),$=(0,t.useMemo)(()=>P?r_(P):null,[P]),G=function(){const e=!1===(null==z?void 0:z.autoScrollEnabled),t="object"===typeof c?!1===c.enabled:!1===c,s=C&&!e&&!t;if("object"===typeof c)return d(d({},c),{},{enabled:s});return{enabled:s}}(),K=function(e,t){return DS(e,t)}(q,O.draggable.measure);!function(e){let{activeNode:s,measure:a,initialRect:n,config:l=!0}=e;const r=(0,t.useRef)(!1),{x:i,y:o}="boolean"===typeof l?{x:l,y:l}:l;KD(()=>
2{if(!i&&!o||!s)return void(r.current=!1);if(r.current||!n)return;const e=null==s?void 0:s.node.current;if(!e||!1===e.isConnected)return;const t=z_(a(e),n);if(i||(t.x=0),o||(t.y=0),r.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){const s=U_(e);s&&s.scrollBy({top:t.y,left:t.x})}},[s,i,o,n,a])}({activeNode:null!=k?D.get(k):null,config:G.layoutShiftCompensation,initialRect:K,measure:O.draggable.measure});const Y=ES(q,O.draggable.measure,K),J=ES(q?q.parentElement:null),Q=(0,t.useRef)({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),X=S.getNodeFor(null==(s=Q.current.over)?void 0:s.id),Z=function(e){let{measure:s}=e;const[a,n]=(0,t.useState)(null),l=_S({callback:(0,t.useCallback)(e=>{for(const{target:t}of e)if(qD(t)){n(e=>{const a=s(t);return e?d(d({},e),{},{width:a.width,height:a.height}):a});break}},[s])}),r=(0,t.useCallback)(e=>{const t=MS(e);null==l||l.disconnect(),t&&(null==l||l.observe(t)),n(t?s(t):null)},[s,l]),[i,o]=XD(r);return(0,t.useMemo)(()=>({nodeRef:i,rect:a,setRef:o}),[a,i,o])}({measure:O.dragOverlay.measure}),ee=null!=(a=Z.nodeRef.current)?a:q,te=C?null!=(n=Z.rect)?n:Y:null,se=Boolean(Z.nodeRef.current&&Z.rect),ae=z_(ne=se?null:Y,DS(ne));var ne;const le=TS(ee?WD(ee):null),re=function(e){const s=(0,t.useRef)(e),a=QD(t=>e?t&&t!==AS&&e&&s.current&&e.parentNode===s.current.parentNode?t:O_(e):AS,[e]);return(0,t.useEffect)(()=>{s.current=e},[e]),a}(C?null!=X?X:q:null),ie=function(e,s){void 0===s&&(s=L_);const[a]=e,n=TS(a?WD(a):null),[l,r]=(0,t.useState)(zS);function i(){r(()=>e.length?e.map(e=>G_(e)?n:new tS(s(e),e)):zS)}const o=_S({callback:i});return KD(()=>{null==o||o.disconnect(),i(),e.forEach(e=>null==o?void 0:o.observe(e))},[e]),l}(re),oe=$S(p,{transform:{x:_.x-ae.x,y:_.y-ae.y,scaleX:1,scaleY:1},activatorEvent:P,active:F,activeNodeRect:Y,containerNodeRect:J,draggingNodeRect:te,over:Q.current.over,overlayNodeRect:Z.rect,scrollableAncestors:re,scrollableAncestorRects:ie,windowRect:le}),ce=$?a_($,_):null,de=function(e){const[s,a]=(0,t.useState)(null),n=(0,t.useRef)(e),l=(0,t.useCallback)(e=>{const t=H_(e.target);t&&a(e=>e?(e.set(t,q_(t)),new Map(e)):null)},[]);return(0,t.useEffect)(()=>{const t=n.current;if(e!==t){s(t);const r=e.map(e=>{const t=H_(e);return t?(t.addEventListener("scroll",l,{passive:!0}),[t,q_(t)]):null}).filter(e=>null!=e);a(r.length?new Map(r):null),n.current=e}return()=>{s(e),s(t)};function s(e){e.forEach(e=>{const t=H_(e);null==t||t.removeEventListener("scroll",l)})}},[l,e]),(0,t.useMemo)(()=>e.length?s?Array.from(s.values()).reduce((e,t)=>a_(e,t),w_):X_(e):w_,[e,s])}(re),ue=FS(de),me=FS(de,[Y]),he=a_(oe,ue),xe=te?P_(te,oe):null,pe=F&&xe?h({active:F,collisionRect:xe,droppableRects:H,droppableContainers:I,pointerCoordinates:ce}):null,ge=S_(pe,"id"),[fe,ve]=(0,t.useState)(null),be=function(e,t,s){return d(d({},e),{},{scaleX:t&&s?t.width/s.width:1,scaleY:t&&s?t.height/s.height:1})}(se?oe:a_(oe,me),null!=(r=null==fe?void 0:fe.rect)?r:null,Y),je=(0,t.useRef)(null),ye=(0,t.useCallback)((e,t)=>{let{sensor:s,options:a}=t;if(null==T.current)return;const n=D.get(T.current);if(!n)return;const l=e.nativeEvent,r=new s({active:T.current,activeNode:n,event:l,options:a,context:Q,onAbort(e){if(!D.get(e))return;const{onDragAbort:t}=R.current,s={id:e};null==t||t(s),j({type:"onDragAbort",event:s})},onPending(e,t,s,a){if(!D.get(e))return;const{onDragPending:n}=R.current,l={id:e,constraint:t,initialCoordinates:s,offset:a};null==n||n(l),j({type:"onDragPending",event:l})},onStart(e){const t=T.current;if(null==t)return;const s=D.get(t);if(!s)return;const{onDragStart:a}=R.current,n={activatorEvent:l,active:{id:t,data:s.data,rect:A}};(0,Ts.unstable_batchedUpdates)(()=>{null==a||a(n),w(KS.Initializing),b({type:b_.DragStart,initialCoordinates:e,active:t}),j({type:"onDragStart",event:n}),M(je.current),B(l)})},onMove(e){b({type:b_.DragMove,coordinates:e})},onEnd:i(b_.DragEnd),onCancel:i(b_.DragCancel)});function i(e){return async function(){const{active:t,collisions:s,over:a,scrollAdjustedTranslate:n}=Q.current;let r=null;if(t&&n){const{cancelDrop:i}=R.current;if(r={activatorEvent:l,active:t,collisions:s,delta:n,over:a},e===b_.DragEnd&&"function"===typeof i){await Promise.resolve(i(r))&&(e=b_.DragCancel)}}T.current=null,(0,Ts.unstable_batchedUpdates)(()=>{b({type:e}),w(KS.Uninitialized),ve(null),M(null),B(null),je.current=null;const t=e===b_.DragEnd?"onDragEnd":"onDragCancel";if(r){const e=R.current[t];null==e||e(r),j({type:t,event:r})}})}}je.current=r},[D]),Ne=(0,t.useCallback)((e,t)=>(s,a)=>{const n=s.nativeEvent,l=D.get(a);if(null!==T.current||!l||n.dndKit||n.defaultPrevented)return;const r={active:l};!0===e(s,t.options,r)&&(n.dndKit={capturedBy:t.sensor},T.current=a,ye(s,t))},[D,ye]),we=function(e,s){return(0,t.useMemo)(()=>e.reduce((e,t)=>
2{const{sensor:a}=t;return[...e,...a.activators.map(e=>({eventName:e.eventName,handler:s(e.handler,t)}))]},[]),[e,s])}(m,Ne);!function(e){(0,t.useEffect)(()=>{if(!OD)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(m),KD(()=>{Y&&N===KS.Initializing&&w(KS.Initialized)},[Y,N]),(0,t.useEffect)(()=>{const{onDragMove:e}=R.current,{active:t,activatorEvent:s,collisions:a,over:n}=Q.current;if(!t||!s)return;const l={active:t,activatorEvent:s,collisions:a,delta:{x:he.x,y:he.y},over:n};(0,Ts.unstable_batchedUpdates)(()=>{null==e||e(l),j({type:"onDragMove",event:l})})},[he.x,he.y]),(0,t.useEffect)(()=>{const{active:e,activatorEvent:t,collisions:s,droppableContainers:a,scrollAdjustedTranslate:n}=Q.current;if(!e||null==T.current||!t||!n)return;const{onDragOver:l}=R.current,r=a.get(ge),i=r&&r.rect.current?{id:r.id,rect:r.rect.current,data:r.data,disabled:r.disabled}:null,o={active:e,activatorEvent:t,collisions:s,delta:{x:n.x,y:n.y},over:i};(0,Ts.unstable_batchedUpdates)(()=>{ve(i),null==l||l(o),j({type:"onDragOver",event:o})})},[ge]),KD(()=>{Q.current={activatorEvent:P,active:F,activeNode:q,collisionRect:xe,collisions:pe,droppableRects:H,draggableNodes:D,draggingNode:ee,draggingNodeRect:te,droppableContainers:S,over:fe,scrollableAncestors:re,scrollAdjustedTranslate:he},A.current={initial:te,translated:xe}},[F,q,pe,xe,D,ee,te,H,S,fe,re,he]),yS(d(d({},G),{},{delta:_,draggingRect:xe,pointerCoordinates:ce,scrollableAncestors:re,scrollableAncestorRects:ie}));const Ce=(0,t.useMemo)(()=>({active:F,activeNode:q,activeNodeRect:Y,activatorEvent:P,collisions:pe,containerNodeRect:J,dragOverlay:Z,draggableNodes:D,droppableContainers:S,droppableRects:H,over:fe,measureDroppableContainers:W,scrollableAncestors:re,scrollableAncestorRects:ie,measuringConfiguration:O,measuringScheduled:V,windowRect:le}),[F,q,Y,P,pe,J,Z,D,S,H,fe,W,re,ie,O,V,le]),ke=(0,t.useMemo)(()=>({activatorEvent:P,activators:we,active:F,activeNodeRect:Y,ariaDescribedById:{draggable:L},dispatch:b,draggableNodes:D,over:fe,measureDroppableContainers:W}),[P,we,F,Y,b,L,D,fe,W]);return t.createElement(p_.Provider,{value:y},t.createElement(US.Provider,{value:ke},t.createElement(HS.Provider,{value:Ce},t.createElement(GS.Provider,{value:be},u)),t.createElement(qS,{disabled:!1===(null==o?void 0:o.restoreFocus)})),t.createElement(v_,d(d({},o),{},{hiddenTextDescribedById:L})))}),JS=(0,t.createContext)(null),QS="button";function XS(e){let{id:s,data:a,disabled:n=!1,attributes:l}=e;const r=t_("Draggable"),{activators:i,activatorEvent:o,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:m,over:h}=(0,t.useContext)(US),{role:x=QS,roleDescription:p="draggable",tabIndex:g=0}=null!=l?l:{},f=(null==c?void 0:c.id)===s,v=(0,t.useContext)(f?GS:JS),[b,j]=XD(),[y,N]=XD(),w=function(e,s){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{eventName:a,handler:n}=t;return e[a]=e=>{n(e,s)},e},{}),[e,s])}(i,s),C=JD(a);KD(()=>(m.set(s,{id:s,key:r,node:b,activatorNode:y,data:C}),()=>{const e=m.get(s);e&&e.key===r&&m.delete(s)}),[m,s]);return{active:c,activatorEvent:o,activeNodeRect:d,attributes:(0,t.useMemo)(()=>({role:x,tabIndex:g,"aria-disabled":n,"aria-pressed":!(!f||x!==QS)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable}),[n,x,g,f,p,u.draggable]),isDragging:f,listeners:n?void 0:w,node:b,over:h,setNodeRef:j,setActivatorNodeRef:N,transform:v}}function ZS(){return(0,t.useContext)(HS)}const eE={timeout:25};function tE(e,t,s){const a=e.slice();return a.splice(s<0?a.length+s:s,0,a.splice(t,1)[0]),a}function sE(e,t){return e.reduce((e,s,a)=>{const n=t.get(s);return n&&(e[a]=n),e},Array(e.length))}function aE(e){return null!==e&&e>=0}const nE=e=>{let{rects:t,activeIndex:s,overIndex:a,index:n}=e;const l=tE(t,a,s),r=t[n],i=l[n];return i&&r?{x:i.left-r.left,y:i.top-r.top,scaleX:i.width/r.width,scaleY:i.height/r.height}:null},lE={scaleX:1,scaleY:1},rE=e=>{var t;let{activeIndex:s,activeNodeRect:a,index:n,rects:l,overIndex:r}=e;const i=null!=(t=l[s])?t:a;if(!i)return null;if(n===s){const e=l[r];return e?d({x:0,y:s<r?e.top+e.height-(i.top+i.height):e.top-i.top},lE):null}const o=function(e,t,s){const a=e[t],n=e[t-1],l=e[t+1];if(!a)return 0;if(s<t)return n?a.top-(n.top+n.height):l?l.top-(a.top+a.height):0;return l?l.top-(a.top+a.height):n?a.top-(n.top+n.height):0}(l,n,s);return d(n>s&&n<=r?{x:0,y:-i.height-o}:n<s&&n>=r?{x:0,y:i.height+o}:{x:0,y:0},lE)};
2const iE="Sortable",oE=t.createContext({activeIndex:-1,containerId:iE,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:nE,disabled:{draggable:!1,droppable:!1}});function cE(e){let{children:s,id:a,items:n,strategy:l=nE,disabled:r=!1}=e;const{active:i,dragOverlay:o,droppableRects:c,over:d,measureDroppableContainers:u}=ZS(),m=t_(iE,a),h=Boolean(null!==o.rect),x=(0,t.useMemo)(()=>n.map(e=>"object"===typeof e&&"id"in e?e.id:e),[n]),p=null!=i,g=i?x.indexOf(i.id):-1,f=d?x.indexOf(d.id):-1,v=(0,t.useRef)(x),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}(x,v.current),j=-1!==f&&-1===g||b,y=function(e){return"boolean"===typeof e?{draggable:e,droppable:e}:e}(r);KD(()=>{b&&p&&u(x)},[b,x,p,u]),(0,t.useEffect)(()=>{v.current=x},[x]);const N=(0,t.useMemo)(()=>({activeIndex:g,containerId:m,disabled:y,disableTransforms:j,items:x,overIndex:f,useDragOverlay:h,sortedRects:sE(x,c),strategy:l}),[g,m,y.draggable,y.droppable,j,x,f,c,h,l]);return t.createElement(oE.Provider,{value:N},s)}const dE=e=>{let{id:t,items:s,activeIndex:a,overIndex:n}=e;return tE(s,a,n).indexOf(t)},uE=e=>{let{containerId:t,isSorting:s,wasDragging:a,index:n,items:l,newIndex:r,previousItems:i,previousContainerId:o,transition:c}=e;return!(!c||!a)&&((i===l||n!==r)&&(!!s||r!==n&&t===o))},mE={duration:200,easing:"ease"},hE="transform",xE=i_.Transition.toString({property:hE,duration:0,easing:"linear"}),pE={roleDescription:"sortable"};function gE(e){let{animateLayoutChanges:s=uE,attributes:a,disabled:n,data:l,getNewIndex:r=dE,id:i,strategy:o,resizeObserverConfig:c,transition:u=mE}=e;const{items:m,containerId:h,activeIndex:x,disabled:p,disableTransforms:g,sortedRects:f,overIndex:v,useDragOverlay:b,strategy:j}=(0,t.useContext)(oE),y=function(e,t){var s,a;if("boolean"===typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(s=null==e?void 0:e.draggable)?s:t.draggable,droppable:null!=(a=null==e?void 0:e.droppable)?a:t.droppable}}(n,p),N=m.indexOf(i),w=(0,t.useMemo)(()=>d({sortable:{containerId:h,index:N,items:m}},l),[h,l,N,m]),C=(0,t.useMemo)(()=>m.slice(m.indexOf(i)),[m,i]),{rect:k,node:D,isOver:_,setNodeRef:S}=function(e){let{data:s,disabled:a=!1,id:n,resizeObserverConfig:l}=e;const r=t_("Droppable"),{active:i,dispatch:o,over:c,measureDroppableContainers:u}=(0,t.useContext)(US),m=(0,t.useRef)({disabled:a}),h=(0,t.useRef)(!1),x=(0,t.useRef)(null),p=(0,t.useRef)(null),{disabled:g,updateMeasurementsFor:f,timeout:v}=d(d({},eE),l),b=JD(null!=f?f:n),j=_S({callback:(0,t.useCallback)(()=>{h.current?(null!=p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),p.current=null},v)):h.current=!0},[v]),disabled:g||!i}),y=(0,t.useCallback)((e,t)=>{j&&(t&&(j.unobserve(t),h.current=!1),e&&j.observe(e))},[j]),[N,w]=XD(y),C=JD(s);return(0,t.useEffect)(()=>{j&&N.current&&(j.disconnect(),h.current=!1,j.observe(N.current))},[N,j]),(0,t.useEffect)(()=>(o({type:b_.RegisterDroppable,element:{id:n,key:r,disabled:a,node:N,rect:x,data:C}}),()=>o({type:b_.UnregisterDroppable,key:r,id:n})),[n]),(0,t.useEffect)(()=>{a!==m.current.disabled&&(o({type:b_.SetDroppableDisabled,id:n,key:r,disabled:a}),m.current.disabled=a)},[n,r,a,o]),{active:i,rect:x,isOver:(null==c?void 0:c.id)===n,node:N,over:c,setNodeRef:w}}({id:i,data:w,disabled:y.droppable,resizeObserverConfig:d({updateMeasurementsFor:C},c)}),{active:E,activatorEvent:A,activeNodeRect:F,attributes:T,setNodeRef:z,listeners:M,isDragging:P,over:B,setActivatorNodeRef:R,transform:L}=XS({id:i,data:w,attributes:d(d({},pE),a),disabled:y.draggable}),I=function(){for(var e=arguments.length,s=new Array(e),a=0;a<e;a++)s[a]=arguments[a];return(0,t.useMemo)(()=>e=>{s.forEach(t=>t(e))},s)}(S,z),O=Boolean(E),U=O&&!g&&aE(x)&&aE(v),H=!b&&P,W=H&&U?L:null,V=U?null!=W?W:(null!=o?o:j)({rects:f,activeNodeRect:F,activeIndex:x,overIndex:v,index:N}):null,q=aE(x)&&aE(v)?r({id:i,items:m,activeIndex:x,overIndex:v}):N,$=null==E?void 0:E.id,G=(0,t.useRef)({activeId:$,items:m,newIndex:q,containerId:h}),K=m!==G.current.items,Y=s({active:E,containerId:h,isDragging:P,isSorting:O,id:i,index:N,items:m,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:u,wasDragging:null!=G.current.activeId}),J=function(e){let{disabled:s,index:a,node:n,rect:l}=e;const[r,i]=(0,t.useState)(null),o=(0,t.useRef)(a);return KD(()=>
2{if(!s&&a!==o.current&&n.current){const e=l.current;if(e){const t=L_(n.current,{ignoreTransform:!0}),s={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(s.x||s.y)&&i(s)}}a!==o.current&&(o.current=a)},[s,a,n,l]),(0,t.useEffect)(()=>{r&&i(null)},[r]),r}({disabled:!Y,index:N,node:D,rect:k});return(0,t.useEffect)(()=>{O&&G.current.newIndex!==q&&(G.current.newIndex=q),h!==G.current.containerId&&(G.current.containerId=h),m!==G.current.items&&(G.current.items=m)},[O,q,h,m]),(0,t.useEffect)(()=>{if($===G.current.activeId)return;if(null!=$&&null==G.current.activeId)return void(G.current.activeId=$);const e=setTimeout(()=>{G.current.activeId=$},50);return()=>clearTimeout(e)},[$]),{active:E,activeIndex:x,attributes:T,data:w,rect:k,index:N,newIndex:q,items:m,isOver:_,isSorting:O,isDragging:P,listeners:M,node:D,overIndex:v,over:B,setNodeRef:I,setActivatorNodeRef:R,setDroppableNodeRef:S,setDraggableNodeRef:z,transform:null!=J?J:V,transition:function(){if(J||K&&G.current.newIndex===N)return xE;if(H&&!l_(A)||!u)return;if(O||Y)return i_.Transition.toString(d(d({},u),{},{property:hE}));return}()}}function fE(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"===typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const vE=[lS.Down,lS.Right,lS.Up,lS.Left],bE=(e,t)=>{let{context:{active:s,collisionRect:a,droppableRects:n,droppableContainers:l,over:r,scrollableAncestors:i}}=t;if(vE.includes(e.code)){if(e.preventDefault(),!s||!a)return;const t=[];l.getEnabled().forEach(s=>{if(!s||null!=s&&s.disabled)return;const l=n.get(s.id);if(l)switch(e.code){case lS.Down:a.top<l.top&&t.push(s);break;case lS.Up:a.top>l.top&&t.push(s);break;case lS.Left:a.left>l.left&&t.push(s);break;case lS.Right:a.left<l.left&&t.push(s)}});const o=(e=>{let{collisionRect:t,droppableRects:s,droppableContainers:a}=e;const n=__(t),l=[];for(const r of a){const{id:e}=r,t=s.get(e);if(t){const s=__(t),a=n.reduce((e,t,a)=>e+C_(s[a],t),0),i=Number((a/4).toFixed(4));l.push({id:e,data:{droppableContainer:r,value:i}})}}return l.sort(k_)})({active:s,collisionRect:a,droppableRects:n,droppableContainers:t,pointerCoordinates:null});let c=S_(o,"id");if(c===(null==r?void 0:r.id)&&o.length>1&&(c=o[1].id),null!=c){const e=l.get(s.id),t=l.get(c),r=t?n.get(t.id):null,o=null==t?void 0:t.node.current;if(o&&r&&e&&t){const s=O_(o).some((e,t)=>i[t]!==e),n=jE(e,t),l=function(e,t){if(!fE(e)||!fE(t))return!1;if(!jE(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=s||!n?{x:0,y:0}:{x:l?a.width-r.width:0,y:l?a.height-r.height:0},d={x:r.left,y:r.top};return c.x&&c.y?d:n_(d,c)}}}};function jE(e,t){return!(!fE(e)||!fE(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const yE=Vl("grip-vertical",[["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"}]]),NE=Vl("panels-top-left",[["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"}]]),wE=Vl("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"}]]),CE=Vl("bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]),kE=Vl("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),DE=Vl("mail-x",[["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"}]]),_E=Vl("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),SE=Vl("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"}]]),EE=Vl("mouse-pointer-click",[["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.
2074z",key:"s0h3yz"}]]),AE=Vl("grid-3x3",[["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"}]]),FE=Vl("layout-panel-left",[["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"}]]),TE=Vl("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"}]]),zE=Vl("sliders-horizontal",[["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"}]]),ME=Vl("layout-panel-top",[["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"}]]),PE=Vl("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"}]]),BE=Vl("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"}]]),RE=Vl("message-square-quote",[["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"}]]),LE=Vl("monitor-play",[["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"}]]),IE=Vl("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"}]]),OE=Vl("file-code",[["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"}]]),UE=Vl("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"}]]),HE=Vl("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"}]]);var WE=s(461);function VE(e){this.content=e}VE.prototype={constructor:VE,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,s){var a=s&&s!=e?this.remove(s):this,n=a.find(e),l=a.content.slice();return-1==n?l.push(s||e,t):(l[n+1]=t,s&&(l[n]=s)),new VE(l)},remove:function(e){var t=this.find(e);if(-1==t)return this;var s=this.content.slice();return s.splice(t,2),new VE(s)},addToStart:function(e,t){return new VE([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var s=this.remove(e).content.slice();return s.push(e,t),new VE(s)},addBefore:function(e,t,s){var a=this.remove(t),n=a.content.slice(),l=a.find(e);return n.splice(-1==l?n.length:l,0,t,s),new VE(n)}
vendor: 8,890 bytes, line 2
2,forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=VE.from(e)).size?new VE(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=VE.from(e)).size?new VE(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=VE.from(e);for(var s=0;s<e.content.length;s+=2)t=t.remove(e.content[s]);return t},toObject:function(){var e={};return this.forEach(function(t,s){e[t]=s}),e},get size(){return this.content.length>>1}},VE.from=function(e){if(e instanceof VE)return e;var t=[];if(e)for(var s in e)t.push(s,e[s]);return new VE(t)};const qE=VE;function $E(e,t,s){for(let a=0;;a++){if(a==e.childCount||a==t.childCount)return e.childCount==t.childCount?null:s;let n=e.child(a),l=t.child(a);if(n!=l){if(!n.sameMarkup(l))return s;if(n.isText&&n.text!=l.text){for(let e=0;n.text[e]==l.text[e];e++)s++;return s}if(n.content.size||l.content.size){let e=$E(n.content,l.content,s+1);if(null!=e)return e}s+=n.nodeSize}else s+=n.nodeSize}}function GE(e,t,s,a){for(let n=e.childCount,l=t.childCount;;){if(0==n||0==l)return n==l?null:{a:s,b:a};let r=e.child(--n),i=t.child(--l),o=r.nodeSize;if(r!=i){if(!r.sameMarkup(i))return{a:s,b:a};if(r.isText&&r.text!=i.text){let e=0,t=Math.min(r.text.length,i.text.length);for(;e<t&&r.text[r.text.length-e-1]==i.text[i.text.length-e-1];)e++,s--,a--;return{a:s,b:a}}if(r.content.size||i.content.size){let e=GE(r.content,i.content,s-1,a-1);if(e)return e}s-=o,a-=o}else s-=o,a-=o}}class KE{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let s=0;s<e.length;s++)this.size+=e[s].nodeSize}nodesBetween(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0;for(let l=0,r=0;r<t;l++){let i=this.content[l],o=r+i.nodeSize;if(o>e&&!1!==s(i,a+r,n||null,l)&&i.content.size){let n=r+1;i.nodesBetween(Math.max(0,e-n),Math.min(i.content.size,t-n),s,a+n)}r=o}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,s,a){let n="",l=!0;return this.nodesBetween(e,t,(r,i)=>{let o=r.isText?r.text.slice(Math.max(e,i)-i,t-i):r.isLeaf?a?"function"===typeof a?a(r):a:r.type.spec.leafText?r.type.spec.leafText(r):"":"";r.isBlock&&(r.isLeaf&&o||r.isTextblock)&&s&&(l?l=!1:n+=s),n+=o},0),n}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,s=e.firstChild,a=this.content.slice(),n=0;for(t.isText&&t.sameMarkup(s)&&(a[a.length-1]=t.withText(t.text+s.text),n=1);n<e.content.length;n++)a.push(e.content[n]);return new KE(a,this.size+e.size)}cut(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==e&&t==this.size)return this;let s=[],a=0;if(t>e)for(let n=0,l=0;l<t;n++){let r=this.content[n],i=l+r.nodeSize;i>e&&((l<e||i>t)&&(r=r.isText?r.cut(Math.max(0,e-l),Math.min(r.text.length,t-l)):r.cut(Math.max(0,e-l-1),Math.min(r.content.size,t-l-1))),s.push(r),a+=r.nodeSize),l=i}return new KE(s,a)}cutByIndex(e,t){return e==t?KE.empty:0==e&&t==this.content.length?this:new KE(this.content.slice(e,t))}replaceChild(e,t){let s=this.content[e];if(s==t)return this;let a=this.content.slice(),n=this.size+t.nodeSize-s.nodeSize;return a[e]=t,new KE(a,n)}addToStart(e){return new KE([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new KE(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,s=0;t<this.content.length;t++){let a=this.content[t];e(a,s,t),s+=a.nodeSize}}findDiffStart(e){return $E(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}findDiffEnd(e){return GE(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size)}findIndex(e){if(0==e)return JE(0,e);if(e==this.size)return JE(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(let t=0,s=0;;t++){let a=s+this.child(t).nodeSize;if(a>=e)return a==e?JE(t+1,a):JE(t,s);s=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return KE.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new KE(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return KE.empty;let t,s=0;for(let a=0;a<e.length;a++){let n=e[a];s+=n.nodeSize,a&&n.isText&&e[a-1].sameMarkup(n)?(t||(t=e.slice(0,a)),t[t.length-1]=n.withText(t[t.length-1].text+n.text)):t&&t.push(n)}return new KE(t||e,s)}static from(e){if(!e)return KE.empty;if(e instanceof KE)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new KE([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}KE.empty=new KE([],0);const YE={index:0,offset:0};function JE(e,t){return YE.index=e,YE.offset=t,YE}function QE(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let s=Array.isArray(e);if(Array.isArray(t)!=s)return!1;if(s){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!QE(e[s],t[s]))return!1}else{for(let s in e)if(!(s in t)||!QE(e[s],t[s]))return!1;for(let s in t)if(!(s in e))return!1}return!0}class XE{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,s=!1;for(let a=0;a<e.length;a++){let n=e[a];if(this.eq(n))return e;if(this.type.excludes(n.type))t||(t=e.slice(0,a));else{if(n.type.excludes(this.type))return e;!s&&n.type.rank>this.type.rank&&(t||(t=e.slice(0,a)),t.push(this),s=!0),t&&t.push(n)}}return t||(t=e.slice()),s||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&QE(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let s=e.marks[t.type];if(!s)throw new RangeError("There is no mark type ".concat(t.type," in this schema"));let a=s.create(t.attrs);return s.checkAttrs(a.attrs),a}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!e[s].eq(t[s]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return XE.none;if(e instanceof XE)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}XE.none=[];class ZE extends Error{}class eA{constructor(e,t,s){this.content=e,this.openStart=t,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let s=sA(this.content,e+this.openStart,t);return s&&new eA(s,this.openStart,this.openEnd)}removeBetween(e,t){return new eA(tA(this.content,e+this.openStart,t+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,t){if(!t)return eA.empty;let s=t.openStart||0,a=t.openEnd||0;if("number"!=typeof s||"number"!=typeof a)throw new RangeError("Invalid input for Slice.fromJSON");return new eA(KE.fromJSON(e,t.content),s,a)}static maxOpen(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=0,a=0;for(let n=e.firstChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.firstChild)s++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)a++;return new eA(e,s,a)}}function tA(e,t,s){let{index:a,offset:n}=e.findIndex(t),l=e.maybeChild(a),{index:r,offset:i}=e.findIndex(s);if(n==t||l.isText){if(i!=s&&!e.child(r).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(s))}if(a!=r)throw new RangeError("Removing non-flat range");return e.replaceChild(a,l.copy(tA(l.content,t-n-1,s-n-1)))}function sA(e,t,s,a){let{index:n,offset:l}=e.findIndex(t),r=e.maybeChild(n);if(l==t||r.isText)return a&&!a.canReplace(n,n,s)?null:e.cut(0,t).append(s).append(e.cut(t));let i=sA(r.content,t-l-1,s,r);return i&&e.replaceChild(n,r.copy(i))}function aA(e,t,s){if(s.openStart>
vendor: 14,390 bytes, line 2
2e.depth)throw new ZE("Inserted content deeper than insertion position");if(e.depth-s.openStart!=t.depth-s.openEnd)throw new ZE("Inconsistent open depths");return nA(e,t,s,0)}function nA(e,t,s,a){let n=e.index(a),l=e.node(a);if(n==t.index(a)&&a<e.depth-s.openStart){let r=nA(e,t,s,a+1);return l.copy(l.content.replaceChild(n,r))}if(s.content.size){if(s.openStart||s.openEnd||e.depth!=a||t.depth!=a){let{start:n,end:r}=function(e,t){let s=t.depth-e.openStart,a=t.node(s).copy(e.content);for(let n=s-1;n>=0;n--)a=t.node(n).copy(KE.from(a));return{start:a.resolveNoCache(e.openStart+s),end:a.resolveNoCache(a.content.size-e.openEnd-s)}}(s,e);return cA(l,dA(e,n,r,t,a))}{let a=e.parent,n=a.content;return cA(a,n.cut(0,e.parentOffset).append(s.content).append(n.cut(t.parentOffset)))}}return cA(l,uA(e,t,a))}function lA(e,t){if(!t.type.compatibleContent(e.type))throw new ZE("Cannot join "+t.type.name+" onto "+e.type.name)}function rA(e,t,s){let a=e.node(s);return lA(a,t.node(s)),a}function iA(e,t){let s=t.length-1;s>=0&&e.isText&&e.sameMarkup(t[s])?t[s]=e.withText(t[s].text+e.text):t.push(e)}function oA(e,t,s,a){let n=(t||e).node(s),l=0,r=t?t.index(s):n.childCount;e&&(l=e.index(s),e.depth>s?l++:e.textOffset&&(iA(e.nodeAfter,a),l++));for(let i=l;i<r;i++)iA(n.child(i),a);t&&t.depth==s&&t.textOffset&&iA(t.nodeBefore,a)}function cA(e,t){return e.type.checkContent(t),e.copy(t)}function dA(e,t,s,a,n){let l=e.depth>n&&rA(e,t,n+1),r=a.depth>n&&rA(s,a,n+1),i=[];return oA(null,e,n,i),l&&r&&t.index(n)==s.index(n)?(lA(l,r),iA(cA(l,dA(e,t,s,a,n+1)),i)):(l&&iA(cA(l,uA(e,t,n+1)),i),oA(t,s,n,i),r&&iA(cA(r,uA(s,a,n+1)),i)),oA(a,null,n,i),new KE(i)}function uA(e,t,s){let a=[];if(oA(null,e,s,a),e.depth>s){iA(cA(rA(e,t,s+1),uA(e,t,s+1)),a)}return oA(t,null,s,a),new KE(a)}eA.empty=new eA(KE.empty,0,0);class mA{constructor(e,t,s){this.pos=e,this.path=t,this.parentOffset=s,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let s=this.pos-this.path[this.path.length-1],a=e.child(t);return s?e.child(t).cut(s):a}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let s=this.path[3*t],a=0==t?0:this.path[3*t-1]+1;for(let n=0;n<e;n++)a+=s.child(n).nodeSize;return a}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return XE.none;if(this.textOffset)return e.child(t).marks;let s=e.maybeChild(t-1),a=e.maybeChild(t);if(!s){let e=s;s=a,a=e}let n=s.marks;for(var l=0;l<n.length;l++)!1!==n[l].type.spec.inclusive||a&&n[l].isInSet(a.marks)||(n=n[l--].removeFromSet(n));return n}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let s=t.marks,a=e.parent.maybeChild(e.index());for(var n=0;n<s.length;n++)!1!==s[n].type.spec.inclusive||a&&s[n].isInSet(a.marks)||(s=s[n--].removeFromSet(s));return s}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(let s=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);s>=0;s--)if(e.pos<=this.end(s)&&(!t||t(this.node(s))))return new gA(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<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let s=[],a=0,n=t;for(let l=e;;){let{index:e,offset:t}=l.content.findIndex(n),r=n-t;if(s.push(l,e,a+t),!r)break;if(l=l.child(e),l.isText)break;n=r-1,a+=t+1}return new mA(t,s,n)}static resolveCached(e,t){let s=pA.get(e);if(s)for(let n=0;n<s.elts.length;n++){let e=s.elts[n];if(e.pos==t)return e}else pA.set(e,s=new hA);let a=s.elts[s.i]=mA.resolve(e,t);return s.i=(s.i+1)%xA,a}}class hA{constructor(){this.elts=[],this.i=0}}const xA=12,pA=new WeakMap;class gA{constructor(e,t,s){this.$from=e,this.$to=t,this.depth=s}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const fA=Object.create(null);class vA{constructor(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:XE.none;this.type=e,this.attrs=t,this.marks=a,this.content=s||KE.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(e,t,s,a,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,s,a){return this.content.textBetween(e,t,s,a)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,s){return this.type==e&&QE(this.attrs,t||e.defaultAttrs||fA)&&XE.sameSet(this.marks,s||XE.none)}copy(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e==this.content?this:new vA(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vA(this.type,this.attrs,this.content,e)}cut(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e==t)return eA.empty;let a=this.resolve(e),n=this.resolve(t),l=s?0:a.sharedDepth(t),r=a.start(l),i=a.node(l).content.cut(a.pos-r,n.pos-r);return new eA(i,a.depth-l,n.depth-l)}replace(e,t,s){return aA(this.resolve(e),this.resolve(t),s)}nodeAt(e){for(let t=this;;){let{index:s,offset:a}=t.content.findIndex(e);if(t=t.maybeChild(s),!t)return null;if(a==e||t.isText)return t;e-=a+1}}childAfter(e){let{index:t,offset:s}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:s}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:s}=this.content.findIndex(e);if(s<e)return{node:this.content.child(t),index:t,offset:s};let a=this.content.child(t-1);return{node:a,index:t-1,offset:s-a.nodeSize}}resolve(e){return mA.resolveCached(this,e)}resolveNoCache(e){return mA.resolve(this,e)}rangeHasMark(e,t,s){let a=!1;return t>e&&this.nodesBetween(e,t,e=>(s.isInSet(e.marks)&&(a=!0),!a)),a}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),jA(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:KE.empty,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:s.childCount,l=this.contentMatchAt(e).matchFragment(s,a,n),r=l&&l.matchFragment(this.content,t);if(!r||!r.validEnd)return!1;for(let i=a;i<n;i++)if(!this.type.allowsMarks(s.child(i).marks))return!1;return!0}canReplaceWith(e,t,s,a){if(a&&!this.type.allowsMarks(a))return!1;let n=this.contentMatchAt(e).matchType(s),l=n&&n.matchFragment(this.content,t);return!!l&&l.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=XE.none;for(let t=0;t<this.marks.length;t++){let s=this.marks[t];s.type.checkAttrs(s.attrs),e=s.addToSet(e)}if(!XE.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map(e=>e.type.name)));this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let s;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,s)}let a=KE.fromJSON(e,t.content),n=e.nodeType(t.type).create(t.attrs,a,s);return n.type.checkAttrs(n.attrs),n}}vA.prototype.text=void 0;class bA extends vA{constructor(e,t,s,a){if(super(e,t,null,a),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):jA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bA(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bA(this.type,this.attrs,e,this.marks)}cut(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function jA(e,t){for(let s=e.length-1;s>=0;s--)t=e[s].type.name+"("+t+")";return t}class yA{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let s=new NA(e,t);if(null==s.next)return yA.empty;let a=wA(s);s.next&&s.err("Unexpected trailing text");let n=function(e){let t=Object.create(null);return s(EA(e,0));function s(a){let n=[];a.forEach(t=>{e[t].forEach(t=>{let s,{term:a,to:l}=t;if(a){for(let e=0;e<n.length;e++)n[e][0]==a&&(s=n[e][1]);EA(e,l).forEach(e=>{s||n.push([a,s=[]]),-1==s.indexOf(e)&&s.push(e)})}})});let l=t[a.join(",")]=new yA(a.indexOf(e.length-1)>-1);for(let e=0;e<n.length;e++){let a=n[e][1].sort(SA);l.next.push({type:n[e][0],next:t[a.join(",")]||s(a)})}return l}}(function(e){let t=[[]];return n(l(e,0),s()),t;function s(){return t.push([])-1}function a(e,s,a){let n={term:a,to:s};return t[e].push(n),n}function n(e,t){e.forEach(e=>e.to=t)}function l(e,t){if("choice"==e.type)return e.exprs.reduce((e,s)=>e.concat(l(s,t)),[]);if("seq"!=e.type){if("star"==e.type){let r=s();return a(t,r),n(l(e.expr,r),r),[a(r)]}if("plus"==e.type){let r=s();return n(l(e.expr,t),r),n(l(e.expr,r),r),[a(r)]}if("opt"==e.type)return[a(t)].concat(l(e.expr,t));if("range"==e.type){let r=t;for(let t=0;t<e.min;t++){let t=s();n(l(e.expr,r),t),r=t}if(-1==e.max)n(l(e.expr,r),r);else for(let t=e.min;t<e.max;t++){let t=s();a(r,t),n(l(e.expr,r),t),r=t}return[a(r)]}if("name"==e.type)return[a(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let a=0;;a++){let r=l(e.exprs[a],t);if(a==e.exprs.length-1)return r;n(r,t=s())}}}(a));return function(e,t){for(let s=0,a=[e];s<a.length;s++){let e=a[s],n=!e.validEnd,l=[];for(let t=0;t<e.next.length;t++){let{type:s,next:r}=e.next[t];l.push(s.name),!n||s.isText||s.hasRequiredAttrs()||(n=!1),-1==a.indexOf(r)&&a.push(r)}n&&t.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(n,s),n}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.childCount,a=this;for(let n=t;a&&n<s;n++)a=a.matchType(e.child(n).type);return a}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let s=0;s<e.next.length;s++)if(this.next[t].type==e.next[s].type)return!0;return!1}fillBefore(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=[this];return function n(l,r){let i=l.matchFragment(e,s);if(i&&(!t||i.validEnd))return KE.from(r.map(e=>e.createAndFill()));for(let e=0;e<l.next.length;e++){let{type:t,next:s}=l.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==a.indexOf(s)){a.push(s);let e=n(s,r.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let s=0;s<this.wrapCache.length;
vendor: 5,377 bytes, line 2
2s+=2)if(this.wrapCache[s]==e)return this.wrapCache[s+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),s=[{match:this,type:null,via:null}];for(;s.length;){let a=s.shift(),n=a.match;if(n.matchType(e)){let e=[];for(let t=a;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<n.next.length;e++){let{type:l,next:r}=n.next[e];l.isLeaf||l.hasRequiredAttrs()||l.name in t||a.type&&!r.validEnd||(s.push({match:l.contentMatch,type:l,via:a}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}toString(){let e=[];return function t(s){e.push(s);for(let a=0;a<s.next.length;a++)-1==e.indexOf(s.next[a].next)&&t(s.next[a].next)}(this),e.map((t,s)=>{let a=s+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)a+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return a}).join("\n")}}yA.empty=new yA(!0);class NA{constructor(e,t){this.string=e,this.nodeTypes=t,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 wA(e){let t=[];do{t.push(CA(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function CA(e){let t=[];do{t.push(kA(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function kA(e){let t=function(e){if(e.eat("(")){let t=wA(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let s=e.nodeTypes,a=s[t];if(a)return[a];let n=[];for(let l in s){let e=s[l];e.isInGroup(t)&&n.push(e)}0==n.length&&e.err("No node type or group '"+t+"' found");return n}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=_A(e,t)}return t}function DA(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function _A(e,t){let s=DA(e),a=s;return e.eat(",")&&(a="}"!=e.next?DA(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:s,max:a,expr:t}}function SA(e,t){return t-e}function EA(e,t){let s=[];return function t(a){let n=e[a];if(1==n.length&&!n[0].term)return t(n[0].to);s.push(a);for(let e=0;e<n.length;e++){let{term:a,to:l}=n[e];a||-1!=s.indexOf(l)||t(l)}}(t),s.sort(SA)}function AA(e){let t=Object.create(null);for(let s in e){let a=e[s];if(!a.hasDefault)return null;t[s]=a.default}return t}function FA(e,t){let s=Object.create(null);for(let a in e){let n=t&&t[a];if(void 0===n){let t=e[a];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+a);n=t.default}s[a]=n}return s}function TA(e,t,s,a){for(let n in t)if(!(n in e))throw new RangeError("Unsupported attribute ".concat(n," for ").concat(s," of type ").concat(n));for(let n in e){let s=e[n];s.validate&&s.validate(t[n])}}function zA(e,t){let s=Object.create(null);if(t)for(let a in t)s[a]=new PA(e,a,t[a]);return s}class MA{constructor(e,t,s){this.name=e,this.schema=t,this.spec=s,this.markSet=null,this.groups=s.group?s.group.split(" "):[],this.attrs=zA(e,s.attrs),this.defaultAttrs=AA(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(s.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yA.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-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:FA(this.attrs,e)}create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,s=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new vA(this,this.computeAttrs(e),KE.from(t),XE.setFrom(s))}createChecked(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,s=arguments.length>2?arguments[2]:void 0;return t=KE.from(t),this.checkContent(t),new vA(this,this.computeAttrs(e),t,XE.setFrom(s))}createAndFill(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,s=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),t=KE.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let a=this.contentMatch.matchFragment(t),n=a&&a.fillBefore(KE.empty,!0);return n?new vA(this,e,t.append(n),XE.setFrom(s)):null}validContent(e){let t=this.contentMatch.matchFragment(e);
2if(!t||!t.validEnd)return!1;for(let s=0;s<e.childCount;s++)if(!this.allowsMarks(e.child(s).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(e.toString().slice(0,50)))}checkAttrs(e){TA(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let s=0;s<e.length;s++)this.allowsMarkType(e[s].type)?t&&t.push(e[s]):t||(t=e.slice(0,s));return t?t.length?t:XE.none:e}static compile(e,t){let s=Object.create(null);e.forEach((e,a)=>s[e]=new MA(e,t,a));let a=t.spec.topNode||"doc";if(!s[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let n in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}}class PA{constructor(e,t,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate="string"==typeof s.validate?function(e,t,s){let a=s.split("|");return s=>{let n=null===s?"null":typeof s;if(a.indexOf(n)<0)throw new RangeError("Expected value of type ".concat(a," for attribute ").
vendor: 4,230 bytes, line 2
2concat(t," on type ").concat(e,", got ").concat(n))}}(e,t,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class BA{constructor(e,t,s,a){this.name=e,this.rank=t,this.schema=s,this.spec=a,this.attrs=zA(e,a.attrs),this.excluded=null;let n=AA(this.attrs);this.instance=n?new XE(this,n):null}create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!e&&this.instance?this.instance:new XE(this,FA(this.attrs,e))}static compile(e,t){let s=Object.create(null),a=0;return e.forEach((e,n)=>s[e]=new BA(e,a++,t,n)),s}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){TA(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class RA{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let a in e)t[a]=e[a];t.nodes=qE.from(e.nodes),t.marks=qE.from(e.marks||{}),this.nodes=MA.compile(this.spec.nodes,this),this.marks=BA.compile(this.spec.marks,this);let s=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let e=this.nodes[a],t=e.spec.content||"",n=e.spec.marks;if(e.contentMatch=s[t]||(s[t]=yA.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==n?null:n?LA(this,n.split(" ")):""!=n&&e.inlineContent?null:[]}for(let a in this.marks){let e=this.marks[a],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:LA(this,t.split(" "))}this.nodeFromJSON=e=>vA.fromJSON(this,e),this.markFromJSON=e=>XE.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof MA))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,s,a)}text(e,t){let s=this.nodes.text;return new bA(s,s.defaultAttrs,e,XE.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function LA(e,t){let s=[];for(let a=0;a<t.length;a++){let n=t[a],l=e.marks[n],r=l;if(l)s.push(l);else for(let t in e.marks){let a=e.marks[t];("_"==n||a.spec.group&&a.spec.group.split(" ").indexOf(n)>-1)&&s.push(r=a)}if(!r)throw new SyntaxError("Unknown mark type: '"+t[a]+"'")}return s}class IA{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let s=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];s.indexOf(t)<0&&s.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let s=e.nodes[t.node];return s.contentMatch.matchType(s)})}parse(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=new qA(this,t,!1);return s.addAll(e,XE.none,t.from,t.to),s.finish()}parseSlice(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=new qA(this,t,!0);return s.addAll(e,XE.none,t.from,t.to),eA.maxOpen(s.finish())}matchTag(e,t,s){for(let a=s?this.tags.indexOf(s)+1:0;a<this.tags.length;a++){let s=this.tags[a];if($A(e,s.tag)&&(void 0===s.namespace||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let t=s.getAttrs(e);if(!1===t)continue;s.attrs=t||void 0}return s}}}matchStyle(e,t,s,a){for(let n=a?this.styles.indexOf(a)+1:0;n<this.styles.length;n++){let a=this.styles[n],l=a.style;if(!(0!=l.indexOf(e)||a.context&&!s.matchesContext(a.context)||l.length>e.length&&(61!=l.charCodeAt(e.length)||l.slice(e.length+1)!=t))){if(a.getAttrs
vendor: 9,995 bytes, line 2
2){let e=a.getAttrs(t);if(!1===e)continue;a.attrs=e||void 0}return a}}}static schemaRules(e){let t=[];function s(e){let s=null==e.priority?50:e.priority,a=0;for(;a<t.length;a++){let e=t[a];if((null==e.priority?50:e.priority)<s)break}t.splice(a,0,e)}for(let a in e.marks){let t=e.marks[a].spec.parseDOM;t&&t.forEach(e=>{s(e=GA(e)),e.mark||e.ignore||e.clearMark||(e.mark=a)})}for(let a in e.nodes){let t=e.nodes[a].spec.parseDOM;t&&t.forEach(e=>{s(e=GA(e)),e.node||e.ignore||e.mark||(e.node=a)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new IA(e,IA.schemaRules(e)))}}const OA={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},UA={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},HA={ol:!0,ul:!0};function WA(e,t,s){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&s}class VA{constructor(e,t,s,a,n,l){this.type=e,this.attrs=t,this.marks=s,this.solid=a,this.options=l,this.content=[],this.activeMarks=XE.none,this.match=n||(4&l?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(KE.from(e));if(!t){let t,s=this.type.contentMatch;return(t=s.findWrapping(e.type))?(this.match=s,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let s=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-e[0].length))}}let t=KE.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(KE.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!OA.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qA{constructor(e,t,s){this.parser=e,this.options=t,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let a,n=t.topNode,l=WA(null,t.preserveWhitespace,0)|(s?4:0);a=n?new VA(n.type,n.attrs,XE.none,!0,t.topMatch||n.type.contentMatch,l):new VA(s?null:e.schema.topNodeType,null,XE.none,!0,null,l),this.nodes=[a],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let s=e.nodeValue,a=this.top,n=2&a.options?"full":this.localPreserveWS||(1&a.options)>0,{schema:l}=this.parser;if("full"===n||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(n)if("full"===n)s=s.replace(/\r\n?/g,"\n");else if(l.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(l.linebreakReplacement.create())){let e=s.split(/\r?\n|\r/);for(let s=0;s<e.length;s++)s&&this.insertNode(l.linebreakReplacement.create(),t,!0),e[s]&&this.insertNode(l.text(e[s]),t,!/\S/.test(e[s]));s=""}else s=s.replace(/\r?\n|\r/g," ");else if(s=s.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(s)&&this.open==this.nodes.length-1){let t=a.content[a.content.length-1],n=e.previousSibling;(!t||n&&"BR"==n.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(s=s.slice(1))}s&&this.insertNode(l.text(s),t,!/\S/.test(s)),this.findInText(e)}else this.findInside(e)}addElement(e,t,s){let a=this.localPreserveWS,n=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l,r=e.nodeName.toLowerCase();HA.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,s=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&HA.hasOwnProperty(e)&&s?(s.appendChild(t),t=s):"li"==e?s=t:e&&(s=null)}}(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,s));e:if(i?i.ignore:UA.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e,t);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let s,a=this.needsBlock;if(OA.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),s=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let l=i&&i.skip?t:this.readStyles(e,t);l&&this.addAll(e,l),s&&this.sync(n),this.needsBlock=a}else{let s=this.readStyles(e,t);s&&this.addElementByRule(e,i,s,!1===i.consuming?l:void 0)}this.localPreserveWS=a}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let s=e.style;if(s&&s.length)for(let a=0;a<this.parser.matchedStyles.length;a++){let e=this.parser.matchedStyles[a],n=s.getPropertyValue(e);if(n)for(let s;;){let a=this.parser.matchStyle(e,n,this,s);if(!a)break;if(a.ignore)return null;if(t=a.clearMark?t.filter(e=>!a.clearMark(e)):t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),!1!==a.consuming)break;s=a}}return t}addElementByRule(e,t,s,a){let n,l;if(t.node)if(l=this.parser.schema.nodes[t.node],l.isLeaf)this.insertNode(l.create(t.attrs),s,"BR"==e.nodeName)||this.leafFallback(e,s);else{let e=this.enter(l,t.attrs||null,s,t.preserveWhitespace);e&&(n=!0,s=e)}else{let e=this.parser.schema.marks[t.mark];s=s.concat(e.create(t.attrs))}let r=this.top;if(l&&l.isLeaf)this.findInside(e);else if(a)this.addElement(e,s,a);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,s,!1));else{let a=e;"string"==typeof t.contentElement?a=e.querySelector(t.contentElement):"function"==typeof t.contentElement?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,s),this.findAround(e,a,!1)}n&&this.sync(r)&&this.open--}addAll(e,t,s,a){let n=s||0;for(let l=s?e.childNodes[s]:e.firstChild,r=null==a?null:e.childNodes[a];l!=r;l=l.nextSibling,++n)this.findAtPoint(e,n),this.addDOM(l,t);this.findAtPoint(e,n)}findPlace(e,t,s){let a,n;for(let l=this.open,r=0;l>=0;l--){let t=this.nodes[l],i=t.findWrapping(e);if(i&&(!a||a.length>i.length+r)&&(a=i,n=t,!i.length))break;if(t.solid){if(s)break;r+=2}}if(!a)return null;this.sync(n);for(let l=0;l<a.length;l++)t=this.enterInner(a[l],null,t,!1);return t}insertNode(e,t,s){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let a=this.findPlace(e,t,s);if(a){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let s=XE.none;for(let n of a.concat(e.marks))(t.type?t.type.allowsMarkType(n.type):KA(n.type,e.type))&&(s=n.addToSet(s));return t.content.push(e.mark(s)),!0}return!1}enter(e,t,s,a){let n=this.findPlace(e.create(t),s,!1);return n&&(n=this.enterInner(e,t,s,!0,a)),n}enterInner(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4?arguments[4]:void 0;this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let r=WA(e,n,l.options);4&l.options&&0==l.content.length&&(r|=4);let i=XE.none;return s=s.filter(t=>!(l.type?l.type.allowsMarkType(t.type):KA(t.type,e))||(i=t.addToSet(i),!1)),this.nodes.push(new VA(e,t,i,a,null,r)),this.open++,s}closeExtra(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let s=this.nodes[t].content;for(let t=s.length-1;t>=0;t--)e+=s[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==e&&this.find[s].offset==t&&(this.find[s].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,s){if(e!=t&&this.find)for(let a=0;a<this.find.length;a++)if(null==this.find[a].pos&&1==e.nodeType&&e.contains(this.find[a].node)){t.compareDocumentPosition(this.find[a].node)&(s?2:4)&&(this.find[a].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),s=this.options.context,a=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),n=-(s?s.depth+1:0)+(a?0:1),l=(e,r)=>{for(;e>=0;e--){let i=t[e];if(""==i){if(e==t.length-1||0==e)continue;for(;r>=n;r--)if(l(e-1,r))return!0;return!1}{let e=r>0||0==r&&a?this.nodes[r].type:s&&r>=n?s.node(r-n).type:null;if(!e||e.name!=i&&!e.isInGroup(i))return!1;r--}}return!0};return l(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function $A(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function GA(e){let t={};for(let s in e)t[s]=e[s];return t}function KA(e,t){let s=t.schema.nodes;for(let a in s){let n=s[a];if(!n.allowsMarkType(e))continue;let l=[],r=e=>{l.push(e);for(let s=0;s<e.edgeCount;s++){let{type:a,next:n}=e.edge(s);if(a==t)return!0;
2if(l.indexOf(n)<0&&r(n))return!0}};if(r(n.contentMatch))return!0}}class YA{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;s||(s=QA(t).createDocumentFragment());let a=s,n=[];return e.forEach(e=>{if(n.length||e.marks.length){let s=0,l=0;for(;s<n.length&&l<e.marks.length;){let t=e.marks[l];if(this.marks[t.type.name]){if(!t.eq(n[s][0])||!1===t.type.spec.spanning)break;s++,l++}else l++}for(;s<n.length;)a=n.pop()[1];for(;l<e.marks.length;){let s=e.marks[l++],r=this.serializeMark(s,e.isInline,t);r&&(n.push([s,a]),a.appendChild(r.dom),a=r.contentDOM||r.dom)}}a.appendChild(this.serializeNodeInner(e,t))}),s}serializeNodeInner(e,t){let{dom:s,contentDOM:a}=eF(QA(t),this.nodes[e.type.name](e),null,e.attrs);if(a){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,a)}return s}serializeNode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.serializeNodeInner(e,t);for(let a=e.marks.length-1;a>=0;a--){let n=this.serializeMark(e.marks[a],e.isInline,t);n&&((n.contentDOM||n.dom).appendChild(s),s=n.dom)}return s}serializeMark(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this.marks[e.type.name];return a&&eF(QA(s),a(e,t),null,e.attrs)}static renderSpec(e,t){return eF(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new YA(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=JA(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return JA(e.marks)}}function JA(e){let t={};for(let s in e){let a=e[s].spec.toDOM;a&&(t[s]=a)}return t}function QA(e){return e.document||window.document}const XA=new WeakMap;function ZA(e){let t=XA.get(e);return void 0===t&&XA.set(e,t=function(e){let t=null;function s(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)s(e[t]);else for(let t in e)s(e[t])}return s(e),t}(e)),t}function eF(e,t,s,a){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let n,l=t[0];if("string"!=typeof l)throw new RangeError("Invalid array passed to renderSpec");if(a&&(n=ZA(a))&&n.indexOf(t)>-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 r,i=l.indexOf(" ");i>0&&(s=l.slice(0,i),l=l.slice(i+1));let o=s?e.createElementNS(s,l):e.createElement(l),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?o.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&o.style?o.style.cssText=c[e]:o.setAttribute(e,c[e])}}for(let u=d;u<t.length;u++){let n=t[u];if(0===n){if(u<t.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:o,contentDOM:o}}{let{dom:t,contentDOM:l}=eF(e,n,s,a);if(o.appendChild(t),l){if(r)throw new RangeError("Multiple content holes");r=l}}}return{dom:o,contentDOM:r}}const tF=Math.pow(2,16);function sF(e,t){return e+t*tF}function aF(e){return 65535&e}class nF{constructor(e,t,s){this.pos=e,this.delInfo=t,this.recover=s}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class lF{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ranges=e,this.inverted=t,!e.length&&lF.empty)return lF.empty}recover(e){let t=0,s=aF(e);if(!this.inverted)for(let a=0;a<s;a++)t+=this.ranges[3*a+2]-this.ranges[3*a+1];return this.ranges[3*s]+t+function(e){return(e-(65535&e))/tF}(e)}mapResult(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}map(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!0)}_map(e,t,s){let a=0,n=this.inverted?2:1,l=this.inverted?1:2;
vendor: 33,686 bytes, line 2
2for(let r=0;r<this.ranges.length;r+=3){let i=this.ranges[r]-(this.inverted?a:0);if(i>e)break;let o=this.ranges[r+n],c=this.ranges[r+l],d=i+o;if(e<=d){let n=i+a+((o?e==i?-1:e==d?1:t:t)<0?0:c);if(s)return n;let l=e==(t<0?i:d)?null:sF(r/3,e-i),u=e==i?2:e==d?1:4;return(t<0?e!=i:e!=d)&&(u|=8),new nF(n,u,l)}a+=c-o}return s?e+a:new nF(e+a,0,null)}touches(e,t){let s=0,a=aF(t),n=this.inverted?2:1,l=this.inverted?1:2;for(let r=0;r<this.ranges.length;r+=3){let t=this.ranges[r]-(this.inverted?s:0);if(t>e)break;let i=this.ranges[r+n];if(e<=t+i&&r==3*a)return!0;s+=this.ranges[r+l]-i}return!1}forEach(e){let t=this.inverted?2:1,s=this.inverted?1:2;for(let a=0,n=0;a<this.ranges.length;a+=3){let l=this.ranges[a],r=l-(this.inverted?n:0),i=l+(this.inverted?0:n),o=this.ranges[a+t],c=this.ranges[a+s];e(r,r+o,i,i+c),n+=c-o}}invert(){return new lF(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?lF.empty:new lF(e<0?[0,-e,0]:[0,0,e])}}lF.empty=new lF([]);class rF{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e?e.length:0;this.mirror=t,this.from=s,this.to=a,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new rF(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,s=this._maps.length;t<e._maps.length;t++){let a=e.getMirror(t);this.appendMap(e._maps[t],null!=a&&a<t?s+a:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,s=this._maps.length+e._maps.length;t>=0;t--){let a=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=a&&a>t?s-a-1:void 0)}}invert(){let e=new rF;return e.appendMappingInverted(this),e}map(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(e,t,!0);for(let s=this.from;s<this.to;s++)e=this._maps[s].map(e,t);return e}mapResult(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}_map(e,t,s){let a=0;for(let n=this.from;n<this.to;n++){let s=this._maps[n].mapResult(e,t);if(null!=s.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(s.recover);continue}}a|=s.delInfo,e=s.pos}return s?e:new nF(e,a,null)}}const iF=Object.create(null);class oF{getMap(){return lF.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let s=iF[t.stepType];if(!s)throw new RangeError("No step type ".concat(t.stepType," defined"));return s.fromJSON(e,t)}static jsonID(e,t){if(e in iF)throw new RangeError("Duplicate use of step JSON ID "+e);return iF[e]=t,t.prototype.jsonID=e,t}}class cF{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new cF(e,null)}static fail(e){return new cF(null,e)}static fromReplace(e,t,s,a){try{return cF.ok(e.replace(t,s,a))}catch(G2){if(G2 instanceof ZE)return cF.fail(G2.message);throw G2}}}function dF(e,t,s){let a=[];for(let n=0;n<e.childCount;n++){let l=e.child(n);l.content.size&&(l=l.copy(dF(l.content,t,l))),l.isInline&&(l=t(l,s,n)),a.push(l)}return KE.fromArray(a)}class uF extends oF{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=e.resolve(this.from),a=s.node(s.sharedDepth(this.to)),n=new eA(dF(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,a),t.openStart,t.openEnd);return cF.fromReplace(e,this.from,this.to,n)}invert(){return new mF(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new uF(t.pos,s.pos,this.mark)}merge(e){return e instanceof uF&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new uF(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,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new uF(t.from,t.to,e.markFromJSON(t.mark))}}oF.jsonID("addMark",uF);class mF extends oF{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=new eA(dF(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return cF.fromReplace(e,this.from,this.to,s)}invert(){return new uF(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new mF(t.pos,s.pos,this.mark)}merge(e){return e instanceof mF&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new mF(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,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new mF(t.from,t.to,e.markFromJSON(t.mark))}}oF.jsonID("removeMark",mF);class hF extends oF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cF.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return cF.fromReplace(e,this.pos,this.pos+1,new eA(KE.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(e))return new hF(this.pos,t.marks[s]);return new hF(this.pos,this.mark)}}return new xF(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new hF(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new hF(t.pos,e.markFromJSON(t.mark))}}oF.jsonID("addNodeMark",hF);class xF extends oF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cF.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return cF.fromReplace(e,this.pos,this.pos+1,new eA(KE.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new hF(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xF(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xF(t.pos,e.markFromJSON(t.mark))}}oF.jsonID("removeNodeMark",xF);class pF extends oF{constructor(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(),this.from=e,this.to=t,this.slice=s,this.structure=a}apply(e){return this.structure&&fF(e,this.from,this.to)?cF.fail("Structure replace would overwrite content"):cF.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new lF([this.from,this.to-this.from,this.slice.size])}invert(e){return new pF(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deletedAcross&&s.deletedAcross?null:new pF(t.pos,Math.max(t.pos,s.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pF)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?eA.empty:new eA(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pF(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?eA.empty:new eA(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pF(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pF(t.from,t.to,eA.fromJSON(e,t.slice),!!t.structure)}}oF.jsonID("replace",pF);class gF extends oF{constructor(e,t,s,a,n,l){let r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];super(),this.from=e,this.to=t,this.gapFrom=s,this.gapTo=a,this.slice=n,this.insert=l,this.structure=r}apply(e){if(this.structure&&(fF(e,this.from,this.gapFrom)||fF(e,this.gapTo,this.to)))return cF.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return cF.fail("Gap is not a flat range");let s=this.slice.insertAt(this.insert,t.content);return s?cF.fromReplace(e,this.from,this.to,s):cF.fail("Content does not fit in gap")}getMap(){return new lF([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new gF(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1),a=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),n=this.to==this.gapTo?s.pos:e.map(this.gapTo,1);return t.deletedAcross&&s.deletedAcross||a<t.pos||n>s.pos?null:new gF(t.pos,s.pos,a,n,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,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new gF(t.from,t.to,t.gapFrom,t.gapTo,eA.fromJSON(e,t.slice),t.insert,!!t.structure)}}function fF(e,t,s){let a=e.resolve(t),n=s-t,l=a.depth;for(;n>0&&l>0&&a.indexAfter(l)==a.node(l).childCount;)l--,n--;if(n>0){let e=a.node(l).maybeChild(a.indexAfter(l));for(;n>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,n--}}return!1}function vF(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.contentMatch,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],l=e.doc.nodeAt(t),r=[],i=t+1;for(let o=0;o<l.childCount;o++){let t=l.child(o),c=i+t.nodeSize,d=a.matchType(t.type);if(d){a=d;for(let a=0;a<t.marks.length;a++)s.allowsMarkType(t.marks[a].type)||e.step(new mF(i,c,t.marks[a]));if(n&&t.isText&&"pre"!=s.whitespace){let e,a,n=/\r?\n|\r/g;for(;e=n.exec(t.text);)a||(a=new eA(KE.from(s.schema.text(" ",s.allowedMarks(t.marks))),0,0)),r.push(new pF(i+e.index,i+e.index+e[0].length,a))}}else r.push(new pF(i,c,eA.empty));i=c}if(!a.validEnd){let t=a.fillBefore(KE.empty,!0);e.replace(i,i,new eA(t,0,0))}for(let o=r.length-1;o>=0;o--)e.step(r[o])}function bF(e,t,s){return(0==t||e.canReplace(t,e.childCount))&&(s==e.childCount||e.canReplace(0,s))}function jF(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let s=e.depth,a=0,n=0;;--s){let l=e.$from.node(s),r=e.$from.index(s)+a,i=e.$to.indexAfter(s)-n;if(s<e.depth&&l.canReplace(r,i,t))return s;if(0==s||l.type.spec.isolating||!bF(l,r,i))break;r&&(a=1),i<l.childCount&&(n=1)}return null}function yF(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,n=function(e,t){let{parent:s,startIndex:a,endIndex:n}=e,l=s.contentMatchAt(a).findWrapping(t);if(!l)return null;let r=l.length?l[0]:t;return s.canReplaceWith(a,n,r)?l:null}(e,t),l=n&&function(e,t){let{parent:s,startIndex:a,endIndex:n}=e,l=s.child(a),r=t.contentMatch.findWrapping(l.type);if(!r)return null;let i=(r.length?r[r.length-1]:t).contentMatch;for(let o=a;i&&o<n;o++)i=i.matchType(s.child(o).type);return i&&i.validEnd?r:null}(a,t);return l?n.map(NF).concat({type:t,attrs:s}).concat(l.map(NF)):null}function NF(e){return{type:e,attrs:null}}function wF(e,t,s,a){t.forEach((n,l)=>{if(n.isText){let r,i=/\r?\n|\r/g;for(;r=i.exec(n.text);){let n=e.mapping.slice(a).map(s+1+l+r.index);e.replaceWith(n,n+1,t.type.schema.linebreakReplacement.create())}}})}function CF(e,t,s,a){t.forEach((n,l)=>{if(n.type==n.type.schema.linebreakReplacement){let n=e.mapping.slice(a).map(s+1+l);e.replaceWith(n,n+1,t.type.schema.text("\n"))}})}function kF(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3?arguments[3]:void 0,n=e.resolve(t),l=n.depth-s,r=a&&a[a.length-1]||n.parent;if(l<0||n.parent.type.spec.isolating||!n.parent.canReplace(n.index(),n.parent.childCount)||!r.type.validContent(n.parent.content.cutByIndex(n.index(),n.parent.childCount)))return!1;for(let c=n.depth-1,d=s-2;c>l;c--,d--){let e=n.node(c),t=n.index(c);if(e.type.spec.isolating)return!1;let s=e.content.cutByIndex(t,e.childCount),l=a&&a[d+1];l&&(s=s.replaceChild(0,l.type.create(l.attrs)));let r=a&&a[d]||e;if(!e.canReplace(t+1,e.childCount)||!r.type.validContent(s))return!1}let i=n.indexAfter(l),o=a&&a[0];return n.node(l).canReplaceWith(i,i,o?o.type:n.node(l+1).type)}function DF(e,t){let s=e.resolve(t),a=s.index();return _F(s.nodeBefore,s.nodeAfter)&&s.parent.canReplace(a,a+1)}function _F(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let s=e.contentMatchAt(e.childCount),{linebreakReplacement:a}=e.type.schema;for(let n=0;n<t.childCount;n++){let l=t.child(n),r=l.type==a?e.type.schema.nodes.text:l.type;if(s=s.matchType(r),!s)return!1;if(!e.type.allowsMarks(l.marks))return!1}return s.validEnd}(e,t))}function SF(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,a=e.resolve(t);for(let n=a.depth;;n--){let e,l,r=a.index(n);if(n==a.depth?(e=a.nodeBefore,l=a.nodeAfter):s>0?(e=a.node(n+1),r++,l=a.node(n).maybeChild(r)):(e=a.node(n).maybeChild(r-1),l=a.node(n+1)),e&&!e.isTextblock&&_F(e,l)&&a.node(n).canReplace(r,r+1))return t;if(0==n)break;t=s<0?a.before(n):a.after(n)}}function EF(e,t,s){let a=e.resolve(t);if(!s.content.size)return t;let n=s.content;for(let l=0;l<s.openStart;l++)n=n.firstChild.content;for(let l=1;l<=(0==s.openStart&&s.size?2:1);l++)for(let e=a.depth;e>=0;e--){let t=e==a.depth?0:a.pos<=(a.start(e+1)+a.end(e+1))/2?-1:1,s=a.index(e)+(t>0?1:0),r=a.node(e),i=!1;if(1==l)i=r.canReplace(s,s,n);else{let e=r.contentMatchAt(s).findWrapping(n.firstChild.type);i=e&&r.canReplaceWith(s,s,e[0])}if(i)return 0==t?a.pos:t<0?a.before(e+1):a.after(e+1)}return null}function AF(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:eA.empty;if(t==s&&!a.size)return null;let n=e.resolve(t),l=e.resolve(s);return FF(n,l,a)?new pF(t,s,a):new TF(n,l,a).fit()}function FF(e,t,s){return!s.openStart&&!s.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),s.content)}oF.jsonID("replaceAround",gF);class TF{constructor(e,t,s){this.$from=e,this.$to=t,this.unplaced=s,this.frontier=[],this.placed=KE.empty;for(let a=0;a<=e.depth;a++){let t=e.node(a);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=KE.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,s=this.$from,a=this.close(e<0?this.$to:s.doc.resolve(e));if(!a)return null;let n=this.placed,l=s.depth,r=a.depth;for(;l&&r&&1==n.childCount;)n=n.firstChild.content,l--,r--;let i=new eA(n,l,r);return e>-1?new gF(s.pos,e,this.$to.pos,this.$to.end(),i,t):i.size||s.pos!=this.$to.pos?new pF(s.pos,a.pos,i):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,s=0,a=this.unplaced.openEnd;s<e;s++){let n=t.firstChild;if(t.childCount>1&&(a=0),n.type.spec.isolating&&a<=s){e=s;break}t=n.content}for(let t=1;t<=2;t++)for(let s=1==t?e:this.unplaced.openStart;s>=0;s--){let e,a=null;s?(a=PF(this.unplaced.content,s-1).firstChild,e=a.content):e=this.unplaced.content;let n=e.firstChild;for(let l=this.depth;l>=0;l--){let e,{type:r,match:i}=this.frontier[l],o=null;if(1==t&&(n?i.matchType(n.type)||(o=i.fillBefore(KE.from(n),!1)):a&&r.compatibleContent(a.type)))return{sliceDepth:s,frontierDepth:l,parent:a,inject:o};if(2==t&&n&&(e=i.findWrapping(n.type)))return{sliceDepth:s,frontierDepth:l,parent:a,wrap:e};if(a&&i.matchType(a.type))break}}}openMore(){let{content:e,openStart:t,openEnd:s}=this.unplaced,a=PF(e,t);return!(!a.childCount||a.firstChild.isLeaf)&&(this.unplaced=new eA(e,t+1,Math.max(s,a.size+t>=e.size-s?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:s}=this.unplaced,a=PF(e,t);if(a.childCount<=1&&t>0){let n=e.size-t<=t+a.size;this.unplaced=new eA(zF(e,t-1,1),t-1,n?t-1:s)}else this.unplaced=new eA(zF(e,t,1),t,s)}placeNodes(e){let{sliceDepth:t,frontierDepth:s,parent:a,inject:n,wrap:l}=e;for(;this.depth>s;)this.closeFrontierNode();if(l)for(let p=0;p<l.length;p++)this.openFrontierNode(l[p]);let r=this.unplaced,i=a?a.content:r.content,o=r.openStart-t,c=0,d=[],{match:u,type:m}=this.frontier[s];if(n){for(let e=0;e<n.childCount;e++)d.push(n.child(e));u=u.matchFragment(n)}let h=i.size+t-(r.content.size-r.openEnd);for(;c<i.childCount;){let e=i.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||0==o||e.content.size)&&(u=t,d.push(BF(e.mark(m.allowedMarks(e.marks)),1==c?o:0,c==i.childCount?h:-1)))}let x=c==i.childCount;x||(h=-1),this.placed=MF(this.placed,s,KE.from(d)),this.frontier[s].match=u,x&&h<0&&a&&a.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let p=0,g=i;p<h;p++){let e=g.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),g=e.content}this.unplaced=x?0==t?eA.empty:new eA(zF(r.content,t-1,1),t-1,h<0?r.openEnd:t-1):new eA(zF(r.content,t,c),r.openStart,r.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!RF(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:s}=this.$to,a=this.$to.after(s);for(;s>1&&a==this.$to.end(--s);)++a;return a}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:s,type:a}=this.frontier[t],n=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),l=RF(e,t,a,s,n);if(l){for(let s=t-1;s>=0;s--){let{match:t,type:a}=this.frontier[s],n=RF(e,s,a,t,!0);if(!n||n.childCount)continue e}return{depth:t,fit:l,move:n?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=MF(this.placed,t.depth,t.fit)),e=t.move;for(let s=t.depth+1;s<=e.depth;s++){let t=e.node(s),a=t.type.contentMatch.fillBefore(t.content,!0,e.index(s));this.openFrontierNode(t.type,t.attrs,a)}return e}openFrontierNode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2?arguments[2]:void 0,a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=MF(this.placed,this.depth,KE.from(e.create(t,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(KE.empty,!0);e.childCount&&(this.placed=MF(this.placed,this.frontier.length,e))}}function zF(e,t,s){return 0==t?e.cutByIndex(s,e.childCount):e.replaceChild(0,e.firstChild.copy(zF(e.firstChild.content,t-1,s)))}function MF(e,t,s){return 0==t?e.append(s):e.replaceChild(e.childCount-1,e.lastChild.copy(MF(e.lastChild.content,t-1,s)))}function PF(e,t){for(let s=0;s<t;s++)e=e.firstChild.content;return e}function BF(e,t,s){if(t<=0)return e;let a=e.content;return t>1&&(a=a.replaceChild(0,BF(a.firstChild,t-1,1==a.childCount?s-1:0))),t>0&&(a=e.type.contentMatch.fillBefore(a).append(a),s<=0&&(a=a.append(e.type.contentMatch.matchFragment(a).fillBefore(KE.empty,!0)))),e.copy(a)}function RF(e,t,s,a,n){let l=e.node(t),r=n?e.indexAfter(t):e.index(t);if(r==l.childCount&&!s.compatibleContent(l.type))return null;let i=a.fillBefore(l.content,!0,r);return i&&!function(e,t,s){for(let a=s;a<t.childCount;a++)if(!e.allowsMarks(t.child(a).marks))return!0;return!1}(s,l.content,r)?i:null}function LF(e){return e.spec.defining||e.spec.definingForContent}function IF(e,t,s,a,n){if(t<s){let n=e.firstChild;e=e.replaceChild(0,n.copy(IF(n.content,t+1,s,a,n)))}if(t>a){let t=n.contentMatchAt(0),s=t.fillBefore(e).append(e);e=s.append(t.matchFragment(s).fillBefore(KE.empty,!0))}return e}function OF(e,t){let s=[];for(let a=Math.min(e.depth,t.depth);a>=0;a--){let n=e.start(a);if(n<e.pos-(e.depth-a)||t.end(a)>t.pos+(t.depth-a)||e.node(a).type.spec.isolating||t.node(a).type.spec.isolating)break;(n==t.start(a)||a==e.depth&&a==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&a&&t.start(a-1)==n-1)&&s.push(a)}return s}class UF extends oF{constructor(e,t,s){super(),this.pos=e,this.attr=t,this.value=s}apply(e){let t=e.nodeAt(this.pos);if(!t)return cF.fail("No node at attribute step's position");let s=Object.create(null);for(let n in t.attrs)s[n]=t.attrs[n];s[this.attr]=this.value;let a=t.type.create(s,null,t.marks);return cF.fromReplace(e,this.pos,this.pos+1,new eA(KE.from(a),0,t.isLeaf?0:1))}getMap(){return lF.empty}invert(e){return new UF(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new UF(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new UF(t.pos,t.attr,t.value)}}oF.jsonID("attr",UF);class HF extends oF{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let a in e.attrs)t[a]=e.attrs[a];t[this.attr]=this.value;let s=e.type.create(t,e.content,e.marks);return cF.ok(s)}getMap(){return lF.empty}invert(e){return new HF(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new HF(t.attr,t.value)}}oF.jsonID("docAttr",HF);let WF=class extends Error{};WF=function e(t){let s=Error.call(this,t);return s.__proto__=e.prototype,s},(WF.prototype=Object.create(Error.prototype)).constructor=WF,WF.prototype.name="TransformError";class VF{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rF}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new WF(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eA.empty,a=AF(this.doc,e,t,s);return a&&this.step(a),this}replaceWith(e,t,s){return this.replace(e,t,new eA(KE.from(s),0,0))}delete(e,t){return this.replace(e,t,eA.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,s){return function(e,t,s,a){if(!a.size)return e.deleteRange(t,s);let n=e.doc.resolve(t),l=e.doc.resolve(s);if(FF(n,l,a))return e.step(new pF(t,s,a));let r=OF(n,l);0==r[r.length-1]&&r.pop();let i=-(n.depth+1);r.unshift(i);for(let m=n.depth,h=n.pos-1;m>0;m--,h--){let e=n.node(m).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;r.indexOf(m)>-1?i=m:n.before(m)==h&&r.splice(1,0,-m)}let o=r.indexOf(i),c=[],d=a.openStart;for(let m=a.content,h=0;;h++){let e=m.firstChild;if(c.push(e),h==a.openStart)break;m=e.content}for(let m=d-1;m>=0;m--){let e=c[m],t=LF(e.type);if(t&&!e.sameMarkup(n.node(Math.abs(i)-1)))d=m;else if(t||!e.type.isTextblock)break}for(let m=a.openStart;m>=0;m--){let t=(m+d+1)%(a.openStart+1),i=c[t];if(i)for(let c=0;c<r.length;c++){let d=r[(c+o)%r.length],u=!0;d<0&&(u=!1,d=-d);let m=n.node(d-1),h=n.index(d-1);if(m.canReplaceWith(h,h,i.type,i.marks))return e.replace(n.before(d),u?l.after(d):s,new eA(IF(a.content,0,a.openStart,t),t,a.openEnd))}}let u=e.steps.length;for(let m=r.length-1;m>=0&&(e.replace(t,s,a),!(e.steps.length>u));m--){let e=r[m];e<0||(t=n.before(e),s=l.after(e))}}(this,e,t,s),this}replaceRangeWith(e,t,s){return function(e,t,s,a){if(!a.isInline&&t==s&&e.doc.resolve(t).parent.content.size){let n=function(e,t,s){let a=e.resolve(t);if(a.parent.canReplaceWith(a.index(),a.index(),s))return t;if(0==a.parentOffset)for(let n=a.depth-1;n>=0;n--){let e=a.index(n);if(a.node(n).canReplaceWith(e,e,s))return a.before(n+1);if(e>0)return null}if(a.parentOffset==a.parent.content.size)for(let n=a.depth-1;n>=0;n--){let e=a.indexAfter(n);if(a.node(n).canReplaceWith(e,e,s))return a.after(n+1);if(e<a.node(n).childCount)return null}return null}(e.doc,t,a.type);null!=n&&(t=s=n)}e.replaceRange(t,s,new eA(KE.from(a),0,0))}(this,e,t,s),this}deleteRange(e,t){return function(e,t,s){let a=e.doc.resolve(t),n=e.doc.resolve(s),l=OF(a,n);for(let r=0;r<l.length;r++){let t=l[r],s=r==l.length-1;if(s&&0==t||a.node(t).type.contentMatch.validEnd)return e.delete(a.start(t),n.end(t));if(t>0&&(s||a.node(t-1).canReplace(a.index(t-1),n.indexAfter(t-1))))return e.delete(a.before(t),n.after(t))}for(let r=1;r<=a.depth&&r<=n.depth;r++)if(t-a.start(r)==a.depth-r&&s>a.end(r)&&n.end(r)-s!=n.depth-r&&a.start(r-1)==n.start(r-1)&&a.node(r-1).canReplace(a.index(r-1),n.index(r-1)))return e.delete(a.before(r),s);e.delete(t,s)}(this,e,t),this}lift(e,t){return function(e,t,s){let{$from:a,$to:n,depth:l}=t,r=a.before(l+1),i=n.after(l+1),o=r,c=i,d=KE.empty,u=0;for(let x=l,p=!1;x>s;x--)p||a.index(x)>0?(p=!0,d=KE.from(a.node(x).copy(d)),u++):o--;let m=KE.empty,h=0;for(let x=l,p=!1;x>s;x--)p||n.after(x+1)<n.end(x)?(p=!0,m=KE.from(n.node(x).copy(m)),h++):c++;e.step(new gF(o,c,r,i,new eA(d.append(m),u,h),d.size-u,!0))}(this,e,t),this}join(e){return function(e,t,s){let a=null,{linebreakReplacement:n}=e.doc.type.schema,l=e.doc.resolve(t-s),r=l.node().type;if(n&&r.inlineContent){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(n);e&&!t?a=!1:!e&&t&&(a=!0)}let i=e.steps.length;if(!1===a){let a=e.doc.resolve(t+s);CF(e,a.node(),a.before(),i)}r.inlineContent&&vF(e,t+s-1,r,l.node().contentMatchAt(l.index()),null==a);let o=e.mapping.slice(i),c=o.map(t-s);if(e.step(new pF(c,o.map(t+s,-1),eA.empty,!0)),!0===a){let t=e.doc.resolve(c);wF(e,t.node(),t.before(),e.steps.length)}}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this}wrap(e,t){return function(e,t,s){let a=KE.empty;for(let r=s.length-1;r>=0;r--){if(a.size){let e=s[r].type.contentMatch.matchFragment(a);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}a=KE.from(s[r].type.create(s[r].attrs,a))}let n=t.start,l=t.end;e.step(new gF(n,l,n,l,new eA(a,0,0),s.length,!0))}(this,e,t),this}setBlockType(e){return function(e,t,s,a,n){if(!a.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let l=e.steps.length;e.doc.nodesBetween(t,s,(t,s)=>{let r="function"==typeof n?n(t):n;if(t.isTextblock&&!t.hasMarkup(a,r)&&function(e,t,s){let a=e.resolve(t),n=a.index();return a.parent.canReplaceWith(n,n+1,s)}(e.doc,e.mapping.slice(l).map(s),a)){let n=null;if(a.schema.linebreakReplacement){let e="pre"==a.whitespace,t=!!a.contentMatch.matchType(a.schema.linebreakReplacement);e&&!t?n=!1:!e&&t&&(n=!0)}!1===n&&CF(e,t,s,l),vF(e,e.mapping.slice(l).map(s,1),a,void 0,null===n);let i=e.mapping.slice(l),o=i.map(s,1),c=i.map(s+t.nodeSize,1);return e.step(new gF(o,c,o+1,c-1,new eA(KE.from(a.create(r,null,t.marks)),0,0),1,!0)),!0===n&&wF(e,t,s,l),!1}})}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,arguments.length>2?arguments[2]:void 0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),this}setNodeMarkup(e,t){return function(e,t,s,a,n){let l=e.doc.nodeAt(t);if(!l)throw new RangeError("No node at given position");s||(s=l.type);let r=s.create(a,null,n||l.marks);if(l.isLeaf)return e.replaceWith(t,t+l.nodeSize,r);if(!s.validContent(l.content))throw new RangeError("Invalid content for node type "+s.name);e.step(new gF(t,t+l.nodeSize,t+1,t+l.nodeSize-1,new eA(KE.from(r),0,0),1,!0))}(this,e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0),this}setNodeAttribute(e,t,s){return this.step(new UF(e,t,s)),this}setDocAttribute(e,t){return this.step(new HF(e,t)),this}addNodeMark(e,t){return this.step(new hF(e,t)),this}removeNodeMark(e,t){let s=this.doc.nodeAt(e);if(!s)throw new RangeError("No node at position "+e);if(t instanceof XE)t.isInSet(s.marks)&&this.step(new xF(e,t));else{let a,n=s.marks,l=[];for(;a=t.isInSet(n);)l.push(new xF(e,a)),n=a.removeFromSet(n);for(let e=l.length-1;e>=0;e--)this.step(l[e])}return this}split(e){return function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3?arguments[3]:void 0,n=e.doc.resolve(t),l=KE.empty,r=KE.empty;for(let i=n.depth,o=n.depth-s,c=s-1;i>o;i--,c--){l=KE.from(n.node(i).copy(l));let e=a&&a[c];r=KE.from(e?e.type.create(e.attrs,r):n.node(i).copy(r))}e.step(new pF(t,t,new eA(l.append(r),s,s),!0))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2?arguments[2]:void 0),this}addMark(e,t,s){return function(e,t,s,a){let n,l,r=[],i=[];e.doc.nodesBetween(t,s,(e,o,c)=>{if(!e.isInline)return;let d=e.marks;if(!a.isInSet(d)&&c.type.allowsMarkType(a.type)){let c=Math.max(o,t),u=Math.min(o+e.nodeSize,s),m=a.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(m)||(n&&n.to==c&&n.mark.eq(d[e])?n.to=u:r.push(n=new mF(c,u,d[e])));l&&l.to==c?l.to=u:i.push(l=new uF(c,u,a))}}),r.forEach(t=>e.step(t)),i.forEach(t=>e.step(t))}(this,e,t,s),this}removeMark(e,t,s){return function(e,t,s,a){let n=[],l=0;e.doc.nodesBetween(t,s,(e,r)=>{if(!e.isInline)return;l++;let i=null;if(a instanceof BA){let t,s=e.marks;for(;t=a.isInSet(s);)(i||(i=[])).push(t),s=t.removeFromSet(s)}else a?a.isInSet(e.marks)&&(i=[a]):i=e.marks;if(i&&i.length){let a=Math.min(r+e.nodeSize,s);for(let e=0;e<i.length;e++){let s,o=i[e];for(let e=0;e<n.length;e++){let t=n[e];t.step==l-1&&o.eq(n[e].style)&&(s=t)}s?(s.to=a,s.step=l):n.push({style:o,from:Math.max(r,t),to:a,step:l})}}}),n.forEach(t=>e.step(new mF(t.from,t.to,t.style)))}(this,e,t,s),this}clearIncompatible(e,t,s){return vF(this,e,t,s),this}}const qF=Object.create(null);class $F{constructor(e,t,s){this.$anchor=e,this.$head=t,this.ranges=s||[new GF(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eA.empty,s=t.content.lastChild,a=null;for(let r=0;r<t.openEnd;r++)a=s,s=s.lastChild;let n=e.steps.length,l=this.ranges;for(let r=0;r<l.length;r++){let{$from:i,$to:o}=l[r],c=e.mapping.slice(n);e.replaceRange(c.map(i.pos),c.map(o.pos),r?eA.empty:t),0==r&&aT(e,n,(s?s.isInline:a&&a.isTextblock)?-1:1)}}replaceWith(e,t){let s=e.steps.length,a=this.ranges;for(let n=0;n<a.length;n++){let{$from:l,$to:r}=a[n],i=e.mapping.slice(s),o=i.map(l.pos),c=i.map(r.pos);n?e.deleteRange(o,c):(e.replaceRangeWith(o,c,t),aT(e,s,t.isInline?-1:1))}}static findFrom(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=e.parent.inlineContent?new JF(e):sT(e.node(0),e.parent,e.pos,e.index(),t,s);if(a)return a;for(let n=e.depth-1;n>=0;n--){let a=t<0?sT(e.node(0),e.node(n),e.before(n+1),e.index(n),t,s):sT(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,t,s);if(a)return a}return null}static near(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom(e,t)||this.findFrom(e,-t)||new eT(e.node(0))}static atStart(e){return sT(e,e,0,0,1)||new eT(e)}static atEnd(e){return sT(e,e,e.content.size,e.childCount,-1)||new eT(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=qF[t.type];if(!s)throw new RangeError("No selection type ".concat(t.type," defined"));return s.fromJSON(e,t)}static jsonID(e,t){if(e in qF)throw new RangeError("Duplicate use of selection JSON ID "+e);return qF[e]=t,t.prototype.jsonID=e,t}getBookmark(){return JF.between(this.$anchor,this.$head).getBookmark()}}$F.prototype.visible=!0;class GF{constructor(e,t){this.$from=e,this.$to=t}}let KF=!1;function YF(e){KF||e.parent.inlineContent||(KF=!0,console.warn("TextSelection endpoint not pointing into a
2node with inline content ("+e.parent.type.name+")"))}class JF extends $F{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;YF(e),YF(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let s=e.resolve(t.map(this.head));if(!s.parent.inlineContent)return $F.near(s);let a=e.resolve(t.map(this.anchor));return new JF(a.parent.inlineContent?a:s,s)}replace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eA.empty;if(super.replace(e,t),t==eA.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof JF&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new QF(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new JF(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,a=e.resolve(t);return new this(a,s==t?a:e.resolve(s))}static between(e,t,s){let a=e.pos-t.pos;if(s&&!a||(s=a>=0?1:-1),!t.parent.inlineContent){let e=$F.findFrom(t,s,!0)||$F.findFrom(t,-s,!0);if(!e)return $F.near(t,s);t=e.$head}return e.parent.inlineContent||(0==a||(e=($F.findFrom(e,-s,!0)||$F.findFrom(e,s,!0)).$anchor).pos<t.pos!=a<0)&&(e=t),new JF(e,t)}}$F.jsonID("text",JF);class QF{constructor(e,t){this.anchor=e,this.head=t}map(e){return new QF(e.map(this.anchor),e.map(this.head))}resolve(e){return JF.between(e.resolve(this.anchor),e.resolve(this.head))}}class XF extends $F{constructor(e){let t=e.nodeAfter,s=e.node(0).resolve(e.pos+t.nodeSize);super(e,s),this.node=t}map(e,t){let{deleted:s,pos:a}=t.mapResult(this.anchor),n=e.resolve(a);return s?$F.near(n):new XF(n)}content(){return new eA(KE.from(this.node),0,0)}eq(e){return e instanceof XF&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ZF(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new XF(e.resolve(t.anchor))}static create(e,t){return new XF(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}XF.prototype.visible=!1,$F.jsonID("node",XF);class ZF{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:s}=e.mapResult(this.anchor);return t?new QF(s,s):new ZF(s)}resolve(e){let t=e.resolve(this.anchor),s=t.nodeAfter;return s&&XF.isSelectable(s)?new XF(t):$F.near(t)}}class eT extends $F{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eA.empty;if(t==eA.empty){e.delete(0,e.doc.content.size);let t=$F.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new eT(e)}map(e){return new eT(e)}eq(e){return e instanceof eT}getBookmark(){return tT}}$F.jsonID("all",eT);const tT={map(){return this},resolve:e=>new eT(e)};function sT(e,t,s,a,n){let l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t.inlineContent)return JF.create(e,s);for(let r=a-(n>0?0:1);n>0?r<t.childCount:r>=0;r+=n){let a=t.child(r);if(a.isAtom){if(!l&&XF.isSelectable(a))return XF.create(e,s-(n<0?a.nodeSize:0))}else{let t=sT(e,a,s+n,n<0?a.childCount:0,n,l);if(t)return t}s+=a.nodeSize*n}return null}function aT(e,t,s){let a=e.steps.length-1;if(a<t)return;let n,l=e.steps[a];(l instanceof pF||l instanceof gF)&&(e.mapping.maps[a].forEach((e,t,s,a)=>{null==n&&(n=a)}),e.setSelection($F.near(e.doc.resolve(n),s)))}class nT extends VF{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.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return XE.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=this.selection;return t&&(e=e.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||XE.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}
vendor: 5,229 bytes, line 2
2insertText(e,t,s){let a=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(null==s&&(s=t),!e)return this.deleteRange(t,s);let n=this.storedMarks;if(!n){let e=this.doc.resolve(t);n=s==t?e.marks():e.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(t,s,a.text(e,n)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection($F.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function lT(e,t){return t&&e?e.bind(t):e}class rT{constructor(e,t,s){this.name=e,this.init=lT(t.init,s),this.apply=lT(t.apply,s)}}const iT=[new rT("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new rT("selection",{init:(e,t)=>e.selection||$F.atStart(t.doc),apply:e=>e.selection}),new rT("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,s,a)=>a.selection.$cursor?e.storedMarks:null}),new rT("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class oT{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=iT.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new rT(e.key,e.spec.state,e))})}}class cT{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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;for(let s=0;s<this.config.plugins.length;s++)if(s!=t){let t=this.config.plugins[s];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],s=this.applyInner(e),a=null;for(;;){let n=!1;for(let l=0;l<this.config.plugins.length;l++){let r=this.config.plugins[l];if(r.spec.appendTransaction){let i=a?a[l].n:0,o=a?a[l].state:this,c=i<t.length&&r.spec.appendTransaction.call(r,i?t.slice(i):t,o,s);if(c&&s.filterTransaction(c,l)){if(c.setMeta("appendedTransaction",e),!a){a=[];for(let e=0;e<this.config.plugins.length;e++)a.push(e<l?{state:s,n:t.length}:{state:this,n:0})}t.push(c),s=s.applyInner(c),n=!0}a&&(a[l]={state:s,n:t.length})}}if(!n)return{state:s,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new cT(this.config),s=this.config.fields;for(let a=0;a<s.length;a++){let n=s[a];t[n.name]=n.apply(e,this[n.name],this,t)}return t}get tr(){return new nT(this)}static create(e){let t=new oT(e.doc?e.doc.type.schema:e.schema,e.plugins),s=new cT(t);for(let a=0;a<t.fields.length;a++)s[t.fields[a].name]=t.fields[a].init(e,s);return s}reconfigure(e){let t=new oT(this.schema,e.plugins),s=t.fields,a=new cT(t);for(let n=0;n<s.length;n++){let t=s[n].name;a[t]=this.hasOwnProperty(t)?this[t]:s[n].init(e,a)}return a}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let s in e){if("doc"==s||"selection"==s)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=e[s],n=a.spec.state;n&&n.toJSON&&(t[s]=n.toJSON.call(a,this[a.key]))}return t}static fromJSON(e,t,s){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let a=new oT(e.schema,e.plugins),n=new cT(a);return a.fields.forEach(a=>{if("doc"==a.name)n.doc=vA.fromJSON(e.schema,t.doc);else if("selection"==a.name)n.selection=$F.fromJSON(n.doc,t.selection);else if("storedMarks"==a.name)t.storedMarks&&(n.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let l in s){let r=s[l],i=r.spec.state;if(r.key==a.name&&i&&i.fromJSON&&Object.prototype.hasOwnProperty.call(t,l))return void(n[a.name]=i.fromJSON.call(r,e,t[l],n))}n[a.name]=a.init(e,n)}}),n}}function dT(e,t,s){for(let a in e){let n=e[a];n instanceof Function?n=n.bind(t):"handleDOMEvents"==a&&(n=dT(n,t,{})),s[a]=n}return s}class uT{constructor(e){this.spec=e,this.props={},e.props&&dT(e.props,this,this.props),this.key=e.key?e.key.key:hT("plugin")}getState(e){return e[this.key]}}const mT=Object.create(null);function hT(e){return e in mT?e+"$"+ ++mT[e]:(mT[e]=0,e+"$")}class xT{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"key";this.key=hT(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const pT=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function gT(e,t){let{$cursor:s}=e.selection;return!s||(t?!t.endOfTextblock("backward",e):s.parentOffset>0)?null:s}const fT=(e,t,s)=>{let a=gT(e,s);if(!a)return!1;let n=yT(a);if(!n){let s=a.blockRange(),n=s&&jF(s);return null!=n&&(t&&t(e.tr.lift(s,n).scrollIntoView()),!0)}let l=n.nodeBefore;if(zT(e,n,t,-1))return!0;
2if(0==a.parent.content.size&&(bT(l,"end")||XF.isSelectable(l)))for(let r=a.depth;;r--){let s=AF(e.doc,a.before(r),a.after(r),eA.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(bT(l,"end")?$F.findFrom(a.doc.resolve(a.mapping.map(n.pos,-1)),-1):XF.create(a.doc,n.pos-l.nodeSize)),t(a.scrollIntoView())}return!0}if(1==r||a.node(r-1).childCount>1)break}return!(!l.isAtom||n.depth!=a.depth-1)&&(t&&t(e.tr.delete(n.pos-l.nodeSize,n.pos).scrollIntoView()),!0)};function vT(e,t,s){let a=t.nodeBefore,n=t.pos-1;for(;!a.isTextblock;n--){if(a.type.spec.isolating)return!1;let e=a.lastChild;if(!e)return!1;a=e}let l=t.nodeAfter,r=t.pos+1;for(;!l.isTextblock;r++){if(l.type.spec.isolating)return!1;let e=l.firstChild;if(!e)return!1;l=e}let i=AF(e.doc,n,r,eA.empty);if(!i||i.from!=n||i instanceof pF&&i.slice.size>=r-n)return!1;if(s){let t=e.tr.step(i);t.setSelection(JF.create(t.doc,n)),s(t.scrollIntoView())}return!0}function bT(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(let a=e;a;a="start"==t?a.firstChild:a.lastChild){if(a.isTextblock)return!0;if(s&&1!=a.childCount)return!1}return!1}const jT=(e,t,s)=>{let{$head:a,empty:n}=e.selection,l=a;if(!n)return!1;if(a.parent.isTextblock){if(s?!s.endOfTextblock("backward",e):a.parentOffset>0)return!1;l=yT(a)}let r=l&&l.nodeBefore;return!(!r||!XF.isSelectable(r))&&(t&&t(e.tr.setSelection(XF.create(e.doc,l.pos-r.nodeSize)).scrollIntoView()),!0)};function yT(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function NT(e,t){let{$cursor:s}=e.selection;return!s||(t?!t.endOfTextblock("forward",e):s.parentOffset<s.parent.content.size)?null:s}const wT=(e,t,s)=>{let a=NT(e,s);if(!a)return!1;let n=kT(a);if(!n)return!1;let l=n.nodeAfter;if(zT(e,n,t,1))return!0;if(0==a.parent.content.size&&(bT(l,"start")||XF.isSelectable(l))){let s=AF(e.doc,a.before(),a.after(),eA.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(bT(l,"start")?$F.findFrom(a.doc.resolve(a.mapping.map(n.pos)),1):XF.create(a.doc,a.mapping.map(n.pos))),t(a.scrollIntoView())}return!0}}return!(!l.isAtom||n.depth!=a.depth-1)&&(t&&t(e.tr.delete(n.pos,n.pos+l.nodeSize).scrollIntoView()),!0)},CT=(e,t,s)=>{let{$head:a,empty:n}=e.selection,l=a;if(!n)return!1;if(a.parent.isTextblock){if(s?!s.endOfTextblock("forward",e):a.parentOffset<a.parent.content.size)return!1;l=kT(a)}let r=l&&l.nodeAfter;return!(!r||!XF.isSelectable(r))&&(t&&t(e.tr.setSelection(XF.create(e.doc,l.pos)).scrollIntoView()),!0)};function kT(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let s=e.node(t);if(e.index(t)+1<s.childCount)return e.doc.resolve(e.after(t+1));if(s.type.spec.isolating)break}return null}const DT=(e,t)=>{let{$head:s,$anchor:a}=e.selection;return!(!s.parent.type.spec.code||!s.sameParent(a))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function _T(e){for(let t=0;t<e.edgeCount;t++){let{type:s}=e.edge(t);if(s.isTextblock&&!s.hasRequiredAttrs())return s}return null}const ST=(e,t)=>{let{$head:s,$anchor:a}=e.selection;if(!s.parent.type.spec.code||!s.sameParent(a))return!1;let n=s.node(-1),l=s.indexAfter(-1),r=_T(n.contentMatchAt(l));if(!r||!n.canReplaceWith(l,l,r))return!1;if(t){let a=s.after(),n=e.tr.replaceWith(a,a,r.createAndFill());n.setSelection($F.near(n.doc.resolve(a),1)),t(n.scrollIntoView())}return!0},ET=(e,t)=>{let s=e.selection,{$from:a,$to:n}=s;if(s instanceof eT||a.parent.inlineContent||n.parent.inlineContent)return!1;let l=_T(n.parent.contentMatchAt(n.indexAfter()));if(!l||!l.isTextblock)return!1;if(t){let s=(!a.parentOffset&&n.index()<n.parent.childCount?a:n).pos,r=e.tr.insert(s,l.createAndFill());r.setSelection(JF.create(r.doc,s+1)),t(r.scrollIntoView())}return!0},AT=(e,t)=>{let{$cursor:s}=e.selection;if(!s||s.parent.content.size)return!1;if(s.depth>1&&s.after()!=s.end(-1)){let a=s.before();if(kF(e.doc,a))return t&&t(e.tr.split(a).scrollIntoView()),!0}let a=s.blockRange(),n=a&&jF(a);return null!=n&&(t&&t(e.tr.lift(a,n).scrollIntoView()),!0)};const FT=(e,t)=>{let{$from:s,$to:a}=e.selection;if(e.selection instanceof XF&&e.selection.node.isBlock)return!(!s.parentOffset||!kF(e.doc,s.pos))&&(t&&t(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let n,l,r=[],i=!1,o=!1;for(let m=s.depth;;m--){if(s.node(m).isBlock){i=s.end(m)==s.pos+(s.depth-m),o=s.start(m)==s.pos-(s.depth-m),l=_T(s.node(m-1).contentMatchAt(s.indexAfter(m-1)));let e=TT&&TT(a.parent,i,s);r.unshift(e||(i&&l?{type:l}:null)),n=m;break}if(1==m)return!1;r.unshift(null)}let c=e.tr;(e.selection instanceof JF||e.selection instanceof eT)&&c.deleteSelection();let d=c.mapping.map(s.pos),u=kF(c.doc,d,r.length,r);if(u||(r[0]=l?{type:l}:null,u=kF(c.doc,d,r.length,r)),!u)return!1;if(c.split(d,r.length,r),!i&&o&&s.node(n).type!=l){let e=c.mapping.map(s.before(n)),t=c.doc.resolve(e);l&&s.node(n-1).canReplaceWith(t.index(),t.index()+1,l)&&c.setNodeMarkup(c.mapping.map(s.before(n)),l)}return t&&t(c.scrollIntoView()),!0};var TT;function zT(e,t,s,a){let n,l,r=t.nodeBefore,i=t.nodeAfter,o=r.type.spec.isolating||i.type.spec.isolating;if(!o&&function(e,t,s){let a=t.nodeBefore,n=t.nodeAfter,l=t.index();return!!(a&&n&&a.type.compatibleContent(n.type))&&(!a.content.size&&t.parent.canReplace(l-1,l)?(s&&s(e.tr.delete(t.pos-a.nodeSize,t.pos).scrollIntoView()),!0):!(!t.parent.canReplace(l,l+1)||!n.isTextblock&&!DF(e.doc,t.pos))&&(s&&s(e.tr.join(t.pos).scrollIntoView()),!0))}(e,t,s))return!0;let c=!o&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(n=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(n[0]||i.type).validEnd){if(s){let a=t.pos+i.nodeSize,l=KE.empty;for(let e=n.length-1;e>=0;e--)l=KE.from(n[e].create(null,l));l=KE.from(r.copy(l));let o=e.tr.step(new gF(t.pos-1,a,t.pos,a,new eA(l,1,0),n.length,!0)),c=o.doc.resolve(a+2*n.length);c.nodeAfter&&c.nodeAfter.type==r.type&&DF(o.doc,c.pos)&&o.join(c.pos),s(o.scrollIntoView())}return!0}let d=i.type.spec.isolating||a>0&&o?null:$F.findFrom(t,1),u=d&&d.$from.blockRange(d.$to),m=u&&jF(u);if(null!=m&&m>=t.depth)return s&&s(e.tr.lift(u,m).scrollIntoView()),!0;if(c&&bT(i,"start",!0)&&bT(r,"end")){let a=r,n=[];for(;n.push(a),!a.isTextblock;)a=a.lastChild;let l=i,o=1;for(;!l.isTextblock;l=l.firstChild)o++;if(a.canReplace(a.childCount,a.childCount,l.content)){if(s){let a=KE.empty;for(let e=n.length-1;e>=0;e--)a=KE.from(n[e].copy(a));s(e.tr.step(new gF(t.pos-n.length,t.pos+i.nodeSize,t.pos+o,t.pos+i.nodeSize-o,new eA(a,n.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function MT(e){return function(t,s){let a=t.selection,n=e<0?a.$from:a.$to,l=n.depth;for(;n.node(l).isInline;){if(!l)return!1;l--}return!!n.node(l).isTextblock&&(s&&s(t.tr.setSelection(JF.create(t.doc,e<0?n.start(l):n.end(l)))),!0)}}const PT=MT(-1),BT=MT(1);function RT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(s,a){let n=!1;for(let l=0;l<s.selection.ranges.length&&!n;l++){let{$from:{pos:a},$to:{pos:r}}=s.selection.ranges[l];s.doc.nodesBetween(a,r,(a,l)=>{if(n)return!1;if(a.isTextblock&&!a.hasMarkup(e,t))if(a.type==e)n=!0;else{let t=s.doc.resolve(l),a=t.index();n=t.parent.canReplaceWith(a,a+1,e)}})}if(!n)return!1;if(a){let n=s.tr;for(let a=0;a<s.selection.ranges.length;a++){let{$from:{pos:l},$to:{pos:r}}=s.selection.ranges[a];n.setBlockType(l,r,e,t)}a(n.scrollIntoView())}return!0}}function LT(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return function(e,s,a){for(let n=0;n<t.length;n++)if(t[n](e,s,a))return!0;return!1}}let IT=LT(pT,fT,jT),OT=LT(pT,wT,CT);const UT={Enter:LT(DT,ET,AT,FT),"Mod-Enter":ST,Backspace:IT,"Mod-Backspace":IT,"Shift-Backspace":IT,Delete:OT,"Mod-Delete":OT,"Mod-a":(e,t)=>
vendor: 26,140 bytes, line 2
2(t&&t(e.tr.setSelection(new eT(e.doc))),!0)},HT={"Ctrl-h":UT.Backspace,"Alt-Backspace":UT["Mod-Backspace"],"Ctrl-d":UT.Delete,"Ctrl-Alt-Backspace":UT["Mod-Delete"],"Alt-Delete":UT["Mod-Delete"],"Alt-d":UT["Mod-Delete"],"Ctrl-a":PT,"Ctrl-e":BT};for(let s in UT)HT[s]=UT[s];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&os.platform();function WT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(s,a){let{$from:n,$to:l}=s.selection,r=n.blockRange(l);if(!r)return!1;let i=a?s.tr:null;return!!function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=!1,l=t,r=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(s)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=r.resolve(t.start-2);l=new gA(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new gA(t.$from,r.resolve(t.$to.end(t.depth)),t.depth)),n=!0}let i=yF(l,s,a,t);if(!i)return!1;e&&function(e,t,s,a,n){let l=KE.empty;for(let d=s.length-1;d>=0;d--)l=KE.from(s[d].type.create(s[d].attrs,l));e.step(new gF(t.start-(a?2:0),t.end,t.start,t.end,new eA(l,0,0),s.length,!0));let r=0;for(let d=0;d<s.length;d++)s[d].type==n&&(r=d+1);let i=s.length-r,o=t.start+s.length-(a?2:0),c=t.parent;for(let d=t.startIndex,u=t.endIndex,m=!0;d<u;d++,m=!1)!m&&kF(e.doc,o,i)&&(e.split(o,i),o+=2*i),o+=c.child(d).nodeSize}(e,t,i,n,s);return!0}(i,r,e,t)&&(a&&a(i.scrollIntoView()),!0)}}function VT(e){return function(t,s){let{$from:a,$to:n}=t.selection,l=a.blockRange(n,t=>t.childCount>0&&t.firstChild.type==e);return!!l&&(!s||(a.node(l.depth-1).type==e?function(e,t,s,a){let n=e.tr,l=a.end,r=a.$to.end(a.depth);l<r&&(n.step(new gF(l-1,r,l,r,new eA(KE.from(s.create(null,a.parent.copy())),1,0),1,!0)),a=new gA(n.doc.resolve(a.$from.pos),n.doc.resolve(r),a.depth));const i=jF(a);if(null==i)return!1;n.lift(a,i);let o=n.doc.resolve(n.mapping.map(l,-1)-1);DF(n.doc,o.pos)&&o.nodeBefore.type==o.nodeAfter.type&&n.join(o.pos);return t(n.scrollIntoView()),!0}(t,s,e,l):function(e,t,s){let a=e.tr,n=s.parent;for(let h=s.end,x=s.endIndex-1,p=s.startIndex;x>p;x--)h-=n.child(x).nodeSize,a.delete(h-1,h+1);let l=a.doc.resolve(s.start),r=l.nodeAfter;if(a.mapping.map(s.end)!=s.start+l.nodeAfter.nodeSize)return!1;let i=0==s.startIndex,o=s.endIndex==n.childCount,c=l.node(-1),d=l.index(-1);if(!c.canReplace(d+(i?0:1),d+1,r.content.append(o?KE.empty:KE.from(n))))return!1;let u=l.pos,m=u+r.nodeSize;return a.step(new gF(u-(i?1:0),m+(o?1:0),u+1,m-1,new eA((i?KE.empty:KE.from(n.copy(KE.empty))).append(o?KE.empty:KE.from(n.copy(KE.empty))),i?0:1,o?0:1),i?0:1)),t(a.scrollIntoView()),!0}(t,s,l)))}}const qT=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},$T=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let GT=null;const KT=function(e,t,s){let a=GT||(GT=document.createRange());return a.setEnd(e,null==s?e.nodeValue.length:s),a.setStart(e,t||0),a},YT=function(e,t,s,a){return s&&(QT(e,t,s,a,-1)||QT(e,t,s,a,1))},JT=/^(img|br|input|textarea|hr)$/i;function QT(e,t,s,a,n){for(var l;;){if(e==s&&t==a)return!0;if(t==(n<0?0:XT(e))){let s=e.parentNode;if(!s||1!=s.nodeType||ZT(e)||JT.test(e.nodeName)||"false"==e.contentEditable)return!1;t=qT(e)+(n<0?0:1),e=s}else{if(1!=e.nodeType)return!1;{let s=e.childNodes[t+(n<0?-1:0)];if(1==s.nodeType&&"false"==s.contentEditable){if(!(null===(l=s.pmViewDesc)||void 0===l?void 0:l.ignoreForSelection))return!1;t+=n}else e=s,t=n<0?XT(e):0}}}}function XT(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ZT(e){let t;for(let s=e;s&&!(t=s.pmViewDesc);s=s.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const ez=function(e){return e.focusNode&&YT(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function tz(e,t){let s=document.createEvent("Event");return s.initEvent("keydown",!0,!0),s.keyCode=e,s.key=s.code=t,s}const sz="undefined"!=typeof navigator?navigator:null,az="undefined"!=typeof document?document:null,nz=sz&&sz.userAgent||"",lz=/Edge\/(\d+)/.exec(nz),rz=/MSIE \d/.exec(nz),iz=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nz),oz=!!(rz||iz||lz),cz=rz?document.documentMode:iz?+iz[1]:lz?+lz[1]:0,dz=!oz&&/gecko\/(\d+)/i.test(nz);dz&&(/Firefox\/(\d+)/.exec(nz)||[0,0])[1];const uz=!oz&&/Chrome\/(\d+)/.exec(nz),mz=!!uz,hz=uz?+uz[1]:0,xz=!oz&&!!sz&&/Apple Computer/.test(sz.vendor),pz=xz&&(/Mobile\/\w+/.test(nz)||!!sz&&sz.maxTouchPoints>2),gz=pz||!!sz&&/Mac/.test(sz.platform),fz=!!sz&&/Win/.test(sz.platform),vz=/Android \d/.test(nz),bz=!!az&&"webkitFontSmoothing"in az.documentElement.style,jz=bz?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yz(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Nz(e,t){return"number"==typeof e?e:e[t]}function wz(e){let t=e.getBoundingClientRect(),s=t.width/e.offsetWidth||1,a=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*s,top:t.top,bottom:t.top+e.clientHeight*a}}function Cz(e,t,s){let a=e.someProp("scrollThreshold")||0,n=e.someProp("scrollMargin")||5,l=e.dom.ownerDocument;for(let r=s||e.dom;r;){if(1!=r.nodeType){r=$T(r);continue}let e=r,s=e==l.body,i=s?yz(l):wz(e),o=0,c=0;if(t.top<i.top+Nz(a,"top")?c=-(i.top-t.top+Nz(n,"top")):t.bottom>i.bottom-Nz(a,"bottom")&&(c=t.bottom-t.top>i.bottom-i.top?t.top+Nz(n,"top")-i.top:t.bottom-i.bottom+Nz(n,"bottom")),t.left<i.left+Nz(a,"left")?o=-(i.left-t.left+Nz(n,"left")):t.right>i.right-Nz(a,"right")&&(o=t.right-i.right+Nz(n,"right")),o||c)if(s)l.defaultView.scrollBy(o,c);else{let s=e.scrollLeft,a=e.scrollTop;c&&(e.scrollTop+=c),o&&(e.scrollLeft+=o);let n=e.scrollLeft-s,l=e.scrollTop-a;t={left:t.left-n,top:t.top-l,right:t.right-n,bottom:t.bottom-l}}let d=s?"fixed":getComputedStyle(r).position;if(/^(fixed|sticky)$/.test(d))break;r="absolute"==d?r.offsetParent:$T(r)}}function kz(e){let t=[],s=e.ownerDocument;for(let a=e;a&&(t.push({dom:a,top:a.scrollTop,left:a.scrollLeft}),e!=s);a=$T(a));return t}function Dz(e,t){for(let s=0;s<e.length;s++){let{dom:a,top:n,left:l}=e[s];a.scrollTop!=n+t&&(a.scrollTop=n+t),a.scrollLeft!=l&&(a.scrollLeft=l)}}let _z=null;function Sz(e,t){let s,a,n,l,r=2e8,i=0,o=t.top,c=t.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=KT(d).getClientRects()}for(let m=0;m<e.length;m++){let h=e[m];if(h.top<=o&&h.bottom>=c){o=Math.max(h.bottom,o),c=Math.min(h.top,c);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<r){s=d,r=e,a=e&&3==s.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==d.nodeType&&e&&(i=u+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!n&&h.left<=t.left&&h.right>=t.left&&(n=d,l={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!s&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(i=u+1)}}return!s&&n&&(s=n,a=l,r=0),s&&3==s.nodeType?function(e,t){let s,a=e.nodeValue.length,n=document.createRange();for(let l=0;l<a;l++){n.setEnd(e,l+1),n.setStart(e,l);let a=zz(n,1);if(a.top!=a.bottom&&Ez(t,a)){s={node:e,offset:l+(t.left>=(a.left+a.right)/2?1:0)};break}}return n.detach(),s||{node:e,offset:0}}(s,a):!s||r&&1==s.nodeType?{node:e,offset:i}:Sz(s,a)}function Ez(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Az(e,t,s){let a=e.childNodes.length;if(a&&s.top<s.bottom)for(let n=Math.max(0,Math.min(a-1,Math.floor(a*(t.top-s.top)/(s.bottom-s.top))-2)),l=n;;){let s=e.childNodes[l];if(1==s.nodeType){let e=s.getClientRects();for(let a=0;a<e.length;a++){let n=e[a];if(Ez(t,n))return Az(s,t,n)}}if((l=(l+1)%a)==n)break}return e}function Fz(e,t){let s,a=e.dom.ownerDocument,n=0,l=function(e,t,s){if(e.caretPositionFromPoint)try{let a=e.caretPositionFromPoint(t,s);if(a)return{node:a.offsetNode,offset:Math.min(XT(a.offsetNode),a.offset)}}catch(a){}if(e.caretRangeFromPoint){let a=e.caretRangeFromPoint(t,s);if(a)return{node:a.startContainer,offset:Math.min(XT(a.startContainer),a.startOffset)}}}(a,t.left,t.top);l&&({node:s,offset:n}=l);let r,i=(e.root.elementFromPoint?e.root:a).elementFromPoint(t.left,t.top);if(!i||!e.dom.contains(1!=i.nodeType?i.parentNode:i)){let s=e.dom.getBoundingClientRect();if(!Ez(t,s))return null;if(i=Az(e.dom,t,s),!i)return null}if(xz)for(let c=i;s&&c;c=$T(c))c.draggable&&(s=void 0);if(i=function(e,t){let s=e.parentNode;return s&&/^li$/i.test(s.nodeName)&&t.left<e.getBoundingClientRect().left?s:e}(i,t),s){if(dz&&1==s.nodeType&&(n=Math.min(n,s.childNodes.length),n<s.childNodes.length)){let e,a=s.childNodes[n];"IMG"==a.nodeName&&(e=a.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&n++}let a;bz&&n&&1==s.nodeType&&1==(a=s.childNodes[n-1]).nodeType&&"false"==a.contentEditable&&a.getBoundingClientRect().top>=t.top&&n--,s==e.dom&&n==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>s.lastChild.getBoundingClientRect().bottom?r=e.state.doc.content.size:0!=n&&1==s.nodeType&&"BR"==s.childNodes[n-1].nodeName||(r=function(e,t,s,a){let n=-1;for(let l=t,r=!1;l!=e.dom;){let t,s=e.docView.nearestDesc(l,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!r&&t.left>a.left||t.top>a.top?n=s.posBefore:(!r&&t.right<a.left||t.bottom<a.top)&&(n=s.posAfter),r=!0),!s.contentDOM&&n<0&&!s.node.isText))return(s.node.isBlock?a.top<(t.top+t.bottom)/2:a.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;l=s.dom.parentNode}return n>-1?n:e.docView.posFromDOM(t,s,-1)}(e,s,n,t))}null==r&&(r=function(e,t,s){let{node:a,offset:n}=Sz(t,s),l=-1;if(1==a.nodeType&&!a.firstChild){let e=a.getBoundingClientRect();l=e.left!=e.right&&s.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(a,n,l)}(e,i,t));let o=e.docView.nearestDesc(i,!0);return{pos:r,inside:o?o.posAtStart-o.border:-1}}function Tz(e){return e.top<e.bottom||e.left<e.right}function zz(e,t){let s=e.getClientRects();if(s.length){let e=s[t<0?0:s.length-1];if(Tz(e))return e}return Array.prototype.find.call(s,Tz)||e.getBoundingClientRect()}const Mz=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pz(e,t,s){let{node:a,offset:n,atom:l}=e.docView.domFromPos(t,s<0?-1:1),r=bz||dz;if(3==a.nodeType){if(!r||!Mz.test(a.nodeValue)&&(s<0?n:n!=a.nodeValue.length)){let e=n,t=n,l=s<0?1:-1;return s<0&&!n?(t++,l=-1):s>=0&&n==a.nodeValue.length?(e--,l=1):s<0?e--:t++,Bz(zz(KT(a,e,t),l),l<0)}{let e=zz(KT(a,n,n),s);if(dz&&n&&/\s/.test(a.nodeValue[n-1])&&n<a.nodeValue.length){let t=zz(KT(a,n-1,n-1),-1);if(t.top==e.top){let s=zz(KT(a,n,n+1),-1);if(s.top!=e.top)return Bz(s,s.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(l||0)).parent.inlineContent){if(null==l&&n&&(s<0||n==XT(a))){let e=a.childNodes[n-1];if(1==e.nodeType)return Rz(e.getBoundingClientRect(),!1)}if(null==l&&n<XT(a)){let e=a.childNodes[n];if(1==e.nodeType)return Rz(e.getBoundingClientRect(),!0)}return Rz(a.getBoundingClientRect(),s>=0)}if(null==l&&n&&(s<0||n==XT(a))){let e=a.childNodes[n-1],t=3==e.nodeType?KT(e,XT(e)-(r?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Bz(zz(t,1),!1)}if(null==l&&n<XT(a)){let e=a.childNodes[n];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?KT(e,0,r?0:1):1==e.nodeType?e:null:null;if(t)return Bz(zz(t,-1),!0)}return Bz(zz(3==a.nodeType?KT(a):a,-s),s>=0)}function Bz(e,t){if(0==e.width)return e;let s=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:s,right:s}}function Rz(e,t){if(0==e.height)return e;let s=t?e.top:e.bottom;return{top:s,bottom:s,left:e.left,right:e.right}}function Lz(e,t,s){let a=e.state,n=e.root.activeElement;a!=t&&e.updateState(t),n!=e.dom&&e.focus();try{return s()}finally{a!=t&&e.updateState(a),n!=e.dom&&n&&n.focus()}}const Iz=/[\u0590-\u08ac]/;let Oz=null,Uz=null,Hz=!1;function Wz(e,t,s){return Oz==t&&Uz==s?Hz:(Oz=t,Uz=s,Hz="up"==s||"down"==s?function(e,t,s){let a=t.selection,n="up"==s?a.$from:a.$to;return Lz(e,t,()=>{let{node:t}=e.docView.domFromPos(n.pos,"up"==s?-1:1);for(;;){let s=e.docView.nearestDesc(t,!0);if(!s)break;if(s.node.isBlock){t=s.contentDOM||s.dom;break}t=s.dom.parentNode}let a=Pz(e,n.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=KT(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let n=t[e];if(n.bottom>n.top+1&&("up"==s?a.top-n.top>2*(n.bottom-a.top):n.bottom-a.bottom>2*(a.bottom-n.top)))return!1}}return!0})}(e,t,s):function(e,t,s){let{$head:a}=t.selection;if(!a.parent.isTextblock)return!1;let n=a.parentOffset,l=!n,r=n==a.parent.content.size,i=e.domSelection();return i?Iz.test(a.parent.textContent)&&i.modify?Lz(e,t,()=>{let{focusNode:t,focusOffset:n,anchorNode:l,anchorOffset:r}=e.domSelectionRange(),o=i.caretBidiLevel;i.modify("move",s,"character");let c=a.depth?e.docView.domAfterPos(a.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),m=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&n==u;try{i.collapse(l,r),t&&(t!=l||n!=r)&&i.extend&&i.extend(t,n)}catch(h){}return null!=o&&(i.caretBidiLevel=o),m}):"left"==s||"backward"==s?l:r:a.pos==a.start()||a.pos==a.end()}(e,t,s))}class Vz{constructor(e,t,s,a){this.parent=e,this.children=t,this.dom=s,this.contentDOM=a,this.dirty=0,s.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,s){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,s=this.posAtStart;;t++){let a=this.children[t];if(a==e)return s;s+=a.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,s){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(s<0){let s,a;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&(!(a=s.pmViewDesc)||a.parent!=this);)s=s.previousSibling;return s?this.posBeforeChild(a)+a.size:this.posAtStart}{let s,a;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&(!(a=s.pmViewDesc)||a.parent!=this);)s=s.nextSibling;return s?this.posBeforeChild(a):this.posAtEnd}}let a;if(e==this.dom&&this.contentDOM)a=t>qT(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){a=!1;break}if(t.previousSibling)break}if(null==a&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){a=!0;break}if(t.nextSibling)break}}return(null==a?s>0:a)?this.posAtEnd:this.posAtStart}nearestDesc(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(let s=!0,a=e;a;a=a.parentNode){let n,l=this.getDesc(a);if(l&&(!t||l.node)){if(!s||!(n=l.nodeDOM)||(1==n.nodeType?n.contains(1==e.nodeType?e:e.parentNode):n==e))return l;s=!1}}}getDesc(e){let t=e.pmViewDesc;for(let s=t;s;s=s.parent)if(s==this)return t}posFromDOM(e,t,s){for(let a=e;a;a=a.parentNode){let n=this.getDesc(a);if(n)return n.localPosFromDOM(e,t,s)}return-1}descAt(e){for(let t=0,s=0;t<this.children.length;t++){let a=this.children[t],n=s+a.size;if(s==e&&n!=s){for(;!a.border&&a.children.length;)for(let e=0;e<a.children.length;e++){let t=a.children[e];if(t.size){a=t;break}}return a}if(e<n)return a.descAt(e-s-a.border);s=n}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let s=0,a=0;for(let n=0;s<this.children.length;s++){let t=this.children[s],l=n+t.size;if(l>e||t instanceof Qz){a=e-n;break}n=l}if(a)return this.children[s].domFromPos(a-this.children[s].border,t);for(let n;s&&!(n=this.children[s-1]).size&&n instanceof qz&&n.side>=0;s--);if(t<=0){let e,a=!0;for(;e=s?this.children[s-1]:null,e&&e.dom.parentNode!=this.contentDOM;s--,a=!1);return e&&t&&a&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?qT(e.dom)+1:0}}{let e,a=!0;for(;e=s<this.children.length?this.children[s]:null,e&&e.dom.parentNode!=this.contentDOM;s++,a=!1);return e&&a&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?qT(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let a=-1,n=-1;for(let l=s,r=0;;r++){let s=this.children[r],i=l+s.size;if(-1==a&&e<=i){let n=l+s.border;if(e>=n&&t<=i-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,n);e=l;for(let t=r;t>0;t--){let s=this.children[t-1];if(s.size&&s.dom.parentNode==this.contentDOM&&!s.emptyChildAt(1)){a=qT(s.dom)+1;break}e-=s.size}-1==a&&(a=0)}if(a>-1&&(i>t||r==this.children.length-1)){t=i;for(let e=r+1;e<this.children.length;e++){let s=this.children[e];if(s.size&&s.dom.parentNode==this.contentDOM&&!s.emptyChildAt(-1)){n=qT(s.dom);break}t+=s.size}-1==n&&(n=this.contentDOM.childNodes.length);break}l=i}return{node:this.contentDOM,from:e,to:t,fromOffset:a,toOffset:n}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:s}=this.domFromPos(e,0);if(1!=t.nodeType||s==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[s]}setSelection(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=Math.min(e,t),l=Math.max(e,t);for(let h=0,x=0;h<this.children.length;h++){let r=this.children[h],i=x+r.size;if(n>x&&l<i)return r.setSelection(e-x-r.border,t-x-r.border,s,a);x=i}let r=this.domFromPos(e,e?-1:1),i=t==e?r:this.domFromPos(t,t?-1:1),o=s.root.getSelection(),c=s.domSelectionRange(),d=!1;if((dz||xz)&&e==t){let{node:e,offset:t}=r;if(3==e.nodeType){if(d=!(!t||"\n"!=e.nodeValue[t-1]),d&&t==e.nodeValue.length)for(let s,a=e;a;a=a.parentNode){if(s=a.nextSibling){"BR"==s.nodeName&&(r=i={node:s.parentNode,offset:qT(s)+1});break}let e=a.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let s=e.childNodes[t-1];d=s&&("BR"==s.nodeName||"false"==s.contentEditable)}}if(dz&&c.focusNode&&c.focusNode!=i.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(a=!0)}if(!(a||d&&xz)&&YT(r.node,r.offset,c.anchorNode,c.anchorOffset)&&YT(i.node,i.offset,c.focusNode,c.focusOffset))return;let u=!1;if((o.extend||e==t)&&(!d||!dz)){o.collapse(r.node,r.offset);try{e!=t&&o.extend(i.node,i.offset),u=!0}catch(m){}}if(!u){if(e>t){let e=r;r=i,i=e}let s=document.createRange();s.setEnd(i.node,i.offset),s.setStart(r.node,r.offset),o.removeAllRanges(),o.addRange(s)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let s=0,a=0;a<this.children.length;a++){let n=this.children[a],l=s+n.size;if(s==l?e<=l&&t>=s:e<l&&t>s){let a=s+n.border,r=l-n.border;if(e>=a&&t<=r)return this.dirty=e==s||t==l?2:1,void(e!=a||t!=r||!n.contentLost&&n.dom.parentNode==this.contentDOM?n.markDirty(e-a,t-a):n.dirty=3);n.dirty=n.dom!=n.contentDOM||n.dom.parentNode!=this.contentDOM||n.children.length?3:2}s=l}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let s=1==e?2:1;t.dirty<s&&(t.dirty=s)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class qz extends Vz{constructor(e,t,s,a){let n,l=t.type.toDOM;if("function"==typeof l&&(l=l(s,()=>n?n.parent?n.parent.posBeforeChild(n):void 0:a)),!t.type.spec.raw){if(1!=l.nodeType){let e=document.createElement("span");e.appendChild(l),l=e}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=t,this.widget=t,n=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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 $z extends Vz{constructor(e,t,s,a){super(e,[],t,null),this.textDOM=s,this.text=a}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Gz extends Vz{constructor(e,t,s,a,n){super(e,[],s,a),this.mark=t,this.spec=n}static create(e,t,s,a){let n=a.nodeViews[t.type.name],l=n&&n(t,a,s);return l&&l.dom||(l=YA.renderSpec(document,t.type.spec.toDOM(t,s),null,t.attrs)),new Gz(e,t,l.dom,l.contentDOM||l.dom,l)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,s){let a=Gz.create(this.parent,this.mark,!0,s),n=this.children,l=this.size;t<l&&(n=dM(n,t,l,s)),e>0&&(n=dM(n,0,e,s));for(let r=0;r<n.length;r++)n[r].parent=a;return a.children=n,a}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Kz extends Vz{constructor(e,t,s,a,n,l,r,i,o){super(e,[],n,l),this.node=t,this.outerDeco=s,this.innerDeco=a,this.nodeDOM=r}static create(e,t,s,a,n,l){let r,i=n.nodeViews[t.type.name],o=i&&i(t,n,()=>r?r.parent?r.parent.posBeforeChild(r):void 0:l,s,a),c=o&&o.dom,d=o&&o.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=YA.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return c=lM(c,s,t),o?r=new Xz(e,t,s,a,c,d||null,u,o,n,l+1):t.isText?new Jz(e,t,s,a,c,u,n):new Kz(e,t,s,a,c,d||null,u,n,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let s=this.children[t];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>KE.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,s){return 0==this.dirty&&e.eq(this.node)&&rM(t,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let s=this.node.inlineContent,a=t,n=e.composing?this.localCompositionInfo(e,t):null,l=n&&n.pos>-1?n:null,r=n&&n.pos<0,i=new oM(this,l&&l.node,e);!function(e,t,s,a){let n=t.locals(e),l=0;if(0==n.length){for(let s=0;s<e.childCount;s++){let r=e.child(s);a(r,n,t.forChild(l,r),s),l+=r.nodeSize}return}let r=0,i=[],o=null;for(let c=0;;){let d,u,m,h;for(;r<n.length&&n[r].to==l;){let e=n[r++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(cM);for(let e=0;e<u.length;e++)s(u[e],c,!!o)}else s(d,c,!!o);if(o)h=-1,m=o,o=null;else{if(!(c<e.childCount))break;h=c,m=e.child(c++)}for(let e=0;e<i.length;e++)i[e].to<=l&&i.splice(e--,1);for(;r<n.length&&n[r].from<=l&&n[r].to>l;)i.push(n[r++]);let x=l+m.nodeSize;if(m.isText){let e=x;r<n.length&&n[r].from<e&&(e=n[r].from);for(let t=0;t<i.length;t++)i[t].to<e&&(e=i[t].to);e<x&&(o=m.cut(e-l),m=m.cut(0,e-l),x=e,h=-1)}else for(;r<n.length&&n[r].to<x;)r++;a(m,m.isInline&&!m.isLeaf?i.filter(e=>!e.inline):i.slice(),t.forChild(l,m),h),l=x}}(this.node,this.innerDeco,(t,n,l)=>{t.spec.marks?i.syncToMarks(t.spec.marks,s,e):t.type.side>=0&&!l&&i.syncToMarks(n==this.node.childCount?XE.none:this.node.child(n).marks,s,e),i.placeWidget(t,e,a)},(t,l,o,c)=>{let d;i.syncToMarks(t.marks,s,e),i.findNodeMatch(t,l,o,c)||r&&e.state.selection.from>a&&e.state.selection.to<a+t.nodeSize&&(d=i.findIndexWithChild(n.node))>-1&&i.updateNodeAt(t,l,o,d,e)||i.updateNextNode(t,l,o,e,c,a)||i.addNode(t,l,o,e,a),a+=t.nodeSize}),i.syncToMarks([],s,e),this.node.isTextblock&&i.addTextblockHacks(),i.destroyRest(),(i.changed||2==this.dirty)&&(l&&this.protectLocalComposition(e,l),Zz(this.contentDOM,this.children,e),pz&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:s,to:a}=e.state.selection;if(!(e.state.selection instanceof JF)||s<t||a>t+this.node.content.size)return null;let n=e.input.compositionNode;if(!n||!this.dom.contains(n.parentNode))return null;if(this.node.inlineContent){let e=n.nodeValue,l=function(e,t,s,a){for(let n=0,l=0;n<e.childCount&&l<=a;){let r=e.child(n++),i=l;if(l+=r.nodeSize,!r.isText)continue;let o=r.text;for(;n<e.childCount;){let t=e.child(n++);if(l+=t.nodeSize,!t.isText)break;o+=t.text}if(l>=s){if(l>=a&&o.slice(a-t.length-i,a-i)==t)return a-t.length;let e=i<a?o.lastIndexOf(t,a-i-1):-1;
vendor: 4,883 bytes, line 2
2if(e>=0&&e+t.length+i>=s)return i+e;if(s==a&&o.length>=a+t.length-i&&o.slice(a-i,a-i+t.length)==t)return a}}return-1}(this.node.content,e,s-t,a-t);return l<0?null:{node:n,pos:l,text:e}}return{node:n,pos:-1,text:""}}protectLocalComposition(e,t){let{node:s,pos:a,text:n}=t;if(this.getDesc(s))return;let l=s;for(;l.parentNode!=this.contentDOM;l=l.parentNode){for(;l.previousSibling;)l.parentNode.removeChild(l.previousSibling);for(;l.nextSibling;)l.parentNode.removeChild(l.nextSibling);l.pmViewDesc&&(l.pmViewDesc=void 0)}let r=new $z(this,l,s,n);e.input.compositionNodes.push(r),this.children=dM(this.children,a,a+n.length,e,r)}update(e,t,s,a){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,s,a),!0)}updateInner(e,t,s,a){this.updateOuterDeco(t),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(rM(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,s=this.dom;this.dom=aM(this.dom,this.nodeDOM,sM(this.outerDeco,this.node,t),sM(e,this.node,t)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Yz(e,t,s,a,n){lM(a,t,e);let l=new Kz(void 0,e,t,s,a,a,a,n,0);return l.contentDOM&&l.updateChildren(n,0),l}class Jz extends Kz{constructor(e,t,s,a,n,l,r){super(e,t,s,a,n,null,l,r,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,s,a){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,s){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,s)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,s){let a=this.node.cut(e,t),n=document.createTextNode(a.text);return new Jz(this.parent,a,this.outerDeco,this.innerDeco,n,n,s)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Qz extends Vz{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Xz extends Kz{constructor(e,t,s,a,n,l,r,i,o,c){super(e,t,s,a,n,l,r,o,c),this.spec=i}update(e,t,s,a){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let n=this.spec.update(e,t,s);return n&&this.updateInner(e,t,s,a),n}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,s,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,s,a){this.spec.setSelection?this.spec.setSelection(e,t,s.root):super.setSelection(e,t,s,a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Zz(e,t,s){let a=e.firstChild,n=!1;for(let l=0;l<t.length;l++){let r=t[l],i=r.dom;if(i.parentNode==e){for(;i!=a;)a=iM(a),n=!0;a=a.nextSibling}else n=!0,e.insertBefore(i,a);if(r instanceof Gz){let t=a?a.previousSibling:e.lastChild;Zz(r.contentDOM,r.children,s),a=t?t.nextSibling:e.firstChild}}for(;a;)a=iM(a),n=!0;n&&s.trackWrites==e&&(s.trackWrites=null)}const eM=function(e){e&&(this.nodeName=e)};eM.prototype=Object.create(null);const tM=[new eM];function sM(e,t,s){if(0==e.length)return tM;let a=s?tM[0]:new eM,n=[a];for(let l=0;l<e.length;l++){let r=e[l].type.attrs;if(r){r.nodeName&&n.push(a=new eM(r.nodeName));for(let e in r){let l=r[e];null!=l&&(s&&1==n.length&&n.push(a=new eM(t.isInline?"span":"div")),"class"==e?a.class=(a.class?a.class+" ":"")+l:"style"==e?a.style=(a.style?a.style+";":"")+l:"nodeName"!=e&&(a[e]=l))}}}return n}function aM(e,t,s,a){if(s==tM&&a==tM)return t;let n=t;for(let l=0;l<a.length;l++){let t=a[l],r=s[l];if(l){let s;r&&r.nodeName==t.nodeName&&n!=e&&(s=n.parentNode)&&s.nodeName.toLowerCase()==t.nodeName||(s=document.createElement(t.no
vendor: 1,227 bytes, line 2
2deName),s.pmIsDeco=!0,s.appendChild(n),r=tM[0]),n=s}nM(n,r||tM[0],t)}return n}function nM(e,t,s){for(let a in t)"class"==a||"style"==a||"nodeName"==a||a in s||e.removeAttribute(a);for(let a in s)"class"!=a&&"style"!=a&&"nodeName"!=a&&s[a]!=t[a]&&e.setAttribute(a,s[a]);if(t.class!=s.class){let a=t.class?t.class.split(" ").filter(Boolean):[],n=s.class?s.class.split(" ").filter(Boolean):[];for(let t=0;t<a.length;t++)-1==n.indexOf(a[t])&&e.classList.remove(a[t]);for(let t=0;t<n.length;t++)-1==a.indexOf(n[t])&&e.classList.add(n[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=s.style){if(t.style){let s,a=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;s=a.exec(t.style);)e.style.removeProperty(s[1])}s.style&&(e.style.cssText+=s.style)}}function lM(e,t,s){return aM(e,e,tM,sM(t,s,1!=e.nodeType))}function rM(e,t){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!e[s].type.eq(t[s].type))return!1;return!0}function iM(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class oM{constructor(e,t,s){this.lock=t,this.view=s,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let s=t,a=s.children.length,n=e.childCount,l=ne
vendor: 4,185 bytes, line 2
2w Map,r=[];e:for(;n>0;){let i;for(;;)if(a){let e=s.children[a-1];if(!(e instanceof Gz)){i=e,a--;break}s=e,a=e.children.length}else{if(s==t)break e;a=s.parent.children.indexOf(s),s=s.parent}let o=i.node;if(o){if(o!=e.child(n-1))break;--n,l.set(i,n),r.push(i)}}return{index:n,matched:l,matches:r.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let s=e;s<t;s++)this.top.children[s].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,s){let a=0,n=this.stack.length>>1,l=Math.min(n,e.length);for(;a<l&&(a==n-1?this.top:this.stack[a+1<<1]).matchesMark(e[a])&&!1!==e[a].type.spec.spanning;)a++;for(;a<n;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),n--;for(;n<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let s=this.top.children[t];if(s.matchesMark(e[n])&&!this.isLocked(s.dom)){a=t;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let a=Gz.create(this.top,e[n],t,s);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,n++}}findNodeMatch(e,t,s,a){let n,l=-1;if(a>=this.preMatch.index&&(n=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&n.matchesNode(e,t,s))l=this.top.children.indexOf(n,this.index);else for(let r=this.index,i=Math.min(this.top.children.length,r+5);r<i;r++){let a=this.top.children[r];if(a.matchesNode(e,t,s)&&!this.preMatch.matched.has(a)){l=r;break}}return!(l<0)&&(this.destroyBetween(this.index,l),this.index++,!0)}updateNodeAt(e,t,s,a,n){let l=this.top.children[a];return 3==l.dirty&&l.dom==l.contentDOM&&(l.dirty=2),!!l.update(e,t,s,n)&&(this.destroyBetween(this.index,a),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,s,a,n,l){for(let r=this.index;r<this.top.children.length;r++){let i=this.top.children[r];if(i instanceof Kz){let o=this.preMatch.matched.get(i);if(null!=o&&o!=n)return!1;let c,d=i.dom,u=this.isLocked(d)&&!(e.isText&&i.node&&i.node.isText&&i.nodeDOM.nodeValue==e.text&&3!=i.dirty&&rM(t,i.outerDeco));if(!u&&i.update(e,t,s,a))return this.destroyBetween(this.index,r),i.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(i,e,t,s,a,l)))return this.destroyBetween(this.index,r),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(a,l+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,s,a,n,l){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!rM(s,e.outerDeco)||!a.eq(e.innerDeco))return null;let r=Kz.create(this.top,t,s,a,n,l);if(r.contentDOM){r.children=e.children,e.children=[];for(let e of r.children)e.parent=r}return e.destroy(),r}addNode(e,t,s,a,n){let l=Kz.create(this.top,e,t,s,a,n);l.contentDOM&&l.updateChildren(a,n+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,t,s){let a=this.index<this.top.children.length?this.top.children[this.index]:null;if(!a||!a.matchesWidget(e)||e!=a.widget&&a.widget.type.toDOM.parentNode){let a=new qz(this.top,e,t,s);this.top.children.splice(this.index++,0,a),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Gz;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Jz)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((xz||mz)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let s=document.createElement(e);"IMG"==e&&(s.className="ProseMirror-separator",s.alt=""),"BR"==e&&(s.className="ProseMirror-trailingBreak");let a=new Qz(this.top,[],s,null);t!=this.top?t.children.push(a):t.children.splice(this.index++,0,a),this.changed=!0}}
vendor: 6,878 bytes, line 2
2isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function cM(e,t){return e.type.side-t.type.side}function dM(e,t,s,a,n){let l=[];for(let r=0,i=0;r<e.length;r++){let o=e[r],c=i,d=i+=o.size;c>=s||d<=t?l.push(o):(c<t&&l.push(o.slice(0,t-c,a)),n&&(l.push(n),n=void 0),d>s&&l.push(o.slice(s-c,o.size,a)))}return l}function uM(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=e.domSelectionRange(),a=e.state.doc;if(!s.focusNode)return null;let n=e.docView.nearestDesc(s.focusNode),l=n&&0==n.size,r=e.docView.posFromDOM(s.focusNode,s.focusOffset,1);if(r<0)return null;let i,o,c=a.resolve(r);if(ez(s)){for(i=r;n&&!n.node;)n=n.parent;let e=n.node;if(n&&e.isAtom&&XF.isSelectable(e)&&n.parent&&(!e.isInline||!function(e,t,s){for(let a=0==t,n=t==XT(e);a||n;){if(e==s)return!0;let t=qT(e);if(!(e=e.parentNode))return!1;a=a&&0==t,n=n&&t==XT(e)}}(s.focusNode,s.focusOffset,n.dom))){let e=n.posBefore;o=new XF(r==e?c:a.resolve(e))}}else{if(s instanceof e.dom.ownerDocument.defaultView.Selection&&s.rangeCount>1){let t=r,n=r;for(let a=0;a<s.rangeCount;a++){let l=s.getRangeAt(a);t=Math.min(t,e.docView.posFromDOM(l.startContainer,l.startOffset,1)),n=Math.max(n,e.docView.posFromDOM(l.endContainer,l.endOffset,-1))}if(t<0)return null;[i,r]=n==e.state.selection.anchor?[n,t]:[t,n],c=a.resolve(r)}else i=e.docView.posFromDOM(s.anchorNode,s.anchorOffset,1);if(i<0)return null}let d=a.resolve(i);if(!o){o=jM(e,d,c,"pointer"==t||e.state.selection.head<c.pos&&!l?1:-1)}return o}function mM(e){return e.editable?e.hasFocus():NM(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function hM(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=e.state.selection;if(vM(e,s),mM(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&mz){let t=e.domSelectionRange(),s=e.domObserver.currentSelection;if(t.anchorNode&&s.anchorNode&&YT(t.anchorNode,t.anchorOffset,s.anchorNode,s.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let s=e.cursorWrapper.dom,a="IMG"==s.nodeName;a?t.collapse(s.parentNode,qT(s)+1):t.collapse(s,0);!a&&!e.state.selection.visible&&oz&&cz<=11&&(s.disabled=!0,s.disabled=!1)}(e);else{let a,n,{anchor:l,head:r}=s;!xM||s instanceof JF||(s.$from.parent.inlineContent||(a=pM(e,s.from)),s.empty||s.$from.parent.inlineContent||(n=pM(e,s.to))),e.docView.setSelection(l,r,e,t),xM&&(a&&fM(a),n&&fM(n)),s.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let s=e.domSelectionRange(),a=s.anchorNode,n=s.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{s.anchorNode==a&&s.anchorOffset==n||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{mM(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const xM=xz||mz&&hz<63;function pM(e,t){let{node:s,offset:a}=e.docView.domFromPos(t,0),n=a<s.childNodes.length?s.childNodes[a]:null,l=a?s.childNodes[a-1]:null;if(xz&&n&&"false"==n.contentEditable)return gM(n);if((!n||"false"==n.contentEditable)&&(!l||"false"==l.contentEditable)){if(n)return gM(n);if(l)return gM(l)}}function gM(e){return e.contentEditable="true",xz&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function fM(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function vM(e,t){if(t instanceof XF){let s=e.docView.descAt(t.from);s!=e.lastSelectedViewDesc&&(bM(e),s&&s.selectNode(),e.lastSelectedViewDesc=s)}else bM(e)}function bM(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function jM(e,t,s,a){return e.someProp("createSelectionBetween",a=>a(e,t,s))||JF.between(t,s,a)}function yM(e){return!(e.editable&&!e.hasFocus())&&NM(e)}function NM(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(s){return!1}}function wM(e,t){let{$anchor:s,$head:a}=e.selection,n=t>0?s.max(a):s.min(a),l=n.parent.inlineContent?n.depth?e.doc.resolve(t>0?n.after():n.before()):null:n;return l&&$F.findFrom(l,t)}function CM(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function kM(e,t,s){let a=e.state.selection;if(!(a instanceof JF)){if(a instanceof XF&&a.node.isInline)return CM(e,new JF(t>0?a.$to:a.$from));{let s=wM(e.state,t);return!!s&&CM(e,s)}}if(s.indexOf("s")>-1){let{$head:s}=a,n=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!n||n.isText||!n.isLeaf)return!1;let l=e.state.doc.resolve(s.pos+n.nodeSize*(t<0?-1:1));return CM(e,new JF(a.$anchor,l))}if(!a.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let s=wM(e.state,t);return!!(s&&s instanceof XF)&&CM(e,s)}if(!(gz&&s.indexOf("m")>-1)){let s,n=a.$head,l=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!l||l.isText)return!1;let r=t<0?n.pos-l.nodeSize:n.pos;return!!(l.isAtom||(s=e.docView.descAt(r))&&!s.contentDOM)&&(XF.isSelectable(l)?CM(e,new XF(t<0?e.state.doc.resolve(n.pos-l.nodeSize):n)):!!bz&&CM(e,new JF(e.state.doc.resolve(t<0?r:r+l.nodeSize))))}}function DM(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function _M(e,t){let s=e.pmViewDesc;return s&&0==s.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function SM(e,t){return t<0?function(e){let t=e.domSelectionRange(),s=t.focusNode,a=t.focusOffset;if(!s)return;let n,l,r=!1;dz&&1==s.nodeType&&a<DM(s)&&_M(s.childNodes[a],-1)&&(r=!0);for(;;)if(a>0){if(1!=s.nodeType)break;{let e=s.childNodes[a-1];if(_M(e,-1))n=s,l=--a;else{if(3!=e.nodeType)break;s=e,a=s.nodeValue.length}}}else{if(EM(s))break;{let t=s.previousSibling;for(;t&&_M(t,-1);)n=s.parentNode,l=qT(t),t=t.previousSibling;if(t)s=t,a=DM(s);else{if(s=s.parentNode,s==e.dom)break;a=0}}}r?AM(e,s,a):n&&AM(e,n,l)}(e):function(e){let t=e.domSelectionRange(),s=t.focusNode,a=t.focusOffset;if(!s)return;let n,l,r=DM(s);for(;;)if(a<r){if(1!=s.nodeType)break;if(!_M(s.childNodes[a],1))break;n=s,l=++a}else{if(EM(s))break;{let t=s.nextSibling;for(;t&&_M(t,1);)n=t.parentNode,l=qT(t)+1,t=t.nextSibling;if(t)s=t,a=0,r=DM(s);else{if(s=s.parentNode,s==e.dom)break;a=r=0}}}n&&AM(e,n,l)}(e)}function EM(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function AM(e,t,s){if(3!=t.nodeType){let e,a;(a=function(e,t){for(;e&&t==e.childNodes.length&&!ZT(e);)t=qT(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let s=e.childNodes[t];
vendor: 20,523 bytes, line 2
2if(3==s.nodeType)return s;if(1==s.nodeType&&"false"==s.contentEditable)break;e=s,t=0}}(t,s))?(t=a,s=0):(e=function(e,t){for(;e&&!t&&!ZT(e);)t=qT(e),e=e.parentNode;for(;e&&t;){let s=e.childNodes[t-1];if(3==s.nodeType)return s;if(1==s.nodeType&&"false"==s.contentEditable)break;t=(e=s).childNodes.length}}(t,s))&&(t=e,s=e.nodeValue.length)}let a=e.domSelection();if(!a)return;if(ez(a)){let e=document.createRange();e.setEnd(t,s),e.setStart(t,s),a.removeAllRanges(),a.addRange(e)}else a.extend&&a.extend(t,s);e.domObserver.setCurSelection();let{state:n}=e;setTimeout(()=>{e.state==n&&hM(e)},50)}function FM(e,t){let s=e.state.doc.resolve(t);if(!mz&&!fz&&s.parent.inlineContent){let a=e.coordsAtPos(t);if(t>s.start()){let s=e.coordsAtPos(t-1),n=(s.top+s.bottom)/2;if(n>a.top&&n<a.bottom&&Math.abs(s.left-a.left)>1)return s.left<a.left?"ltr":"rtl"}if(t<s.end()){let s=e.coordsAtPos(t+1),n=(s.top+s.bottom)/2;if(n>a.top&&n<a.bottom&&Math.abs(s.left-a.left)>1)return s.left>a.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function TM(e,t,s){let a=e.state.selection;if(a instanceof JF&&!a.empty||s.indexOf("s")>-1)return!1;if(gz&&s.indexOf("m")>-1)return!1;let{$from:n,$to:l}=a;if(!n.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=wM(e.state,t);if(s&&s instanceof XF)return CM(e,s)}if(!n.parent.inlineContent){let s=t<0?n:l,r=a instanceof eT?$F.near(s,t):$F.findFrom(s,t);return!!r&&CM(e,r)}return!1}function zM(e,t){if(!(e.state.selection instanceof JF))return!0;let{$head:s,$anchor:a,empty:n}=e.state.selection;if(!s.sameParent(a))return!0;if(!n)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let l=!s.textOffset&&(t<0?s.nodeBefore:s.nodeAfter);if(l&&!l.isText){let a=e.state.tr;return t<0?a.delete(s.pos-l.nodeSize,s.pos):a.delete(s.pos,s.pos+l.nodeSize),e.dispatch(a),!0}return!1}function MM(e,t,s){e.domObserver.stop(),t.contentEditable=s,e.domObserver.start()}function PM(e,t){let s=t.keyCode,a=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==s||gz&&72==s&&"c"==a)return zM(e,-1)||SM(e,-1);if(46==s&&!t.shiftKey||gz&&68==s&&"c"==a)return zM(e,1)||SM(e,1);if(13==s||27==s)return!0;if(37==s||gz&&66==s&&"c"==a){let t=37==s?"ltr"==FM(e,e.state.selection.from)?-1:1:-1;return kM(e,t,a)||SM(e,t)}if(39==s||gz&&70==s&&"c"==a){let t=39==s?"ltr"==FM(e,e.state.selection.from)?1:-1:1;return kM(e,t,a)||SM(e,t)}return 38==s||gz&&80==s&&"c"==a?TM(e,-1,a)||SM(e,-1):40==s||gz&&78==s&&"c"==a?function(e){if(!xz||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:s}=e.domSelectionRange();if(t&&1==t.nodeType&&0==s&&t.firstChild&&"false"==t.firstChild.contentEditable){let s=t.firstChild;MM(e,s,"true"),setTimeout(()=>MM(e,s,"false"),20)}return!1}(e)||TM(e,1,a)||SM(e,1):a==(gz?"m":"c")&&(66==s||73==s||89==s||90==s)}function BM(e,t){e.someProp("transformCopied",s=>{t=s(t,e)});let s=[],{content:a,openStart:n,openEnd:l}=t;for(;n>1&&l>1&&1==a.childCount&&1==a.firstChild.childCount;){n--,l--;let e=a.firstChild;s.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),a=e.content}let r=e.someProp("clipboardSerializer")||YA.fromSchema(e.state.schema),i=$M(),o=i.createElement("div");o.appendChild(r.serializeFragment(a,{document:i}));let c,d=o.firstChild,u=0;for(;d&&1==d.nodeType&&(c=VM[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=i.createElement(c[e]);for(;o.firstChild;)t.appendChild(o.firstChild);o.appendChild(t),u++}d=o.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice","".concat(n," ").concat(l).concat(u?" -".concat(u):""," ").concat(JSON.stringify(s))),{dom:o,text:e.someProp("clipboardTextSerializer",s=>s(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function RM(e,t,s,a,n){let l,r,i=n.parent.type.spec.code;if(!s&&!t)return null;let o=!!t&&(a||i||!s);if(o){if(e.someProp("transformPastedText",s=>{t=s(t,i||a,e)}),i)return r=new eA(KE.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{r=t(r,e,!0)}),r;let s=e.someProp("clipboardTextParser",s=>s(t,n,a,e));if(s)r=s;else{let s=n.marks(),{schema:a}=e.state,r=YA.fromSchema(a);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=l.appendChild(document.createElement("p"));e&&t.appendChild(r.serializeNode(a.text(e,s)))})}}else e.someProp("transformPastedHTML",t=>{s=t(s,e)}),l=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let s,a=$M().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(e);(s=n&&VM[n[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join(""));if(a.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;GM||(GM=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return GM.createHTML(e)}(e),s)for(let l=0;l<s.length;l++)a=a.querySelector(s[l])||a;return a}(s),bz&&function(e){let t=e.querySelectorAll(mz?"span:not([class]):not([style])":"span.Apple-converted-space");for(let s=0;s<t.length;s++){let a=t[s];1==a.childNodes.length&&"\xa0"==a.textContent&&a.parentNode&&a.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),a)}}(l);let c=l&&l.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let e=l.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;l=e}if(!r){let t=e.someProp("clipboardParser")||e.someProp("domParser")||IA.fromSchema(e.state.schema);r=t.parseSlice(l,{preserveWhitespace:!(!o&&!d),context:n,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||LM.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)r=function(e,t){if(!e.size)return e;let s,a=e.content.firstChild.type.schema;try{s=JSON.parse(t)}catch(G2){return e}let{content:n,openStart:l,openEnd:r}=e;for(let i=s.length-2;i>=0;i-=2){let e=a.nodes[s[i]];if(!e||e.hasRequiredAttrs())break;n=KE.from(e.create(s[i+1],n)),l++,r++}return new eA(n,l,r)}(WM(r,+d[1],+d[2]),d[4]);else if(r=eA.maxOpen(function(e,t){if(e.childCount<2)return e;for(let s=t.depth;s>=0;s--){let a,n=t.node(s).contentMatchAt(t.index(s)),l=[];if(e.forEach(e=>{if(!l)return;let t,s=n.findWrapping(e.type);if(!s)return l=null;if(t=l.length&&a.length&&OM(s,a,e,l[l.length-1],0))l[l.length-1]=t;else{l.length&&(l[l.length-1]=UM(l[l.length-1],a.length));let t=IM(e,s);l.push(t),n=n.matchType(t.type),a=s}}),l)return KE.from(l)}return e}(r.content,n),!0),r.openStart||r.openEnd){let e=0,t=0;for(let s=r.content.firstChild;e<r.openStart&&!s.type.spec.isolating;e++,s=s.firstChild);for(let s=r.content.lastChild;t<r.openEnd&&!s.type.spec.isolating;t++,s=s.lastChild);r=WM(r,e,t)}return e.someProp("transformPasted",t=>{r=t(r,e,o)}),r}const LM=/^(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 IM(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(let a=t.length-1;a>=s;a--)e=t[a].create(null,KE.from(e));return e}function OM(e,t,s,a,n){if(n<e.length&&n<t.length&&e[n]==t[n]){let l=OM(e,t,s,a.lastChild,n+1);if(l)return a.copy(a.content.replaceChild(a.childCount-1,l));if(a.contentMatchAt(a.childCount).matchType(n==e.length-1?s.type:e[n+1]))return a.copy(a.content.append(KE.from(IM(s,e,n+1))))}}function UM(e,t){if(0==t)return e;let s=e.content.replaceChild(e.childCount-1,UM(e.lastChild,t-1)),a=e.contentMatchAt(e.childCount).fillBefore(KE.empty,!0);return e.copy(s.append(a))}function HM(e,t,s,a,n,l){let r=t<0?e.firstChild:e.lastChild,i=r.content;return e.childCount>1&&(l=0),n<a-1&&(i=HM(i,t,s,a,n+1,l)),n>=s&&(i=t<0?r.contentMatchAt(0).fillBefore(i,l<=n).append(i):i.append(r.contentMatchAt(r.childCount).fillBefore(KE.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,r.copy(i))}function WM(e,t,s){return t<e.openStart&&(e=new eA(HM(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),s<e.openEnd&&(e=new eA(HM(e.content,1,s,e.openEnd,0,0),e.openStart,s)),e}const VM={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let qM=null;function $M(){return qM||(qM=document.implementation.createHTMLDocument("title"))}let GM=null;const KM={},YM={},JM={touchstart:!0,touchmove:!0};class QM{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 XM(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ZM(e){e.someProp("handleDOMEvents",t=>{for(let s in t)e.input.eventHandlers[s]||e.dom.addEventListener(s,e.input.eventHandlers[s]=t=>eP(e,t))})}function eP(e,t){return e.someProp("handleDOMEvents",s=>{let a=s[t.type];return!!a&&(a(e,t)||t.defaultPrevented)})}function tP(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let s=t.target;s!=e.dom;s=s.parentNode)if(!s||11==s.nodeType||s.pmViewDesc&&s.pmViewDesc.stopEvent(t))return!1;return!0}function sP(e){return{left:e.clientX,top:e.clientY}}function aP(e,t,s,a,n){if(-1==a)return!1;let l=e.state.doc.resolve(a);for(let r=l.depth+1;r>0;r--)if(e.someProp(t,t=>r>l.depth?t(e,s,l.nodeAfter,l.before(r),n,!0):t(e,s,l.node(r),l.before(r),n,!1)))return!0;return!1}function nP(e,t,s){if(e.focused||e.focus(),e.state.selection.eq(t))return;let a=e.state.tr.setSelection(t);"pointer"==s&&a.setMeta("pointer",!0),e.dispatch(a)}function lP(e,t,s,a,n){return aP(e,"handleClickOn",t,s,a)||e.someProp("handleClick",s=>s(e,t,a))||(n?function(e,t){if(-1==t)return!1;let s,a,n=e.state.selection;n instanceof XF&&(s=n.node);let l=e.state.doc.resolve(t);for(let r=l.depth+1;r>0;r--){let e=r>l.depth?l.nodeAfter:l.node(r);if(XF.isSelectable(e)){a=s&&n.$from.depth>0&&r>=n.$from.depth&&l.before(n.$from.depth+1)==n.$from.pos?l.before(n.$from.depth):l.before(r);break}}return null!=a&&(nP(e,XF.create(e.state.doc,a),"pointer"),!0)}(e,s):function(e,t){if(-1==t)return!1;let s=e.state.doc.resolve(t),a=s.nodeAfter;return!!(a&&a.isAtom&&XF.isSelectable(a))&&(nP(e,new XF(s),"pointer"),!0)}(e,s))}function rP(e,t,s,a){return aP(e,"handleDoubleClickOn",t,s,a)||e.someProp("handleDoubleClick",s=>s(e,t,a))}function iP(e,t,s,a){return aP(e,"handleTripleClickOn",t,s,a)||e.someProp("handleTripleClick",s=>s(e,t,a))||function(e,t,s){if(0!=s.button)return!1;let a=e.state.doc;if(-1==t)return!!a.inlineContent&&(nP(e,JF.create(a,0,a.content.size),"pointer"),!0);let n=a.resolve(t);for(let l=n.depth+1;l>0;l--){let t=l>n.depth?n.nodeAfter:n.node(l),s=n.before(l);if(t.inlineContent)nP(e,JF.create(a,s+1,s+1+t.content.size),"pointer");else{if(!XF.isSelectable(t))continue;nP(e,XF.create(a,s),"pointer")}return!0}}(e,s,a)}function oP(e){return gP(e)}YM.keydown=(e,t)=>{let s=t;if(e.input.shiftKey=16==s.keyCode||s.shiftKey,!uP(e,s)&&(e.input.lastKeyCode=s.keyCode,e.input.lastKeyCodeTime=Date.now(),!vz||!mz||13!=s.keyCode))if(229!=s.keyCode&&e.domObserver.forceFlush(),!pz||13!=s.keyCode||s.ctrlKey||s.altKey||s.metaKey)e.someProp("handleKeyDown",t=>t(e,s))||PM(e,s)?s.preventDefault():XM(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,tz(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},YM.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},YM.keypress=(e,t)=>{let s=t;if(uP(e,s)||!s.charCode||s.ctrlKey&&!s.altKey||gz&&s.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,s)))return void s.preventDefault();let a=e.state.selection;if(!(a instanceof JF)||!a.$from.sameParent(a.$to)){let t=String.fromCharCode(s.charCode),n=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",s=>s(e,a.$from.pos,a.$to.pos,t,n))||e.dispatch(n()),s.preventDefault()}};const cP=gz?"metaKey":"ctrlKey";KM.mousedown=(e,t)=>{let s=t;e.input.shiftKey=s.shiftKey;let a=oP(e),n=Date.now(),l="singleClick";n-e.input.lastClick.time<500&&function(e,t){let s=t.x-e.clientX,a=t.y-e.clientY;return s*s+a*a<100}(s,e.input.lastClick)&&!s[cP]&&e.input.lastClick.button==s.button&&("singleClick"==e.input.lastClick.type?l="doubleClick":"doubleClick"==e.input.lastClick.type&&(l="tripleClick")),e.input.lastClick={time:n,x:s.clientX,y:s.clientY,type:l,button:s.button};let r=e.posAtCoords(sP(s));r&&("singleClick"==l?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new dP(e,r,s,!!a)):("doubleClick"==l?rP:iP)(e,r.pos,r.inside,s)?s.preventDefault():XM(e,"pointer"))};class dP{constructor(e,t,s,a){let n,l;if(this.view=e,this.pos=t,this.event=s,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[cP],this.allowDefault=s.shiftKey,t.inside>-1)n=e.state.doc.nodeAt(t.inside),l=t.inside;else{let s=e.state.doc.resolve(t.pos);n=s.parent,l=s.depth?s.before():0}const r=a?null:s.target,i=r?e.docView.nearestDesc(r,!0):null;this.target=i&&1==i.nodeDOM.nodeType?i.nodeDOM:null;let{selection:o}=e.state;(0==s.button&&n.type.spec.draggable&&!1!==n.type.spec.selectable||o instanceof XF&&o.from<=l&&o.to>l)&&(this.mightDrag={node:n,pos:l,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!dz||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)),XM(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(()=>hM(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(sP(e))),this.updateAllowDefault(e),this.allowDefault||!t?XM(this.view,"pointer"):lP(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||xz&&this.mightDrag&&!this.mightDrag.node.isAtom||mz&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(nP(this.view,$F.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):XM(this.view,"pointer")}move(e){this.updateAllowDefault(e),XM(this.view,"pointer"),0==e.buttons&&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)}}function uP(e,t){return!!e.composing||!!(xz&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}KM.touchstart=e=>{e.input.lastTouch=Date.now(),oP(e),XM(e,"pointer")},KM.touchmove=e=>{e.input.lastTouch=Date.now(),XM(e,"pointer")},KM.contextmenu=e=>oP(e);const mP=vz?5e3:-1;function hP(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>gP(e),t))}function xP(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function pP(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let s=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=XT(e=e.childNodes[t-1])}else{if(!e.parentNode||ZT(e))return null;t=qT(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),a=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||ZT(e))return null;t=qT(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(s&&a&&s!=a){let t=a.pmViewDesc,n=e.domObserver.lastChangedTextNode;if(s==n||a==n)return n;if(!t||!t.isText(a.nodeValue))return a;if(e.input.compositionNode==a){let e=s.pmViewDesc;if(e&&e.isText(s.nodeValue))return a}}return s||a}function gP(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(vz&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),xP(e),t||e.docView&&e.docView.dirty){let s=uM(e),a=e.state.selection;return s&&!s.eq(a)?e.dispatch(e.state.tr.setSelection(s)):!e.markCursor&&!t||a.$from.node(a.$from.sharedDepth(a.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}YM.compositionstart=YM.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,s=t.selection.$to;if(t.selection instanceof JF&&(t.storedMarks||!s.textOffset&&s.parentOffset&&s.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||mz&&fz&&function(e){let{focusNode:t,focusOffset:s}=e.domSelectionRange();if(!t||1!=t.nodeType||s>=t.childNodes.length)return!1;let a=t.childNodes[s];return 1==a.nodeType&&"false"==a.contentEditable}(e)))e.markCursor=e.state.storedMarks||s.marks(),gP(e,!0),e.markCursor=null;else if(gP(e,!t.selection.empty),dz&&t.selection.empty&&s.parentOffset&&!s.textOffset&&s.nodeBefore.marks.length){let t=e.domSelectionRange();for(let s=t.focusNode,a=t.focusOffset;s&&1==s.nodeType&&0!=a;){let t=a<0?s.lastChild:s.childNodes[a-1];if(!t)break;if(3==t.nodeType){let s=e.domSelection();s&&s.collapse(t,t.nodeValue.length);break}s=t,a=-1}}e.input.composing=!0}hP(e,mP)},YM.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,hP(e,20))};const fP=oz&&cz<15||pz&&jz<604;function vP(e,t,s,a,n){let l=RM(e,t,s,a,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,n,l||eA.empty)))return!0;if(!l)return!1;let r=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(l),i=r?e.state.tr.replaceSelectionWith(r,a):e.state.tr.replaceSelection(l);return e.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bP(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let s=e.getData("text/uri-list");return s?s.replace(/\r?\n/g," "):""}KM.copy=YM.cut=(e,t)=>{let s=t,a=e.state.selection,n="cut"==s.type;if(a.empty)return;let l=fP?null:s.clipboardData,r=a.content(),{dom:i,text:o}=BM(e,r);l?(s.preventDefault(),l.clearData(),l.setData("text/html",i.innerHTML),l.setData("text/plain",o)):function(e,t){if(!e.dom.parentNode)return;let s=e.dom.parentNode.appendChild(document.createElement("div"));s.appendChild(t),s.style.cssText="position: fixed; left: -10000px; top: 10px";let a=getSelection(),n=document.createRange();n.selectNodeContents(t),e.dom.blur(),a.removeAllRanges(),a.addRange(n),setTimeout(()=>{s.parentNode&&s.parentNode.removeChild(s),e.focus()},50)}(e,i),n&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},YM.paste=(e,t)=>{let s=t;if(e.composing&&!vz)return;let a=fP?null:s.clipboardData,n=e.input.shiftKey&&45!=e.input.lastKeyCode;a&&vP(e,bP(a),a.getData("text/html"),n,s)?s.preventDefault():function(e,t){if(!e.dom.parentNode)return;let s=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,a=e.dom.parentNode.appendChild(document.createElement(s?"textarea":"div"));s||(a.contentEditable="true"),a.style.cssText="position: fixed; left: -10000px; top: 10px",a.focus();let n=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),a.parentNode&&a.parentNode.removeChild(a),s?vP(e,a.value,
vendor: 10,238 bytes, line 2
2null,n,t):vP(e,a.textContent,a.innerHTML,n,t)},50)}(e,s)};class jP{constructor(e,t,s){this.slice=e,this.move=t,this.node=s}}const yP=gz?"altKey":"ctrlKey";function NP(e,t){let s=e.someProp("dragCopies",e=>!e(t));return null!=s?s:!t[yP]}KM.dragstart=(e,t)=>{let s=t,a=e.input.mouseDown;if(a&&a.done(),!s.dataTransfer)return;let n,l=e.state.selection,r=l.empty?null:e.posAtCoords(sP(s));if(r&&r.pos>=l.from&&r.pos<=(l instanceof XF?l.to-1:l.to));else if(a&&a.mightDrag)n=XF.create(e.state.doc,a.mightDrag.pos);else if(s.target&&1==s.target.nodeType){let t=e.docView.nearestDesc(s.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(n=XF.create(e.state.doc,t.posBefore))}let i=(n||e.state.selection).content(),{dom:o,text:c,slice:d}=BM(e,i);(!s.dataTransfer.files.length||!mz||hz>120)&&s.dataTransfer.clearData(),s.dataTransfer.setData(fP?"Text":"text/html",o.innerHTML),s.dataTransfer.effectAllowed="copyMove",fP||s.dataTransfer.setData("text/plain",c),e.dragging=new jP(d,NP(e,s),n)},KM.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},YM.dragover=YM.dragenter=(e,t)=>t.preventDefault(),YM.drop=(e,t)=>{try{!function(e,t,s){if(!t.dataTransfer)return;let a=e.posAtCoords(sP(t));if(!a)return;let n=e.state.doc.resolve(a.pos),l=s&&s.slice;l?e.someProp("transformPasted",t=>{l=t(l,e,!1)}):l=RM(e,bP(t.dataTransfer),fP?null:t.dataTransfer.getData("text/html"),!1,n);let r=!(!s||!NP(e,t));if(e.someProp("handleDrop",s=>s(e,t,l||eA.empty,r)))return void t.preventDefault();if(!l)return;t.preventDefault();let i=l?EF(e.state.doc,n.pos,l):n.pos;null==i&&(i=n.pos);let o=e.state.tr;if(r){let{node:e}=s;e?e.replace(o):o.deleteSelection()}let c=o.mapping.map(i),d=0==l.openStart&&0==l.openEnd&&1==l.content.childCount,u=o.doc;d?o.replaceRangeWith(c,c,l.content.firstChild):o.replaceRange(c,c,l);if(o.doc.eq(u))return;let m=o.doc.resolve(c);if(d&&XF.isSelectable(l.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(l.content.firstChild))o.setSelection(new XF(m));else{let t=o.mapping.map(i);o.mapping.maps[o.mapping.maps.length-1].forEach((e,s,a,n)=>t=n),o.setSelection(jM(e,m,o.doc.resolve(t)))}e.focus(),e.dispatch(o.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},KM.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&hM(e)},20))},KM.blur=(e,t)=>{let s=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),s.relatedTarget&&e.dom.contains(s.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},KM.beforeinput=(e,t)=>{if(mz&&vz&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,tz(8,"Backspace"))))return;let{$cursor:s}=e.state.selection;s&&s.pos>0&&e.dispatch(e.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let s in YM)KM[s]=YM[s];function wP(e,t){if(e==t)return!0;for(let s in e)if(e[s]!==t[s])return!1;for(let s in t)if(!(s in e))return!1;return!0}class CP{constructor(e,t){this.toDOM=e,this.spec=t||EP,this.side=this.spec.side||0}map(e,t,s,a){let{pos:n,deleted:l}=e.mapResult(t.from+a,this.side<0?-1:1);return l?null:new _P(n-s,n-s,this)}valid(){return!0}eq(e){return this==e||e instanceof CP&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&wP(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class kP{constructor(e,t){this.attrs=e,this.spec=t||EP}map(e,t,s,a){let n=e.map(t.from+a,this.spec.inclusiveStart?-1:1)-s,l=e.map(t.to+a,this.spec.inclusiveEnd?1:-1)-s;return n>=l?null:new _P(n,l,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof kP&&wP(this.attrs,e.attrs)&&wP(this.spec,e.spec)}static is(e){return e.type instanceof kP}destroy(){}}class DP{constructor(e,t){this.attrs=e,this.spec=t||EP}map(e,t,s,a){let n=e.mapResult(t.from+a,1);if(n.deleted)return null;let l=e.mapResult(t.to+a,-1);return l.deleted||l.pos<=n.pos?null:new _P(n.pos-s,l.pos-s,this)}valid(e,t){let s,{index:a,offset:n}=e.content.findIndex(t.from);return n==t.from&&!(s=e.child(a)).isText&&n+s.nodeSize==t.to}eq(e){return this==e||e instanceof DP&&wP(this.attrs,e.attrs)&&wP(this.spec,e.spec)}destroy(){}}class _P{constructor(e,t,s){this.from=e,this.to=t,this.type=s}copy(e,t){return new _P(e,t,this.type)}eq(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,s){return this.type.map(e,this,t,s)}static widget(e,t,s){return new _P(e,e,new CP(t,s))}static inline(e,t,s,a){return new _P(e,t,new kP(s,a))}static node(e,t,s,a){return new _P(e,t,new DP(s,a))}get spec(){return this.type.spec}get inline(){return this.type instanceof kP}get widget(){return this.type instanceof CP}}const SP=[],EP={};class AP{constructor(e,t){this.local=e.length?e:SP,this.children=t.length?t:SP}static create(e,t){return t.length?BP(t,e,0,EP):FP}find(e,t,s){let a=[];return this.findInner(null==e?0:e,null==t?1e9:t,a,0,s),a}findInner(e,t,s,a,n){for(let l=0;l<this.local.length;l++){let r=this.local[l];r.from<=t&&r.to>=e&&(!n||n(r.spec))&&s.push(r.copy(r.from+a,r.to+a))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<t&&this.children[l+1]>e){let r=this.children[l]+1;this.children[l+2].findInner(e-r,t-r,s,a+r,n)}}map(e,t,s){return this==FP||0==e.maps.length?this:this.mapInner(e,t,0,0,s||EP)}mapInner(e,t,s,a,n){let l;for(let r=0;r<this.local.length;r++){let i=this.local[r].map(e,s,a);i&&i.type.valid(t,i)?(l||(l=[])).push(i):n.onRemove&&n.onRemove(this.local[r].spec)}return this.children.length?function(e,t,s,a,n,l,r){let i=e.slice();for(let c=0,d=l;c<s.maps.length;c++){let e=0;s.maps[c].forEach((t,s,a,n)=>{let l=n-a-(s-t);for(let r=0;r<i.length;r+=3){let a=i[r+1];if(a<0||t>a+d-e)continue;let n=i[r]+d-e;s>=n?i[r+1]=t<=n?-2:-1:t>=d&&l&&(i[r]+=l,i[r+1]+=l)}e+=l}),d=s.maps[c].map(d,-1)}let o=!1;for(let c=0;c<i.length;c+=3)if(i[c+1]<0){if(-2==i[c+1]){o=!0,i[c+1]=-1;continue}let t=s.map(e[c]+l),d=t-n;if(d<0||d>=a.content.size){o=!0;continue}let u=s.map(e[c+1]+l,-1)-n,{index:m,offset:h}=a.content.findIndex(d),x=a.maybeChild(m);if(x&&h==d&&h+x.nodeSize==u){let a=i[c+2].mapInner(s,x,t+1,e[c]+l+1,r);a!=FP?(i[c]=d,i[c+1]=u,i[c+2]=a):(i[c+1]=-2,o=!0)}else o=!0}if(o){let o=function(e,t,s,a,n,l,r){function i(e,t){for(let l=0;l<e.local.length;l++){let i=e.local[l].map(a,n,t);i?s.push(i):r.onRemove&&r.onRemove(e.local[l].spec)}for(let s=0;s<e.children.length;s+=3)i(e.children[s+2],e.children[s]+t+1)}for(let o=0;o<e.length;o+=3)-1==e[o+1]&&i(e[o+2],t[o]+l+1);return s}(i,e,t,s,n,l,r),c=BP(o,a,0,r);t=c.local;for(let e=0;e<i.length;e+=3)i[e+1]<0&&(i.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let s=c.children[e];for(;t<i.length&&i[t]<s;)t+=3;i.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new AP(t.sort(RP),i)}(this.children,l||[],e,t,s,a,n):l?new AP(l.sort(RP),SP):FP}add(e,t){return t.length?this==FP?AP.create(e,t):this.addInner(e,t,0):this}addInner(e,t,s){let a,n=0;e.forEach((e,l)=>{let r,i=l+s;if(r=MP(t,e,i)){for(a||(a=this.children.slice());n<a.length&&a[n]<l;)n+=3;a[n]==l?a[n+2]=a[n+2].addInner(e,r,i+1):a.splice(n,0,l,l+e.nodeSize,BP(r,e,i+1,EP)),n+=3}});let l=zP(n?PP(t):t,-s);for(let r=0;r<l.length;r++)l[r].type.valid(e,l[r])||l.splice(r--,1);return new AP(l.length?this.local.concat(l).sort(RP):this.local,a||this.children)}remove(e){return 0==e.length||this==FP?this:this.removeInner(e,0)}removeInner(e,t){let s=this.children,a=this.local;for(let n=0;n<s.length;n+=3){let a,l=s[n]+t,r=s[n+1]+t;for(let t,s=0;s<e.length;s++)(t=e[s])&&t.from>l&&t.to<r&&(e[s]=null,(a||(a=[])).push(t));if(!a)continue;s==this.children&&(s=this.children.slice());let i=s[n+2].removeInner(a,l+1);i!=FP?s[n+2]=i:(s.splice(n,3),n-=3)}if(a.length)for(let n,l=0;l<e.length;l++)if(n=e[l])for(let e=0;e<a.length;e++)a[e].eq(n,t)&&(a==this.local&&(a=this.local.slice()),a.splice(e--,1));return s==this.children&&a==this.local?this:a.length||s.length?new AP(a,s):FP}forChild(e,t){if(this==FP)return this;if(t.isLeaf)return AP.empty;let s,a;for(let r=0;r<this.children.length;r+=3)if(this.children[r]>=e){this.children[r]==e&&(s=this.children[r+2]);break}let n=e+1,l=n+t.content.size;for(let r=0;r<this.local.length;r++){let e=this.local[r];if(e.from<l&&e.to>n&&e.type instanceof kP){let t=Math.max(n,e.from)-n,s=Math.min(l,e.to)-n;t<s&&(a||(a=[])).push(e.copy(t,s))}}if(a){let e=new AP(a.sort(RP),SP);return s?new TP([e,s]):e}return s||FP}eq(e){if(this==e)return!0;if(!(e instanceof AP)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return LP(this.localsInner(e))}localsInner(e){if(this==FP)return SP;if(e.inlineContent||!this.local.some(kP.is))return this.local;let t=[];for(let s=0;s<this.local.length;s++)this.local[s].type instanceof kP||t.push(this.local[s]);return t}forEachSet(e){e(this)}}AP.empty=new AP([],[]),AP.removeOverlap=LP;const FP=AP.empty;class TP{constructor(e){this.members=e}map(e,t){const s=this.members.map(s=>s.map(e,t,EP));return TP.from(s)}forChild(e,t){if(t.isLeaf)return AP.empty;let s=[];for(let a=0;a<this.members.length;a++){let n=this.members[a].forChild(e,t);n!=FP&&(n instanceof TP?s=s.concat(n.members):s.push(n))}return TP.from(s)}eq(e){if(!(e instanceof TP)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,s=!0;for(let a=0;a<this.members.length;a++){let n=this.members[a].localsInner(e);if(n.length)if(t){s&&(t=t.slice(),s=!1);for(let e=0;e<n.length;e++)t.push(n[e])}else t=n}return t?LP(s?t:t.sort(RP)):SP}static from(e){switch(e.length){case 0:return FP;case 1:return e[0];default:return new TP(e.every(e=>e instanceof AP)?e:e.reduce((e,t)=>
vendor: 16,953 bytes, line 2
2e.concat(t instanceof AP?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function zP(e,t){if(!t||!e.length)return e;let s=[];for(let a=0;a<e.length;a++){let n=e[a];s.push(new _P(n.from+t,n.to+t,n.type))}return s}function MP(e,t,s){if(t.isLeaf)return null;let a=s+t.nodeSize,n=null;for(let l,r=0;r<e.length;r++)(l=e[r])&&l.from>s&&l.to<a&&((n||(n=[])).push(l),e[r]=null);return n}function PP(e){let t=[];for(let s=0;s<e.length;s++)null!=e[s]&&t.push(e[s]);return t}function BP(e,t,s,a){let n=[],l=!1;t.forEach((t,r)=>{let i=MP(e,t,r+s);if(i){l=!0;let e=BP(i,t,s+r+1,a);e!=FP&&n.push(r,r+t.nodeSize,e)}});let r=zP(l?PP(e):e,-s).sort(RP);for(let i=0;i<r.length;i++)r[i].type.valid(t,r[i])||(a.onRemove&&a.onRemove(r[i].spec),r.splice(i--,1));return r.length||n.length?new AP(r,n):FP}function RP(e,t){return e.from-t.from||e.to-t.to}function LP(e){let t=e;for(let s=0;s<t.length-1;s++){let a=t[s];if(a.from!=a.to)for(let n=s+1;n<t.length;n++){let l=t[n];if(l.from!=a.from){l.from<a.to&&(t==e&&(t=e.slice()),t[s]=a.copy(a.from,l.from),IP(t,n,a.copy(l.from,a.to)));break}l.to!=a.to&&(t==e&&(t=e.slice()),t[n]=l.copy(l.from,a.to),IP(t,n+1,l.copy(a.to,l.to)))}}return t}function IP(e,t,s){for(;t<e.length&&RP(s,e[t])>0;)t++;e.splice(t,0,s)}function OP(e){let t=[];return e.someProp("decorations",s=>{let a=s(e.state);a&&a!=FP&&t.push(a)}),e.cursorWrapper&&t.push(AP.create(e.state.doc,[e.cursorWrapper.deco])),TP.from(t)}const UP={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},HP=oz&&cz<=11;class WP{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 VP{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new WP,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);oz&&cz<=11&&e.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),HP&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,UP)),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 t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.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(yM(this.view)){if(this.suppressingSelectionUpdates)return hM(this.view);if(oz&&cz<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&YT(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 t,s=new Set;for(let n=e.focusNode;n;n=$T(n))s.add(n);for(let n=e.anchorNode;n;n=$T(n))if(s.has(n)){t=n;break}let a=t&&this.view.docView.nearestDesc(t);return a&&a.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 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 t=this.pendingRecords();t.length&&(this.queue=[]);let s=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&yM(e)&&!this.ignoreSelectionChange(s),n=-1,l=-1,r=!1,i=[];if(e.editable)for(let c=0;c<t.length;c++){let e=this.registerMutation(t[c],i);e&&(n=n<0?e.from:Math.min(e.from,n),l=l<0?e.to:Math.max(e.to,l),e.typeOver&&(r=!0))}if(dz&&i.length){let t=i.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,s]=t;e.parentNode&&e.parentNode.parentNode==s.parentNode?s.remove():e.remove()}else{let{focusNode:s}=this.currentSelection;for(let a of t){let t=a.parentNode;!t||"LI"!=t.nodeName||s&&KP(e,s)==t||a.remove()}}}else if((mz||xz)&&i.some(e=>"BR"==e.nodeName)&&(8==e.input.lastKeyCode||46==e.input.lastKeyCode))for(let c of i)if("BR"==c.nodeName&&c.parentNode){let e=c.nextSibling;e&&1==e.nodeType&&"false"==e.contentEditable&&c.parentNode.removeChild(c)}let o=null;n<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ez(s)&&(o=uM(e))&&o.eq($F.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,hM(e),this.currentSelection.set(s),e.scrollToSelection()):(n>-1||a)&&(n>-1&&(e.docView.markDirty(n,l),function(e){if(qP.has(e))return;if(qP.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=dz,$P)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),$P=!0}}(e)),this.handleDOMChange(n,l,r,i),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||hM(e),this.currentSelection.set(s))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(s==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!s||s.ignoreMutation(e))return null;if("childList"==e.type){for(let s=0;s<e.addedNodes.length;s++){let a=e.addedNodes[s];t.push(a),3==a.nodeType&&(this.lastChangedTextNode=a)}if(s.contentDOM&&s.contentDOM!=s.dom&&!s.contentDOM.contains(e.target))return{from:s.posBefore,to:s.posAfter};let a=e.previousSibling,n=e.nextSibling;if(oz&&cz<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:s,nextSibling:l}=e.addedNodes[t];(!s||Array.prototype.indexOf.call(e.addedNodes,s)<0)&&(a=s),(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(n=l)}let l=a&&a.parentNode==e.target?qT(a)+1:0,r=s.localPosFromDOM(e.target,l,-1),i=n&&n.parentNode==e.target?qT(n):e.target.childNodes.length;return{from:r,to:s.localPosFromDOM(e.target,i,1)}}return"attributes"==e.type?{from:s.posAtStart-s.border,to:s.posAtEnd+s.border}:(this.lastChangedTextNode=e.target,{from:s.posAtStart,to:s.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let qP=new WeakMap,$P=!1;function GP(e,t){let s=t.startContainer,a=t.startOffset,n=t.endContainer,l=t.endOffset,r=e.domAtPos(e.state.selection.anchor);return YT(r.node,r.offset,n,l)&&([s,a,n,l]=[n,l,s,a]),{anchorNode:s,anchorOffset:a,focusNode:n,focusOffset:l}}function KP(e,t){for(let s=t.parentNode;s&&s!=e.dom;s=s.parentNode){let t=e.docView.nearestDesc(s,!0);if(t&&t.node.isBlock)return s}return null}function YP(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(xz&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||xz&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const JP=/^(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 QP(e,t,s,a,n){let l=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,s=uM(e,t);if(s&&!e.state.selection.eq(s)){if(mz&&vz&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,tz(13,"Enter"))))return;let a=e.state.tr.setSelection(s);"pointer"==t?a.setMeta("pointer",!0):"key"==t&&a.scrollIntoView(),l&&a.setMeta("composition",l),e.dispatch(a)}return}let r=e.state.doc.resolve(t),i=r.sharedDepth(s);t=r.before(i+1),s=e.state.doc.resolve(s).after(i+1);let o,c,d=e.state.selection,u=function(e,t,s){let a,{node:n,fromOffset:l,toOffset:r,from:i,to:o}=e.docView.parseRange(t,s),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(a=[{node:d,offset:c.anchorOffset}],ez(c)||a.push({node:c.focusNode,offset:c.focusOffset})),mz&&8===e.input.lastKeyCode)for(let g=r;g>l;g--){let e=n.childNodes[g-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){r=g;break}if(!t||t.size)break}let u=e.state.doc,m=e.someProp("domParser")||IA.fromSchema(e.state.schema),h=u.resolve(i),x=null,p=m.parse(n,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:l,to:r,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:a,ruleFromNode:YP,context:h});if(a&&null!=a[0].pos){let e=a[0].pos,t=a[1]&&a[1].pos;null==t&&(t=e),x={anchor:e+i,head:t+i}}return{doc:p,sel:x,from:i,to:o}}(e,t,s),m=e.state.doc,h=m.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(o=e.state.selection.to,c="end"):(o=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let x=function(e,t,s,a,n){let l=e.findDiffStart(t,s);if(null==l)return null;let{a:r,b:i}=e.findDiffEnd(t,s+e.size,s+t.size);if("end"==n){a-=r+Math.max(0,l-Math.min(r,i))-l}if(r<l&&e.size<t.size){let e=a<=l&&a>=r?l-a:0;l-=e,l&&l<t.size&&eB(t.textBetween(l-1,l+1))&&(l+=e?1:-1),i=l+(i-r),r=l}else if(i<l){let t=a<=l&&a>=i?l-a:0;l-=t,l&&l<e.size&&eB(e.textBetween(l-1,l+1))&&(l+=t?1:-1),r=l+(r-i),i=l}return{start:l,endA:r,endB:i}}(h.content,u.doc.content,u.from,o,c);if(x&&e.input.domChangeCount++,(pz&&e.input.lastIOSEnter>Date.now()-225||vz)&&n.some(e=>1==e.nodeType&&!JP.test(e.nodeName))&&(!x||x.endA>=x.endB)&&e.someProp("handleKeyDown",t=>t(e,tz(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!x){if(!(a&&d instanceof JF&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let t=XP(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let s=e.state.tr.setSelection(t);l&&s.setMeta("composition",l),e.dispatch(s)}}return}x={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&x.start==x.endB&&e.state.selection instanceof JF&&(x.start>e.state.selection.from&&x.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?x.start=e.state.selection.from:x.endA<e.state.selection.to&&x.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(x.endB+=e.state.selection.to-x.endA,x.endA=e.state.selection.to)),oz&&cz<=11&&x.endB==x.start+1&&x.endA==x.start&&x.start>u.from&&" \xa0"==u.doc.textBetween(x.start-u.from-1,x.start-u.from+1)&&(x.start--,x.endA--,x.endB--);let p=u.doc.resolveNoCache(x.start-u.from),g=u.doc.resolveNoCache(x.endB-u.from),f=m.resolve(x.start),v=p.sameParent(g)&&p.parent.inlineContent&&f.end()>=x.endA;if((pz&&e.input.lastIOSEnter>Date.now()-225&&(!v||n.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!v&&p.pos<u.doc.content.size&&(!p.sameParent(g)||!p.parent.inlineContent)&&p.pos<g.pos&&!/\S/.test(u.doc.textBetween(p.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,tz(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>x.start&&function(e,t,s,a,n){if(s-t<=n.pos-a.pos||ZP(a,!0,!1)<n.pos)return!1;let l=e.resolve(t);if(!a.parent.isTextblock){let e=l.nodeAfter;return null!=e&&s==t+e.nodeSize}if(l.parentOffset<l.parent.content.size||!l.parent.isTextblock)return!1;let r=e.resolve(ZP(l,!0,!0));return!(!r.parent.isTextblock||r.pos>s||ZP(r,!0,!1)<s)&&a.parent.content.cut(a.parentOffset).eq(r.parent.content)}(m,x.start,x.endA,p,g)&&e.someProp("handleKeyDown",t=>t(e,tz(8,"Backspace"))))return void(vz&&mz&&e.domObserver.suppressSelectionUpdates());mz&&x.endB==x.start&&(e.input.lastChromeDelete=Date.now()),vz&&!v&&p.start()!=g.start()&&0==g.parentOffset&&p.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==x.endA&&(x.endB-=2,g=u.doc.resolveNoCache(x.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,tz(13,"Enter"))})},20));let b,j=x.start,y=x.endA,N=t=>{let s=t||e.state.tr.replace(j,y,u.doc.slice(x.start-u.from,x.endB-u.from));if(u.sel){let t=XP(e,s.doc,u.sel);t&&!(mz&&e.composing&&t.empty&&(x.start!=x.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==j||t.head==s.mapping.map(y)-1)||oz&&t.empty&&t.head==j)&&s.setSelection(t)}return l&&s.setMeta("composition",l),s.scrollIntoView()};if(v)if(p.pos==g.pos){oz&&cz<=11&&0==p.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>hM(e),20));let t=N(e.state.tr.delete(j,y)),s=m.resolve(x.start).marksAcross(m.resolve(x.endA));s&&t.ensureMarks(s),e.dispatch(t)}else if(x.endA==x.endB&&(b=function(e,t){let s,a,n,l=e.firstChild.marks,r=t.firstChild.marks,i=l,o=r;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<l.length;d++)o=l[d].removeFromSet(o);if(1==i.length&&0==o.length)a=i[0],s="add",n=e=>e.mark(a.addToSet(e.marks));else{if(0!=i.length||1!=o.length)return null;a=o[0],s="remove",n=e=>e.mark(a.removeFromSet(e.marks))}let c=[];for(let d=0;d<t.childCount;d++)c.push(n(t.child(d)));if(KE.from(c).eq(e))return{mark:a,type:s}}(p.parent.content.cut(p.parentOffset,g.parentOffset),f.parent.content.cut(f.parentOffset,x.endA-f.start())))){let t=N(e.state.tr);"add"==b.type?t.addMark(j,y,b.mark):t.removeMark(j,y,b.mark),e.dispatch(t)}else if(p.parent.child(p.index()).isText&&p.index()==g.index()-(g.textOffset?0:1)){let t=p.parent.textBetween(p.parentOffset,g.parentOffset),s=()=>N(e.state.tr.insertText(t,j,y));e.someProp("handleTextInput",a=>a(e,j,y,t,s))||e.dispatch(s())}else e.dispatch(N());else e.dispatch(N())}function XP(e,t,s){return Math.max(s.anchor,s.head)>t.content.size?null:jM(e,t.resolve(s.anchor),t.resolve(s.head))}function ZP(e,t,s){let a=e.depth,n=t?e.end():e.pos;for(;a>0&&(t||e.indexAfter(a)==e.node(a).childCount);)a--,n++,t=!1;if(s){let t=e.node(a).maybeChild(e.indexAfter(a));for(;t&&!t.isLeaf;)t=t.firstChild,n++}return n}function eB(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),s=e.charCodeAt(1);return t>=56320&&t<=57343&&s>=55296&&s<=56319}class tB{constructor(e,t){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 QM,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rB),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=nB(this),aB(this),this.nodeViews=lB(this),this.docView=Yz(this.state.doc,sB(this),OP(this),this.dom,this),this.domObserver=new VP(this,(e,t,s,a)=>QP(this,e,t,s,a)),this.domObserver.start(),function(e){for(let t in KM){let s=KM[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!tP(e,t)||eP(e,t)||!e.editable&&t.type in YM||s(e,t)},JM[t]?{passive:!0}:void 0)}xz&&e.dom.addEventListener("input",()=>null),ZM(e)}(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ZM(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rB),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let s in this._props)t[s]=this._props[s];t.state=this.state;for(let s in e)t[s]=e[s];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var s;let a=this.state,n=!1,l=!1;
vendor: 6,610 bytes, line 2
2e.storedMarks&&this.composing&&(xP(this),l=!0),this.state=e;let r=a.plugins!=e.plugins||this._props.plugins!=t.plugins;if(r||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=lB(this);(function(e,t){let s=0,a=0;for(let n in e){if(e[n]!=t[n])return!0;s++}for(let n in t)a++;return s!=a})(e,this.nodeViews)&&(this.nodeViews=e,n=!0)}(r||t.handleDOMEvents!=this._props.handleDOMEvents)&&ZM(this),this.editable=nB(this),aB(this);let i=OP(this),o=sB(this),c=a.plugins==e.plugins||a.doc.eq(e.doc)?e.scrollToSelection>a.scrollToSelection?"to selection":"preserve":"reset",d=n||!this.docView.matchesNode(e.doc,o,i);!d&&e.selection.eq(a.selection)||(l=!0);let u="preserve"==c&&l&&null==this.dom.style.overflowAnchor&&function(e){let t,s,a=e.dom.getBoundingClientRect(),n=Math.max(0,a.top);for(let l=(a.left+a.right)/2,r=n+1;r<Math.min(innerHeight,a.bottom);r+=5){let a=e.root.elementFromPoint(l,r);if(!a||a==e.dom||!e.dom.contains(a))continue;let i=a.getBoundingClientRect();if(i.top>=n-20){t=a,s=i.top;break}}return{refDOM:t,refTop:s,stack:kz(e.dom)}}(this);if(l){this.domObserver.stop();let t=d&&(oz||mz)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&function(e,t){let s=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(s)!=t.$anchor.start(s)}(a.selection,e.selection);if(d){let s=mz?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=pP(this)),!n&&this.docView.update(e.doc,o,i,this)||(this.docView.updateOuterDeco(o),this.docView.destroy(),this.docView=Yz(e.doc,o,i,this.dom,this)),s&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),s=e.domSelectionRange();return YT(t.node,t.offset,s.anchorNode,s.anchorOffset)}(this))?hM(this,t):(vM(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),(null===(s=this.dragging)||void 0===s?void 0:s.node)&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function(e){let{refDOM:t,refTop:s,stack:a}=e,n=t?t.getBoundingClientRect().top:0;Dz(a,0==n?0:n-s)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof XF){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Cz(this,t.getBoundingClientRect(),e)}else Cz(this,this.coordsAtPos(this.state.selection.head,1),e);else;}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)for(let t=0;t<this.pluginViews.length;t++){let s=this.pluginViews[t];s.update&&s.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let s=e.node,a=-1;if(this.state.doc.nodeAt(s.from)==s.node)a=s.from;else{let e=s.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==s.node&&(a=e)}this.dragging=new jP(e.slice,e.move,a<0?void 0:XF.create(this.state.doc,a))}someProp(e,t){let s,a=this._props&&this._props[e];if(null!=a&&(s=t?t(a):a))return s;for(let l=0;l<this.directPlugins.length;l++){let a=this.directPlugins[l].props[e];if(null!=a&&(s=t?t(a):a))return s}let n=this.state.plugins;if(n)for(let l=0;l<n.length;l++){let a=n[l].props[e];if(null!=a&&(s=t?t(a):a))return s}}hasFocus(){if(oz){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(_z)return e.focus(_z);let t=kz(e);e.focus(null==_z?{get preventScroll(){return _z={preventScroll:!0},!0}}:void 0),_z||(_z=!1,Dz(t,0))}(this.dom),hM(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Fz(this,e)}coordsAtPos(e){return Pz(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}domAtPos(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,a=this.docView.posFromDOM(e,t,s);if(null==a)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,t){return Wz(this,t||this.state,e)}pasteHTML(e,t){return vP(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return vP(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return BM(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],OP(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,GT=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){eP(e,t)||!KM[t.type]||!e.editable&&t.type in YM||KM[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?xz&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return GP(e,s)}let s;function a(e){e.preventDefault(),e.stopImmediatePropagation(),s=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",a,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",a,!0),s?GP(e,s):null}
2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function sB(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",s=>{if("function"==typeof s&&(s=s(e.state)),s)for(let e in s)"class"==e?t.class+=" "+s[e]:"style"==e?t.style=(t.style?t.style+";":"")+s[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(s[e]))}),t.translate||(t.translate="no"),[_P.node(0,e.state.doc.content.size,t)]}function aB(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:_P.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function nB(e){return!e.someProp("editable",t=>!1===t(e.state))}function lB(e){let t=Object.create(null);function s(e){for(let s in e)Object.prototype.hasOwnProperty.call(t,s)||(t[s]=e[s])}return e.someProp("nodeViews",s),e.someProp("markViews",s),t}function rB(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}tB.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var iB={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:"'"},oB={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cB="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),dB="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),uB=0;uB<10;uB++)iB[48+uB]=iB[96+uB]=String(uB);for(uB=1;uB<=24;uB++)iB[uB+111]="F"+uB;for(uB=65;uB<=90;uB++)iB[uB]=String.fromCharCode(uB+32),oB[uB]=String.fromCharCode(uB);for(var mB in iB)oB.hasOwnProperty(mB)||(oB[mB]=iB[mB]);const hB="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),xB="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function pB(e){let t,s,a,n,l=e.split(/-(?!$)/),r=l[l.length-1];"Space"==r&&(r=" ");for(let i=0;i<l.length-1;i++){let e=l[i];if(/^(cmd|meta|m)$/i.test(e))n=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))s=!0;else if(/^s(hift)?$/i.test(e))a=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);hB?n=!0:s=!0}}return t&&(r="Alt-"+r),s&&(r="Ctrl-"+r),n&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function gB(e,t){let s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),s&&t.shiftKey&&(e="Shift-"+e),e}function fB(e){let t=function(e){let t=Object.create(null);for(let s in e)t[pB(s)]=e[s];return t}(e);return function(e,s){let a,n=function(e){var t=!(cB&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||dB&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?oB:iB)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(s),l=t[gB(n,s)];if(l&&l(e.state,e.dispatch,e))return!0;if(1==n.length&&" "!=n){if(s.shiftKey){let a=t[gB(n,s,!1)];if(a&&a(e.state,e.dispatch,e))return!0}if((s.altKey||s.metaKey||s.ctrlKey)&&!(xB&&s.ctrlKey&&s.altKey)&&(a=iB[s.keyCode])&&a!=n){let n=t[gB(a,s)];if(n&&n(e.state,e.dispatch,e))return!0}}return!1}}var vB=Object.defineProperty,bB=(e,t)=>{for(var s in t)vB(e,s,{get:t[s],enumerable:!0})};function jB(e){const{state:t,transaction:s}=e;let{selection:a}=s,{doc:n}=s,{storedMarks:l}=s;return d(d({},t),{},{apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return l},get selection(){return a},get doc(){return n},get tr(){return a=s.selection,n=s.doc,l=s.storedMarks,s}})}var yB=class{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(){var e=this;const{rawCommands:t,editor:s,state:a}=this,{view:n}=s,{tr:l}=a,r=this.buildProps(l);return Object.fromEntries(Object.entries(t).map(t=>{let[s,a]=t;return[s,function(){const t=a(...arguments)(r);return l.getMeta("preventDispatch")||e.hasCustomState||n.dispatch(l),t}]}))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e){var t=this;let s=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{rawCommands:a,editor:n,state:l}=this,{view:r}=n,i=[],o=!!e,c=e||l.tr,u=d(d({},Object.fromEntries(Object.entries(a).map(e=>{let[a,n]=e;return[a,function(){const e=t.buildProps(c,s),a=n(...arguments)(e);return i.push(a),u}]}))),{},{run:()=>(o||!s||c.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(c),i.every(e=>!0===e))});return u}createCan(e){const{rawCommands:t,state:s}=this,a=!1,n=e||s.tr,l=this.buildProps(n,a),r=Object.fromEntries(Object.entries(t).map(e=>{let[t,s]=e;return[t,function(){return s(...arguments)(d(d({},l),{},{dispatch:void 0}))}]}));return d(d({},r),{},{chain:()=>this.createChain(n,a)})}buildProps(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{rawCommands:s,editor:a,state:n}=this,{view:l}=a,r={tr:e,editor:a,view:l,state:jB({state:n,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(s).map(e=>{let[t,s]=e;return[t,function(){return s(...arguments)(r)}]}))}};return r}},NB={};bB(NB,{blur:()=>wB,clearContent:()=>CB,clearNodes:()=>kB,command:()=>DB,createParagraphNear:()=>_B,cut:()=>SB,deleteCurrentNode:()=>EB,deleteNode:()=>FB,deleteRange:()=>TB,deleteSelection:()=>
2zB,enter:()=>MB,exitCode:()=>PB,extendMarkRange:()=>HB,first:()=>WB,focus:()=>YB,forEach:()=>JB,insertContent:()=>QB,insertContentAt:()=>tR,joinBackward:()=>nR,joinDown:()=>aR,joinForward:()=>lR,joinItemBackward:()=>rR,joinItemForward:()=>iR,joinTextblockBackward:()=>oR,joinTextblockForward:()=>cR,joinUp:()=>sR,keyboardShortcut:()=>uR,lift:()=>hR,liftEmptyBlock:()=>xR,liftListItem:()=>pR,newlineInCode:()=>gR,resetAttributes:()=>bR,scrollIntoView:()=>jR,selectAll:()=>yR,selectNodeBackward:()=>NR,selectNodeForward:()=>wR,selectParentNode:()=>CR,selectTextblockEnd:()=>kR,selectTextblockStart:()=>DR,setContent:()=>SR,setMark:()=>dL,setMeta:()=>uL,setNode:()=>mL,setNodeSelection:()=>hL,setTextDirection:()=>xL,setTextSelection:()=>pL,sinkListItem:()=>gL,splitBlock:()=>vL,splitListItem:()=>bL,toggleList:()=>NL,toggleMark:()=>wL,toggleNode:()=>CL,toggleWrap:()=>kL,undoInputRule:()=>DL,unsetAllMarks:()=>_L,unsetMark:()=>SL,unsetTextDirection:()=>EL,updateAttributes:()=>AL,wrapIn:()=>FL,wrapInList:()=>TL});var wB=()=>e=>{let{editor:t,view:s}=e;return requestAnimationFrame(()=>{var e;t.isDestroyed||(s.dom.blur(),null==(e=null==window?void 0:window.getSelection())||e.removeAllRanges())}),!0},CB=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return t=>{let{commands:s}=t;return s.setContent("",{emitUpdate:e})}},kB=()=>e=>{let{state:t,tr:s,dispatch:a}=e;const{selection:n}=s,{ranges:l}=n;return!a||(l.forEach(e=>{let{$from:a,$to:n}=e;t.doc.nodesBetween(a.pos,n.pos,(e,t)=>{if(e.type.isText)return;const{doc:a,mapping:n}=s,l=a.resolve(n.map(t)),r=a.resolve(n.map(t+e.nodeSize)),i=l.blockRange(r);if(!i)return;const o=jF(i);if(e.type.isTextblock){const{defaultType:e}=l.parent.contentMatchAt(l.index());s.setNodeMarkup(i.start,e)}(o||0===o)&&s.lift(i,o)})}),!0)},DB=e=>t=>e(t),_B=()=>e=>{let{state:t,dispatch:s}=e;return ET(t,s)},SB=(e,t)=>s=>{let{editor:a,tr:n}=s;const{state:l}=a,r=l.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);const i=n.mapping.map(t);return n.insert(i,r.content),n.setSelection(new JF(n.doc.resolve(Math.max(i-1,0)))),!0},EB=()=>e=>{let{tr:t,dispatch:s}=e;const{selection:a}=t,n=a.$anchor.node();if(n.content.size>0)return!1;const l=t.selection.$anchor;for(let r=l.depth;r>0;r-=1){if(l.node(r).type===n.type){if(s){const e=l.before(r),s=l.after(r);t.delete(e,s).scrollIntoView()}return!0}}return!1};function AB(e,t){if("string"===typeof e){if(!t.nodes[e])throw Error("There is no node type named '".concat(e,"'. Maybe you forgot to add the extension?"));return t.nodes[e]}return e}var FB=e=>t=>{let{tr:s,state:a,dispatch:n}=t;const l=AB(e,a.schema),r=s.selection.$anchor;for(let e=r.depth;e>0;e-=1){if(r.node(e).type===l){if(n){const t=r.before(e),a=r.after(e);s.delete(t,a).scrollIntoView()}return!0}}return!1},TB=e=>t=>{let{tr:s,dispatch:a}=t;const{from:n,to:l}=e;return a&&s.delete(n,l),!0},zB=()=>e=>{let{state:t,dispatch:s}=e;return pT(t,s)},MB=()=>e=>{let{commands:t}=e;return t.keyboardShortcut("Enter")},PB=()=>e=>{let{state:t,dispatch:s}=e;return ST(t,s)};function BB(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function RB(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{strict:!0};const a=Object.keys(t);return!a.length||a.every(a=>s.strict?t[a]===e[a]:BB(t[a])?t[a].test(e[a]):t[a]===e[a])}function LB(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.find(e=>e.type===t&&RB(Object.fromEntries(Object.keys(s).map(t=>[t,e.attrs[t]])),s))}function IB(e,t){return!!LB(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}function OB(e,t,s){var a;if(!e||!t)return;let n=e.parent.childAfter(e.parentOffset);if(n.node&&n.node.marks.some(e=>e.type===t)||(n=e.parent.childBefore(e.parentOffset)),!n.node||!n.node.marks.some(e=>e.type===t))return;s=s||(null==(a=n.node.marks[0])?void 0:a.attrs);if(!LB([...n.node.marks],t,s))return;let l=n.index,r=e.start()+n.offset,i=l+1,o=r+n.node.nodeSize;for(;l>0&&IB([...e.parent.child(l-1).marks],t,s);)l-=1,r-=e.parent.child(l).nodeSize;for(;i<e.parent.childCount&&IB([...e.parent.child(i).marks],t,s);)o+=e.parent.child(i).nodeSize,i+=1;return{from:r,to:o}}function UB(e,t){if("string"===typeof e){if(!t.marks[e])throw Error("There is no mark type named '".concat(e,"'. Maybe you forgot to add the extension?"));return t.marks[e]}return e}var HB=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{tr:a,state:n,dispatch:l}=s;const r=UB(e,n.schema),{doc:i,selection:o}
2=a,{$from:c,from:d,to:u}=o;if(l){const e=OB(c,r,t);if(e&&e.from<=d&&e.to>=u){const t=JF.create(i,e.from,e.to);a.setSelection(t)}}return!0}},WB=e=>t=>{const s="function"===typeof e?e(t):e;for(let e=0;e<s.length;e+=1)if(s[e](t))return!0;return!1};function VB(e){return e instanceof JF}function qB(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.min(Math.max(e,t),s)}function $B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t)return null;const s=$F.atStart(e),a=$F.atEnd(e);if("start"===t||!0===t)return s;if("end"===t)return a;const n=s.from,l=a.to;return"all"===t?JF.create(e,qB(0,n,l),qB(e.content.size,n,l)):JF.create(e,qB(t,n,l),qB(t,n,l))}function GB(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function KB(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var YB=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{editor:a,view:n,tr:l,dispatch:r}=s;t=d({scrollIntoView:!0},t);const i=()=>{(KB()||GB())&&n.dom.focus(),requestAnimationFrame(()=>{a.isDestroyed||(n.focus(),(null==t?void 0:t.scrollIntoView)&&a.commands.scrollIntoView())})};if(n.hasFocus()&&null===e||!1===e)return!0;if(r&&null===e&&!VB(a.state.selection))return i(),!0;const o=$B(l.doc,e)||a.state.selection,c=a.state.selection.eq(o);return r&&(c||l.setSelection(o),c&&l.storedMarks&&l.setStoredMarks(l.storedMarks),i()),!0}},JB=(e,t)=>s=>e.every((e,a)=>t(e,d(d({},s),{},{index:a}))),QB=(e,t)=>s=>{let{tr:a,commands:n}=s;return n.insertContentAt({from:a.selection.from,to:a.selection.to},e,t)},XB=e=>{const t=e.childNodes;for(let s=t.length-1;s>=0;s-=1){const a=t[s];3===a.nodeType&&a.nodeValue&&/^(\n\s\s|\n)$/.test(a.nodeValue)?e.removeChild(a):1===a.nodeType&&XB(a)}return e};function ZB(e){if("undefined"===typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t="<body>".concat(e,"</body>"),s=(new window.DOMParser).parseFromString(t,"text/html").body;return XB(s)}function eR(e,t,s){if(e instanceof vA||e instanceof KE)return e;s=d({slice:!0,parseOptions:{}},s);const a="string"===typeof e;if("object"===typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return KE.fromArray(e.map(e=>t.nodeFromJSON(e)));const a=t.nodeFromJSON(e);return s.errorOnInvalidContent&&a.check(),a}catch(n){if(s.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:n});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),eR("",t,s)}if(a){if(s.errorOnInvalidContent){let a=!1,n="";const l=new RA({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(a=!0,n="string"===typeof e?e:e.outerHTML,null)}]}})});if(s.slice?IA.fromSchema(l).parseSlice(ZB(e),s.parseOptions):IA.fromSchema(l).parse(ZB(e),s.parseOptions),s.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error("Invalid element found: ".concat(n))})}const a=IA.fromSchema(t);return s.slice?a.parseSlice(ZB(e),s.parseOptions).content:a.parse(ZB(e),s.parseOptions)}return eR("",t,s)}var tR=(e,t,s)=>a=>{let{tr:n,dispatch:l,editor:r}=a;var i;if(l){let a;s=d({parseOptions:r.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1},s);const l=e=>{r.emit("contentError",{editor:r,error:e,disableCollaboration:()=>{"collaboration"in r.storage&&"object"===typeof r.storage.collaboration&&r.storage.collaboration&&(r.storage.collaboration.isDisabled=!0)}})},o=d({preserveWhitespace:"full"},s.parseOptions);if(!s.errorOnInvalidContent&&!r.options.enableContentCheck&&r.options.emitContentError)try{eR(t,r.schema,{parseOptions:o,errorOnInvalidContent:!0})}catch(G2){l(G2)}try{a=eR(t,r.schema,{parseOptions:o,errorOnInvalidContent:null!=(i=s.errorOnInvalidContent)?i:r.options.enableContentCheck})}catch(G2){return l(G2),!1}let{from:c,to:u}="number"===typeof e?{from:e,to:e}:{from:e.from,to:e.to},m=!0,h=!0;
2if(("type"in a?[a]:a).forEach(e=>{e.check(),m=!!m&&(e.isText&&0===e.marks.length),h=!!h&&e.isBlock}),c===u&&h){const{parent:e}=n.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(c-=1,u+=1)}let x;if(m){if(Array.isArray(t))x=t.map(e=>e.text||"").join("");else if(t instanceof KE){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),x=e}else x="object"===typeof t&&t&&t.text?t.text:t;n.insertText(x,c,u)}else{x=a;const e=n.doc.resolve(c),t=e.node(),s=0===e.parentOffset,l=t.isText||t.isTextblock,r=t.content.size>0;s&&l&&r&&(c=Math.max(0,c-1)),n.replaceWith(c,u,x)}s.updateSelection&&function(e,t,s){const a=e.steps.length-1;if(a<t)return;const n=e.steps[a];if(!(n instanceof pF||n instanceof gF))return;const l=e.mapping.maps[a];let r=0;l.forEach((e,t,s,a)=>{0===r&&(r=a)}),e.setSelection($F.near(e.doc.resolve(r),s))}(n,n.steps.length-1,-1),s.applyInputRules&&n.setMeta("applyInputRules",{from:c,text:x}),s.applyPasteRules&&n.setMeta("applyPasteRules",{from:c,text:x})}return!0},sR=()=>e=>{let{state:t,dispatch:s}=e;return((e,t)=>{let s,a=e.selection,n=a instanceof XF;if(n){if(a.node.isTextblock||!DF(e.doc,a.from))return!1;s=a.from}else if(s=SF(e.doc,a.from,-1),null==s)return!1;if(t){let a=e.tr.join(s);n&&a.setSelection(XF.create(a.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),t(a.scrollIntoView())}return!0})(t,s)},aR=()=>e=>{let{state:t,dispatch:s}=e;return((e,t)=>{let s,a=e.selection;if(a instanceof XF){if(a.node.isTextblock||!DF(e.doc,a.to))return!1;s=a.to}else if(s=SF(e.doc,a.to,1),null==s)return!1;return t&&t(e.tr.join(s).scrollIntoView()),!0})(t,s)},nR=()=>e=>{let{state:t,dispatch:s}=e;return fT(t,s)},lR=()=>e=>{let{state:t,dispatch:s}=e;return wT(t,s)},rR=()=>e=>{let{state:t,dispatch:s,tr:a}=e;try{const e=SF(t.doc,t.selection.$from.pos,-1);return null!==e&&void 0!==e&&(a.join(e,2),s&&s(a),!0)}catch(n){return!1}},iR=()=>e=>{let{state:t,dispatch:s,tr:a}=e;try{const e=SF(t.doc,t.selection.$from.pos,1);return null!==e&&void 0!==e&&(a.join(e,2),s&&s(a),!0)}catch(n){return!1}},oR=()=>e=>{let{state:t,dispatch:s}=e;return((e,t,s)=>{let a=gT(e,s);if(!a)return!1;let n=yT(a);return!!n&&vT(e,n,t)})(t,s)},cR=()=>e=>{let{state:t,dispatch:s}=e;return((e,t,s)=>{let a=NT(e,s);if(!a)return!1;let n=kT(a);return!!n&&vT(e,n,t)})(t,s)};function dR(){return"undefined"!==typeof navigator&&/Mac/.test(navigator.platform)}var uR=e=>t=>{let{editor:s,view:a,tr:n,dispatch:l}=t;const r=function(e){const t=e.split(/-(?!$)/);let s,a,n,l,r=t[t.length-1];"Space"===r&&(r=" ");for(let i=0;i<t.length-1;i+=1){const e=t[i];if(/^(cmd|meta|m)$/i.test(e))l=!0;else if(/^a(lt)?$/i.test(e))s=!0;else if(/^(c|ctrl|control)$/i.test(e))a=!0;else if(/^s(hift)?$/i.test(e))n=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: ".concat(e));KB()||dR()?l=!0:a=!0}}return s&&(r="Alt-".concat(r)),a&&(r="Ctrl-".concat(r)),l&&(r="Meta-".concat(r)),n&&(r="Shift-".concat(r)),r}(e).split(/-(?!$)/),i=r.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),o=new KeyboardEvent("keydown",{key:"Space"===i?" ":i,altKey:r.includes("Alt"),ctrlKey:r.includes("Ctrl"),metaKey:r.includes("Meta"),shiftKey:r.includes("Shift"),bubbles:!0,cancelable:!0}),c=s.captureTransaction(()=>{a.someProp("handleKeyDown",e=>e(a,o))});return null==c||c.steps.forEach(e=>{const t=e.map(n.mapping);t&&l&&n.maybeStep(t)}),!0};function mR(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{from:a,to:n,empty:l}=e.selection,r=t?AB(t,e.schema):null,i=[];e.doc.nodesBetween(a,n,(e,t)=>{if(e.isText)return;const s=Math.max(a,t),l=Math.min(n,t+e.nodeSize);i.push({node:e,from:s,to:l})});const o=n-a,c=i.filter(e=>!r||r.name===e.node.type.name).filter(e=>RB(e.node.attrs,s,{strict:!1}));if(l)return!!c.length;return c.reduce((e,t)=>e+t.to-t.from,0)>=o}var hR=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{state:a,dispatch:n}=s;return!!mR(a,AB(e,a.schema),t)&&((e,t)=>{let{$from:s,$to:a}=e.selection,n=s.blockRange(a),l=n&&jF(n);return null!=l&&(t&&t(e.tr.lift(n,l).scrollIntoView()),!0)})(a,n)}},xR=()=>e=>{let{state:t,dispatch:s}=e;return AT(t,s)},pR=e=>t=>{let{state:s,dispatch:a}=t;return VT(AB(e,s.schema))(s,a)},gR=()=>e=>{let{state:t,dispatch:s}=e;return DT(t,s)};function fR(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function vR(e,t){const s="string"===typeof t?[t]:t;return Object.keys(e).reduce((t,a)=>(s.includes(a)||(t[a]=e[a]),t),{})}var bR=(e,t)=>s=>{let{tr:a,state:n,dispatch:l}=s,r=null,i=null;const o=fR("string"===typeof e?e:e.name,n.schema);if(!o)return!1;"node"===o&&(r=AB(e,n.schema)),"mark"===o&&(i=UB(e,n.schema));let c=!1;
2return a.selection.ranges.forEach(e=>{n.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,s)=>{r&&r===e.type&&(c=!0,l&&a.setNodeMarkup(s,void 0,vR(e.attrs,t))),i&&e.marks.length&&e.marks.forEach(n=>{i===n.type&&(c=!0,l&&a.addMark(s,s+e.nodeSize,i.create(vR(n.attrs,t))))})})}),c},jR=()=>e=>{let{tr:t,dispatch:s}=e;return s&&t.scrollIntoView(),!0},yR=()=>e=>{let{tr:t,dispatch:s}=e;if(s){const e=new eT(t.doc);t.setSelection(e)}return!0},NR=()=>e=>{let{state:t,dispatch:s}=e;return jT(t,s)},wR=()=>e=>{let{state:t,dispatch:s}=e;return CT(t,s)},CR=()=>e=>{let{state:t,dispatch:s}=e;return((e,t)=>{let s,{$from:a,to:n}=e.selection,l=a.sharedDepth(n);return 0!=l&&(s=a.before(l),t&&t(e.tr.setSelection(XF.create(e.doc,s))),!0)})(t,s)},kR=()=>e=>{let{state:t,dispatch:s}=e;return BT(t,s)},DR=()=>e=>{let{state:t,dispatch:s}=e;return PT(t,s)};function _R(e,t){return eR(e,t,{slice:!1,parseOptions:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},errorOnInvalidContent:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).errorOnInvalidContent})}var SR=function(e){let{errorOnInvalidContent:t,emitUpdate:s=!0,parseOptions:a={}}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{let{editor:l,tr:r,dispatch:i,commands:o}=n;const{doc:c}=r;if("full"!==a.preserveWhitespace){const n=_R(e,l.schema,a,{errorOnInvalidContent:null!=t?t:l.options.enableContentCheck});return i&&r.replaceWith(0,c.content.size,n).setMeta("preventUpdate",!s),!0}return i&&r.setMeta("preventUpdate",!s),o.insertContentAt({from:0,to:c.content.size},e,{parseOptions:a,errorOnInvalidContent:null!=t?t:l.options.enableContentCheck})}};function ER(e,t){const s=UB(t,e.schema),{from:a,to:n,empty:l}=e.selection,r=[];l?(e.storedMarks&&r.push(...e.storedMarks),r.push(...e.selection.$head.marks())):e.doc.nodesBetween(a,n,e=>{r.push(...e.marks)});const i=r.find(e=>e.type.name===s.name);return i?d({},i.attrs):{}}function AR(e,t){const s=new VF(e);return t.forEach(e=>{e.steps.forEach(e=>{s.step(e)})}),s}function FR(e){return t=>function(e,t){for(let s=e.depth;s>0;s-=1){const a=e.node(s);if(t(a))return{pos:s>0?e.before(s):0,start:e.start(s),depth:s,node:a}}}(t.$from,e)}function TR(e,t,s){if(void 0===e.config[t]&&e.parent)return TR(e.parent,t,s);if("function"===typeof e.config[t]){return e.config[t].bind(d(d({},s),{},{parent:e.parent?TR(e.parent,t,s):null}))}return e.config[t]}function zR(e){return e.map(e=>{const t=TR(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...zR(t())]:e}).flat(10)}function MR(e,t){const s=YA.fromSchema(t).serializeFragment(e),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(s),a.innerHTML}function PR(e){return"function"===typeof e}function BR(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(PR(e)){for(var s=arguments.length,a=new Array(s>2?s-2:0),n=2;n<s;n++)a[n-2]=arguments[n];return t?e.bind(t)(...a):e(...a)}return e}function RR(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function LR(e){const t=[],{nodeExtensions:s,markExtensions:a}=RR(e),n=[...s,...a],l={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{const s=TR(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:n});if(!s)return;s().forEach(e=>{e.types.forEach(s=>{Object.entries(e.attributes).forEach(e=>{let[a,n]=e;t.push({type:s,name:a,attribute:d(d({},l),n)})})})})}),n.forEach(e=>{const s={name:e.name,options:e.options,storage:e.storage},a=TR(e,"addAttributes",s);if(!a)return;const n=a();Object.entries(n).forEach(s=>{let[a,n]=s;const r=d(d({},l),n);"function"===typeof(null==r?void 0:r.default)&&(r.default=r.default()),(null==r?void 0:r.isRequired)&&void 0===(null==r?void 0:r.default)&&delete r.default,t.push({type:e.name,name:a,attribute:r})})}),t}function IR(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter(e=>!!e).reduce((e,t)=>{const s=d({},e);
2return Object.entries(t).forEach(e=>{let[t,a]=e;if(s[t])if("class"===t){const e=a?String(a).split(" "):[],n=s[t]?s[t].split(" "):[],l=e.filter(e=>!n.includes(e));s[t]=[...n,...l].join(" ")}else if("style"===t){const e=a?a.split(";").map(e=>e.trim()).filter(Boolean):[],n=s[t]?s[t].split(";").map(e=>e.trim()).filter(Boolean):[],l=new Map;n.forEach(e=>{const[t,s]=e.split(":").map(e=>e.trim());l.set(t,s)}),e.forEach(e=>{const[t,s]=e.split(":").map(e=>e.trim());l.set(t,s)}),s[t]=Array.from(l.entries()).map(e=>{let[t,s]=e;return"".concat(t,": ").concat(s)}).join("; ")}else s[t]=a;else s[t]=a}),s},{})}function OR(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>IR(e,t),{})}function UR(e,t){return"style"in e?e:d(d({},e),{},{getAttrs:s=>{const a=e.getAttrs?e.getAttrs(s):e.attrs;if(!1===a)return!1;const n=t.reduce((e,t)=>{const a=t.attribute.parseHTML?t.attribute.parseHTML(s):function(e){return"string"!==typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(s.getAttribute(t.name));return null===a||void 0===a?e:d(d({},e),{},{[t.name]:a})},{});return d(d({},a),n)}})}function HR(e){return Object.fromEntries(Object.entries(e).filter(e=>{let[t,s]=e;return("attrs"!==t||!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 0===Object.keys(e).length&&e.constructor===Object}(s))&&(null!==s&&void 0!==s)}))}function WR(e){var t,s;const a={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(a.default=e.attribute.default),void 0!==(null==(s=null==e?void 0:e.attribute)?void 0:s.validate)&&(a.validate=e.attribute.validate),[e.name,a]}function VR(e,t){var s;const a=LR(e),{nodeExtensions:n,markExtensions:l}=RR(e),r=null==(s=n.find(e=>TR(e,"topNode")))?void 0:s.name,i=Object.fromEntries(n.map(s=>{const n=a.filter(e=>e.type===s.name),l={name:s.name,options:s.options,storage:s.storage,editor:t},r=e.reduce((e,t)=>{const a=TR(t,"extendNodeSchema",l);return d(d({},e),a?a(s):{})},{}),i=HR(d(d({},r),{},{content:BR(TR(s,"content",l)),marks:BR(TR(s,"marks",l)),group:BR(TR(s,"group",l)),inline:BR(TR(s,"inline",l)),atom:BR(TR(s,"atom",l)),selectable:BR(TR(s,"selectable",l)),draggable:BR(TR(s,"draggable",l)),code:BR(TR(s,"code",l)),whitespace:BR(TR(s,"whitespace",l)),linebreakReplacement:BR(TR(s,"linebreakReplacement",l)),defining:BR(TR(s,"defining",l)),isolating:BR(TR(s,"isolating",l)),attrs:Object.fromEntries(n.map(WR))})),o=BR(TR(s,"parseHTML",l));o&&(i.parseDOM=o.map(e=>UR(e,n)));const c=TR(s,"renderHTML",l);c&&(i.toDOM=e=>c({node:e,HTMLAttributes:OR(e,n)}));const u=TR(s,"renderText",l);return u&&(i.toText=u),[s.name,i]})),o=Object.fromEntries(l.map(s=>{const n=a.filter(e=>e.type===s.name),l={name:s.name,options:s.options,storage:s.storage,editor:t},r=e.reduce((e,t)=>{const a=TR(t,"extendMarkSchema",l);return d(d({},e),a?a(s):{})},{}),i=HR(d(d({},r),{},{inclusive:BR(TR(s,"inclusive",l)),excludes:BR(TR(s,"excludes",l)),group:BR(TR(s,"group",l)),spanning:BR(TR(s,"spanning",l)),code:BR(TR(s,"code",l)),attrs:Object.fromEntries(n.map(WR))})),o=BR(TR(s,"parseHTML",l));o&&(i.parseDOM=o.map(e=>UR(e,n)));const c=TR(s,"renderHTML",l);return c&&(i.toDOM=e=>c({mark:e,HTMLAttributes:OR(e,n)})),[s.name,i]}));return new RA({topNode:r,nodes:i,marks:o})}function qR(e){return e.sort((e,t)=>{const s=TR(e,"priority")||100,a=TR(t,"priority")||100;return s>a?-1:s<a?1:0})}function $R(e){const t=qR(zR(e)),s=function(e){const t=e.filter((t,s)=>e.indexOf(t)!==s);return Array.from(new Set(t))}(t.map(e=>e.name));return s.length&&console.warn("[tiptap warn]: Duplicate extension names found: [".concat(s.map(e=>"'".concat(e,"'")).join(", "),"]. This can lead to issues.")),t}function GR(e,t,s){const{from:a,to:n}=t,{blockSeparator:l="\n\n",textSerializers:r={}}=s||{};let i="";return e.nodesBetween(a,n,(e,s,o,c)=>{var d;e.isBlock&&s>a&&(i+=l);const u=null==r?void 0:r[e.type.name];if(u)return o&&(i+=u({node:e,pos:s,parent:o,index:c,range:t})),!1;e.isText&&(i+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(a,s)-s,n-s))}),i}function KR(e,t){return GR(e,{from:0,to:e.content.size},t)}function YR(e){return Object.fromEntries(Object.entries(e.nodes).filter(e=>{let[,t]=e;return t.spec.toText}).map(e=>{let[t,s]=e;return[t,s.spec.toText]}))}function JR(e,t){const s=fR("string"===typeof t?t:t.name,e.schema);return"node"===s?function(e,t){const s=AB(t,e.schema),{from:a,to:n}=e.selection,l=[];e.doc.nodesBetween(a,n,e=>{l.push(e)});const r=l.reverse().find(e=>
2e.type.name===s.name);return r?d({},r.attrs):{}}(e,t):"mark"===s?ER(e,t):{}}function QR(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:JSON.stringify;const s={};return e.filter(e=>{const a=t(e);return!Object.prototype.hasOwnProperty.call(s,a)&&(s[a]=!0)})}(e);return 1===t.length?t:t.filter((e,s)=>{const a=t.filter((e,t)=>t!==s);return!a.some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to)})}function XR(e){const{mapping:t,steps:s}=e,a=[];return t.maps.forEach((e,n)=>{const l=[];if(e.ranges.length)e.forEach((e,t)=>{l.push({from:e,to:t})});else{const{from:e,to:t}=s[n];if(void 0===e||void 0===t)return;l.push({from:e,to:t})}l.forEach(e=>{let{from:s,to:l}=e;const r=t.slice(n).map(s,-1),i=t.slice(n).map(l),o=t.invert().map(r,-1),c=t.invert().map(i);a.push({oldRange:{from:o,to:c},newRange:{from:r,to:i}})})}),QR(a)}function ZR(e,t,s){const a=[];return e===t?s.resolve(e).marks().forEach(t=>{const n=OB(s.resolve(e),t.type);n&&a.push(d({mark:t},n))}):s.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&a.push(...e.marks.map(s=>({from:t,to:t+e.nodeSize,mark:s})))}),a}function eL(e,t){return t.nodes[e]||t.marks[e]||null}function tL(e,t,s){return Object.fromEntries(Object.entries(s).filter(s=>{let[a]=s;const n=e.find(e=>e.type===t&&e.name===a);return!!n&&n.attribute.keepOnSplit}))}function sL(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{empty:a,ranges:n}=e.selection,l=t?UB(t,e.schema):null;if(a)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!l||l.name===e.type.name).find(e=>RB(e.attrs,s,{strict:!1}));let r=0;const i=[];if(n.forEach(t=>{let{$from:s,$to:a}=t;const n=s.pos,l=a.pos;e.doc.nodesBetween(n,l,(e,t)=>{if(!e.isText&&!e.marks.length)return;const s=Math.max(n,t),a=Math.min(l,t+e.nodeSize);r+=a-s,i.push(...e.marks.map(e=>({mark:e,from:s,to:a})))})}),0===r)return!1;const o=i.filter(e=>!l||l.name===e.mark.type.name).filter(e=>RB(e.mark.attrs,s,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=i.filter(e=>!l||e.mark.type!==l&&e.mark.type.excludes(l)).reduce((e,t)=>e+t.to-t.from,0);return(o>0?o+c:o)>=r}function aL(e,t){return Array.isArray(t)?t.some(t=>("string"===typeof t?t:t.name)===e.name):t}function nL(e,t){const{nodeExtensions:s}=RR(t),a=s.find(t=>t.name===e);if(!a)return!1;const n=BR(TR(a,"group",{name:a.name,options:a.options,storage:a.storage}));return"string"===typeof n&&n.split(" ").includes("list")}function lL(e){let{checkChildren:t=!0,ignoreWhitespace:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var a;if(s){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(a=e.text)?a:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let a=!0;return e.content.forEach(e=>{!1!==a&&(lL(e,{ignoreWhitespace:s,checkChildren:t})||(a=!1))}),a}return!1}function rL(e){return e instanceof XF}var iL=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function oL(e,t){const s=t.mapping.mapResult(e.position);return{position:new iL(s.pos),mapResult:s}}function cL(e){return new iL(e)}var dL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{tr:a,state:n,dispatch:l}=s;const{selection:r}=a,{empty:i,ranges:o}=r,c=UB(e,n.schema);if(l)if(i){const e=ER(n,c);a.addStoredMark(c.create(d(d({},e),t)))}else o.forEach(e=>{const s=e.$from.pos,l=e.$to.pos;n.doc.nodesBetween(s,l,(e,n)=>{const r=Math.max(n,s),i=Math.min(n+e.nodeSize,l);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&a.addMark(r,i,c.create(d(d({},e.attrs),t)))}):a.addMark(r,i,c.create(t))})});return function(e,t,s){var a;const{selection:n}=t;let l=null;if(VB(n)&&(l=n.$cursor),l){const t=null!=(a=e.storedMarks)?a:l.marks();return l.parent.type.allowsMarkType(s)&&(!!s.isInSet(t)||!t.some(e=>e.type.excludes(s)))}const{ranges:r}=n;return r.some(t=>{let{$from:a,$to:n}=t,l=0===a.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(s);return e.doc.nodesBetween(a.pos,n.pos,(e,t,a)=>{if(l)return!1;if(e.isInline){const t=!a||a.type.allowsMarkType(s),n=!!s.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(s));l=t&&n}return!l}),l})}(n,a,c)}},uL=(e,t)=>s=>{let{tr:a}=s;return a.setMeta(e,t),!0},mL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{state:a,dispatch:n,chain:l}=s;const r=AB(e,a.schema);let i;return a.selection.$anchor.sameParent(a.selection.$head)&&(i=a.selection.$anchor.parent.attrs),r.isTextblock?l().command(e=>{let{commands:s}=e;return!!RT(r,d(d({},i),t))(a)||s.clearNodes()}).command(e=>{let{state:s}=e;return RT(r,d(d({},i),t))(s,n)}).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)}},hL=e=>t=>{let{tr:s,dispatch:a}=t;if(a){const{doc:t}=s,a=qB(e,0,t.content.size),n=XF.create(t,a);s.setSelection(n)}return!0},xL=(e,t)=>s=>{let{tr:a,state:n,dispatch:l}=s;const{selection:r}=n;let i,o;return"number"===typeof t?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=r.from,o=r.to),l&&a.doc.nodesBetween(i,o,(t,s)=>{t.isText||a.setNodeMarkup(s,void 0,d(d({},t.attrs),{},{dir:e}))}),!0},pL=e=>t=>{let{tr:s,dispatch:a}=t;if(a){const{doc:t}=s,{from:a,to:n}="number"===typeof e?{from:e,to:e}:e,l=JF.atStart(t).from,r=JF.atEnd(t).to,i=qB(a,l,r),o=qB(n,l,r),c=JF.create(t,i,o);s.setSelection(c)}return!0},gL=e=>t=>{let{state:s,dispatch:a}=t;const n=AB(e,s.schema);return(l=n,function(e,t){let{$from:s,$to:a}=e.selection,n=s.blockRange(a,e=>e.childCount>0&&e.firstChild.type==l);if(!n)return!1;let r=n.startIndex;if(0==r)return!1;let i=n.parent,o=i.child(r-1);if(o.type!=l)return!1;if(t){let s=o.lastChild&&o.lastChild.type==i.type,a=KE.from(s?l.create():null),r=new eA(KE.from(l.create(null,KE.from(i.type.create(null,a)))),s?3:1,0),c=n.start,d=n.end;t(e.tr.step(new gF(c-(s?3:1),d,c,d,r,1,!0)).scrollIntoView())}return!0})(s,a);var l};function fL(e,t){const s=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(s){const a=s.filter(e=>
2null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(a)}}var vL=function(){let{keepMarks:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>{let{tr:s,state:a,dispatch:n,editor:l}=t;const{selection:r,doc:i}=s,{$from:o,$to:c}=r,d=tL(l.extensionManager.attributes,o.node().type.name,o.node().attrs);if(r instanceof XF&&r.node.isBlock)return!(!o.parentOffset||!kF(i,o.pos))&&(n&&(e&&fL(a,l.extensionManager.splittableMarks),s.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const u=c.parentOffset===c.parent.content.size,m=0===o.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:s}=e.edge(t);if(s.isTextblock&&!s.hasRequiredAttrs())return s}return null}(o.node(-1).contentMatchAt(o.indexAfter(-1)));let h=u&&m?[{type:m,attrs:d}]:void 0,x=kF(s.doc,s.mapping.map(o.pos),1,h);if(h||x||!kF(s.doc,s.mapping.map(o.pos),1,m?[{type:m}]:void 0)||(x=!0,h=m?[{type:m,attrs:d}]:void 0),n){if(x&&(r instanceof JF&&s.deleteSelection(),s.split(s.mapping.map(o.pos),1,h),m&&!u&&!o.parentOffset&&o.parent.type!==m)){const e=s.mapping.map(o.before()),t=s.doc.resolve(e);o.node(-1).canReplaceWith(t.index(),t.index()+1,m)&&s.setNodeMarkup(s.mapping.map(o.before()),m)}e&&fL(a,l.extensionManager.splittableMarks),s.scrollIntoView()}return x}},bL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{tr:a,state:n,dispatch:l,editor:r}=s;var i;const o=AB(e,n.schema),{$from:c,$to:u}=n.selection,m=n.selection.node;if(m&&m.isBlock||c.depth<2||!c.sameParent(u))return!1;const h=c.node(-1);if(h.type!==o)return!1;const x=r.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==o||c.index(-2)!==c.node(-2).childCount-1)return!1;if(l){let e=KE.empty;const s=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-s;t>=c.depth-3;t-=1)e=KE.from(c.node(t).copy(e));const n=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,l=d(d({},tL(x,c.node().type.name,c.node().attrs)),t),r=(null==(i=o.contentMatch.defaultType)?void 0:i.createAndFill(l))||void 0;e=e.append(KE.from(o.createAndFill(null,r)||void 0));const u=c.before(c.depth-(s-1));a.replace(u,c.after(-n),new eA(e,4-s,0));let m=-1;a.doc.nodesBetween(u,a.doc.content.size,(e,t)=>{if(m>-1)return!1;e.isTextblock&&0===e.content.size&&(m=t+1)}),m>-1&&a.setSelection(JF.near(a.doc.resolve(m))),a.scrollIntoView()}return!0}const p=u.pos===c.end()?h.contentMatchAt(0).defaultType:null,g=d(d({},tL(x,h.type.name,h.attrs)),t),f=d(d({},tL(x,c.node().type.name,c.node().attrs)),t);a.delete(c.pos,u.pos);const v=p?[{type:o,attrs:g},{type:p,attrs:f}]:[{type:o,attrs:g}];if(!kF(a.doc,c.pos,2))return!1;if(l){const{selection:e,storedMarks:t}=n,{splittableMarks:s}=r.extensionManager,i=t||e.$to.parentOffset&&e.$from.marks();if(a.split(c.pos,2,v).scrollIntoView(),!i||!l)return!0;const o=i.filter(e=>s.includes(e.type.name));a.ensureMarks(o)}return!0}},jL=(e,t)=>{const s=FR(e=>e.type===t)(e.selection);if(!s)return!0;const a=e.doc.resolve(Math.max(0,s.pos-1)).before(s.depth);if(void 0===a)return!0;const n=e.doc.nodeAt(a);return s.node.type!==(null==n?void 0:n.type)||!DF(e.doc,s.pos)||(e.join(s.pos),!0)},yL=(e,t)=>{const s=FR(e=>e.type===t)(e.selection);if(!s)return!0;const a=e.doc.resolve(s.start).after(s.depth);if(void 0===a)return!0;const n=e.doc.nodeAt(a);return s.node.type!==(null==n?void 0:n.type)||!DF(e.doc,a)||(e.join(a),!0)},NL=function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n=>{let{editor:l,tr:r,state:i,dispatch:o,chain:c,commands:d,can:u}=n;const{extensions:m,splittableMarks:h}=l.extensionManager,x=AB(e,i.schema),p=AB(t,i.schema),{selection:g,storedMarks:f}=i,{$from:v,$to:b}=g,j=v.blockRange(b),y=f||g.$to.parentOffset&&g.$from.marks();if(!j)return!1;const N=FR(e=>nL(e.type.name,m))(g);if(j.depth>=1&&N&&j.depth-N.depth<=1){if(N.node.type===x)return d.liftListItem(p);if(nL(N.node.type.name,m)&&x.validContent(N.node.content)&&o)return c().command(()=>(r.setNodeMarkup(N.pos,x),!0)).command(()=>jL(r,x)).command(()=>yL(r,x)).run()}return s&&y&&o?c().command(()=>{const e=u().wrapInList(x,a),t=y.filter(e=>
2h.includes(e.type.name));return r.ensureMarks(t),!!e||d.clearNodes()}).wrapInList(x,a).command(()=>jL(r,x)).command(()=>yL(r,x)).run():c().command(()=>!!u().wrapInList(x,a)||d.clearNodes()).wrapInList(x,a).command(()=>jL(r,x)).command(()=>yL(r,x)).run()}},wL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a=>{let{state:n,commands:l}=a;const{extendEmptyMarkRange:r=!1}=s,i=UB(e,n.schema);return sL(n,i,t)?l.unsetMark(i,{extendEmptyMarkRange:r}):l.setMark(i,t)}},CL=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a=>{let{state:n,commands:l}=a;const r=AB(e,n.schema),i=AB(t,n.schema),o=mR(n,r,s);let c;return n.selection.$anchor.sameParent(n.selection.$head)&&(c=n.selection.$anchor.parent.attrs),o?l.setNode(i,c):l.setNode(r,d(d({},c),s))}},kL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{state:a,commands:n}=s;const l=AB(e,a.schema);return mR(a,l,t)?n.lift(l):n.wrapIn(l,t)}},DL=()=>e=>{let{state:t,dispatch:s}=e;const a=t.plugins;for(let n=0;n<a.length;n+=1){const e=a[n];let l;if(e.spec.isInputRules&&(l=e.getState(t))){if(s){const e=t.tr,s=l.transform;for(let t=s.steps.length-1;t>=0;t-=1)e.step(s.steps[t].invert(s.docs[t]));if(l.text){const s=e.doc.resolve(l.from).marks();e.replaceWith(l.from,l.to,t.schema.text(l.text,s))}else e.delete(l.from,l.to)}return!0}}return!1},_L=()=>e=>{let{tr:t,dispatch:s}=e;const{selection:a}=t,{empty:n,ranges:l}=a;return n||s&&l.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos)}),!0},SL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{tr:a,state:n,dispatch:l}=s;var r;const{extendEmptyMarkRange:i=!1}=t,{selection:o}=a,c=UB(e,n.schema),{$from:d,empty:u,ranges:m}=o;if(!l)return!0;if(u&&i){let{from:e,to:t}=o;const s=null==(r=d.marks().find(e=>e.type===c))?void 0:r.attrs,n=OB(d,c,s);n&&(e=n.from,t=n.to),a.removeMark(e,t,c)}else m.forEach(e=>{a.removeMark(e.$from.pos,e.$to.pos,c)});return a.removeStoredMark(c),!0}},EL=e=>t=>{let{tr:s,state:a,dispatch:n}=t;const{selection:l}=a;let r,i;return"number"===typeof e?(r=e,i=e):e&&"from"in e&&"to"in e?(r=e.from,i=e.to):(r=l.from,i=l.to),n&&s.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;const a=d({},e.attrs);delete a.dir,s.setNodeMarkup(t,void 0,a)}),!0},AL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{tr:a,state:n,dispatch:l}=s,r=null,i=null;const o=fR("string"===typeof e?e:e.name,n.schema);if(!o)return!1;"node"===o&&(r=AB(e,n.schema)),"mark"===o&&(i=UB(e,n.schema));let c=!1;return a.selection.ranges.forEach(e=>{const s=e.$from.pos,o=e.$to.pos;let u,m,h,x;a.selection.empty?n.doc.nodesBetween(s,o,(e,t)=>{r&&r===e.type&&(c=!0,h=Math.max(t,s),x=Math.min(t+e.nodeSize,o),u=t,m=e)}):n.doc.nodesBetween(s,o,(e,n)=>{n<s&&r&&r===e.type&&(c=!0,h=Math.max(n,s),x=Math.min(n+e.nodeSize,o),u=n,m=e),n>=s&&n<=o&&(r&&r===e.type&&(c=!0,l&&a.setNodeMarkup(n,void 0,d(d({},e.attrs),t))),i&&e.marks.length&&e.marks.forEach(r=>{if(i===r.type&&(c=!0,l)){const l=Math.max(n,s),c=Math.min(n+e.nodeSize,o);a.addMark(l,c,i.create(d(d({},r.attrs),t)))}}))}),m&&(void 0!==u&&l&&a.setNodeMarkup(u,void 0,d(d({},m.attrs),t)),i&&m.marks.length&&m.marks.forEach(e=>{i===e.type&&l&&a.addMark(h,x,i.create(d(d({},e.attrs),t)))}))}),c}},FL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{state:a,dispatch:n}=s;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(s,a){let{$from:n,$to:l}=s.selection,r=n.blockRange(l),i=r&&yF(r,e,t);return!!i&&(a&&a(s.tr.wrap(r,i).scrollIntoView()),!0)}}(AB(e,a.schema),t)(a,n)}},TL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s=>{let{state:a,dispatch:n}=s;return WT(AB(e,a.schema),t)(a,n)}},zL=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];const n=this.callbacks[e];
2return n&&n.forEach(e=>e.apply(this,s)),this}off(e,t){const s=this.callbacks[e];return s&&(t?this.callbacks[e]=s.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){var s=this;const a=function(){s.off(e,a);for(var n=arguments.length,l=new Array(n),r=0;r<n;r++)l[r]=arguments[r];t.apply(s,l)};return this.on(e,a)}removeAllListeners(){this.callbacks={}}},ML=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function PL(e){var t;const{editor:s,from:a,to:n,text:l,rules:r,plugin:i}=e,{view:o}=s;if(o.composing)return!1;const c=o.state.doc.resolve(a);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1;const u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,s="";const a=e.parentOffset;return e.parent.nodesBetween(Math.max(0,a-t),a,(e,t,n,l)=>{var r,i;const o=(null==(i=(r=e.type.spec).toText)?void 0:i.call(r,{node:e,pos:t,parent:n,index:l}))||e.textContent||"%leaf%";s+=e.isAtom&&!e.isText?o:o.slice(0,Math.max(0,a-t))}),s}(c)+l;return r.forEach(e=>{if(d)return;const t=((e,t)=>{if(BB(t))return t.exec(e);const s=t(e);if(!s)return null;const a=[s.text];return a.index=s.index,a.input=e,a.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),a.push(s.replaceWith)),a})(u,e.find);if(!t)return;const r=o.state.tr,c=jB({state:o.state,transaction:r}),m={from:a-(t[0].length-l.length),to:n},{commands:h,chain:x,can:p}=new yB({editor:s,state:c});null!==e.handler({state:c,range:m,match:t,commands:h,chain:x,can:p})&&r.steps.length&&(e.undoable&&r.setMeta(i,{transform:r,from:a,to:n,text:l}),o.dispatch(r),d=!0)}),d}function BL(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function RL(e,t){const s=d({},e);return BL(e)&&BL(t)&&Object.keys(t).forEach(a=>{BL(t[a])&&BL(e[a])?s[a]=RL(e[a],t[a]):s[a]=t[a]}),s}var LL=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config=d(d({},this.config),e),this.name=this.config.name}get options(){return d({},BR(TR(this,"addOptions",{name:this.name}))||{})}get storage(){return d({},BR(TR(this,"addStorage",{name:this.name,options:this.options}))||{})}configure(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.extend(d(d({},this.config),{},{addOptions:()=>RL(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=new this.constructor(d(d({},this.config),e));return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},IL=class e extends LL{constructor(){super(...arguments),this.type="mark"}static create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s="function"===typeof t?t():t;return new e(s)}static handleExit(e){let{editor:t,mark:s}=e;const{tr:a}=t.state,n=t.state.selection.$from;if(n.pos===n.end()){const e=n.marks(),l=!!e.find(e=>(null==e?void 0:e.type.name)===s.name);if(!l)return!1;const r=e.find(e=>(null==e?void 0:e.type.name)===s.name);return r&&a.removeStoredMark(r),a.insertText(" ",n.pos),t.view.dispatch(a),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"===typeof e?e():e;return super.extend(t)}};var OL=class{constructor(e){this.find=e.find,this.handler=e.handler}};function UL(e){const{editor:t,state:s,from:a,to:n,rule:l,pasteEvent:r,dropEvent:i}=e,{commands:o,chain:c,can:d}=new yB({editor:t,state:s}),u=[];s.doc.nodesBetween(a,n,(e,t)=>{var m,h,x,p,g;if((null==(h=null==(m=e.type)?void 0:m.spec)?void 0:h.code)||!(e.isText||e.isTextblock||e.isInline))return;const f=null!=(g=null!=(p=null==(x=e.content)?void 0:x.size)?p:e.nodeSize)?g:0,v=Math.max(a,t),b=Math.min(n,t+f);if(v>=b)return;const j=((e,t,s)=>{if(BB(t))return[...e.matchAll(t)];const a=t(e,s);return a?a.map(t=>{const s=[t.text];return s.index=t.index,s.input=e,s.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(t.replaceWith)),s}):[]})(e.isText?e.text||"":e.textBetween(v-t,b-t,void 0,"\ufffc"),l.find,r);
2j.forEach(e=>{if(void 0===e.index)return;const t=v+e.index+1,a=t+e[0].length,n={from:s.tr.mapping.map(t),to:s.tr.mapping.map(a)},m=l.handler({state:s,range:n,match:e,commands:o,chain:c,can:d,pasteEvent:r,dropEvent:i});u.push(m)})});return u.every(e=>null!==e)}var HL=null;function WL(e){const{editor:t,rules:s}=e;let a,n=null,l=!1,r=!1,i="undefined"!==typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{a="undefined"!==typeof DragEvent?new DragEvent("drop"):null}catch(c){a=null}const o=e=>{let{state:s,from:n,to:l,rule:r,pasteEvt:o}=e;const c=s.tr,d=jB({state:s,transaction:c});if(UL({editor:t,state:d,from:Math.max(n-1,0),to:l.b-1,rule:r,pasteEvent:o,dropEvent:a})&&c.steps.length){try{a="undefined"!==typeof DragEvent?new DragEvent("drop"):null}catch(u){a=null}return i="undefined"!==typeof ClipboardEvent?new ClipboardEvent("paste"):null,c}};return s.map(e=>new uT({view(e){const s=s=>{var a;n=(null==(a=e.dom.parentElement)?void 0:a.contains(s.target))?e.dom.parentElement:null,n&&(HL=t)},a=()=>{HL&&(HL=null)};return window.addEventListener("dragstart",s),window.addEventListener("dragend",a),{destroy(){window.removeEventListener("dragstart",s),window.removeEventListener("dragend",a)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(r=n===e.dom.parentElement,a=t,!r){const e=HL;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var s;const a=null==(s=t.clipboardData)?void 0:s.getData("text/html");return i=t,l=!!(null==a?void 0:a.includes("data-pm-slice")),!1}}},appendTransaction:(t,s,a)=>{const n=t[0],c="paste"===n.getMeta("uiEvent")&&!l,d="drop"===n.getMeta("uiEvent")&&!r,u=n.getMeta("applyPasteRules"),m=!!u;if(!c&&!d&&!m)return;if(m){let{text:t}=u;"string"===typeof t||(t=MR(KE.from(t),a.schema));const{from:s}=u,n=s+t.length,l=(e=>{var t;const s=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=s.clipboardData)||t.setData("text/html",e),s})(t);return o({rule:e,state:a,from:s,to:{b:n},pasteEvt:l})}const h=s.doc.content.findDiffStart(a.doc.content),x=s.doc.content.findDiffEnd(a.doc.content);return"number"===typeof h&&x&&h!==x.b?o({rule:e,state:a,from:h,to:x,pasteEvt:i}):void 0}}))}var VL=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=$R(e),this.schema=VR(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const s=TR(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:eL(t.name,this.schema)});return s?d(d({},e),s()):e},{})}get plugins(){const{editor:e}=this,t=qR([...this.extensions].reverse()).flatMap(t=>{const s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:eL(t.name,this.schema)},a=[],n=TR(t,"addKeyboardShortcuts",s);let l={};if("mark"===t.type&&TR(t,"exitable",s)&&(l.ArrowRight=()=>IL.handleExit({editor:e,mark:t})),n){const t=Object.fromEntries(Object.entries(n()).map(t=>{let[s,a]=t;return[s,()=>a({editor:e})]}));l=d(d({},l),t)}const r=new uT({props:{handleKeyDown:fB(l)}});a.push(r);const i=TR(t,"addInputRules",s);if(aL(t,e.options.enableInputRules)&&i){const t=i();if(t&&t.length){const s=function(e){const{editor:t,rules:s}=e,a=new uT({state:{init:()=>null,apply(e,n,l){const r=e.getMeta(a);if(r)return r;const i=e.getMeta("applyInputRules");return!!i&&setTimeout(()=>{let{text:e}=i;"string"===typeof e||(e=MR(KE.from(e),l.schema));const{from:n}=i,r=n+e.length;PL({editor:t,from:n,to:r,text:e,rules:s,plugin:a})}),e.selectionSet||e.docChanged?null:n}},props:{handleTextInput:(e,n,l,r)=>PL({editor:t,from:n,to:l,text:r,rules:s,plugin:a}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:n}=e.state.selection;n&&PL({editor:t,from:n.pos,to:n.pos,text:"",rules:s,plugin:a})}),!1)},handleKeyDown(e,n){if("Enter"!==n.key)return!1;const{$cursor:l}=e.state.selection;return!!l&&PL({editor:t,from:l.pos,to:l.pos,text:"\n",rules:s,plugin:a})}},isInputRules:!0});return a}({editor:e,rules:t}),n=Array.isArray(s)?s:[s];a.push(...n)}}const o=TR(t,"addPasteRules",s);if(aL(t,e.options.enablePasteRules)&&o){const t=o();if(t&&t.length){const s=WL({editor:e,rules:t});a.push(...s)}}const c=TR(t,"addProseMirrorPlugins",s);if(c){const e=c();a.push(...e)}return a});return t}get attributes(){return LR(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=RR(this.extensions);return Object.fromEntries(t.filter(e=>!!TR(e,"addNodeView")).map(t=>{const s=this.attributes.filter(e=>e.type===t.name),a={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:AB(t.name,this.schema)},n=TR(t,"addNodeView",a);if(!n)return[];const l=n();if(!l)return[];return[t.name,(a,n,r,i,o)=>{const c=OR(a,s);return l({node:a,view:n,getPos:r,decorations:i,innerDecorations:o,editor:e,extension:t,HTMLAttributes:c})}]}))}get markViews(){const{editor:e}=this,{markExtensions:t}=RR(this.extensions);return Object.fromEntries(t.filter(e=>!!TR(e,"addMarkView")).map(t=>{const s=this.attributes.filter(e=>e.type===t.name),a={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:UB(t.name,this.schema)},n=TR(t,"addMarkView",a);if(!n)return[];return[t.name,(a,l,r)=>{const i=OR(a,s);return n()({mark:a,view:l,inline:r,editor:e,extension:t,HTMLAttributes:i,updateAttributes:t=>{bI(a,e,t)}})}]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>
2[e.name,e.storage])),e.forEach(e=>{var t;const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:eL(e.name,this.schema)};if("mark"===e.type){(null==(t=BR(TR(e,"keepOnSplit",s)))||t)&&this.splittableMarks.push(e.name)}const a=TR(e,"onBeforeCreate",s),n=TR(e,"onCreate",s),l=TR(e,"onUpdate",s),r=TR(e,"onSelectionUpdate",s),i=TR(e,"onTransaction",s),o=TR(e,"onFocus",s),c=TR(e,"onBlur",s),d=TR(e,"onDestroy",s);a&&this.editor.on("beforeCreate",a),n&&this.editor.on("create",n),l&&this.editor.on("update",l),r&&this.editor.on("selectionUpdate",r),i&&this.editor.on("transaction",i),o&&this.editor.on("focus",o),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};VL.resolve=$R,VL.sort=qR,VL.flatten=zR;bB({},{ClipboardTextSerializer:()=>$L,Commands:()=>GL,Delete:()=>KL,Drop:()=>YL,Editable:()=>JL,FocusEvents:()=>XL,Keymap:()=>ZL,Paste:()=>eI,Tabindex:()=>tI,TextDirection:()=>sI,focusEventsPluginKey:()=>QL});var qL=class e extends LL{constructor(){super(...arguments),this.type="extension"}static create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s="function"===typeof t?t():t;return new e(s)}configure(e){return super.configure(e)}extend(e){const t="function"===typeof e?e():e;return super.extend(t)}},$L=qL.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new uT({key:new xT("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:s}=e,{doc:a,selection:n}=t,{ranges:l}=n,r=Math.min(...l.map(e=>e.$from.pos)),i=Math.max(...l.map(e=>e.$to.pos)),o=YR(s);return GR(a,{from:r,to:i},d(d({},void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{}),{},{textSerializers:o}))}}})]}}),GL=qL.create({name:"commands",addCommands:()=>d({},NB)}),KL=qL.create({name:"delete",onUpdate(e){let{transaction:t,appendedTransactions:s}=e;var a,n,l;const r=()=>{var e,a,n,l;if(null!=(l=null==(n=null==(a=null==(e=this.editor.options.coreExtensionOptions)?void 0:e.delete)?void 0:a.filterTransaction)?void 0:n.call(a,t))?l:t.getMeta("y-sync$"))return;const r=AR(t.before,[t,...s]);XR(r).forEach(e=>{r.mapping.mapResult(e.oldRange.from).deletedAfter&&r.mapping.mapResult(e.oldRange.to).deletedBefore&&r.before.nodesBetween(e.oldRange.from,e.oldRange.to,(s,a)=>{const n=a+s.nodeSize-2,l=e.oldRange.from<=a&&n<=e.oldRange.to;this.editor.emit("delete",{type:"node",node:s,from:a,to:n,newFrom:r.mapping.map(a),newTo:r.mapping.map(n),deletedRange:e.oldRange,newRange:e.newRange,partial:!l,editor:this.editor,transaction:t,combinedTransform:r})})});const i=r.mapping;r.steps.forEach((e,s)=>{var a,n;if(e instanceof mF){const l=i.slice(s).map(e.from,-1),o=i.slice(s).map(e.to),c=i.invert().map(l,-1),d=i.invert().map(o),u=null==(a=r.doc.nodeAt(l-1))?void 0:a.marks.some(t=>t.eq(e.mark)),m=null==(n=r.doc.nodeAt(o))?void 0:n.marks.some(t=>t.eq(e.mark));this.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:c,to:d},newRange:{from:l,to:o},partial:Boolean(m||u),editor:this.editor,transaction:t,combinedTransform:r})}})};null==(l=null==(n=null==(a=this.editor.options.coreExtensionOptions)?void 0:a.delete)?void 0:n.async)||l?setTimeout(r,0):r()}}),YL=qL.create({name:"drop",addProseMirrorPlugins(){return[new uT({key:new xT("tiptapDrop"),props:{handleDrop:(e,t,s,a)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:s,moved:a})}}})]}}),JL=qL.create({name:"editable",addProseMirrorPlugins(){return[new uT({key:new xT("editable"),props:{editable:()=>this.editor.options.editable}})]}}),QL=new xT("focusEvents"),XL=qL.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new uT({key:QL,props:{handleDOMEvents:{focus:(t,s)=>{e.isFocused=!0;const a=e.state.tr.setMeta("focus",{event:s}).setMeta("addToHistory",!1);return t.dispatch(a),!1},blur:(t,s)=>{e.isFocused=!1;const a=e.state.tr.setMeta("blur",{event:s}).setMeta("addToHistory",!1);return t.dispatch(a),!1}}}})]}}),ZL=qL.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(e=>{let{commands:t}=e;return[()=>t.undoInputRule(),()=>t.command(e=>{let{tr:s}=e;const{selection:a,doc:n}=s,{empty:l,$anchor:r}=a,{pos:i,parent:o}=r,c=r.parent.isTextblock&&i>0?s.doc.resolve(i-1):r,d=c.parent.type.spec.isolating,u=r.pos-r.parentOffset,m=d&&1===c.parent.childCount?u===r.pos:$F.atStart(n).from===i;return!(!l||!o.type.isTextblock||o.textContent.length||!m||m&&"paragraph"===r.parent.type.name)&&t.clearNodes()}),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()]}),t=()=>this.editor.commands.first(e=>{let{commands:t}=e;return[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()]}),s={Enter:()=>this.editor.commands.first(e=>{let{commands:t}=e;return[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()]}),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},a=d({},s),n=d(d({},s),{},{"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()});return KB()||dR()?n:a},addProseMirrorPlugins(){return[new uT({key:new xT("clearDocument"),appendTransaction:(e,t,s)=>{if(e.some(e=>e.getMeta("composition")))return;const a=e.some(e=>e.docChanged)&&!t.doc.eq(s.doc),n=e.some(e=>e.getMeta("preventClearDocument"));if(!a||n)return;const{empty:l,from:r,to:i}=t.selection,o=$F.atStart(t.doc).from,c=$F.atEnd(t.doc).to;
2if(l||!(r===o&&i===c))return;if(!lL(s.doc))return;const d=s.tr,u=jB({state:s,transaction:d}),{commands:m}=new yB({editor:this.editor,state:u});return m.clearNodes(),d.steps.length?d:void 0}})]}}),eI=qL.create({name:"paste",addProseMirrorPlugins(){return[new uT({key:new xT("tiptapPaste"),props:{handlePaste:(e,t,s)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:s})}}})]}}),tI=qL.create({name:"tabindex",addProseMirrorPlugins(){return[new uT({key:new xT("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),sI=qL.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=RR(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new uT({key:new xT("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),aI=class e{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=e,this.editor=t,this.currentNode=a}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,s=this.to;if(this.isBlock){if(0===this.content.size)return void console.error("You can\u2019t set content on a block node. Tried to set content on ".concat(this.name," at ").concat(this.pos));t=this.from+1,s=this.to-1}this.editor.commands.insertContentAt({from:t,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(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),s=this.resolvedPos.doc.resolve(t);return new e(s,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((s,a)=>{const n=s.isBlock&&!s.isTextblock,l=s.isAtom&&!s.isText,r=this.pos+a+(l?0:1);if(r<0||r>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(r);if(!n&&i.depth<=this.depth)return;const o=new e(i,this.editor,n,n?s:null);n&&(o.actualDepth=this.depth+1),t.push(new e(i,this.editor,n,n?s:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null,a=this.parent;for(;a&&!s;){if(a.node.type.name===e)if(Object.keys(t).length>0){const e=a.node.attrs,s=Object.keys(t);for(let a=0;a<s.length;a+=1){const n=s[a];if(e[n]!==t[n])break}}else s=a;a=a.parent}return s}querySelector(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=[];if(!this.children||0===this.children.length)return a;const n=Object.keys(t);return this.children.forEach(l=>{if(!(s&&a.length>
20)){if(l.node.type.name===e){const e=n.every(e=>t[e]===l.node.attrs[e]);e&&a.push(l)}s&&a.length>0||(a=a.concat(l.querySelectorAll(e,t,s)))}}),a}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,d(d({},this.node.attrs),e)),this.editor.view.dispatch(t)}};var nI=class extends zL{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!==typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:e=>{let{error:t}=e;throw t},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:oL,createMappablePosition:cL},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),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",e=>{let{event:t,slice:s,moved:a}=e;return this.options.onDrop(t,s,a)}),this.on("paste",e=>{let{event:t,slice:s}=e;return this.options.onPaste(t,s)}),this.on("delete",this.options.onDelete);const t=this.createDoc(),s=$B(t,this.options.autofocus);this.editorState=cT.create({doc:t,schema:this.schema,selection:s||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"===typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(".".concat(this.className)).length)try{"function"===typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}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&&"undefined"!==typeof document&&(this.css=function(e,t,s){const a=document.querySelector("style[data-tiptap-style".concat(s?"-".concat(s):"","]"));if(null!==a)return a;const n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.setAttribute("data-tiptap-style".concat(s?"-".concat(s):""),""),n.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(n),n}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}
2\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=d(d({},this.options),e),this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error("[tiptap error]: The editor view is not available. Cannot access view['".concat(t,"']. The editor may not be mounted yet."))}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const s=PR(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],a=this.state.reconfigure({plugins:s});return this.view.updateState(a),a}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let s=t;if([].concat(e).forEach(e=>
2{const t="string"===typeof e?"".concat(e,"$"):e.key;s=s.filter(e=>!e.key.startsWith(t))}),t.length===s.length)return;const a=this.state.reconfigure({plugins:s});return this.view.updateState(a),a}createExtensionManager(){var e,t;const s=[...this.options.enableCoreExtensions?[JL,$L.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),GL,XL,ZL,tI,YL,eI,KL,sI.configure({direction:this.options.textDirection})].filter(e=>"object"!==typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new VL(s,this)}createCommandManager(){this.commandManager=new yB({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=_R(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(G2){if(!(G2 instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(G2.message))throw G2;this.emit("contentError",{editor:this,error:G2,disableCollaboration:()=>{"collaboration"in this.storage&&"object"===typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=_R(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new tB(e,d(d({},this.options.editorProps),{},{attributes:d({role:"textbox"},null==(t=this.options.editorProps)?void 0:t.attributes),dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews}));const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className="".concat(this.className," ").concat(this.view.dom.className)}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);const{state:t,transactions:s}=this.state.applyTransaction(e),a=!this.state.selection.eq(t.selection),n=s.includes(e),l=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!n)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:s.slice(1)}),a&&this.emit("selectionUpdate",{editor:this,transaction:e});const r=s.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),i=null==r?void 0:r.getMeta("focus"),o=null==r?void 0:r.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:r}),o&&this.emit("blur",{editor:this,event:o.event,transaction:r}),e.getMeta("preventUpdate")||!s.some(e=>e.docChanged)||l.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:s.slice(1)})}getAttributes(e){return JR(this.state,e)}isActive(e,t){const s="string"===typeof e?e:null,a="string"===typeof e?t:e;return function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return mR(e,null,s)||sL(e,null,s);const a=fR(t,e.schema);return"node"===a?mR(e,t,s):"mark"===a&&sL(e,t,s)}(this.state,s,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return MR(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:s={}}=e||{};return KR(this.state.doc,{blockSeparator:t,textSerializers:d(d({},YR(this.schema)),s)})}get isEmpty(){return lL(this.state.doc)}
2destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var s;return(null==(s=this.$doc)?void 0:s.querySelector(e,t))||null}$nodes(e,t){var s;return(null==(s=this.$doc)?void 0:s.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new aI(t,this)}get $doc(){return this.$pos(0)}};function lI(e){return new ML({find:e.find,handler:t=>{let{state:s,range:a,match:n}=t;const l=BR(e.getAttributes,void 0,n);if(!1===l||null===l)return null;const{tr:r}=s,i=n[n.length-1],o=n[0];if(i){const t=o.search(/\S/),n=a.from+o.indexOf(i),c=n+i.length;if(ZR(a.from,a.to,s.doc).filter(t=>t.mark.type.excluded.find(s=>s===e.type&&s!==t.mark.type)).filter(e=>e.to>n).length)return null;c<a.to&&r.delete(c,a.to),n>a.from&&r.delete(a.from+t,n);const d=a.from+t+i.length;r.addMark(a.from+t,d,e.type.create(l||{})),r.removeStoredMark(e.type)}},undoable:e.undoable})}function rI(e){return new ML({find:e.find,handler:t=>{let{state:s,range:a,match:n}=t;const l=BR(e.getAttributes,void 0,n)||{},{tr:r}=s,i=a.from;let o=a.to;const c=e.type.create(l);if(n[1]){let e=i+n[0].lastIndexOf(n[1]);e>o?e=o:o=e+n[1].length;const t=n[0][n[0].length-1];r.insertText(t,i+n[0].length-1),r.replaceWith(e,o,c)}else if(n[0]){const t=e.type.isInline?i:i-1;r.insert(t,e.type.create(l)).delete(r.mapping.map(i),r.mapping.map(o))}r.scrollIntoView()},undoable:e.undoable})}function iI(e){return new ML({find:e.find,handler:t=>{let{state:s,range:a,match:n}=t;const l=s.doc.resolve(a.from),r=BR(e.getAttributes,void 0,n)||{};if(!l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e.type))return null;s.tr.delete(a.from,a.to).setBlockType(a.from,a.from,e.type,r)},undoable:e.undoable})}function oI(e){return new ML({find:e.find,handler:t=>{let{state:s,range:a,match:n,chain:l}=t;const r=BR(e.getAttributes,void 0,n)||{},i=s.tr.delete(a.from,a.to),o=i.doc.resolve(a.from).blockRange(),c=o&&yF(o,e.type,r);if(!c)return null;if(i.wrap(o,c),e.keepMarks&&e.editor){const{selection:t,storedMarks:a}=s,{splittableMarks:n}=e.editor.extensionManager,l=a||t.$to.parentOffset&&t.$from.marks();if(l){const e=l.filter(e=>n.includes(e.type.name));i.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";l().updateAttributes(t,r).run()}const d=i.doc.resolve(a.from-1).nodeBefore;d&&d.type===e.type&&DF(i.doc,a.from-1)&&(!e.joinPredicate||e.joinPredicate(n,d))&&i.join(a.from-1)},undoable:e.undoable})}var cI=class{constructor(e){var t,s,a,n,l,r;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;const t=e.clientX-this.startX,s=e.clientY-this.startY;this.handleResize(t,s)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;const t=e.touches[0];if(!t)return;const s=t.clientX-this.startX,a=t.clientY-this.startY;this.handleResize(s,a)},this.handleMouseUp=()=>{if(!this.isResizing)return;const e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize=d(d({},this.minSize),e.options.min)),(null==(s=e.options)?void 0:s.max)&&(this.maxSize=e.options.max),(null==(a=null==e?void 0:e.options)?void 0:a.directions)&&(this.directions=e.options.directions),(null==(n=e.options)?void 0:n.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(l=e.options)?void 0:l.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(r=e.options)?void 0:r.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement}handleEditorUpdate(){const e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}
2update(e,t,s){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,s))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display="flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){const e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){const t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){const s=t.includes("top"),a=t.includes("bottom"),n=t.includes("left"),l=t.includes("right");s&&(e.style.top="0"),a&&(e.style.bottom="0"),n&&(e.style.left="0"),l&&(e.style.right="0"),"top"!==t&&"bottom"!==t||(e.style.left="0",e.style.right="0"),"left"!==t&&"right"!==t||(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn('[ResizableNodeView] createCustomHandle("'.concat(e,'") did not return an HTMLElement. Falling back to default handle.')),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){const e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width="".concat(e,"px"),this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height="".concat(t,"px"),this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight);this.getPos();this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;const s=this.preserveAspectRatio||this.isShiftKeyPressed,{width:a,height:n}=this.calculateNewDimensions(this.activeHandle,e,t),l=this.applyConstraints(a,n,s);this.element.style.width="".concat(l.width,"px"),this.element.style.height="".concat(l.height,"px"),this.onResize&&this.onResize(l.width,l.height)}calculateNewDimensions(e,t,s){let a=this.startWidth,n=this.startHeight;const l=e.includes("right"),r=e.includes("left"),i=e.includes("bottom"),o=e.includes("top");l?a=this.startWidth+t:r&&(a=this.startWidth-t),i?n=this.startHeight+s:o&&(n=this.startHeight-s),"right"!==e&&"left"!==e||(a=this.startWidth+(l?t:-t)),"top"!==e&&"bottom"!==e||(n=this.startHeight+(i?s:-s));return this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(a,n,e):{width:a,height:n}}applyConstraints(e,t,s){var a,n,l,r;if(!s){let s=Math.max(this.minSize.width,e),l=Math.max(this.minSize.height,t);return(null==(a=this.maxSize)?void 0:a.width)&&(s=Math.min(this.maxSize.width,s)),(null==(n=this.maxSize)?void 0:n.height)&&(l=Math.min(this.maxSize.height,l)),{width:s,height:l}}let i=e,o=t;return i<this.minSize.width&&(i=this.minSize.width,o=i/this.aspectRatio),o<this.minSize.height&&(o=this.minSize.height,i=o*this.aspectRatio),(null==(l=this.maxSize)?void 0:l.width)&&i>this.maxSize.width&&(i=this.maxSize.width,o=i/this.aspectRatio),(null==(r=this.maxSize)?void 0:r.height)&&o>this.maxSize.height&&(o=this.maxSize.height,i=o*this.aspectRatio),{width:i,height:o}}applyAspectRatio(e,t,s){const a="top"===s||"bottom"===s;return"left"===s||"right"===s?{width:e,height:e/this.aspectRatio}:a?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function dI(e){if(!(null==e?void 0:e.trim()))return{};const t={},s=[],a=e.replace(/["']([^"']*)["']/g,e=>(s.push(e),"__QUOTED_".concat(s.length-1,"__"))),n=a.match(/(?:^|\s)\.([a-zA-Z][\
2w-]*)/g);if(n){const e=n.map(e=>e.trim().slice(1));t.class=e.join(" ")}const l=a.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);l&&(t.id=l[1]);Array.from(a.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(e=>{let[,a,n]=e;var l;const r=parseInt((null==(l=n.match(/__QUOTED_(\d+)__/))?void 0:l[1])||"0",10),i=s[r];i&&(t[a]=i.slice(1,-1))});const r=a.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();if(r){r.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)})}return t}function uI(e){if(!e||0===Object.keys(e).length)return"";const t=[];if(e.class){String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(".".concat(e)))}return e.id&&t.push("#".concat(e.id)),Object.entries(e).forEach(e=>{let[s,a]=e;"class"!==s&&"id"!==s&&(!0===a?t.push(s):!1!==a&&null!=a&&t.push("".concat(s,'="').concat(String(a),'"')))}),t.join(" ")}function mI(e){const{nodeName:t,name:s,parseAttributes:a=dI,serializeAttributes:n=uI,defaultAttributes:l={},requiredAttributes:r=[],allowedAttributes:i}=e,o=s||t;return{parseMarkdown:(e,s)=>{const a=d(d({},l),e.attributes);return s.createNode(t,a,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const s=new RegExp("^:::".concat(o,"(?:\\s|$)"),"m"),a=null==(t=e.match(s))?void 0:t.index;return void 0!==a?a:-1},tokenize(e,s,n){const l=new RegExp("^:::".concat(o,"(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)")),i=e.match(l);if(!i)return;const c=i[1]||"",d=a(c);return r.find(e=>!(e in d))?void 0:{type:t,raw:i[0],attributes:d}}},renderMarkdown:e=>{const t=(e=>{if(!i)return e;const t={};return i.forEach(s=>{s in e&&(t[s]=e[s])}),t})(e.attrs||{}),s=n(t),a=s?" {".concat(s,"}"):"";return":::".concat(o).concat(a," :::")}}}function hI(e){const{nodeName:t,name:s,getContent:a,parseAttributes:n=dI,serializeAttributes:l=uI,defaultAttributes:r={},content:i="block",allowedAttributes:o}=e,c=s||t;return{parseMarkdown:(e,s)=>{let n;if(a){const t=a(e);n="string"===typeof t?[{type:"text",text:t}]:t}else n="block"===i?s.parseChildren(e.tokens||[]):s.parseInline(e.tokens||[]);const l=d(d({},r),e.attributes);return s.createNode(t,l,n)},markdownTokenizer:{name:t,level:"block",start(e){var t;const s=new RegExp("^:::".concat(c),"m"),a=null==(t=e.match(s))?void 0:t.index;return void 0!==a?a:-1},tokenize(e,s,a){var l;const r=new RegExp("^:::".concat(c,"(?:\\s+\\{([^}]*)\\})?\\s*\\n")),o=e.match(r);if(!o)return;const[d,u=""]=o,m=n(u);let h=1;const x=d.length;let p="";const g=/^:::([\w-]*)(\s.*)?/gm,f=e.slice(x);for(g.lastIndex=0;;){const s=g.exec(f);if(null===s)break;const n=s.index,r=s[1];if(!(null==(l=s[2])?void 0:l.endsWith(":::")))if(r)h+=1;else if(h-=1,0===h){const l=f.slice(0,n);p=l.trim();const r=e.slice(0,x+n+s[0].length);let o=[];if(p)if("block"===i)for(o=a.blockTokens(l),o.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=a.inlineTokens(e.text))});o.length>0;){const e=o[o.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;o.pop()}else o=a.inlineTokens(p);return{type:t,raw:r,attributes:m,content:p,tokens:o}}}}},renderMarkdown:(e,t)=>{const s=(e=>{if(!o)return e;const t={};return o.forEach(s=>{s in e&&(t[s]=e[s])}),t})(e.attrs||{}),a=l(s),n=a?" {".concat(a,"}"):"",r=t.renderChildren(e.content||[],"\n\n");return":::".concat(c).concat(n,"\n\n").concat(r,"\n\n:::")}}}function xI(e){if(!e.trim())return{};const t={},s=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let a=s.exec(e);for(;null!==a;){const[,n,l,r]=a;t[n]=l||r,a=s.exec(e)}return t}function pI(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t&&null!==t}).map(e=>{let[t,s]=e;return"".concat(t,'="').concat(s,'"')}).join(" ")}function gI(e){const{nodeName:t,name:s,getContent:a,parseAttributes:n=xI,serializeAttributes:l=pI,defaultAttributes:r={},selfClosing:i=!1,allowedAttributes:o}=e,c=s||t,u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,s)=>{const n=d(d({},r),e.attributes);if(i)return s.createNode(t,n);const l=a?a(e):e.content||"";return l?s.createNode(t,n,[s.createTextNode(l)]):s.createNode(t,n,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=i?new RegExp("\\[".concat(u,"\\s*[^\\]]*\\]")):new RegExp("\\[".concat(u,"\\s*[^\\]]*\\][\\s\\S]*?\\[\\/").concat(u,"\\]")),s=e.match(t),a=null==s?void 0:s.index;return void 0!==a?a:-1},tokenize(e,s,a){const l=i?new RegExp("^\\[".concat(u,"\\s*([^\\]]*)\\]")):new RegExp("^\\[".concat(u,"\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/").concat(u,"\\]")),r=e.match(l);if(!r)return;let o="",c="";if(i){const[,e]=r;c=e}else{const[,e,t]=r;c=e,o=t||""}const d=n(c.trim());return{type:t,raw:r[0],content:o.trim(),attributes:d}}},renderMarkdown:e=>{let t="";a?t=a(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const s=(e=>{if(!o)return e;const t={};return o.forEach(s=>{const a="string"===typeof s?s:s.name,n="string"===typeof s?void 0:s.skipIfDefault;if(a in e){const s=e[a];if(void 0!==n&&s===n)return;t[a]=s}}),t})(e.attrs||{}),n=l(s),r=n?" ".concat(n):"";return i?"[".concat(c).concat(r,"]"):"[".concat(c).concat(r,"]").concat(t,"[/").concat(c,"]")}}}function fI(e,t,s){var a,n,l,r;const i=e.split("\n"),o=[];let c="",d=0;const u=t.baseIndentSize||2;for(;d<i.length;){const e=i[d],m=e.match(t.itemPattern);if(!m){if(o.length>0)break;if(""===e.trim()){d+=1,c="".concat(c).concat(e,"\n");continue}return}const h=t.extractItemData(m),{indentLevel:x,mainContent:p}=h;c="".concat(c).concat(e,"\n");const g=[p];for(d+=1;d<i.length;){const e=i[d];if(""===e.trim()){const t=i.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;
2if(((null==(n=null==(a=i[d+1+t].match(/^(\s*)/))?void 0:a[1])?void 0:n.length)||0)>x){g.push(e),c="".concat(c).concat(e,"\n"),d+=1;continue}break}if(!(((null==(r=null==(l=e.match(/^(\s*)/))?void 0:l[1])?void 0:r.length)||0)>x))break;g.push(e),c="".concat(c).concat(e,"\n"),d+=1}let f;const v=g.slice(1);if(v.length>0){const e=v.map(e=>e.slice(x+u)).join("\n");e.trim()&&(f=t.customNestedParser?t.customNestedParser(e):s.blockTokens(e))}const b=t.createToken(h,f);o.push(b)}if(0!==o.length)return{items:o,raw:c}}function vI(e,t,s,a){if(!e||!Array.isArray(e.content))return"";const n="function"===typeof s?s(a):s,[l,...r]=e.content,i=t.renderChildren([l]),o=["".concat(n).concat(i)];return r&&r.length>0&&r.forEach(e=>{const s=t.renderChildren([e]);if(s){const e=s.split("\n").map(e=>e?t.indent(e):"").join("\n");o.push(e)}}),o.join("\n")}function bI(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{state:a}=t,{doc:n,tr:l}=a,r=e;n.descendants((t,a)=>{const n=l.mapping.map(a),i=l.mapping.map(a)+t.nodeSize;let o=null;if(t.marks.forEach(e=>{if(e!==r)return!1;o=e}),!o)return;let c=!1;if(Object.keys(s).forEach(e=>{s[e]!==o.attrs[e]&&(c=!0)}),c){const t=e.type.create(d(d({},e.attrs),s));l.removeMark(n,i,e.type),l.addMark(n,i,t)}}),l.docChanged&&t.view.dispatch(l)}bB({},{createAtomBlockMarkdownSpec:()=>mI,createBlockMarkdownSpec:()=>hI,createInlineMarkdownSpec:()=>gI,parseAttributes:()=>dI,parseIndentedBlocks:()=>fI,renderNestedMarkdownContent:()=>vI,serializeAttributes:()=>uI});var jI=class e extends LL{constructor(){super(...arguments),this.type="node"}static create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s="function"===typeof t?t():t;return new e(s)}configure(e){return super.configure(e)}extend(e){const t="function"===typeof e?e():e;return super.extend(t)}};function yI(e){return new OL({find:e.find,handler:t=>{let{state:s,range:a,match:n,pasteEvent:l}=t;const r=BR(e.getAttributes,void 0,n,l);if(!1===r||null===r)return null;const{tr:i}=s,o=n[n.length-1],c=n[0];let d=a.to;if(o){const t=c.search(/\S/),n=a.from+c.indexOf(o),l=n+o.length;if(ZR(a.from,a.to,s.doc).filter(t=>t.mark.type.excluded.find(s=>s===e.type&&s!==t.mark.type)).filter(e=>e.to>n).length)return null;l<a.to&&i.delete(l,a.to),n>a.from&&i.delete(a.from+t,n),d=a.from+t+o.length,i.addMark(a.from+t,d,e.type.create(r||{})),i.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:NI,getOwnPropertySymbols:wI}=Object,{hasOwnProperty:CI}=Object.prototype;function kI(e,t){return function(s,a,n){return e(s,a,n)&&t(s,a,n)}}function DI(e){return function(t,s,a){if(!t||!s||"object"!==typeof t||"object"!==typeof s)return e(t,s,a);const{cache:n}=a,l=n.get(t),r=n.get(s);if(l&&r)return l===s&&r===t;n.set(t,s),n.set(s,t);const i=e(t,s,a);return n.delete(t),n.delete(s),i}}function _I(e){return NI(e).concat(wI(e))}const SI=Object.hasOwn||((e,t)=>CI.call(e,t));function EI(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const{getOwnPropertyDescriptor:AI,keys:FI}=Object;function TI(e,t,s){let a=e.length;if(t.length!==a)return!1;for(;a-- >0;)if(!s.equals(e[a],t[a],a,a,e,t,s))return!1;return!0}function zI(e,t){return EI(e.getTime(),t.getTime())}function MI(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function PI(e,t){return e===t}function BI(e,t,s){const a=e.size;if(a!==t.size)return!1;if(!a)return!0;const n=new Array(a),l=e.entries();let r,i,o=0;for(;(r=l.next())&&!r.done;){const a=t.entries();let l=!1,c=0;for(;(i=a.next())&&!i.done;){if(n[c]){c++;continue}const a=r.value,d=i.value;if(s.equals(a[0],d[0],o,c,e,t,s)&&s.equals(a[1],d[1],a[0],d[0],e,t,s)){l=n[c]=!0;break}c++}if(!l)return!1;o++}return!0}const RI=EI;function LI(e,t,s){const a=FI(e);let n=a.length;if(FI(t).length!==n)return!1;for(;n-- >0;)if(!qI(e,t,s,a[n]))return!1;return!0}function II(e,t,s){const a=_I(e);let n,l,r,i=a.length;if(_I(t).length!==i)return!1;for(;i-- >0;){if(n=a[i],!qI(e,t,s,n))return!1;if(l=AI(e,n),r=AI(t,n),(l||r)&&(!l||!r||l.configurable!==r.configurable||l.enumerable!==r.enumerable||l.writable!==r.writable))return!1}return!0}function OI(e,t){return EI(e.valueOf(),t.valueOf())}function UI(e,t){return e.source===t.source&&e.flags===t.flags}function HI(e,t,s){const a=e.size;if(a!==t.size)return!1;if(!a)return!0;const n=new Array(a),l=e.values();let r,i;for(;(r=l.next())&&!r.done;){const a=t.values();let l=!1,o=0;for(;(i=a.next())&&!i.done;){if(!n[o]&&s.equals(r.value,i.value,r.value,i.value,e,t,s)){l=n[o]=!0;break}o++}if(!l)return!1}return!0}function WI(e,t){let s=e.length;if(t.length!==s)return!1;for(;s-- >0;)if(e[s]!==t[s])return!1;return!0}function VI(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function qI(e,t,s,a){return!("_owner"!==a&&"__o"!==a&&"__v"!==a||
2!e.$$typeof&&!t.$$typeof)||SI(t,a)&&s.equals(e[a],t[a],a,a,e,t,s)}const{isArray:$I}=Array,GI="undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView?ArrayBuffer.isView:null,{assign:KI}=Object,YI=Object.prototype.toString.call.bind(Object.prototype.toString);function JI(e){let{areArraysEqual:t,areDatesEqual:s,areErrorsEqual:a,areFunctionsEqual:n,areMapsEqual:l,areNumbersEqual:r,areObjectsEqual:i,arePrimitiveWrappersEqual:o,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:u,areUrlsEqual:m,unknownTagComparators:h}=e;return function(e,x,p){if(e===x)return!0;if(null==e||null==x)return!1;const g=typeof e;if(g!==typeof x)return!1;if("object"!==g)return"number"===g?r(e,x,p):"function"===g&&n(e,x,p);const f=e.constructor;if(f!==x.constructor)return!1;if(f===Object)return i(e,x,p);if($I(e))return t(e,x,p);if(null!=GI&&GI(e))return u(e,x,p);if(f===Date)return s(e,x,p);if(f===RegExp)return c(e,x,p);if(f===Map)return l(e,x,p);if(f===Set)return d(e,x,p);const v=YI(e);if("[object Date]"===v)return s(e,x,p);if("[object RegExp]"===v)return c(e,x,p);if("[object Map]"===v)return l(e,x,p);if("[object Set]"===v)return d(e,x,p);if("[object Object]"===v)return"function"!==typeof e.then&&"function"!==typeof x.then&&i(e,x,p);if("[object URL]"===v)return m(e,x,p);if("[object Error]"===v)return a(e,x,p);if("[object Arguments]"===v)return i(e,x,p);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return o(e,x,p);if(h){let t=h[v];if(!t){const s=null!=(b=e)?b[Symbol.toStringTag]:void 0;s&&(t=h[s])}if(t)return t(e,x,p)}var b;return!1}}const QI=XI();XI({strict:!0}),XI({circular:!0}),XI({circular:!0,strict:!0}),XI({createInternalComparator:()=>EI}),XI({strict:!0,createInternalComparator:()=>EI}),XI({circular:!0,createInternalComparator:()=>EI}),XI({circular:!0,createInternalComparator:()=>EI,strict:!0});function XI(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{circular:t=!1,createInternalComparator:s,createState:a,strict:n=!1}=e,l=function(e){let{circular:t,createCustomConfig:s,strict:a}=e,n={areArraysEqual:a?II:TI,areDatesEqual:zI,areErrorsEqual:MI,areFunctionsEqual:PI,areMapsEqual:a?kI(BI,II):BI,areNumbersEqual:RI,areObjectsEqual:a?II:LI,arePrimitiveWrappersEqual:OI,areRegExpsEqual:UI,areSetsEqual:a?kI(HI,II):HI,areTypedArraysEqual:a?II:WI,areUrlsEqual:VI,unknownTagComparators:void 0};if(s&&(n=KI({},n,s(n))),t){const e=DI(n.areArraysEqual),t=DI(n.areMapsEqual),s=DI(n.areObjectsEqual),a=DI(n.areSetsEqual);n=KI({},n,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:s,areSetsEqual:a})}return n}(e),r=JI(l);var i;return function(e){let{circular:t,comparator:s,createState:a,equals:n,strict:l}=e;if(a)return function(e,r){const{cache:i=(t?new WeakMap:void 0),meta:o}=a();return s(e,r,{cache:i,equals:n,meta:o,strict:l})};if(t)return function(e,t){return s(e,t,{cache:new WeakMap,equals:n,meta:void 0,strict:l})};const r={cache:void 0,equals:n,meta:void 0,strict:l};return function(e,t){return s(e,t,r)}}({circular:t,comparator:r,createState:a,equals:s?s(r):(i=r,function(e,t,s,a,n,l,r){return i(e,t,r)}),strict:n})}var ZI=s(443);const eO=["editor","innerRef"];var tO=function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return e=>{t.forEach(t=>{"function"===typeof t?t(e):t&&(t.current=e)})}},sO=e=>{let{contentComponent:t}=e;const s=(0,WE.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getServerSnapshot);return(0,ea.jsx)(ea.Fragment,{children:Object.values(s)})};var aO=class extends t.Component{constructor(e){var s;super(e),this.editorContentRef=t.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null==(s=e.editor)?void 0:s.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 t=this.editorContentRef.current;t.append(e.view.dom),e.setOptions({element:t}),e.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(s,a){t=d(d({},t),{},{[s]:Ts.createPortal(a.reactElement,a.element,s)}
2),e.forEach(e=>e())},removeRenderer(s){const a=d({},t);delete a[s],t=a,e.forEach(e=>e())}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.firstChild))return;const s=document.createElement("div");s.append(t.view.dom),t.setOptions({element:s})}catch(s){}}}render(){const e=this.props,{editor:t,innerRef:s}=e,a=l(e,eO);return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",d({ref:tO(s,this.editorContentRef)},a)),(null==t?void 0:t.contentComponent)&&(0,ea.jsx)(sO,{contentComponent:t.contentComponent})]})}},nO=(0,t.forwardRef)((e,s)=>{const a=t.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[e.editor]);return t.createElement(aO,d({key:a,innerRef:s},e))}),lO=t.memo(nO),rO="undefined"!==typeof window?t.useLayoutEffect:t.useEffect,iO=class{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.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 e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var oO="undefined"===typeof window,cO=oO||Boolean("undefined"!==typeof window&&window.next),dO=class e{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(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?oO||cO?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){var e=this;const t=d(d({},this.options.current),{},{onBeforeCreate:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onBeforeCreate)?void 0:s.call(t,...n)},onBlur:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onBlur)?void 0:s.call(t,...n)},onCreate:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onCreate)?void 0:s.call(t,...n)},onDestroy:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onDestroy)?void 0:s.call(t,...n)},onFocus:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onFocus)?void 0:s.call(t,...n)},onSelectionUpdate:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onSelectionUpdate)?void 0:s.call(t,...n)},onTransaction:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onTransaction)?void 0:s.call(t,...n)},onUpdate:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onUpdate)?void 0:s.call(t,...n)},onContentError:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onContentError)?void 0:s.call(t,...n)},onDrop:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onDrop)?void 0:s.call(t,...n)},onPaste:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onPaste)?void 0:s.call(t,...n)},onDelete:function(){for(var t,s,a=arguments.length,n=new Array(a),l=0;l<a;l++)n[l]=arguments[l];return null==(s=(t=e.options.current).onDelete)?void 0:s.call(t,...n)}});return new nI(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(s=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)||("extensions"===s&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,s)=>{var a;return e===(null==(a=t.extensions)?void 0:a[s])}):e[s]===t[s]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions(d(d({},this.options.current),{},{editable:this.editor.isEditable})):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){
2if(null===this.previousDeps)return void(this.previousDeps=e);const t=this.previousDeps.length===e.length&&this.previousDeps.every((t,s)=>t===e[s]);if(t)return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function uO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const a=(0,t.useRef)(e);a.current=e;const[n]=(0,t.useState)(()=>new dO(a)),l=(0,WE.useSyncExternalStore)(n.subscribe,n.getEditor,n.getServerSnapshot);return(0,t.useDebugValue)(l),(0,t.useEffect)(n.onRender(s)),function(e){var s;const[a]=(0,t.useState)(()=>new iO(e.editor)),n=(0,ZI.useSyncExternalStoreWithSelector)(a.subscribe,a.getSnapshot,a.getServerSnapshot,e.selector,null!=(s=e.equalityFn)?s:QI);rO(()=>a.watch(e.editor),[e.editor,a]),(0,t.useDebugValue)(n)}({editor:l,selector:t=>{let{transactionNumber:s}=t;return!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===s?0:s+1}}),l}var mO=(0,t.createContext)({editor:null});mO.Consumer;var hO=(0,t.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),xO=()=>(0,t.useContext)(hO);t.forwardRef((e,t)=>{const{onDragStart:s}=xO(),a=e.as||"div";return(0,ea.jsx)(a,d(d({},e),{},{ref:t,"data-node-view-wrapper":"",onDragStart:s,style:d({whiteSpace:"normal"},e.style)}))});t.createContext({markViewContentRef:()=>{}});const pO=["children"];var gO=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const s=null!=t?t:{},{children:a}=s,n=l(s,pO);if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,n,a]},fO=/^\s*>\s$/,vO=jI.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML(e){let{HTMLAttributes:t}=e;return gO("blockquote",d(d({},IR(this.options.HTMLAttributes,t)),{},{children:gO("slot",{})}))},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const s=[];return e.content.forEach(e=>{const a=t.renderChildren([e]).split("\n").map(e=>""===e.trim()?">":"".concat(">"," ").concat(e));s.push(a.join("\n"))}),s.join("\n".concat(">","\n"))},addCommands(){return{setBlockquote:()=>e=>{let{commands:t}=e;return t.wrapIn(this.name)},toggleBlockquote:()=>e=>{let{commands:t}=e;return t.toggleWrap(this.name)},unsetBlockquote:()=>e=>{let{commands:t}=e;return t.lift(this.name)}}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[oI({find:fO,type:this.type})]}}),bO=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,jO=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,yO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,NO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,wO=IL.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML(e){let{HTMLAttributes:t}=e;return gO("strong",d(d({},IR(this.options.HTMLAttributes,t)),{},{children:gO("slot",{})}))},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>"**".concat(t.renderChildren(e),"**"),addCommands(){return{setBold:()=>e=>{let{commands:t}=e;return t.setMark(this.name)},toggleBold:()=>e=>{let{commands:t}=e;return t.toggleMark(this.name)},unsetBold:()=>e=>{let{commands:t}=e;return t.unsetMark(this.name)}}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
2,addInputRules(){return[lI({find:bO,type:this.type}),lI({find:yO,type:this.type})]},addPasteRules(){return[yI({find:jO,type:this.type}),yI({find:NO,type:this.type})]}}),CO=/(^|[^`])`([^`]+)`(?!`)$/,kO=/(^|[^`])`([^`]+)`(?!`)/g,DO=IL.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML(e){let{HTMLAttributes:t}=e;return["code",IR(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?"`".concat(t.renderChildren(e.content),"`"):"",addCommands(){return{setCode:()=>e=>{let{commands:t}=e;return t.setMark(this.name)},toggleCode:()=>e=>{let{commands:t}=e;return t.toggleMark(this.name)},unsetCode:()=>e=>{let{commands:t}=e;return t.unsetMark(this.name)}}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[lI({find:CO,type:this.type})]},addPasteRules(){return[yI({find:kO,type:this.type})]}}),_O=/^```([a-z]+)?[\s\n]$/,SO=/^~~~([a-z]+)?[\s\n]$/,EO=jI.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:s}=this.options;if(!s)return null;const a=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(s)).map(e=>e.replace(s,""))[0];return a||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML(e){let{node:t,HTMLAttributes:s}=e;return["pre",IR(this.options.HTMLAttributes,s),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var s;return!1===(null==(s=e.raw)?void 0:s.startsWith("```"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var s;let a="";const n=(null==(s=e.attrs)?void 0:s.language)||"";if(e.content){a=["```".concat(n),t.renderChildren(e.content),"```"].join("\n")}else a="```".concat(n,"\n\n```");return a},addCommands(){return{setCodeBlock:e=>t=>{let{commands:s}=t;return s.setNode(this.name,e)},toggleCodeBlock:e=>t=>{let{commands:s}=t;return s.toggleNode(this.name,"paragraph",e)}}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,s=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!s&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:e=>{let{editor:t}=e;var s;if(!this.options.enableTabIndentation)return!1;const a=null!=(s=this.options.tabSize)?s:4,{state:n}=t,{selection:l}=n,{$from:r,empty:i}=l;if(r.parent.type!==this.type)return!1;const o=" ".repeat(a);return i?t.commands.insertContent(o):t.commands.command(e=>{let{tr:t}=e;const{from:s,to:a}=l,r=n.doc.textBetween(s,a,"\n","\n").split("\n").map(e=>o+e).join("\n");return t.replaceWith(s,a,n.schema.text(r)),!0})},"Shift-Tab":e=>{let{editor:t}=e;var s;if(!this.options.enableTabIndentation)return!1;const a=null!=(s=this.options.tabSize)?s:4,{state:n}=t,{selection:l}=n,{$from:r,empty:i}=l;return r.parent.type===this.type&&(i?t.commands.command(e=>{let{tr:t}=e;var s;const{pos:l}=r,i=r.start(),o=r.end(),c=n.doc.textBetween(i,o,"\n","\n").split("\n");let d=0,u=0;const m=l-i;for(let a=0;a<c.length;a+=1){if(u+c[a].length>=m){d=a;break}u+=c[a].length+1}const h=(null==(s=c[d].match(/^ */))?void 0:s[0])||"",x=Math.min(h.length,a);if(0===x)return!0;let p=i;for(let a=0;a<d;a+=1)p+=c[a].length+1;t.delete(p,p+x);return l-p<=x&&t.setSelection(JF.create(t.doc,p)),!0}):t.commands.command(e=>{let{tr:t}=e;const{from:s,to:r}=l,i=n.doc.textBetween(s,r,"\n","\n").split("\n").map(e=>{var t;const s=(null==(t=e.match(/^ */))?void 0:t[0])||"",n=Math.min(s.length,a);return e.slice(n)}).join("\n");return t.replaceWith(s,r,n.schema.text(i)),!0}))},Enter:e=>{let{editor:t}=e;if(!this.options.exitOnTripleEnter)return!1;const{state:s}=t,{selection:a}=s,{$from:n,empty:l}=a;if(!l||n.parent.type!==this.type)return!1;const r=n.parentOffset===n.parent.nodeSize-2,i=n.parent.textContent.endsWith("\n\n");return!(!r||!i)&&t.chain().command(e=>{let{tr:t}=e;return t.delete(n.pos-2,n.pos),!0}).exitCode().run()},ArrowDown:e=>{let{editor:t}=e;if(!this.options.exitOnArrowDown)return!1;const{state:s}=t,{selection:a,doc:n}=s,{$from:l,empty:r}=a;if(!r||l.parent.type!==this.type)return!1;if(!(l.parentOffset===l.parent.nodeSize-2))return!1;const i=l.after();if(void 0===i)return!1;return n.nodeAt(i)?t.commands.command(e=>{let{tr:t}=e;return t.setSelection($F.near(n.resolve(i))),!0}):t.commands.exitCode()}}}
2,addInputRules(){return[iI({find:_O,type:this.type,getAttributes:e=>({language:e[1]})}),iI({find:SO,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new uT({key:new xT("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const s=t.clipboardData.getData("text/plain"),a=t.clipboardData.getData("vscode-editor-data"),n=a?JSON.parse(a):void 0,l=null==n?void 0:n.mode;if(!s||!l)return!1;const{tr:r,schema:i}=e.state,o=i.text(s.replace(/\r\n?/g,"\n"));return r.replaceSelectionWith(this.type.create({language:l},o)),r.selection.$from.parent.type!==this.type&&r.setSelection(JF.near(r.doc.resolve(Math.max(0,r.selection.from-2)))),r.setMeta("paste",!0),e.dispatch(r),!0}}})]}}),AO=jI.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),FO=jI.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML(e){let{HTMLAttributes:t}=e;return["br",IR(this.options.HTMLAttributes,t)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>e=>{let{commands:t,chain:s,state:a,editor:n}=e;return t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:e,storedMarks:t}=a;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:r}=n.extensionManager,i=t||e.$to.parentOffset&&e.$from.marks();return s().insertContent({type:this.name}).command(e=>{let{tr:t,dispatch:s}=e;if(s&&i&&l){const e=i.filter(e=>r.includes(e.type.name));t.ensureMarks(e)}return!0}).run()})])}}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),TO=jI.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:"h".concat(e),attrs:{level:e}}))},renderHTML(e){let{node:t,HTMLAttributes:s}=e;const a=this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0];return["h".concat(a),IR(this.options.HTMLAttributes,s),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var s;const a=(null==(s=e.attrs)?void 0:s.level)?parseInt(e.attrs.level,10):1,n="#".repeat(a);return e.content?"".concat(n," ").concat(t.renderChildren(e.content)):""},addCommands(){return{setHeading:e=>t=>{let{commands:s}=t;return!!this.options.levels.includes(e.level)&&s.setNode(this.name,e)},toggleHeading:e=>t=>{let{commands:s}=t;return!!this.options.levels.includes(e.level)&&s.toggleNode(this.name,"paragraph",e)}}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>d(d({},e),{["Mod-Alt-".concat(t)]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>iI({find:new RegExp("^(#{".concat(Math.min(...this.options.levels),",").concat(e,"}
2)\\s$")),type:this.type,getAttributes:{level:e}}))}}),zO=jI.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML(e){let{HTMLAttributes:t}=e;return["hr",IR(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>e=>{let{chain:t,state:s}=e;if(!function(e,t){const{selection:s}=e,{$from:a}=s;if(s instanceof XF){const e=a.index();return a.parent.canReplaceWith(e,e+1,t)}let n=a.depth;for(;n>=0;){const e=a.index(n);if(a.node(n).contentMatchAt(e).matchType(t))return!0;n-=1}return!1}(s,s.schema.nodes[this.name]))return!1;const{selection:a}=s,{$to:n}=a,l=t();return rL(a)?l.insertContentAt(n.pos,{type:this.name}):l.insertContent({type:this.name}),l.command(e=>{let{state:t,tr:s,dispatch:a}=e;if(a){const{$to:e}=s.selection,a=e.end();if(e.nodeAfter)e.nodeAfter.isTextblock?s.setSelection(JF.create(s.doc,e.pos+1)):e.nodeAfter.isBlock?s.setSelection(XF.create(s.doc,e.pos)):s.setSelection(JF.create(s.doc,e.pos));else{const n=t.schema.nodes[this.options.nextNodeType]||e.parent.type.contentMatch.defaultType,l=null==n?void 0:n.create();l&&(s.insert(a,l),s.setSelection(JF.create(s.doc,a+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[rI({find:/^(?:---|\u2014-|___\s|\*\*\*\s)$/,type:this.t
2ype})]}}),MO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,PO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,BO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,RO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,LO=IL.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML(e){let{HTMLAttributes:t}=e;return["em",IR(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>e=>{let{commands:t}=e;return t.setMark(this.name)},toggleItalic:()=>e=>{let{commands:t}=e;return t.toggleMark(this.name)},unsetItalic:()=>e=>{let{commands:t}=e;return t.unsetMark(this.name)}}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>"*".concat(t.renderChildren(e),"*"),addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[lI({find:MO,type:this.type}),lI({find:BO,type:this.type})]},addPasteRules(){return[yI({find:PO,type:this.type}),yI({find:RO,type:this.type})]}});const IO="numeric",OO="ascii",UO="alpha",HO="asciinumeric",WO="alphanumeric",VO="domain",qO="emoji",$O="scheme",GO="slashscheme",KO="whitespace";function YO(e,t){return e in t||(t[e]=[]),t[e]}function JO(e,t,s){t[IO]&&(t[HO]=!0,t[WO]=!0),t[OO]&&(t[HO]=!0,t[UO]=!0),t[HO]&&(t[WO]=!0),t[UO]&&(t[WO]=!0),t[WO]&&(t[VO]=!0),t[qO]&&(t[VO]=!0);for(const a in t){const t=YO(a,s);t.indexOf(e)<0&&t.push(e)}}function QO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.j={},this.jr=[],this.jd=null,this.t=e}QO.groups={},QO.prototype={accepts(){return!!this.t},go(e){const t=this,s=t.j[e];if(s)return s;for(let a=0;a<t.jr.length;a++){const s=t.jr[a][0],n=t.jr[a][1];if(n&&s.test(e))return n}return t.jd},has(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e in this.j:!!this.go(e)},ta(e,t,s,a){for(let n=0;n<e.length;n++)this.tt(e[n],t,s,a)},tr(e,t,s,a){let n;return a=a||QO.groups,t&&t.j?n=t:(n=new QO(t),s&&a&&JO(t,s,a)),this.jr.push([e,n]),n},ts(e,t,s,a){let n=this;const l=e.length;if(!l)return n;for(let r=0;r<l-1;r++)n=n.tt(e[r]);return n.tt(e[l-1],t,s,a)},tt(e,t,s,a){a=a||QO.groups;const n=this;if(t&&t.j)return n.j[e]=t,t;const l=t;let r,i=n.go(e);if(i?(r=new QO,Object.assign(r.j,i.j),r.jr.push.apply(r.jr,i.jr),r.jd=i.jd,r.t=i.t):r=new QO,l){if(a)if(r.t&&"string"===typeof r.t){const e=Object.assign(function(e,t){const s={};for(const a in t)t[a].indexOf(e)>=0&&(s[a]=!0);return s}(r.t,a),s);JO(l,e,a)}else s&&JO(l,s,a);r.t=l}return n.j[e]=r,r}};const XO=(e,t,s,a,n)=>e.ta(t,s,a,n),ZO=(e,t,s,a,n)=>e.tr(t,s,a,n),eU=(e,t,s,a,n)=>e.ts(t,s,a,n),tU=(e,t,s,a,n)=>e.tt(t,s,a,n),sU="WORD",aU="UWORD",nU="ASCIINUMERICAL",lU="ALPHANUMERICAL",rU="LOCALHOST",iU="TLD",oU="UTLD",cU="SCHEME",dU="SLASH_SCHEME",uU="NUM",mU="WS",hU="NL",xU="OPENBRACE",pU="CLOSEBRACE",gU="OPENBRACKET",fU="CLOSEBRACKET",vU="OPENPAREN",bU="CLOSEPAREN",jU="OPENANGLEBRACKET",yU="CLOSEANGLEBRACKET",NU="FULLWIDTHLEFTPAREN",wU="FULLWIDTHRIGHTPAREN",CU="LEFTCORNERBRACKET",kU="RIGHTCORNERBRACKET",DU="LEFTWHITECORNERBRACKET",_U="RIGHTWHITECORNERBRACKET",SU="FULLWIDTHLESSTHAN",EU="FULLWIDTHGREATERTHAN",AU="AMPERSAND",FU="APOSTROPHE",TU="ASTERISK",zU="AT",MU="BACKSLASH",PU="BACKTICK",BU="CARET",RU="COLON",LU="COMMA",IU="DOLLAR",OU="DOT",UU="EQUALS",HU="EXCLAMATION",WU="HYPHEN",VU="PERCENT",qU="PIPE",$U="PLUS",GU="POUND",KU="QUERY",YU="QUOTE",JU="FULLWIDTHMIDDLEDOT",QU="SEMI",XU="SLASH",ZU="TILDE",eH="UNDERSCORE",tH="EMOJI",sH="SYM";var aH=Object.freeze({__proto__:null,ALPHANUMERICAL:lU,AMPERSAND:AU,APOSTROPHE:FU,ASCIINUMERICAL:nU,ASTERISK:TU,AT:zU,BACKSLASH:MU,BACKTICK:PU,CARET:BU,CLOSEANGLEBRACKET:yU,CLOSEBRACE:pU,CLOSEBRACKET:fU,CLOSEPAREN:bU,COLON:RU,COMMA:LU,DOLLAR:IU,DOT:OU,EMOJI:tH,EQUALS:UU,EXCLAMATION:HU,FULLWIDTHGREATERTHAN:EU,FULLWIDTHLEFTPAREN:NU,FULLWIDTHLESSTHAN:SU,FULLWIDTHMIDDLEDOT:JU,FULLWIDTHRIGHTPAREN:wU,HYPHEN:WU,LEFTCORNERBRACKET:CU,LEFTWHITECORNERBRACKET:DU,LOCALHOST:rU,NL:hU,NUM:uU,OPENANGLEBRACKET:jU,OPENBRACE:xU,OPENBRACKET:gU,OPENPAREN:vU,PERCENT:VU,PIPE:qU,PLUS:$U,POUND:GU,QUERY:KU,QUOTE:YU,RIGHTCORNERBRACKET:kU,RIGHTWHITECORNERBRACKET:_U,SCHEME:cU,SEMI:QU,SLASH:XU,SLASH_SCHEME:dU,SYM:sH,TILDE:ZU,TLD:iU,UNDERSCORE:eH,UTLD:oU,UWORD:aU,WORD:sU,WS:mU});const nH=/[a-z]/,lH=/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u
20EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE4
20-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])/,rH=/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED8\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8])/,iH=/\d/,oH=/\s/;let cH=null,dH=null;function uH(e,t){const s=function(e){const t=[],s=e.length;let a=0;for(;a<s;){let n,l=e.charCodeAt(a),r=l<55296||l>56319||a+1===s||(n=e.charCodeAt(a+1))<56320||n>57343?e[a]:e.slice(a,a+2);t.push(r),a+=r.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),a=s.length,n=[];let l=0,r=0;for(;r<a;){let i=e,o=null,c=0,d=null,u=-1,m=-1;for(;r<a&&(o=i.go(s[r]));)i=o,i.accepts()?(u=0,m=0,d=i):u>=0&&(u+=s[r].length,m++),c+=s[r].length,l+=s[r].length,r++;l-=u,r-=m,c-=u,n.push({t:d.t,v:t.slice(l-c,l),s:l-c,e:l})}return n}function mH(e,t,s,a,n){let l;const r=t.length;for(let i=0;i<r-1;i++){const s=t[i];e.j[s]?l=e.j[s]:(l=new QO(a),l.jr=n.slice(),e.j[s]=l),e=l}return l=new QO(s),l.jr=n.slice(),e.j[t[r-1]]=l,l}function hH(e){const t=[],s=[];let a=0;for(;a<e.length;){let n=0;for(;"0123456789".indexOf(e[a+n])>=0;)n++;if(n>0){t.push(s.join(""));for(let t=parseInt(e.substring(a,a+n),10);t>0;t--)s.pop();a+=n}else s.push(e[a]),a++}return t}const xH={defaultProtocol:"http",events:null,format:gH,formatHref:gH,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function pH(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=Object.assign({},xH);e&&(s=Object.assign(s,e instanceof pH?e.o:e));const a=s.ignoreTags,n=[];for(let l=0;l<a.length;l++)n.push(a[l].toUpperCase());this.o=s,t&&(this.defaultRender=t),this.ignoreTags=n}function gH(e){return e}pH.prototype={o:xH,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,s){const a=null!=t;let n=this.o[e];return n?("object"===typeof n?(n=s.t in n?n[s.t]:xH[e],"function"===typeof n&&a&&(n=n(t,s))):"function"===typeof n&&a&&(n=n(t,s.t,s)),n):n},getObj(e,t,s){let a=this.o[e];return"function"===typeof a&&null!=t&&(a=a(t,s.t,s)),a},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function fH(e,t){this.t="token",this.v=e,this.tk=t}
2function vH(e,t){class s extends fH{constructor(t,s){super(t,s),this.t=e}}for(const a in t)s.prototype[a]=t[a];return s.t=e,s}fH.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),s=e.get("truncate",t,this),a=e.get("format",t,this);return s&&a.length>s?a.substring(0,s)+"\u2026":a},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xH.defaultProtocol;return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,s=this.toHref(e.get("defaultProtocol")),a=e.get("formatHref",s,this),n=e.get("tagName",s,t),l=this.toFormattedString(e),r={}
2,i=e.get("className",s,t),o=e.get("target",s,t),c=e.get("rel",s,t),d=e.getObj("attributes",s,t),u=e.getObj("events",s,t);return r.href=a,i&&(r.class=i),o&&(r.target=o),c&&(r.rel=c),d&&Object.assign(r,d),{tagName:n,attributes:r,content:l,eventListeners:u}}};const bH=vH("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),jH=vH("text"),yH=vH("nl"),NH=vH("url",{isLink:!0,toHref(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xH.defaultProtocol;return this.hasProtocol()?this.v:"".concat(e,"://").concat(this.v)},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==rU&&e[1].t===RU}});const wH=e=>new QO(e);function CH(e,t,s){const a=s[0].s,n=s[s.length-1].e;return new e(t.slice(a,n),s)}const kH="undefined"!==typeof console&&console&&console.warn||(()=>{}),DH="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",_H={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function SH(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(_H.initialized&&kH('linkifyjs: already initialized - will not register custom scheme "'.concat(e,'" ').concat(DH)),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');_H.customSchemes.push([e,t])}function EH(){_H.scanner=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t={};QO.groups=t;const s=new QO;null==cH&&(cH=hH("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xf6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==dH&&(dH=hH("\u03b5\u03bb1\u03c52\u0431\u04331\u0435\u043b3\u0434\u0435\u0442\u04384\u0435\u044e2\u043a\u0430\u0442\u043e\u043b\u0438\u043a6\u043e\u043c3\u043c\u043a\u04342\u043e\u043d1\u0441\u043a\u0432\u04306\u043e\u043d\u043b\u0430\u0439\u043d5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043a\u04403\u049b\u0430\u04373\u0570\u0561\u05753\u05d9\u05e9\u05e8\u05d0\u05dc5\u05e7\u05d5\u05dd3\u0627\u0628\u0648\u0638\u0628\u064a5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062f\u06464\u0628\u062d\u0631\u064a\u06465\u062c\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062f\u064a\u06296\u0639\u0644\u064a\u0627\u06465\u0645\u063a\u0631\u06285\u0645\u0627\u0631\u0627\u062a5\u06cc\u0631\u0627\u06465\u0628\u0627\u0631\u062a2\u0632\u0627\u06314\u064a\u062a\u06433\u06be\u0627\u0631\u062a5\u062a\u0648\u0646\u06334\u0633\u0648\u062f\u0627\u06463\u0631\u064a\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064a\u06466\u0642\u0637\u06313\u0643\u0627\u062b\u0648\u0644\u064a\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064a\u0633\u064a\u06275\u0648\u0631\u064a\u062a\u0627\u0646\u064a\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067e\u0627\u06a9\u0633\u062a\u0627\u06467\u0680\u0627\u0631\u062a4\u0915\u0949\u092e3\u0928\u0947\u091f3\u092d\u093e\u0930\u09240\u092e\u094d3\u094b\u09245\u0938\u0902\u0917\u0920\u09285\u09ac\u09be\u0982\u09b2\u09be5\u09ad\u09be\u09b0\u09a42\u09f0\u09a44\u0a2d\u0a3e\u0a30\u0a244\u0aad\u0abe\u0ab0\u0aa44\u0b2d\u0b3e\u0b30\u0b244\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe6\u0bb2\u0b99\u0bcd\u0b95\u0bc86\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd11\u0c2d\u0c3e\u0c30\u0c24\u0c4d5\u0cad\u0cbe\u0cb0\u0ca44\u0d2d\u0d3e\u0d30\u0d24\u0d025\u0dbd\u0d82\u0d9a\u0dcf4\u0e04\u0e2d\u0e213\u0e44\u0e17\u0e223\u0ea5\u0eb2\u0ea73\u10d2\u10d42\u307f\u3093\u306a3\u30a2\u30de\u30be\u30f34\u30af\u30e9\u30a6\u30c94\u30b0\u30fc\u30b0\u30eb4\u30b3\u30e02\u30b9\u30c8\u30a23\u30bb\u30fc\u30eb3\u30d5\u30a1\u30c3\u30b7\u30e7\u30f36\u30dd\u30a4\u30f3\u30c84\u4e16\u754c2\u4e2d\u4fe11\u56fd1\u570b1\u6587\u7f513\u4e9a\u9a6c\u900a3\u4f01\u4e1a2\u4f5b\u5c712\u4fe1\u606f2\u5065\u5eb72\u516b\u53662\u516c\u53f81\u76ca2\u53f0\u6e7e1\u70632\u5546\u57ce1\u5e971\u68072\u5609\u91cc0\u5927\u9152\u5e975\u5728\u7ebf2\u5927\u62ff2\u5929\u4e3b\u65593\u5a31\u4e502\u5bb6\u96fb2\u5e7f\u4e1c2\u5fae\u535a2\u6148\u55842\u6211\u7231\u4f603\u624b\u673a2\u62db\u80582\u653f\u52a11\u5e9c2\u65b0\u52a0\u57612\u95fb2\u65f6\u5c1a2\u66f8\u7c4d2\u673a\u67842\u6de1\u9a6c\u95213\u6e38\u620f2\u6fb3\u95802\u70b9\u770b2\u79fb\u52a82\u7ec4\u7ec7\u673a\u67844\u7f51\u57401\u5e971\u7ad91\u7edc2\u8054\u901a2\u8c37\u6b4c2\u8d2d\u72692\u901a\u8ca92\u96c6\u56e22\u96fb\u8a0a\u76c8\u79d14\u98de\u5229\u6d663\u98df\u54c12\u9910\u53852\u9999\u683c\u91cc\u62c93\u6e2f2\ub2f7\ub1371\ucef42\uc0bc\uc1312\ud55c\uad6d2")),tU(s,"'",FU),tU(s,"{",xU),tU(s,"}",pU),tU(s,"[",gU),tU(s,"]",fU),tU(s,"(",vU),tU(s,")",bU),tU(s,"<",jU),tU(s,">",yU),tU(s,"\uff08",NU),tU(s,"\uff09",wU),tU(s,"\u300c",CU),tU(s,"\u300d",kU),tU(s,"\u300e",DU),tU(s,"\u300f",_U),tU(s,"\uff1c",SU),tU(s,"\uff1e",EU),tU(s,"&",AU),tU(s,"*",TU),tU(s,"@",zU),tU(s,"`",PU),tU(s,"^",BU),tU(s,":",RU),t
vendor: 4,458 bytes, line 2
2U(s,",",LU),tU(s,"$",IU),tU(s,".",OU),tU(s,"=",UU),tU(s,"!",HU),tU(s,"-",WU),tU(s,"%",VU),tU(s,"|",qU),tU(s,"+",$U),tU(s,"#",GU),tU(s,"?",KU),tU(s,'"',YU),tU(s,"/",XU),tU(s,";",QU),tU(s,"~",ZU),tU(s,"_",eH),tU(s,"\\",MU),tU(s,"\u30fb",JU);const a=ZO(s,iH,uU,{[IO]:!0});ZO(a,iH,a);const n=ZO(a,nH,nU,{[HO]:!0}),l=ZO(a,lH,lU,{[WO]:!0}),r=ZO(s,nH,sU,{[OO]:!0});ZO(r,iH,n),ZO(r,nH,r),ZO(n,iH,n),ZO(n,nH,n);const i=ZO(s,lH,aU,{[UO]:!0});ZO(i,nH),ZO(i,iH,l),ZO(i,lH,i),ZO(l,iH,l),ZO(l,nH),ZO(l,lH,l);const o=tU(s,"\n",hU,{[KO]:!0}),c=tU(s,"\r",mU,{[KO]:!0}),d=ZO(s,oH,mU,{[KO]:!0});tU(s,"\ufffc",d),tU(c,"\n",o),tU(c,"\ufffc",d),ZO(c,oH,d),tU(d,"\r"),tU(d,"\n"),ZO(d,oH,d),tU(d,"\ufffc",d);const u=ZO(s,rH,tH,{[qO]:!0});tU(u,"#"),ZO(u,rH,u),tU(u,"\ufe0f",u);const m=tU(u,"\u200d");tU(m,"#"),ZO(m,rH,u);const h=[[nH,r],[iH,n]],x=[[nH,null],[lH,i],[iH,l]];for(let p=0;p<cH.length;p++)mH(s,cH[p],iU,sU,h);for(let p=0;p<dH.length;p++)mH(s,dH[p],oU,aU,x);JO(iU,{tld:!0,ascii:!0},t),JO(oU,{utld:!0,alpha:!0},t),mH(s,"file",cU,sU,h),mH(s,"mailto",cU,sU,h),mH(s,"http",dU,sU,h),mH(s,"https",dU,sU,h),mH(s,"ftp",dU,sU,h),mH(s,"ftps",dU,sU,h),JO(cU,{scheme:!0,ascii:!0},t),JO(dU,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let p=0;p<e.length;p++){const t=e[p][0],a=e[p][1]?{[$O]:!0}:{[GO]:!0};t.indexOf("-")>=0?a[VO]=!0:nH.test(t)?iH.test(t)?a[HO]=!0:a[OO]=!0:a[IO]=!0,eU(s,t,t,a)}return eU(s,"localhost",rU,{ascii:!0}),s.jd=new QO(sH),{start:s,tokens:Object.assign({groups:t},aH)}}(_H.customSchemes);for(let e=0;e<_H.tokenQueue.length;e++)_H.tokenQueue[e][1]({scanner:_H.scanner});_H.parser=function(e){let{groups:t}=e;const s=t.domain.concat([AU,TU,zU,MU,PU,BU,IU,UU,WU,uU,VU,qU,$U,GU,XU,sH,ZU,eH]),a=[FU,RU,LU,OU,HU,VU,KU,YU,QU,jU,yU,xU,pU,fU,gU,vU,bU,NU,wU,CU,kU,DU,_U,SU,EU],n=[AU,FU,TU,MU,PU,BU,IU,UU,WU,xU,pU,VU,qU,$U,GU,KU,XU,sH,ZU,eH],l=wH(),r=tU(l,ZU);XO(r,n,r),XO(r,t.domain,r);const i=wH(),o=wH(),c=wH();XO(l,t.domain,i),XO(l,t.scheme,o),XO(l,t.slashscheme,c),XO(i,n,r),XO(i,t.domain,i);const d=tU(i,zU);tU(r,zU,d),tU(o,zU,d),tU(c,zU,d);const u=tU(r,OU);XO(u,n,r),XO(u,t.domain,r);const m=wH();XO(d,t.domain,m),XO(m,t.domain,m);const h=tU(m,OU);XO(h,t.domain,m);const x=wH(bH);XO(h,t.tld,x),XO(h,t.utld,x),tU(d,rU,x);const p=tU(m,WU);tU(p,WU,p),XO(p,t.domain,m),XO(x,t.domain,m),tU(x,OU,h),tU(x,WU,p);const g=tU(x,RU);XO(g,t.numeric,bH);const f=tU(i,WU),v=tU(i,OU);tU(f,WU,f),XO(f,t.domain,i),XO(v,n,r),XO(v,t.domain,i);const b=wH(NH);XO(v,t.tld,b),XO(v,t.utld,b),XO(b,t.domain,i),XO(b,n,r),tU(b,OU,v),tU(b,WU,f),tU(b,zU,d);const j=tU(b,RU),y=wH(NH);XO(j,t.numeric,y);const N=wH(NH),w=wH();XO(N,s,N),XO(N,a,w),XO(w,s,N),XO(w,a,w),tU(b,XU,N),tU(y,XU,N);const C=tU(o,RU),k=tU(c,RU),D=tU(k,XU),_=tU(D,XU);XO(o,t.domain,i),tU(o,OU,v),tU(o,WU,f),XO(c,t.domain,i),tU(c,OU,v),tU(c,WU,f),XO(C,t.domain,N),tU(C,XU,N),tU(C,KU,N),XO(_,t.domain,N),XO(_,s,N),tU(_,XU,N);const S=[[xU,pU],[gU,fU],[vU,bU],[jU,yU],[NU,wU],[CU,kU],[DU,_U],[SU,EU]];for(let E=0;E<S.length;E++){const[e,t]=S[E],n=tU(N,e);tU(w,e,n),tU(n,t,N);const l=wH(NH);XO(n,s,l);const r=wH();XO(n,a),XO(l,s,l),XO(l,a,r),XO(r,s,l),XO(r,a,r),tU(l,t,N),tU(r,t,N)}return tU(l,rU,b),tU(l,hU,yH),{start:l,tokens:aH}}(_H.scanner.tokens);for(let e=0;e<_H.pluginQueue.length;e++)_H.pluginQueue[e][1]({scanner:_H.scanner,parser:_H.parser});return _H.initialized=!0,_H}function AH(e){return _H.initialized||EH(),function(e,t,s){let a=s.length,n=0,l=[],r=[];for(;n<a;){let i=e,o=null,c=null,d=0,u=null,m=-1;for(;n<a&&!(o=i.go(s[n].t));)r.push(s[n++]);for(;n<a&&(c=o||i.go(s[n].t));)o=null,i=c,i.accepts()?(m=0,u=i):m>=0&&m++,n++,d++;if(m<0)n-=d,n<a&&(r.push(s[n]),n++);else{r.length>0&&(l.push(CH(jH,t,r)),r=[]),n-=m,d-=m;const e=u.t,a=s.slice(n-d,n);l.push(CH(e,t,a))}}return r.length>0&&l.push(CH(jH,t,r)),l}(_H.parser.start,e,uH(_H.scanner.start,e))}function FH(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t&&"object"===typeof t){if(s)throw Error("linkifyjs: Invalid link type ".concat(t,"; must be a string"));s=t,t=null}const a=new pH(s),n=AH(e),l=[];for(let r=0;r<n.length;r++){const e=n[r];!e.isLink||t&&e.t!==t||!a.check(e)||l.push(e.toFormattedObject(a))}return l}AH.scan=uH;var TH="[\0- \xa0\u1680\u180e\u2000-\u2029\u205f\u3000]",zH=new RegExp(TH),MH=new RegExp("".concat(TH,"$")),PH=new RegExp(TH,"g");function BH(e,t){const s=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];
2return t&&t.forEach(e=>{const t="string"===typeof e?e:e.scheme;t&&s.push(t)}),!e||e.replace(PH,"").match(new RegExp("^(?:(?:".concat(s.join("|"),"):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))"),"i"))}var RH=IL.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"!==typeof e?SH(e.scheme,e.optionalSlashes):SH(e)})},onDestroy(){QO.groups={},_H.scanner=null,_H.parser=null,_H.tokenQueue=[],_H.pluginQueue=[],_H.customSchemes=[],_H.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!BH(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!BH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML(e){let{HTMLAttributes:t}=e;return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!BH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",IR(this.options.HTMLAttributes,t),0]:["a",IR(this.options.HTMLAttributes,d(d({},t),{},{href:""})),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var s;const a=(null==(s=e.attrs)?void 0:s.href)||"",n=t.renderChildren(e);return"[".concat(n,"](").concat(a,")")},addCommands(){return{setLink:e=>t=>{let{chain:s}=t;const{href:a}=e;return!!this.options.isAllowedUri(a,{defaultValidate:e=>!!BH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&s().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>t=>{let{chain:s}=t;const{href:a}=e||{};return!(a&&!this.options.isAllowedUri(a,{defaultValidate:e=>!!BH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&s().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>e=>{let{chain:t}=e;return t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}}},addPasteRules(){return[yI({find:e=>{const t=[];if(e){const{protocols:s,defaultProtocol:a}=this.options,n=FH(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!BH(e,s),protocols:s,defaultProtocol:a}));n.length&&n.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t}
2,type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:s}=this.options;return this.options.autolink&&e.push(function(e){return new uT({key:new xT("autolink"),appendTransaction:(t,s,a)=>{const n=t.some(e=>e.docChanged)&&!s.doc.eq(a.doc),l=t.some(e=>e.getMeta("preventAutolink"));if(!n||l)return;const{tr:r}=a;return XR(AR(s.doc,[...t])).forEach(t=>{let{newRange:s}=t;const n=function(e,t,s){const a=[];return e.nodesBetween(t.from,t.to,(e,t)=>{s(e)&&a.push({node:e,pos:t})}),a}(a.doc,s,e=>e.isTextblock);let l,i;if(n.length>1)l=n[0],i=a.doc.textBetween(l.pos,l.pos+l.node.nodeSize,void 0," ");else if(n.length){const e=a.doc.textBetween(s.from,s.to," "," ");if(!MH.test(e))return;l=n[0],i=a.doc.textBetween(l.pos,s.to,void 0," ")}if(l&&i){const t=i.split(zH).filter(Boolean);if(t.length<=0)return!1;const s=t[t.length-1],n=l.pos+i.lastIndexOf(s);if(!s)return!1;const c=AH(s).map(t=>t.toObject(e.defaultProtocol));if(!(1===(o=c).length?o[0].isLink:3===o.length&&o[1].isLink&&["()","[]"].includes(o[0].value+o[2].value)))return!1;c.filter(e=>e.isLink).map(e=>d(d({},e),{},{from:n+e.start+1,to:n+e.end+1})).filter(e=>!a.schema.marks.code||!a.doc.rangeHasMark(e.from,e.to,a.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{ZR(t.from,t.to,a.doc).some(t=>t.mark.type===e.type)||r.addMark(t.from,t.to,e.type.create({href:t.href}))})}var o}),r.steps.length?r:void 0}})}({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!BH(e,t),protocols:t,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink})),e.push(function(e){return new uT({key:new xT("handleClickLink"),props:{handleClick:(t,s,a)=>{var n,l;if(0!==a.button)return!1;if(!t.editable)return!1;let r=!1;if(e.enableClickSelection&&(r=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let s=null;if(a.target instanceof HTMLAnchorElement)s=a.target;else{let e=a.target;const t=[];for(;"DIV"!==e.nodeName;)t.push(e),e=e.parentNode;s=t.find(e=>"A"===e.nodeName)}if(!s)return r;const i=JR(t.state,e.type.name),o=null!=(n=null==s?void 0:s.href)?n:i.href,c=null!=(l=null==s?void 0:s.target)?l:i.target;s&&o&&(window.open(o,c),r=!0)}return r}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new uT({key:new xT("handlePasteLink"),props:{handlePaste:(t,s,a)=>{const{shouldAutoLink:n}=e,{state:l}=t,{selection:r}=l,{empty:i}=r;if(i)return!1;let o="";a.content.forEach(e=>{o+=e.textContent});const c=FH(o,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===o);return!(!o||!c||void 0!==n&&!n(c.href))&&e.editor.commands.setMark(e.type,{href:c.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}});const LH=["start"];var IH=Object.defineProperty,OH="textStyle",UH=/^\s*([-+*])\s$/,HH=jI.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return"".concat(this.options.itemTypeName,"+")},parseHTML:()=>[{tag:"ul"}],renderHTML(e){let{HTMLAttributes:t}=e;return["ul",IR(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>e=>{let{commands:t,chain:s}=e;return this.options.keepAttributes?s().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(OH)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}}
2,addInputRules(){let e=oI({find:UH,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oI({find:UH,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(OH),editor:this.editor})),[e]}}),WH=jI.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML(e){let{HTMLAttributes:t}=e;return["li",IR(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if("list_item"!==e.type)return[];let s=[];if(e.tokens&&e.tokens.length>0){if(e.tokens.some(e=>"paragraph"===e.type))s=t.parseChildren(e.tokens);else{const a=e.tokens[0];if(a&&"text"===a.type&&a.tokens&&a.tokens.length>0){if(s=[{type:"paragraph",content:t.parseInline(a.tokens)}],e.tokens.length>1){const a=e.tokens.slice(1),n=t.parseChildren(a);s.push(...n)}}else s=t.parseChildren(e.tokens)}}return 0===s.length&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(e,t,s)=>vI(e,t,e=>"bulletList"===e.parentType?"- ":"orderedList"===e.parentType?"".concat(e.index+1,". "):"- ",s),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var s in t)IH(e,s,{get:t[s],enumerable:!0})})({},{findListItemPos:()=>VH,getNextListDepth:()=>qH,handleBackspace:()=>YH,handleDelete:()=>XH,hasListBefore:()=>$H,hasListItemAfter:()=>ZH,hasListItemBefore:()=>GH,listItemHasSubList:()=>KH,nextListIsDeeper:()=>JH,nextListIsHigher:()=>QH});var VH=(e,t)=>{const{$from:s}=t.selection,a=AB(e,t.schema);let n=null,l=s.depth,r=s.pos,i=null;for(;l>0&&null===i;)n=s.node(l),n.type===a?i=l:(l-=1,r-=1);return null===i?null:{$pos:t.doc.resolve(r),depth:i}},qH=(e,t)=>{const s=VH(e,t);if(!s)return!1;const[,a]=function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:20;const n=e.doc.resolve(s);let l=a,r=null;for(;l>0&&null===r;){const e=n.node(l);(null==e?void 0:e.type.name)===t?r=e:l-=1}return[r,l]}(t,e,s.$pos.pos+4);return a},$H=(e,t,s)=>{const{$anchor:a}=e.selection,n=Math.max(0,a.pos-2),l=e.doc.resolve(n).node();
2return!(!l||!s.includes(l.type.name))},GH=(e,t)=>{var s;const{$anchor:a}=t.selection,n=t.doc.resolve(a.pos-2);return 0!==n.index()&&(null==(s=n.nodeBefore)?void 0:s.type.name)===e},KH=(e,t,s)=>{if(!s)return!1;const a=AB(e,t.schema);let n=!1;return s.descendants(e=>{e.type===a&&(n=!0)}),n},YH=(e,t,s)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!mR(e.state,t)&&$H(e.state,t,s)){const{$anchor:s}=e.state.selection,a=e.state.doc.resolve(s.before()-1),n=[];a.node().descendants((e,s)=>{e.type.name===t&&n.push({node:e,pos:s})});const l=n.at(-1);if(!l)return!1;const r=e.state.doc.resolve(a.start()+l.pos+1);return e.chain().cut({from:s.start()-1,to:s.end()+1},r.end()).joinForward().run()}if(!mR(e.state,t))return!1;if(!(e=>{const{$from:t,$to:s}=e.selection;return!(t.parentOffset>0||t.pos!==s.pos)})(e.state))return!1;const a=VH(t,e.state);if(!a)return!1;const n=e.state.doc.resolve(a.$pos.pos-2).node(a.depth),l=KH(t,e.state,n);return GH(t,e.state)&&!l?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},JH=(e,t)=>{const s=qH(e,t),a=VH(e,t);return!(!a||!s)&&s>a.depth},QH=(e,t)=>{const s=qH(e,t),a=VH(e,t);return!(!a||!s)&&s<a.depth},XH=(e,t)=>{if(!mR(e.state,t))return!1;if(!((e,t)=>{const{$from:s,$to:a,$anchor:n}=e.selection;if(t){const s=FR(e=>e.type.name===t)(e.selection);if(!s)return!1;const a=e.doc.resolve(s.pos+1);return n.pos+1===a.end()}return!(a.parentOffset<a.parent.nodeSize-2||s.pos!==a.pos)})(e.state,t))return!1;const{selection:s}=e.state,{$from:a,$to:n}=s;return!(!s.empty&&a.sameParent(n))&&(JH(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():QH(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},ZH=(e,t)=>{var s;const{$anchor:a}=t.selection,n=t.doc.resolve(a.pos-a.parentOffset-2);return n.index()!==n.parent.childCount-1&&(null==(s=n.nodeAfter)?void 0:s.type.name)===e},eW=qL.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:e=>{let{editor:t}=e,s=!1;return this.options.listTypes.forEach(e=>{let{itemName:a}=e;void 0!==t.state.schema.nodes[a]&&XH(t,a)&&(s=!0)}),s},"Mod-Delete":e=>{let{editor:t}=e,s=!1;return this.options.listTypes.forEach(e=>{let{itemName:a}=e;void 0!==t.state.schema.nodes[a]&&XH(t,a)&&(s=!0)}),s},Backspace:e=>{let{editor:t}=e,s=!1;return this.options.listTypes.forEach(e=>{let{itemName:a,wrapperNames:n}=e;void 0!==t.state.schema.nodes[a]&&YH(t,a,n)&&(s=!0)}),s},"Mod-Backspace":e=>{let{editor:t}=e,s=!1;return this.options.listTypes.forEach(e=>{let{itemName:a,wrapperNames:n}=e;void 0!==t.state.schema.nodes[a]&&YH(t,a,n)&&(s=!0)}),s}}}}),tW=/^(\s*)(\d+)\.\s+(.*)$/,sW=/^\s/;function aW(e,t,s){var a;const n=[];let l=0;for(;l<e.length;){const r=e[l];if(r.indent===t){const i=r.content.split("\n"),o=(null==(a=i[0])?void 0:a.trim())||"",c=[];o&&c.push({type:"paragraph",raw:o,tokens:s.inlineTokens(o)});const d=i.slice(1).join("\n").trim();if(d){const e=s.blockTokens(d);c.push(...e)}let u=l+1;const m=[];for(;u<e.length&&e[u].indent>t;)m.push(e[u]),u+=1;if(m.length>0){const e=Math.min(...m.map(e=>e.indent)),t=aW(m,e,s);c.push({type:"list",ordered:!0,start:m[0].number,items:t,raw:m.map(e=>e.raw).join("\n")})}n.push({type:"list_item",raw:r.raw,tokens:c}),l=u}else l+=1}return n}var nW="textStyle",lW=/^(\d+)\.\s$/,rW=jI.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return"".concat(this.options.itemTypeName,"+")},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML(e){let{HTMLAttributes:t}=e;const{start:s}=t,a=l(t,LH);return 1===s?["ol",IR(this.options.HTMLAttributes,a),0]:["ol",IR(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if("list"!==e.type||!e.ordered)return[];const s=e.start||1,a=e.items?function(e,t){return e.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];const s=[];return e.tokens&&e.tokens.length>
20&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)s.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){const a=t.parseChildren([e]);s.push({type:"paragraph",content:a})}else{const a=t.parseChildren([e]);a.length>0&&s.push(...a)}}),{type:"listItem",content:s}})}(e.items,t):[];return 1!==s?{type:"orderedList",attrs:{start:s},content:a}:{type:"orderedList",content:a}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),s=null==t?void 0:t.index;return void 0!==s?s:-1},tokenize:(e,t,s)=>{var a;const n=e.split("\n"),[l,r]=function(e){const t=[];let s=0,a=0;for(;s<e.length;){const n=e[s],l=n.match(tW);if(!l)break;const[,r,i,o]=l,c=r.length;let d=o,u=s+1;const m=[n];for(;u<e.length;){const t=e[u];if(t.match(tW))break;if(""===t.trim())m.push(t),d+="\n",u+=1;else{if(!t.match(sW))break;m.push(t),d+="\n".concat(t.slice(c+2)),u+=1}}t.push({indent:c,number:parseInt(i,10),content:d.trim(),raw:m.join("\n")}),a=u,s=u}return[t,a]}(n);if(0===l.length)return;const i=aW(l,0,s);if(0===i.length)return;return{type:"list",ordered:!0,start:(null==(a=l[0])?void 0:a.number)||1,items:i,raw:n.slice(0,r).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>e=>{let{commands:t,chain:s}=e;return this.options.keepAttributes?s().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(nW)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=oI({find:lW,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oI({find:lW,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>d({start:+e[1]},this.editor.getAttributes(nW)),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),iW=/^\s*(\[([( |x])?\])\s$/,oW=jI.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:'li[data-type="'.concat(this.name,'"]'),priority:51}]},renderHTML(e){let{node:t,HTMLAttributes:s}=e;return["li",IR(this.options.HTMLAttributes,s,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const s=[];if(e.tokens&&e.tokens.length>0?s.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?s.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):s.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const a=t.parseChildren(e.nestedTokens);s.push(...a)}return t.createNode("taskItem",{checked:e.checked||!1},s)},renderMarkdown:(e,t)=>{var s;const a=(null==(s=e.attrs)?void 0:s.checked)?"x":" ";return vI(e,t,"- [".concat(a,"] "))},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?d(d({},e),{},{Tab:()=>this.editor.commands.sinkListItem(this.name)}):e},addNodeView(){return e=>{let{node:t,HTMLAttributes:s,getPos:a,editor:n}=e;const l=document.createElement("li"),r=document.createElement("label"),i=document.createElement("span"),o=document.createElement("input"),c=document.createElement("div"),u=e=>{var t,s;o.ariaLabel=(null==(s=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:s.call(t,e,o.checked))||"Task item checkbox for ".concat(e.textContent||"empty task item")};return u(t),r.contentEditable="false",o.type="checkbox",o.addEventListener("mousedown",e=>e.preventDefault()),o.addEventListener("change",e=>
2{if(!n.isEditable&&!this.options.onReadOnlyChecked)return void(o.checked=!o.checked);const{checked:s}=e.target;n.isEditable&&"function"===typeof a&&n.chain().focus(void 0,{scrollIntoView:!1}).command(e=>{let{tr:t}=e;const n=a();if("number"!==typeof n)return!1;const l=t.doc.nodeAt(n);return t.setNodeMarkup(n,void 0,d(d({},null==l?void 0:l.attrs),{},{checked:s})),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,s)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(e=>{let[t,s]=e;l.setAttribute(t,s)}),l.dataset.checked=t.attrs.checked,o.checked=t.attrs.checked,r.append(o,i),l.append(r,c),Object.entries(s).forEach(e=>{let[t,s]=e;l.setAttribute(t,s)}),{dom:l,contentDOM:c,update:e=>e.type===this.type&&(l.dataset.checked=e.attrs.checked,o.checked=e.attrs.checked,u(e),!0)}}},addInputRules(){return[oI({find:iW,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),cW=jI.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return"".concat(this.options.itemTypeName,"+")},parseHTML(){return[{tag:'ul[data-type="'.concat(this.name,'"]'),priority:51}]},renderHTML(e){let{HTMLAttributes:t}=e;return["ul",IR(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const s=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==s?s:-1},tokenize(e,t,s){const a=e=>{const t=fI(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:s.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:a},s);return t?[{type:"taskList",raw:t.raw,items:t.items}]:s.blockTokens(e)},n=fI(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:s.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:a},s);if(n)return{type:"taskList",raw:n.raw,items:n.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>e=>{let{commands:t}=e;return t.toggleList(this.name,this.options.itemTypeName)}}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),dW=(qL.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(HH.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(WH.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(eW.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(rW.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(oW.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(cW.configure(this.options.taskList)),e}}),jI.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML(e){let{HTMLAttributes:t}=e;return["p",IR(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>{const s=e.tokens||[];return 1===s.length&&"image"===s[0].type?t.parseChildren([s[0]]):t.createNode("paragraph",void 0,t.parseInline(s))},renderMarkdown:(e,t)=>e&&Array.isArray(e.content)?t.renderChildren(e.content):"",addCommands(){return{setParagraph:()=>e=>{let{commands:t}=e;return t.setNode(this.name)}}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})),uW=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,mW=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,hW=IL.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML(e){let{HTMLAttributes:t}=e;return["s",IR(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>"~~".concat(t.renderChildren(e),"~~"),addCommands(){return{setStrike:()=>e=>{let{commands:t}=e;return t.setMark(this.name)},toggleStrike:()=>e=>{let{commands:t}=e;return t.toggleMark(this.name)},unsetStrike:()=>e=>{let{commands:t}=e;return t.unsetMark(this.name)}}}
2,addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[lI({find:uW,type:this.type})]},addPasteRules(){return[yI({find:mW,type:this.type})]}}),xW=jI.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),pW=IL.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML(e){let{HTMLAttributes:t}=e;return["u",IR(this.options.HTMLAttributes,t),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>"++".concat(t.renderChildren(e),"++"),markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,s){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!a)return;const n=a[2].trim();return{type:"underline",raw:a[0],text:n,tokens:s.inlineTokens(n)}}},addCommands(){return{setUnderline:()=>e=>{let{commands:t}=e;return t.setMark(this.name)},toggleUnderline:()=>e=>{let{commands:t}=e;return t.toggleMark(this.name)},unsetUnderline:()=>e=>{let{commands:t}=e;return t.unsetMark(this.name)}}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function gW(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new uT({view:t=>new fW(t,e)})}class fW{constructor(e,t){var s;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(s=t.width)&&void 0!==s?s:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let s=e=>{this[t](e)};return e.dom.addEventListener(t,s),{name:t,handler:s}})}destroy(){this.handlers.forEach(e=>{let{name:t,handler:s}=e;return this.editorView.dom.removeEventListener(t,s)})}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),s=!t.parent.inlineContent,a=this.editorView.dom,n=a.getBoundingClientRect(),l=n.width/a.offsetWidth,r=n.height/a.offsetHeight;if(s){let s=t.nodeBefore,a=t.nodeAfter;if(s||a){let t=this.editorView.nodeDOM(this.cursorPos-(s?s.nodeSize:0));if(t){let n=t.getBoundingClientRect(),l=s?n.bottom:n.top;s&&a&&(l=(l+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let i=this.width/2*r;e={left:n.left,right:n.right,top:l-i,bottom:l+i}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),s=this.width/2*l;e={left:t.left-s,right:t.left+s,top:t.top,bottom:t.bottom}}let i,o,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s),!c||c==document.body&&"static"==getComputedStyle(c).position)i=-pageXOffset,o=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,s=e.height/c.offsetHeight;i=e.left-c.scrollLeft*t,o=e.top-c.scrollTop*s}this.element.style.left=(e.left-i)/l+"px",this.element.style.top=(e.top-o)/r+"px",this.element.style.width=(e.right-e.left)/l+"px",this.element.style.height=(e.bottom-e.top)/r+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),s=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),a=s&&s.type.spec.disableDropCursor,n="function"==typeof a?a(this.editorView,t,e):a;if(t&&!n){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=EF(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class vW extends $F{constructor(e){super(e,e)}map(e,t){let s=e.resolve(t.map(this.head));return vW.valid(s)?new vW(s):$F.near(s)}content(){return eA.empty}eq(e){return e instanceof vW&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new vW(e.resolve(t.pos))}getBookmark(){return new bW(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let s=e.index(t),a=e.node(t);if(0!=s)for(let e=a.child(s-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||jW(e.type))return!0;
vendor: 8,975 bytes, line 2
2if(e.inlineContent)return!1}else if(a.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let s=e.indexAfter(t),a=e.node(t);if(s!=a.childCount)for(let e=a.child(s);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||jW(e.type))return!0;if(e.inlineContent)return!1}else if(a.type.spec.isolating)return!0}return!0}(e))return!1;let s=t.type.spec.allowGapCursor;if(null!=s)return s;let a=t.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e:for(;;){if(!s&&vW.valid(e))return e;let a=e.pos,n=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){n=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}if(0==s)return null;a+=t;let r=e.doc.resolve(a);if(vW.valid(r))return r}for(;;){let l=t>0?n.firstChild:n.lastChild;if(!l){if(n.isAtom&&!n.isText&&!XF.isSelectable(n)){e=e.doc.resolve(a+n.nodeSize*t),s=!1;continue e}break}n=l,a+=t;let r=e.doc.resolve(a);if(vW.valid(r))return r}return null}}}vW.prototype.visible=!1,vW.findFrom=vW.findGapCursorFrom,$F.jsonID("gapcursor",vW);class bW{constructor(e){this.pos=e}map(e){return new bW(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return vW.valid(t)?new vW(t):$F.near(t)}}function jW(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const yW=fB({ArrowLeft:NW("horiz",-1),ArrowRight:NW("horiz",1),ArrowUp:NW("vert",-1),ArrowDown:NW("vert",1)});function NW(e,t){const s="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,a,n){let l=e.selection,r=t>0?l.$to:l.$from,i=l.empty;if(l instanceof JF){if(!n.endOfTextblock(s)||0==r.depth)return!1;i=!1,r=e.doc.resolve(t>0?r.after():r.before())}let o=vW.findGapCursorFrom(r,t,i);return!!o&&(a&&a(e.tr.setSelection(new vW(o))),!0)}}function wW(e,t,s){if(!e||!e.editable)return!1;let a=e.state.doc.resolve(t);if(!vW.valid(a))return!1;let n=e.posAtCoords({left:s.clientX,top:s.clientY});return!(n&&n.inside>-1&&XF.isSelectable(e.state.doc.nodeAt(n.inside)))&&(e.dispatch(e.state.tr.setSelection(new vW(a))),!0)}function CW(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof vW))return!1;let{$from:s}=e.state.selection,a=s.parent.contentMatchAt(s.index()).findWrapping(e.state.schema.nodes.text);if(!a)return!1;let n=KE.empty;for(let r=a.length-1;r>=0;r--)n=KE.from(a[r].createAndFill(null,n));let l=e.state.tr.replace(s.pos,s.pos,new eA(n,0,0));return l.setSelection(JF.near(l.doc.resolve(s.pos+1))),e.dispatch(l),!1}function kW(e){if(!(e.selection instanceof vW))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",AP.create(e.doc,[_P.widget(e.selection.head,t,{key:"gapcursor"})])}var DW=200,_W=function(){};_W.prototype.append=function(e){return e.length?(e=_W.from(e),!this.length&&e||e.length<DW&&this.leafAppend(e)||this.length<DW&&e.leafPrepend(this)||this.appendInner(e)):this},_W.prototype.prepend=function(e){return e.length?_W.from(e).append(this):this},_W.prototype.appendInner=function(e){return new EW(this,e)},_W.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?_W.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},_W.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},_W.prototype.forEach=function(e,t,s){void 0===t&&(t=0),void 0===s&&(s=this.length),t<=s?this.forEachInner(e,t,s,0):this.forEachInvertedInner(e,t,s,0)},_W.prototype.map=function(e,t,s){void 0===t&&(t=0),void 0===s&&(s=this.length);var a=[];return this.forEach(function(t,s){return a.push(e(t,s))},t,s),a},_W.from=function(e){return e instanceof _W?e:e&&e.length?new SW(e):_W.empty};var SW=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var s={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,s){return 0==e&&s==this.length?this:new t(this.values.slice(e,s))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,s,a){for(var n=t;n<s;n++)if(!1===e(this.values[n],a+n))return!1},t.prototype.forEachInvertedInner=function(e,t,s,a){for(var n=t-1;n>=s;n--)if(!1===e(this.values[n],a+n))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=DW)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=DW)return new t(e.flatten().concat(this.values))},s.length.get=function(){return this.values.length},s.depth.get=function(){return 0},Object.defineProperties(t.prototype,s),t}(_W);_W.empty=new SW([]);var EW=function(e){function t(t,s){e.call(this),this.left=t,this.right=s,this.length=t.length+s.length,this.depth=Math.max(t.depth,s.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,s,a){var n=this.left.length;return!(t<n&&!1===this.left.forEachInner(e,t,Math.min(s,n),a))&&(!(s>n&&!1===this.right.forEachInner(e,Math.max(t-n,0),Math.min(this.length,s)-n,a+n))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,s,a){var n=this.left.length;return!(t>n&&!1===this.right.forEachInvertedInner(e,t-n,Math.max(s,n)-n,a+n))&&(!(s<n&&!1===this.left.forEachInvertedInner(e,Math.min(t,n),s,a))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var s=this.left.length;return t<=s?this.left.slice(e,t):e>=s?this.right.slice(e-s,t-s):this.left.slice(e,s).append(this.right.slice(0,t-s))},t.prototype.leafAppend=function(e){var s=this.right.leafAppend(e);if(s)return new t(this.left,s)},t.prototype.leafPrepend=function(e){var s=this.left.leafPrepend(e);if(s)return new t(s,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(_W);const AW=_W;class FW{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let s,a,n=this.items.length;for(;;n--){if(this.items.get(n-1).selection){--n;break}}t&&(s=this.remapping(n,this.items.length),a=s.maps.length);let l,r,i=e.tr,o=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return s||(s=this.remapping(n,t+1),a=s.maps.length),a--,void c.push(e);if(s){c.push(new TW(e.map));let t,n=e.step.map(s.slice(a));n&&i.maybeStep(n).doc&&(t=i.mapping.maps[i.mapping.maps.length-1],o.push(new TW(t,void 0,void 0,o.length+c.length))),a--,t&&s.appendMap(t,a)}else i.maybeStep(e.step);return e.selection?(l=s?e.selection.map(s.slice(a)):e.selection,r=new FW(this.items.slice(0,n).append(c.reverse().concat(o)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:r,transform:i,selection:l}}addTransform(e,t,s,a){let n=[],l=this.eventCount,r=this.items,i=!a&&r.length?r.get(r.length-1):null;for(let c=0;c<e.steps.length;c++){let s,o=e.steps[c].invert(e.docs[c]),d=new TW(e.mapping.maps[c],o,t);(s=i&&i.merge(d))&&(d=s,c?n.pop():r=r.slice(0,r.length-1)),n.push(d),t&&(l++,t=void 0),a||(i=d)}let o=l-s.depth;return o>MW&&(r=function(e,t){let s;return e.forEach((e,a)=>{if(e.selection&&0==t--)return s=a,!1}),e.slice(s)}(r,o),l-=o),new FW(r.append(n),l)}remapping(e,t){let s=new rF;return this.items.forEach((t,a)=>{let n=null!=t.mirrorOffset&&a-t.mirrorOffset>=e?s.maps.length-t.mirrorOffset:void 0;s.appendMap(t.map,n)},e,t),s}addMaps(e){return 0==this.eventCount?this:new FW(this.items.append(e.map(e=>new TW(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let s=[],a=Math.max(0,this.items.length-t),n=e.mapping,l=e.steps.length,r=this.eventCount;this.items.forEach(e=>{e.selection&&r--},a);let i=t;this.items.forEach(t=>{let a=n.getMirror(--i);if(null==a)return;l=Math.min(l,a);let o=n.maps[a];if(t.step){let l=e.steps[a].invert(e.docs[a]),c=t.selection&&t.selection.map(n.slice(i+1,a));c&&r++,s.push(new TW(o,l,c))}else s.push(new TW(o))},a);let o=[];for(let u=t;u<l;u++)o.push(new TW(n.maps[u]));let c=this.items.slice(0,a).append(o).append(s),d=new FW(c,r);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-s.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.items.length,t=this.remapping(0,e),s=t.maps.length,a=[],n=0;return this.items.forEach((l,r)=>{if(r>=e)a.push(l),l.selection&&n++;else if(l.step){let e=l.step.map(t.slice(s)),r=e&&e.getMap();if(s--,r&&t.appendMap(r,s),e){let i=l.selection&&l.selection.map(t.slice(s));i&&n++;let o,c=new TW(r.invert(),e,i),d=a.length-1;(o=a.length&&a[d].merge(c))?a[d]=o:a.push(c)}}else l.map&&s--},this.items.length,0),new FW(AW.from(a.reverse()),n)}}FW.empty=new FW(AW.empty,0);
2class TW{constructor(e,t,s,a){this.map=e,this.step=t,this.selection=s,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new TW(t.getMap().invert(),t,this.selection)}}}class zW{constructor(e,t,s,a,n){this.done=e,this.undone=t,this.prevRanges=s,this.prevTime=a,this.prevComposition=n}}const MW=20;function PW(e){let t=[];for(let s=e.length-1;s>=0&&0==t.length;s--)e[s].forEach((e,s,a,n)=>t.push(a,n));return t}function BW(e,t){if(!e)return null;let s=[];for(let a=0;a<e.length;a+=2){let n=t.map(e[a],1),l=t.map(e[a+1],-1);n<=l&&s.push(n,l)}return s}let RW=!1,LW=null;function IW(e){let t=e.plugins;if(LW!=t){RW=!1,LW=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){RW=!0;break}}return RW}const OW=new xT("history"),UW=new xT("closeHistory");function HW(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new uT({key:OW,state:{init:()=>new zW(FW.empty,FW.empty,null,0,-1),apply:(t,s,a)=>function(e,t,s,a){let n,l=s.getMeta(OW);if(l)return l.historyState;s.getMeta(UW)&&(e=new zW(e.done,e.undone,null,0,-1));let r=s.getMeta("appendedTransaction");if(0==s.steps.length)return e;if(r&&r.getMeta(OW))return r.getMeta(OW).redo?new zW(e.done.addTransform(s,void 0,a,IW(t)),e.undone,PW(s.mapping.maps),e.prevTime,e.prevComposition):new zW(e.done,e.undone.addTransform(s,void 0,a,IW(t)),null,e.prevTime,e.prevComposition);if(!1===s.getMeta("addToHistory")||r&&!1===r.getMeta("addToHistory"))return(n=s.getMeta("rebased"))?new zW(e.done.rebased(s,n),e.undone.rebased(s,n),BW(e.prevRanges,s.mapping),e.prevTime,e.prevComposition):new zW(e.done.addMaps(s.mapping.maps),e.undone.addMaps(s.mapping.maps),BW(e.prevRanges,s.mapping),e.prevTime,e.prevComposition);{let n=s.getMeta("composition"),l=0==e.prevTime||!r&&e.prevComposition!=n&&(e.prevTime<(s.time||0)-a.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let s=!1;return e.mapping.maps[0].forEach((e,a)=>{for(let n=0;n<t.length;n+=2)e<=t[n+1]&&a>=t[n]&&(s=!0)}),s}(s,e.prevRanges)),i=r?BW(e.prevRanges,s.mapping):PW(s.mapping.maps);return new zW(e.done.addTransform(s,l?t.selection.getBookmark():void 0,a,IW(t)),FW.empty,i,s.time,null==n?e.prevComposition:n)}}(s,a,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let s=t.inputType,a="historyUndo"==s?VW:"historyRedo"==s?qW:null;return!(!a||!e.editable)&&(t.preventDefault(),a(e.state,e.dispatch))}}}})}function WW(e,t){return(s,a)=>{let n=OW.getState(s);if(!n||0==(e?n.undone:n.done).eventCount)return!1;if(a){let l=function(e,t,s){let a=IW(t),n=OW.get(t).spec.config,l=(s?e.undone:e.done).popEvent(t,a);if(!l)return null;let r=l.selection.resolve(l.transform.doc),i=(s?e.done:e.undone).addTransform(l.transform,t.selection.getBookmark(),n,a),o=new zW(s?i:l.remaining,s?l.remaining:i,null,0,-1);return l.transform.setSelection(r).setMeta(OW,{redo:s,historyState:o})}(n,s,e);l&&a(t?l.scrollIntoView():l)}return!0}}const VW=WW(!1,!0),qW=WW(!0,!0);WW(!1,!1),WW(!0,!1);qL.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,s=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(s)}},addProseMirrorPlugins(){let e=!1;return[new uT({key:new xT("characterCount"),appendTransaction:(t,s,a)=>{if(e)return;const n=this.options.limit;if(null===n||void 0===n||0===n)return void(e=!0);const l=this.storage.characters({node:a.doc});if(l>n){const t=0,s=l-n;console.warn("[CharacterCount] Initial content exceeded limit of ".concat(n," characters. Content was automatically trimmed."));const r=a.tr.deleteRange(t,s);return e=!0,r}e=!0},filterTransaction:(e,t)=>{const s=this.options.limit;if(!e.docChanged||0===s||null===s||void 0===s)return!0;const a=this.storage.characters({node:t.doc}),n=this.storage.characters({node:e.doc});if(n<=s)return!0;
2if(a>s&&n>s&&n<=a)return!0;if(a>s&&n>s&&n>a)return!1;if(!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,r=l-(n-s),i=l;e.deleteRange(r,i);return!(this.storage.characters({node:e.doc})>s)}})]}});var $W=qL.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[gW(this.options)]}}),GW=(qL.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new uT({key:new xT("focus"),props:{decorations:e=>{let{doc:t,selection:s}=e;const{isEditable:a,isFocused:n}=this.editor,{anchor:l}=s,r=[];if(!a||!n)return AP.create(t,[]);let i=0;"deepest"===this.options.mode&&t.descendants((e,t)=>{if(e.isText)return;if(!(l>=t&&l<=t+e.nodeSize-1))return!1;i+=1});let o=0;return t.descendants((e,t)=>{if(e.isText)return!1;if(!(l>=t&&l<=t+e.nodeSize-1))return!1;o+=1;if("deepest"===this.options.mode&&i-o>0||"shallowest"===this.options.mode&&o>1)return"deepest"===this.options.mode;r.push(_P.node(t,t+e.nodeSize,{class:this.options.className}))}),AP.create(t,r)}}})]}}),qL.create({name:"gapCursor",addProseMirrorPlugins:()=>[new uT({props:{decorations:kW,createSelectionBetween:(e,t,s)=>t.pos==s.pos&&vW.valid(s)?new vW(s):null,handleClick:wW,handleKeyDown:yW,handleDOMEvents:{beforeinput
2:CW}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=BR(TR(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}));qL.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new uT({key:new xT("placeholder"),props:{decorations:e=>{let{doc:t,selection:s}=e;const a=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=s,l=[];if(!a)return null;const r=this.editor.isEmpty;return t.descendants((e,t)=>{const s=n>=t&&n<=t+e.nodeSize,a=!e.isLeaf&&lL(e);if((s||!this.options.showOnlyCurrent)&&a){const a=[this.options.emptyNodeClass];r&&a.push(this.options.emptyEditorClass);const n=_P.node(t,t+e.nodeSize,{class:a.join(" "),"data-placeholder":"function"===typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:t,hasAnchor:s}):this.options.placeholder});l.push(n)}return this.options.includeChildren}),AP.create(t,l)}}})]}}),qL.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new uT({key:new xT("selection"),props:{decorations:s=>s.selection.empty||e.isFocused||!e.isEditable||rL(s.selection)||e.view.dragging?null:AP.create(s.doc,[_P.inline(s.selection.from,s.selection.to,{class:t.className})])}})]}});function KW(e){let{types:t,node:s}=e;return s&&Array.isArray(t)&&t.includes(s.type)||(null==s?void 0:s.type)===t}var YW=qL.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new xT(this.name),s=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",a=Object.entries(this.editor.schema.nodes).map(e=>{let[,t]=e;return t}).filter(e=>(this.options.notAfter||[]).concat(s).includes(e.name));return[new uT({key:t,appendTransaction:(e,a,n)=>{const{doc:l,tr:r,schema:i}=n,o=t.getState(n),c=l.content.size,d=i.nodes[s];if(o)return r.insert(c,d.create())},state:{init:(e,t)=>!KW({node:t.tr.doc.lastChild,types:a}),apply:(e,t)=>{if(!e.docChanged)return t;if(e.getMeta("__uniqueIDTransaction"))return t;return!KW({node:e.doc.lastChild,types:a})}}})]}}),JW=qL.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>e=>{let{state:t,dispatch:s}=e;return VW(t,s)},redo:()=>e=>{let{state:t,dispatch:s}=e;return qW(t,s)}}),addProseMirrorPlugins(){return[HW(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044f":()=>this.editor.commands.undo(),"Shift-Mod-\u044f":()=>this.editor.commands.redo()}}}),QW=qL.create({name:"starterKit",addExtensions(){var e,t,s,a;const n=[];return!1!==this.options.bold&&n.push(wO.configure(this.options.bold)),!1!==this.options.blockquote&&n.push(vO.configure(this.options.blockquote)),!1!==this.options.bulletList&&n.push(HH.configure(this.options.bulletList)),!1!==this.options.code&&n.push(DO.configure(this.options.code)),!1!==this.options.codeBlock&&n.push(EO.configure(this.options.codeBlock)),!1!==this.options.document&&n.push(AO.configure(this.options.document)),!1!==this.options.dropcursor&&n.push($W.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&n.push(GW.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&n.push(FO.configure(this.options.hardBreak)),!1!==this.options.heading&&n.push(TO.configure(this.options.heading)),!1!==this.options.undoRedo&&n.push(JW.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&n.push(zO.configure(this.options.horizontalRule)),!1!==this.options.italic&&n.push(LO.configure(this.options.italic)),!1!==this.options.listItem&&n.push(WH.configure(this.options.listItem)),!1!==this.options.listKeymap&&n.push(eW.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&n.push(RH.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&n.push(rW.configure(this.options.orderedList)),!1!==this.options.paragraph&&n.push(dW.configure(this.options.paragraph)),!1!==this.options.strike&&n.push(hW.configure(this.options.strike)),!1!==this.options.text&&n.push(xW.configure(this.options.text)),!1!==this.options.underline&&n.push(pW.configure(null==(s=this.options)?void 0:s.underline)),!1!==this.options.trailingNode&&n.push(YW.configure(null==(a=this.options)?void 0:a.trailingNode)),n}}),XW=qL.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:"text-align: ".concat(e.textAlign)}:{}}}}]},addCommands(){return{setTextAlign:e=>t=>{let{commands:s}=t;return!!this.options.alignments.includes(e)&&this.options.types.map(t=>s.updateAttributes(t,{textAlign:e})).some(e=>e)},unsetTextAlign:()=>e=>{let{commands:t}=e;return this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e)},toggleTextAlign:e=>t=>{let{editor:s,commands:a}=t;return!!this.options.alignments.includes(e)&&(s.isActive({textAlign:e})?a.unsetTextAlign():a.setTextAlign(e))}}}
2,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")}}}),ZW=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const s=[];return!e.children.length||t>20||Array.from(e.children).forEach(e=>{"SPAN"===e.tagName?s.push(e):e.children.length&&s.push(...ZW(e,t+1))}),s},eV=IL.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{},mergeNestedSpanStyles:!0}),parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>!!e.hasAttribute("style")&&(this.options.mergeNestedSpanStyles&&(e=>{if(!e.children.length)return;const t=ZW(e);t&&t.forEach(e=>{var t,s;const a=e.getAttribute("style"),n=null==(s=null==(t=e.parentElement)?void 0:t.closest("span"))?void 0:s.getAttribute("style");e.setAttribute("style","".concat(n,";").concat(a))})})(e),{})}]},renderHTML(e){let{HTMLAttributes:t}=e;return["span",IR(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:e=>t=>{let{commands:s}=t;return s.toggleMark(this.name,e)},removeEmptyTextStyle:()=>e=>{let{tr:t}=e;const{selection:s}=t;return t.doc.nodesBetween(s.from,s.to,(e,s)=>{if(e.isTextblock)return!0;e.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||t.removeMark(s,s+e.nodeSize,this.type)}),!0}}}}),tV=qL.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const s=e.getAttribute("style");if(s){const e=s.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const s=e[t].split(":");if(s.length>=2){const e=s[0].trim().toLowerCase(),t=s.slice(1).join(":").trim();if("background-color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.backgroundColor)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:"background-color: ".concat(e.backgroundColor)}:{}}}}]},addCommands:()=>({setBackgroundColor:e=>t=>{let{chain:s}=t;return s().setMark("textStyle",{backgroundColor:e}).run()},unsetBackgroundColor:()=>e=>{let{chain:t}=e;return t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}})}),sV=qL.create({name:"color",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const s=e.getAttribute("style");if(s){const e=s.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const s=e[t].split(":");if(s.length>=2){const e=s[0].trim().toLowerCase(),t=s.slice(1).join(":").trim();if("color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.color)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:"color: ".concat(e.color)}:{}}}}]},addCommands:()=>({setColor:e=>t=>{let{chain:s}=t;return s().setMark("textStyle",{color:e}).run()},unsetColor:()=>e=>{let{chain:t}=e;return t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}})}),aV=qL.create({name:"fontFamily",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:"font-family: ".concat(e.fontFamily)}:{}}}}]},addCommands:()=>({setFontFamily:e=>t=>{let{chain:s}=t;return s().setMark("textStyle",{fontFamily:e}).run()},unsetFontFamily:()=>e=>{let{chain:t}=e;return t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}})}),nV=qL.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:"font-size: ".concat(e.fontSize)}:{}}}}]},addCommands:()=>({setFontSize:e=>t=>{let{chain:s}=t;return s().setMark("textStyle",{fontSize:e}).run()},unsetFontSize:()=>e=>{let{chain:t}=e;return t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}})}),lV=qL.create({name:"lineHeight",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:"line-height: ".concat(e.lineHeight)}:{}}}}]},addCommands:()=>({setLineHeight:e=>t=>{let{chain:s}=t;return s().setMark("textStyle",{lineHeight:e}).run()},unsetLineHeight:()=>e=>{let{chain:t}=e;return t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}})}),rV=(qL.create({name:"textStyleKit",addExtensions(){const e=[];return!1!==this.options.backgroundColor&&e.push(tV.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(sV.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(aV.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(nV.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(lV.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(eV.configure(this.options.textStyle)),e}}),/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/),iV=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,oV=IL.create({name:"highlight",addOptions:()=>({multicolor:!1,HTMLAttributes:{}}),addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:"background-color: ".concat(e.color,"; color: inherit")}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML(e){let{HTMLAttributes:t}=e;return["mark",IR(this.options.HTMLAttributes,t),0]},renderMarkdown:(e,t)=>"==".concat(t.renderChildren(e),"=="),parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>
2e.indexOf("=="),tokenize(e,t,s){const a=/^(==)([^=]+)(==)/.exec(e);if(a){const e=a[2].trim(),t=s.inlineTokens(e);return{type:"highlight",raw:a[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>t=>{let{commands:s}=t;return s.setMark(this.name,e)},toggleHighlight:e=>t=>{let{commands:s}=t;return s.toggleMark(this.name,e)},unsetHighlight:()=>e=>{let{commands:t}=e;return t.unsetMark(this.name)}}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[lI({find:rV,type:this.type})]},addPasteRules(){return[yI({find:iV,type:this.type})]}}),cV=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,dV=jI.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML(e){let{HTMLAttributes:t}=e;return["img",IR(this.options.HTMLAttributes,t)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,s,a,n,l,r;const i=null!=(s=null==(t=e.attrs)?void 0:t.src)?s:"",o=null!=(n=null==(a=e.attrs)?void 0:a.alt)?n:"",c=null!=(r=null==(l=e.attrs)?void 0:l.title)?r:"";return c?".concat(i,' "').concat(c,'")'):".concat(i,")")},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"undefined"===typeof document)return null;const{directions:e,minWidth:t,minHeight:s,alwaysPreserveAspectRatio:a}=this.options.resize;return n=>{let{node:l,getPos:r,HTMLAttributes:i,editor:o}=n;const c=document.createElement("img");Object.entries(i).forEach(e=>{let[t,s]=e;if(null!=s)switch(t){case"width":case"height":break;default:c.setAttribute(t,s)}}),c.src=i.src;const d=new cI({element:c,editor:o,node:l,getPos:r,onResize:(e,t)=>
2{c.style.width="".concat(e,"px"),c.style.height="".concat(t,"px")},onCommit:(e,t)=>{const s=r();void 0!==s&&this.editor.chain().setNodeSelection(s).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,s)=>e.type===l.type,options:{directions:e,min:{width:t,height:s},preserveAspectRatio:!0===a}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",c.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:e=>t=>{let{commands:s}=t;return s.insertContent({type:this.name,attrs:e})}}},addInputRules(){return[rI({find:cV,type:this.type,getAttributes:e=>{const[,,t,s,a]=e;return{src:s,alt:t,title:a}}})]}}),uV=qL.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:"font-size: ".concat(e.fontSize)}:{}}}}]},addCommands:()=>({setFontSize:e=>t=>{let{chain:s}=t;return s().setMark("textStyle",{fontSize:e}).run()},unsetFontSize:()=>e=>{let{chain:t}=e;return t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}})}),mV=aV;const hV=Vl("undo-2",[["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"}]]),xV=Vl("redo-2",[["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"}]]),pV=Vl("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"}]]),gV=Vl("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"}]]),fV=Vl("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),vV=Vl("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"}]]),bV=Vl("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),jV=Vl("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),yV=Vl("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),NV=Vl("align-justify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]),wV=Vl("list-ordered",[["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"}]]),CV=Vl("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"}]]),kV=["children"],DV=["children"];function _V(e){const s=SV(e),a=t.forwardRef((e,a)=>{const{children:n}=e,r=l(e,kV),i=t.Children.toArray(n),o=i.find(AV);if(o){const e=o.props.children,n=i.map(s=>s===o?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:s);return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null}))}return(0,ea.jsx)(s,d(d({},r),{},{ref:a,children:n}))});return a.displayName="".concat(e,".Slot"),a}function SV(e){const s=t.forwardRef((e,s)=>{const{children:a}=e,n=l(e,DV);if(t.isValidElement(a)){const e=function(e){var t,s;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null===(s=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===s?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),l=function(e,t){const s=d({},t);for(const a in t){const n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?s[a]=function(){const e=l(...arguments);return n(...arguments),e}:n&&(s[a]=n):"style"===a?s[a]=d(d({}
2,n),l):"className"===a&&(s[a]=[n,l].filter(Boolean).join(" "))}return d(d({},e),s)}(n,a.props);return a.type!==t.Fragment&&(l.ref=s?gr(s,e):e),t.cloneElement(a,l)}return t.Children.count(a)>1?t.Children.only(null):null});return s.displayName="".concat(e,".SlotClone"),s}var EV=Symbol("radix.slottable");function AV(e){return t.isValidElement(e)&&"function"===typeof e.type&&"__radixId"in e.type&&e.type.__radixId===EV}const FV=["__scopePopover"],TV=["__scopePopover"],zV=["forceMount"],MV=["__scopePopover","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside"],PV=["__scopePopover"],BV=["__scopePopover"];var RV="Popover",[LV,IV]=jr(RV,[Sc]),OV=Sc(),[UV,HV]=LV(RV),WV=e=>{const{__scopePopover:s,children:a,open:n,defaultOpen:l,onOpenChange:r,modal:i=!1}=e,o=OV(s),c=t.useRef(null),[u,m]=t.useState(!1),[h,x]=Cr({prop:n,defaultProp:null!==l&&void 0!==l&&l,onChange:r,caller:RV});return(0,ea.jsx)(Vc,d(d({},o),{},{children:(0,ea.jsx)(UV,{scope:s,contentId:ki(),triggerRef:c,open:h,onOpenChange:x,onOpenToggle:t.useCallback(()=>x(e=>!e),[x]),hasCustomAnchor:u,onCustomAnchorAdd:t.useCallback(()=>m(!0),[]),onCustomAnchorRemove:t.useCallback(()=>m(!1),[]),modal:i,children:a})}))};WV.displayName=RV;var VV="PopoverAnchor",qV=t.forwardRef((e,s)=>{const{__scopePopover:a}=e,n=l(e,FV),r=HV(VV,a),i=OV(a),{onCustomAnchorAdd:o,onCustomAnchorRemove:c}=r;return t.useEffect(()=>(o(),()=>c()),[o,c]),(0,ea.jsx)(qc,d(d(d({},i),n),{},{ref:s}))});qV.displayName=VV;var $V="PopoverTrigger",GV=t.forwardRef((e,t)=>{const{__scopePopover:s}=e,a=l(e,TV),n=HV($V,s),r=OV(s),i=fr(t,n.triggerRef),o=(0,ea.jsx)(Tr.button,d(d({type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":iq(n.open)},a),{},{ref:i,onClick:xr(e.onClick,n.onOpenToggle)}));return n.hasCustomAnchor?o:(0,ea.jsx)(qc,d(d({asChild:!0},r),{},{children:o}))});GV.displayName=$V;var KV="PopoverPortal",[YV,JV]=LV(KV,{forceMount:void 0}),QV=e=>{const{__scopePopover:t,forceMount:s,children:a,container:n}=e,l=HV(KV,t);return(0,ea.jsx)(YV,{scope:t,forceMount:s,children:(0,ea.jsx)(Jc,{present:s||l.open,children:(0,ea.jsx)(Yc,{asChild:!0,container:n,children:a})})})};QV.displayName=KV;var XV="PopoverContent",ZV=t.forwardRef((e,t)=>{const s=JV(XV,e.__scopePopover),{forceMount:a=s.forceMount}=e,n=l(e,zV),r=HV(XV,e.__scopePopover);return(0,ea.jsx)(Jc,{present:a||r.open,children:r.modal?(0,ea.jsx)(tq,d(d({},n),{},{ref:t})):(0,ea.jsx)(sq,d(d({},n),{},{ref:t}))})});ZV.displayName=XV;var eq=_V("PopoverContent.RemoveScroll"),tq=t.forwardRef((e,s)=>{const a=HV(XV,e.__scopePopover),n=t.useRef(null),l=fr(s,n),r=t.useRef(!1);return t.useEffect(()=>{const e=n.current;if(e)return Fd(e)},[]),(0,ea.jsx)(Nu,{as:eq,allowPinchZoom:!0,children:(0,ea.jsx)(aq,d(d({},e),{},{ref:l,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xr(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),r.current||null===(t=a.triggerRef.current)||void 0===t||t.focus()}),onPointerDownOutside:xr(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,s=0===t.button&&!0===t.ctrlKey,a=2===t.button||s;r.current=a},{checkForDefaultPrevented:!1}),onFocusOutside:xr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})}))})}),sq=t.forwardRef((e,s)=>{const a=HV(XV,e.__scopePopover),n=t.useRef(!1),l=t.useRef(!1);return(0,ea.jsx)(aq,d(d({},e),{},{ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var s,r;(null===(s=e.onCloseAutoFocus)||void 0===s||s.call(e,t),t.defaultPrevented)||(n.current||null===(r=a.triggerRef.current)||void 0===r||r.focus(),t.preventDefault());n.current=!1,l.current=!1},onInteractOutside:t=>{var s,r;null===(s=e.onInteractOutside)||void 0===s||s.call(e,t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(l.current=!0));const i=t.target;(null===(r=a.triggerRef.current)||void 0===r?void 0:r.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&l.current&&t.preventDefault()}}))}),aq=t.forwardRef((e,t)=>{const{__scopePopover:s,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:r,disableOutsidePointerEvents:i,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:m}=e,h=l(e,MV),x=HV(XV,s),p=OV(s);return di(),(0,ea.jsx)(gi,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:r,children:(0,ea.jsx)(li,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:m,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>x.onOpenChange(!1),children:(0,ea.jsx)($c,d(d(d({"data-state":iq(x.open),role:"dialog",id:x.contentId},p),h),{},{ref:t,style:d(d({},h.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)"})}))})})}),nq="PopoverClose",lq=t.forwardRef((e,t)=>
2{const{__scopePopover:s}=e,a=l(e,PV),n=HV(nq,s);return(0,ea.jsx)(Tr.button,d(d({type:"button"},a),{},{ref:t,onClick:xr(e.onClick,()=>n.onOpenChange(!1))}))});lq.displayName=nq;var rq=t.forwardRef((e,t)=>{const{__scopePopover:s}=e,a=l(e,BV),n=OV(s);return(0,ea.jsx)(Gc,d(d(d({},n),a),{},{ref:t}))});function iq(e){return e?"open":"closed"}rq.displayName="PopoverArrow";var oq=QV,cq=ZV;const dq=["className","align","sideOffset"],uq=WV,mq=GV,hq=t.forwardRef((e,t)=>{let{className:s,align:a="center",sideOffset:n=4}=e,r=l(e,dq);return(0,ea.jsx)(oq,{children:(0,ea.jsx)(cq,d({ref:t,align:a,sideOffset:n,className:Np("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 origin-[--radix-popover-content-transform-origin]",s)},r))})});hq.displayName=cq.displayName;const xq=[{label:"Default",value:"inherit"},{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Palatino",value:"Palatino Linotype, serif"},{label:"Garamond",value:"Garamond, serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Lucida Console",value:"Lucida Console, monospace"},{label:"Monaco",value:"Monaco, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Inter",value:"Inter, sans-serif"},{label:"Manrope",value:"Manrope, sans-serif"},{label:"Open Sans",value:"Open Sans, sans-serif"},{label:"Roboto",value:"Roboto, sans-serif"},{label:"Lato",value:"Lato, sans-serif"},{label:"Montserrat",value:"Montserrat, sans-serif"},{label:"Poppins",value:"Poppins, sans-serif"},{label:"Playfair Display",value:"Playfair Display, serif"},{label:"Merriweather",value:"Merriweather, serif"}],pq=Vl("wand-sparkles",[["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"}]]),gq=Vl("refresh-cw",[["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"}]]),fq=["freemium","free"],vq=[{label:"Shorter",instruction:"Make this shorter and more concise."},{label:"Longer",instruction:"Expand this with more detail."},{label:"More formal",instruction:"Rewrite this in a more formal, professional tone."},{label:"Friendlier",instruction:"Rewrite this in a warmer, friendlier tone."},{label:"Fix grammar",instruction:"Fix any grammar and spelling mistakes without changing the meaning."}],bq=e=>{let{onInsert:s}=e;const{planLevel:a}=Jk(),[n,l]=(0,t.useState)(!1),[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)(""),[d,u]=(0,t.useState)(!1),[m,h]=(0,t.useState)(null),[x,p]=(0,t.useState)([]),[g,f]=(0,t.useState)(!1),v=a&&fq.includes(String(a).toLowerCase());(0,t.useEffect)(()=>{if(!n)return;let e=!1;return(async()=>{try{const[t,s]=await Promise.all([_l.get("/ai/credits"),_l.get("/ai/packages")]);e||(h(t.data),p(s.data.packages||[]))}catch(G2){}})(),()=>{e=!0}},[n]);const b=null===m||void 0===m?void 0:m.unlimited,j=null===m||void 0===m?void 0:m.total_remaining,y=!!m&&!b&&"number"===typeof j&&j<=5,N=x.length?[...x].sort((e,t)=>e.price-t.price)[0]:null;if(v)return null;const w=async(e,t)=>{if(e.trim()){u(!0);try{const s={prompt:e,mode:t?"refine":"generate"};t&&o&&(s.current_text=C(o));const{data:a}=await _l.post("/ai/assist-text",s);c(a.text||""),a.status&&h(a.status)}catch(K2){var s,a,n;const t=null===(s=K2.response)||void 0===s?void 0:s.status,l=null===(a=K2.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.detail;402===t?qs.error(l||"Out of AI credits. Purchase more to continue."):403===t?qs.error(l||"AI is not available on your plan."):qs.error(l||"AI generation failed. Please try again.")}finally{u(!1)}}else qs.error("Please enter a prompt")},C=e=>{const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""},k=()=>
2{l(!1),i(""),c("")};return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(NC,{children:(0,ea.jsxs)(wC,{children:[(0,ea.jsx)(CC,{asChild:!0,children:(0,ea.jsxs)(sg,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(!0),className:"h-8 gap-1 px-2 text-violet-600 hover:bg-violet-50 hover:text-violet-700","data-testid":"tiptap-ai-assist-btn",children:[(0,ea.jsx)($g,{size:16}),(0,ea.jsx)("span",{className:"text-xs font-medium",children:"AI"})]})}),(0,ea.jsx)(kC,{children:"Write with AI"})]})}),(0,ea.jsx)(Ok,{open:n,onOpenChange:e=>e?l(!0):k(),children:(0,ea.jsxs)(Wk,{className:"max-w-lg","data-testid":"ai-assist-dialog",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(pq,{size:18,className:"text-violet-600"}),"AI Writing Assistant"]}),(0,ea.jsxs)(Gk,{children:["Describe what you want to write. Each generation uses 1 AI Generation.",m&&(0,ea.jsx)("span",{className:"ml-1 font-medium text-slate-700",children:b?"(Unlimited)":"(".concat(j," left)")})]})]}),(0,ea.jsxs)("div",{className:"space-y-3",children:[y&&N&&(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2","data-testid":"ai-assist-low-nudge",children:[(0,ea.jsx)("span",{className:"text-xs text-amber-800",children:0===j?"You're out of AI Generations this month.":"Only ".concat(j," AI Generation").concat(1===j?"":"s"," left this month.")}),(0,ea.jsxs)(sg,{type:"button",size:"sm",onClick:async()=>{if(N){f(!0);try{const{data:e}=await _l.post("/ai/purchase-credits?package=".concat(N.id));window.open(e.url,"_blank"),qs.success("Opening secure checkout\u2026")}catch(G2){var e,t;qs.error((null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to start checkout")}finally{f(!1)}}},disabled:g,className:"h-7 gap-1 whitespace-nowrap bg-amber-600 px-2.5 text-xs hover:bg-amber-700","data-testid":"ai-assist-buy-topup",children:[g?(0,ea.jsx)(ql,{size:12,className:"animate-spin"}):(0,ea.jsx)(Gl,{size:12}),"Buy ",N.credits," \xb7 $",N.price]})]}),(0,ea.jsx)(YN,{value:r,onChange:e=>i(e.target.value),placeholder:"e.g. Write a friendly intro paragraph about our summer sale...",rows:3,className:"resize-none","data-testid":"ai-assist-prompt"}),(0,ea.jsx)("div",{className:"flex items-center gap-2",children:(0,ea.jsxs)(sg,{type:"button",onClick:()=>w(r,!1),disabled:d||!r.trim(),className:"flex-1 gap-2 bg-violet-600 hover:bg-violet-700","data-testid":"ai-assist-generate",children:[d?(0,ea.jsx)(ql,{size:16,className:"animate-spin"}):(0,ea.jsx)($g,{size:16}),o?"Regenerate":"Generate"]})}),o&&(0,ea.jsxs)("div",{className:"space-y-3","data-testid":"ai-assist-result",children:[(0,ea.jsx)("div",{className:"prose prose-sm max-w-none rounded-lg border border-slate-200 bg-slate-50 p-3 max-h-56 overflow-auto",dangerouslySetInnerHTML:{__html:o}}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"mb-1.5 text-xs font-medium text-slate-500",children:"Quick refine"}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-1.5",children:vq.map(e=>(0,ea.jsxs)("button",{type:"button",onClick:()=>w(e.instruction,!0),disabled:d,className:"inline-flex items-center gap-1 rounded-full border border-slate-200 bg-white px-2.5 py-1 text-xs text-slate-600 hover:border-violet-300 hover:text-violet-700 disabled:opacity-50","data-testid":"ai-refine-".concat(e.label.toLowerCase().replace(/\s+/g,"-")),children:[(0,ea.jsx)(gq,{size:11}),e.label]},e.label))})]}),(0,ea.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,ea.jsx)(sg,{type:"button",onClick:()=>{o&&(s(o),qs.success("Content inserted"),k())},disabled:d,className:"flex-1 bg-emerald-600 hover:bg-emerald-700","data-testid":"ai-assist-insert",children:"Insert into editor"}),(0,ea.jsx)(sg,{type:"button",variant:"outline",onClick:k,disabled:d,children:"Cancel"})]})]})]})]})})]})},jq=["value","onChange","placeholder","className"],yq=t.memo(function(e){let{value:s,onChange:a,placeholder:n,className:r}=e,i=l(e,jq);const[o,c]=t.useState(null!==s&&void 0!==s?s:""),u=t.useRef(null!==s&&void 0!==s?s:"");t.useEffect(()=>{const e=null!==s&&void 0!==s?s:"";e!==u.current&&(u.current=e,c(e))},[s]);const m=e=>/^#[0-9a-fA-F]{3}$/.test(e)||/^#[0-9a-fA-F]{6}$/.test(e);return(0,ea.jsx)(BN,d({value:o,onChange:e=>{const t=e.target.value;c(t),m(t)&&(u.current=t,a(e))},onBlur:e=>{if(m(o))u.current=o,a(d(d({},e),{},{target:d(d({},e.target),{},{value:o})}));else{const e=null!==s&&void 0!==s?s:"";c(e),u.current=e}},placeholder:n,className:r},i))}),Nq=t.memo(function(e){let{value:s,onChange:a,className:n="","data-testid":l,title:r,defaultValue:i="#000000",onPickerMouseDown:o}=e;const c=t.useMemo(()=>{const e=s||i;return/^#[0-9a-fA-F]{3,6}$/.test(e)?e:i},[s,i]);return(0,ea.jsxs)("label",{className:"relative inline-flex flex-shrink-0 cursor-pointer","data-testid":l,title:r,style:{display:"inline-flex"},onMouseDown:o,children:[(0,ea.jsx)("span",{className:"w-8 h-8 rounded-md border-2 border-slate-300 hover:border-indigo-400 transition-all shadow-sm block pointer-events-none",style:{backgroundColor:c}}),(0,ea.jsx)("input",{type:"color",value:c,onChange:a,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",tabIndex:-1,"aria-label":"Pick colour"})]})}),wq=Nq,Cq=e=>{let{content:s,onChange:a,placeholder:n="Start typing...",enableAiAssist:l=!1}=e;const[r,i]=t.useState(!1),[o,c]=t.useState(""),[,d]=t.useReducer(e=>e+1,0),u=t.useRef(null),m=uO({extensions:[QW.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1},underline:!1,link:!1}),pW,eV,sV,uV,mV,oV.configure({multicolor:!0}),XW.configure({types:["heading","paragraph"]}),RH.configure({openOnClick:!1,HTMLAttributes:{style:"color: #4F46E5; text-decoration: underline;"}}),dV],content:s||"<p></p>",onUpdate:e=>{let{editor:t}=e;a&&a(t.getHTML())},onTransaction:()=>{d()}});t.useEffect(()=>{if(!m)return;const e=s||"<p></p>";e!==m.getHTML()&&m.commands.setContent(e,{emitUpdate:!1})},[s,m]);const[h,x]=t.useState(!1),[p,g]=t.useState(!1),f=()=>{if(m){const e=m.state.selection.from,t=m.state.selection.to;u.current={from:e,to:t}}},v=e=>{if(m){if(u.current){const{from:e,to:t}=u.current;m.chain().focus().setTextSelection({from:e,to:t}).run()}else m.chain().focus().run();Promise.resolve().then(()=>{e()})}},b=()=>{if(o&&m){if(u.current){const{from:e,to:t}=u.current;m.chain().focus().setTextSelection({from:e,to:t}).setLink({href:o}).run()}else m.chain().focus().setLink({href:o}).run();c(""),i(!1)}};if(!m)return null;const j=m.getAttributes("textStyle").color||"#000000",y=m.getAttributes("highlight").color||"#ffff00";return(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-1 p-3 bg-slate-50 border-b border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1 pr-2 border-r border-slate-300",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>
2m.chain().focus().undo().run(),disabled:!m.can().undo(),className:"p-2 hover:bg-slate-200 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:"Undo (Ctrl/Cmd+Z)","data-testid":"tiptap-undo-btn",children:(0,ea.jsx)(hV,{size:16})}),(0,ea.jsx)("button",{type:"button",onClick:()=>m.chain().focus().redo().run(),disabled:!m.can().redo(),className:"p-2 hover:bg-slate-200 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:"Redo (Ctrl/Cmd+Shift+Z)","data-testid":"tiptap-redo-btn",children:(0,ea.jsx)(xV,{size:16})})]}),(0,ea.jsx)("div",{className:"flex items-center gap-1 pr-2 border-r border-slate-300",children:(0,ea.jsxs)(eb,{value:m.isActive("heading",{level:1})?"h1":m.isActive("heading",{level:2})?"h2":m.isActive("heading",{level:3})?"h3":m.isActive("heading",{level:4})?"h4":m.isActive("heading",{level:5})?"h5":m.isActive("heading",{level:6})?"h6":"p",onOpenChange:e=>{e&&f()},onValueChange:e=>{v(()=>{if("p"===e)m.chain().focus().setParagraph().run();else{const t=parseInt(e.replace("h",""));m.chain().focus().setHeading({level:t}).run()}})},children:[(0,ea.jsx)(sb,{className:"h-8 w-24 text-xs","data-testid":"tiptap-heading-select",children:(0,ea.jsx)(tb,{placeholder:"Style"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"p",children:"Paragraph"}),(0,ea.jsx)(rb,{value:"h1",children:"Heading 1"}),(0,ea.jsx)(rb,{value:"h2",children:"Heading 2"}),(0,ea.jsx)(rb,{value:"h3",children:"Heading 3"}),(0,ea.jsx)(rb,{value:"h4",children:"Heading 4"}),(0,ea.jsx)(rb,{value:"h5",children:"Heading 5"}),(0,ea.jsx)(rb,{value:"h6",children:"Heading 6"})]})]})}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 pr-2 border-r border-slate-300",children:[(0,ea.jsxs)(eb,{value:(()=>{if(!m)return"16px";const e=m.getAttributes("textStyle").fontSize;if(e)return e;const t={1:"32px",2:"24px",3:"20px",4:"18px",5:"16px",6:"14px"};for(let s=1;s<=6;s+=1)if(m.isActive("heading",{level:s}))return t[s];return"16px"})(),onOpenChange:e=>{e&&f()},onValueChange:e=>{v(()=>{m.chain().focus().setFontSize(e).run()})},children:[(0,ea.jsx)(sb,{className:"h-8 w-20 text-xs","data-testid":"tiptap-fontsize-select",children:(0,ea.jsx)(tb,{placeholder:"Size"})}),(0,ea.jsx)(lb,{children:[{label:"6px",value:"6px"},{label:"8px",value:"8px"},{label:"10px",value:"10px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"40px",value:"40px"},{label:"48px",value:"48px"},{label:"56px",value:"56px"},{label:"64px",value:"64px"},{label:"72px",value:"72px"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsxs)(eb,{value:m.getAttributes("textStyle").fontFamily||"inherit",onOpenChange:e=>{e&&f()},onValueChange:e=>{v(()=>{"inherit"===e?m.chain().focus().unsetFontFamily().run():m.chain().focus().setFontFamily(e).run()})},children:[(0,ea.jsxs)(sb,{className:"h-8 w-28 text-xs","data-testid":"tiptap-fontfamily-select",children:[(0,ea.jsx)(wE,{size:14,className:"mr-1"}),(0,ea.jsx)(tb,{placeholder:"Font"})]}),(0,ea.jsx)(lb,{children:xq.map(e=>(0,ea.jsx)(rb,{value:e.value,style:{fontFamily:e.value},children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 pr-2 border-r border-slate-300",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().toggleBold().run(),className:"h-8 w-8 p-0 ".concat(m.isActive("bold")?"bg-slate-200":""),"data-testid":"tiptap-bold",children:(0,ea.jsx)(pV,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().toggleItalic().run(),className:"h-8 w-8 p-0 ".concat(m.isActive("italic")?"bg-slate-200":""),"data-testid":"tiptap-italic",children:(0,ea.jsx)(gV,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().toggleUnderline().run(),className:"h-8 w-8 p-0 ".concat(m.isActive("underline")?"bg-slate-200":""),"data-testid":"tiptap-underline",children:(0,ea.jsx)(fV,{size:16})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 pr-2 border-r border-slate-300",children:[(0,ea.jsxs)(uq,{open:h,onOpenChange:e=>{x(e),e&&f()},children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 relative","data-testid":"tiptap-text-color",onMouseDown:e=>{e.preventDefault(),f()},children:[(0,ea.jsx)(wE,{size:16}),(0,ea.jsx)("div",{className:"absolute bottom-1 left-1/2 transform -translate-x-1/2 w-4 h-1 rounded",style:{backgroundColor:j}})]})}),(0,ea.jsx)(hq,{className:"w-64 p-3",onOpenAutoFocus:e=>e.preventDefault(),onFocusOutside:e=>e.preventDefault(),children:(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Text Color"}),(0,ea.jsx)("div",{className:"grid grid-cols-8 gap-1",children:["#000000","#ffffff","#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ec4899","#64748b"].map(e=>(0,ea.jsx)("button",{onMouseDown:t=>{t.preventDefault();const s=u.current;m&&s&&s.from!==s.to&&m.chain().focus().setTextSelection({from:s.from,to:s.to}).setColor(e).run(),x(!1)},className:"w-6 h-6 rounded border border-slate-300 hover:scale-110 transition-transform cursor-pointer",style:{backgroundColor:e}},e))}),(0,ea.jsxs)("div",{className:"pt-1 border-t border-slate-100",children:[(0,ea.jsx)("label",{className:"text-[11px] text-slate-500 block mb-1",children:"Custom colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(j)?j:"#000000",onPickerMouseDown:()=>f(),onChange:e=>{const t=e.target.value,s=u.current;m&&s&&s.from!==s.to?m.chain().setTextSelection({from:s.from,to:s.to}).setColor(t).run():m&&m.chain().setColor(t).run()},"data-testid":"tiptap-text-color-picker"}),(0,ea.jsx)("input",{type:"text",value:j,onChange:e=>{const t=e.target.value.trim();if(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t)){const e=u.current;m&&e&&e.from!==e.to?m.chain().setTextSelection({from:e.from,to:e.to}).setColor(t).run():m&&m.chain().setColor(t).run()}},className:"flex-1 h-7 text-xs font-mono px-2 rounded border border-slate-300 focus:outline-none focus:ring-1 focus:ring-indigo-400",placeholder:"#000000","data-testid":"tiptap-text-color-hex"})]})]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onMouseDown:e=>{e.preventDefault();const t=u.current;m&&t&&t.from!==t.to&&m.chain().focus().setTextSelection({from:t.from,to:t.to}).unsetColor().run(),x(!1)},className:"w-full",children:"Clear Color"})]})})]}),(0,ea.jsxs)(uq,{open:p,onOpenChange:e=>{g(e),e&&f()},children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 relative","data-testid":"tiptap-highlight",onMouseDown:e=>{e.preventDefault(),f()},children:[(0,ea.jsx)(vV,{size:16}),(0,ea.jsx)("div",{className:"absolute bottom-1 left-1/2 transform -translate-x-1/2 w-4 h-1 rounded",style:{backgroundColor:y}})]})}),(0,ea.jsx)(hq,{className:"w-64 p-3",onOpenAutoFocus:e=>e.preventDefault(),onFocusOutside:e=>e.preventDefault(),children:(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Highlight Color"}),(0,ea.jsx)("div",{className:"grid grid-cols-8 gap-1",children:["#ffff00","#fef3c7","#fecaca","#bbf7d0","#bfdbfe","#ddd6fe","#fce7f3","#f1f5f9"].map(e=>(0,ea.jsx)("button",{onMouseDown:t=>{t.preventDefault(),t.stopPropagation();const s=u.current;m&&s&&(s.from!==s.to?m.chain().focus().setTextSelection({from:s.from,to:s.to}).setHighlight({color:e}).run():m.chain().focus().setHighlight({color:e}).run()),g(!1)},className:"w-6 h-6 rounded border border-slate-300 hover:scale-110 transition-transform cursor-pointer",style:{backgroundColor:e}},e))}),(0,ea.jsxs)("div",{className:"pt-1 border-t border-slate-100",children:[(0,ea.jsx)("label",{className:"text-[11px] text-slate-500 block mb-1",children:"Custom colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:y||"#ffff00",onPickerMouseDown:()=>f(),onChange:e=>{const t=e.target.value,s=u.current;m&&s&&s.from!==s.to?m.chain().setTextSelection({from:s.from,to:s.to}).setHighlight({color:t}).run():m&&m.chain().setHighlight({color:t}).run()},"data-testid":"tiptap-highlight-color-picker"}),(0,ea.jsx)("input",{type:"text",value:y||"#ffff00",onChange:e=>{const t=e.target.value.trim();if(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t)){const e=u.current;m&&e&&e.from!==e.to?m.chain().setTextSelection({from:e.from,to:e.to}).setHighlight({color:t}).run():m&&m.chain().setHighlight({color:t}).run()}},className:"flex-1 h-7 text-xs font-mono px-2 rounded border border-slate-300 focus:outline-none focus:ring-1 focus:ring-indigo-400",placeholder:"#ffff00","data-testid":"tiptap-highlight-color-hex"})]})]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onMouseDown:e=>{e.preventDefault();const t=u.current;m&&t&&t.from!==t.to&&m.chain().focus().setTextSelection({from:t.from,to:t.to}).unsetHighlight().run(),g(!1)},className:"w-full",children:"Remove Highlight"})]})})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 pr-2 border-r border-slate-300",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().setTextAlign("left").run(),className:"h-8 w-8 p-0 ".concat(m.isActive({textAlign:"left"})?"bg-slate-200":""),"data-testid":"tiptap-align-left",children:(0,ea.jsx)(bV,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().setTextAlign("center").run(),className:"h-8 w-8 p-0 ".concat(m.isActive({textAlign:"center"})?"bg-slate-200":""),"data-testid":"tiptap-align-center",children:(0,ea.jsx)(jV,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().setTextAlign("right").run(),className:"h-8 w-8 p-0 ".concat(m.isActive({textAlign:"right"})?"bg-slate-200":""),"data-testid":"tiptap-align-right",children:(0,ea.jsx)(yV,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().setTextAlign("justify").run(),className:"h-8 w-8 p-0 ".concat(m.isActive({textAlign:"justify"})?"bg-slate-200":""),"data-testid":"tiptap-align-justify",children:(0,ea.jsx)(NV,{size:16})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 pr-2 border-r border-slate-300",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().toggleBulletList().run(),className:"h-8 w-8 p-0 ".concat(m.isActive("bulletList")?"bg-slate-200":""),"data-testid":"tiptap-bullet-list",title:"Bullet List",children:(0,ea.jsx)(IE,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m.chain().focus().toggleOrderedList().run(),className:"h-8 w-8 p-0 ".concat(m.isActive("orderedList")?"bg-slate-200":""),"data-testid":"tiptap-ordered-list",title:"Numbered List",children:(0,ea.jsx)(wV,{size:16})})]}),(0,ea.jsx)("div",{className:"flex items-center gap-1",children:(0,ea.jsxs)(uq,{open:r,onOpenChange:e=>{e?f():c(""),i(e)},children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onMouseDown:e=>{e.preventDefault(),f()},className:"h-8 w-8 p-0 ".concat(m.isActive("link")?"bg-slate-200":""),"data-testid":"tiptap-link",children:(0,ea.jsx)(CV,{size:16})})}),(0,ea.jsx)(hq,{className:"w-72 p-3",onOpenAutoFocus:e=>e.preventDefault(),children:(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Add Link"}),(0,ea.jsx)(BN,{type:"url",placeholder:"https://example.com",value:o,onChange:e=>c(e.target.value),className:"h-8 text-sm",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),b())},"data-testid":"tiptap-link-input"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{size:"sm",onMouseDown:e=>{e.preventDefault(),b()},className:"h-8 flex-1 bg-indigo-600 hover:bg-indigo-700",children:"Add Link"}),m.isActive("link")&&(0,ea.jsx)(sg,{size:"sm",variant:"outline",onMouseDown:e=>{e.preventDefault(),v(()=>{m.chain().focus().unsetLink().run()}),i(!1)},className:"h-8",children:"Remove"})]})]})})]})}),l&&(0,ea.jsx)("div",{className:"flex items-center gap-1 pl-2 border-l border-slate-300 ml-auto",children:(0,ea.jsx)(bq,{onInsert:e=>{m.chain().focus().insertContent(e).run()}})})]}),(0,ea.jsx)(lO,{editor:m,className:"prose prose-sm max-w-none p-4 min-h-[350px] focus:outline-none","data-testid":"tiptap-content"}),(0,ea.jsx)("style",{children:"\n .ProseMirror {\n outline: none;\n }\n .ProseMirror p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n float: left;\n color: #adb5bd;\n pointer-events: none;\n height: 0;\n }\n .ProseMirror p {\n margin: 0.5rem 0;\n }\n .ProseMirror h1 {\n font-size: 36px;\n font-weight: 700;\n margin: 1rem 0 0.5rem 0;\n }\n .ProseMirror h2 {\n font-size: 30px;\n font-weight: 700;\n margin: 1rem 0 0.5rem 0;\n }\n .ProseMirror h3 {\n font-size: 24px;\n font-weight: 600;\n margin: 1rem 0 0.5rem 0;\n }\n .ProseMirror h4 {\n font-size: 20px;\n font-weight: 600;\n margin: 1rem 0 0.5rem 0;\n }\n .ProseMirror h5 {\n font-size: 18px;\n font-weight: 600;\n margin: 1rem 0 0.5rem 0;\n }\n .ProseMirror h6 {\n font-size: 16px;\n font-weight: 600;\n margin: 1rem 0 0.5rem 0;\n }\n .ProseMirror ul {\n list-style-type: disc;\n padding-left: 1.5rem;\n margin: 0.5rem 0;\n }\n .ProseMirror ol {\n list-style-type: decimal;\n padding-left: 1.5rem;\n margin: 0.5rem 0;\n }\n .ProseMirror ul li,\n .ProseMirror ol li {\n margin: 0.25rem 0;\n }\n .ProseMirror ul ul {\n list-style-type: circle;\n }\n .ProseMirror ul ul ul {\n list-style-type: square;\n }\n "})]})},kq=Vl("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"}]]),Dq=e=>{let{open:s,onClose:a,onSelect:n}=e;const[l,r]=(0,t.useState)([]),[i,o]=(0,t.useState)([]),[c,d]=(0,t.useState)(!0),[u,m]=(0,t.useState)(""),[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(null);(0,t.useEffect)(()=>{s&&(f(),g(null),m(""))},[s]);const f=async()=>{d(!0);try{const[e,t]=await Promise.all([_l.get("/media"),_l.get("/media/folders").catch(()=>({data:[]}))]);r(e.data||[]),o(t.data||[])}catch(e){qs.error("Failed to load media")}finally{d(!1)}},v=(0,t.useMemo)(()=>{const e=new Map(i.map(e=>[e.folder_id,e])),t=new Map;return s=>{if(!s)return"Root";if(t.has(s))return t.get(s);const a=[];let n=e.get(s);const l=new Set;for(;n&&!l.has(n.folder_id);)l.add(n.folder_id),a.unshift(n.name||"Unnamed"),n=n.parent_id?e.get(n.parent_id):null;const r=a.length?a.join(" / "):"Root";return t.set(s,r),r}},[i]),b=(0,t.useMemo)(()=>
2{if(!p)return[];const e=new Map(i.map(e=>[e.folder_id,e])),t=[];let s=e.get(p);const a=new Set;for(;s&&!a.has(s.folder_id);)a.add(s.folder_id),t.unshift(s),s=s.parent_id?e.get(s.parent_id):null;return t},[p,i]),j=(0,t.useMemo)(()=>i.filter(e=>p?e.parent_id===p:!e.parent_id),[i,p]),y=u.trim().length>0,N=(0,t.useMemo)(()=>{if(y){const e=u.toLowerCase();return l.filter(t=>[t.filename,t.original_filename,t.alt_text,t.title,t.caption,t.custom_slug].some(t=>"string"===typeof t&&t.toLowerCase().includes(e)))}return l.filter(e=>!p||e.folder_id===p)},[l,p,u,y]),[w,C]=(0,t.useState)(1),[k,D]=(0,t.useState)(()=>{try{return localStorage.getItem("nexuscms_media_sort")||"newest"}catch(G2){return"newest"}});(0,t.useEffect)(()=>{try{localStorage.setItem("nexuscms_media_sort",k)}catch(G2){}},[k]),(0,t.useEffect)(()=>{C(1)},[p,u,k]);const _=(0,t.useMemo)(()=>{const e=[...N],t=e=>new Date(e.uploaded_at||0).getTime(),s=e=>(e.filename||"").toLowerCase(),a=e=>Number(e.size||0);switch(k){case"oldest":e.sort((e,s)=>t(e)-t(s));break;case"name-asc":e.sort((e,t)=>s(e).localeCompare(s(t)));break;case"name-desc":e.sort((e,t)=>s(t).localeCompare(s(e)));break;case"size-desc":e.sort((e,t)=>a(t)-a(e));break;case"size-asc":e.sort((e,t)=>a(e)-a(t));break;default:e.sort((e,s)=>t(s)-t(e))}return e},[N,k]),S=Math.max(1,Math.ceil(_.length/60)),E=Math.min(w,S),A=60*(E-1),F=_.slice(A,A+60);return(0,ea.jsx)(Ok,{open:s,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-4xl max-h-[85vh]","data-testid":"media-picker-modal",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Select from Media Library"})}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3",children:[(0,ea.jsxs)("div",{className:"flex-1 relative",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:18}),(0,ea.jsx)(BN,{placeholder:"Search media \u2014 filename, alt text, title, caption\u2026",value:u,onChange:e=>m(e.target.value),className:"pl-10 pr-9","data-testid":"media-search"}),u&&(0,ea.jsx)("button",{type:"button",onClick:()=>m(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-slate-100 text-slate-400 hover:text-slate-600",title:"Clear search","data-testid":"media-search-clear",children:(0,ea.jsx)(sr,{size:14})})]}),(0,ea.jsxs)(eb,{value:k,onValueChange:D,children:[(0,ea.jsx)(sb,{className:"h-10 w-full sm:w-[170px] shrink-0","data-testid":"media-picker-sort-trigger",children:(0,ea.jsx)(tb,{placeholder:"Sort by"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"newest",children:"Newest first"}),(0,ea.jsx)(rb,{value:"oldest",children:"Oldest first"}),(0,ea.jsx)(rb,{value:"name-asc",children:"Name A \u2013 Z"}),(0,ea.jsx)(rb,{value:"name-desc",children:"Name Z \u2013 A"}),(0,ea.jsx)(rb,{value:"size-desc",children:"Largest first"}),(0,ea.jsx)(rb,{value:"size-asc",children:"Smallest first"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("input",{type:"file",id:"media-upload-modal",className:"hidden",onChange:async e=>{var t;const s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!s)return;x(!0);const a=new FormData;a.append("file",s),p&&a.append("folder_id",p);try{await _l.post("/media/upload",a,{headers:{"Content-Type":"multipart/form-data"}}),qs.success("File uploaded"),f()}catch(n){qs.error("Upload failed")}finally{x(!1),e.target.value=""}},accept:"image/*",disabled:h}),(0,ea.jsx)("label",{htmlFor:"media-upload-modal",children:(0,ea.jsx)(sg,{asChild:!0,disabled:h,"data-testid":"upload-media-button",children:(0,ea.jsxs)("span",{className:"cursor-pointer",children:[(0,ea.jsx)(kq,{size:18,className:"mr-2"}),h?"Uploading...":"Upload here"]})})})]})]}),y&&(0,ea.jsxs)("p",{className:"text-xs text-slate-500","data-testid":"media-picker-search-result-count",children:[N.length," ",1===N.length?"result":"results"," for",(0,ea.jsxs)("span",{className:"font-medium text-slate-700",children:[' "',u,'"']})," across all folders"]}),!y&&(0,ea.jsxs)("div",{className:"flex items-center gap-1 text-sm text-slate-600 flex-wrap","data-testid":"media-picker-breadcrumbs",children:[(0,ea.jsxs)("button",{type:"button",onClick:()=>g(null),className:"flex items-center gap-1 px-2 py-1 rounded hover:bg-slate-100 ".concat(p?"":"text-indigo-600 font-semibold"),"data-testid":"media-picker-breadcrumb-root",children:[(0,ea.jsx)(Rj,{size:14}),(0,ea.jsx)("span",{children:"Root"})]}),b.map((e,s)=>(0,ea.jsxs)(t.Fragment,{children:[(0,ea.jsx)(ax,{size:14,className:"text-slate-400"}),(0,ea.jsx)("button",{type:"button",onClick:()=>g(e.folder_id),className:"px-2 py-1 rounded hover:bg-slate-100 ".concat(s===b.length-1?"text-indigo-600 font-semibold":""),"data-testid":"media-picker-breadcrumb-".concat(e.folder_id),children:e.name||"Unnamed"})]},e.folder_id)),p&&(0,ea.jsxs)("button",{type:"button",onClick:()=>{var e;const t=(null===(e=i.find(e=>e.folder_id===p))||void 0===e?void 0:e.parent_id)||null;g(t)},className:"ml-auto flex items-center gap-1 text-xs text-slate-500 hover:text-indigo-600","data-testid":"media-picker-up-one-level",children:[(0,ea.jsx)(_j,{size:12}),"Up one level"]})]}),c?(0,ea.jsx)("div",{className:"text-center py-12 text-slate-500",children:"Loading media..."}):(0,ea.jsxs)("div",{className:"max-h-[420px] overflow-y-auto p-1 space-y-4",children:[!y&&j.length>0&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wide mb-2 px-1",children:"Folders"}),(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-3",children:j.map(e=>{const t=l.filter(t=>t.folder_id===e.folder_id).length;return(0,ea.jsxs)("button",{type:"button",onClick:()=>g(e.folder_id),className:"flex items-center gap-2 p-3 bg-slate-50 hover:bg-indigo-50 border border-slate-200 hover:border-indigo-300 rounded-lg text-left transition-all","data-testid":"media-picker-folder-".concat(e.folder_id),title:e.name,children:[(0,ea.jsx)(bD,{size:20,className:"text-indigo-600 shrink-0"}),(0,ea.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ea.jsx)("div",{className:"text-sm font-medium text-slate-800 truncate",children:e.name||"Unnamed"}),(0,ea.jsxs)("div",{className:"text-[10px] text-slate-500",children:[t," ",1===t?"file":"files"]})]})]},e.folder_id)})})]}),(0,ea.jsxs)("div",{children:[!y&&j.length>0&&N.length>0&&(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wide mb-2 px-1",children:p?"Files in this folder":"All files \u2014 most recent first"}),0===N.length?(0,ea.jsx)("div",{className:"text-center py-10 text-slate-500 text-sm",children:y?"No media match your search.":p?j.length>0?"No files in this folder yet.":"This folder is empty.":"No media uploaded yet."}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-4",children:F.map(e=>{var t;const s=v(e.folder_id);return(0,ea.jsxs)("button",{onClick:()=>{n(e),a()},"data-testid":"media-item-select-".concat(e.media_id),className:"group relative flex flex-col bg-white rounded-lg overflow-hidden hover:ring-2 hover:ring-indigo-500 transition-all border border-slate-200 text-left",title:"".concat(e.filename," \u2014 ").concat(s),children:[(0,ea.jsxs)("div",{className:"relative aspect-square bg-slate-100",children:[null!==(t=e.mime_type)&&void 0!==t&&t.startsWith("image/")?(0,ea.jsx)("img",{src:e.url,alt:e.filename,className:"w-full h-full object-cover"}):(0,ea.jsx)("div",{className:"w-full h-full flex items-center justify-center text-4xl text-slate-300",children:"\ud83d\udcc4"}),(0,ea.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-40 transition-all flex items-center justify-center",children:(0,ea.jsx)("span",{className:"text-white opacity-0 group-hover:opacity-100 font-medium",children:"Select"})})]}),(0,ea.jsxs)("div",{className:"px-2 py-1.5 border-t border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-medium text-slate-700 truncate",title:e.filename,children:e.filename}),(y||!p)&&(0,ea.jsxs)("div",{className:"flex items-center gap-1 text-[10px] text-slate-500 truncate mt-0.5","data-testid":"media-item-folder-".concat(e.media_id),children:[(0,ea.jsx)(jD,{size:10,
2className:"shrink-0"}),(0,ea.jsx)("span",{className:"truncate",children:s})]})]})]},e.media_id)})}),S>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-between mt-4 px-1","data-testid":"media-picker-pagination",children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:[A+1,"\u2013",Math.min(A+60,N.length)," ","of ",N.length]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>C(e=>Math.max(1,e-1)),disabled:E<=1,"data-testid":"media-picker-pagination-prev",children:"Previous"}),(0,ea.jsxs)("span",{className:"text-xs text-slate-600 px-1",children:["Page ",(0,ea.jsx)("span",{className:"font-medium",children:E})," of ",S]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>C(e=>Math.min(S,e+1)),disabled:E>=S,"data-testid":"media-picker-pagination-next",children:"Next"})]})]})]})]})]})]})]})})},_q=Vl("align-vertical-space-around",[["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"}]]),Sq=Vl("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Eq=Vl("mouse-pointer",[["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"}]]),Aq=Vl("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:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),Fq=Vl("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"}]]),Tq=Vl("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"}]]),zq=e=>{let{styles:t={},onChange:s,content:a={},onContentChange:n}=e;const l=(e,a)=>{s(d(d({},t),{},{[e]:a}))};return(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-2",children:[(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(t.spaceAbove&&"auto"!==t.spaceAbove||t.spaceBelow&&"auto"!==t.spaceBelow?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-spacing-style",title:"Adjust the gap above and below this block. Set to None to butt against the next block (no white gap).",children:[(0,ea.jsx)(_q,{size:18}),(0,ea.jsx)("span",{children:"Spacing"})]})}),(0,ea.jsx)(hq,{className:"w-72 p-3",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Spacing"}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-500",children:'Controls the gap between this block and the surrounding ones. Set both to "None" to butt this block against its neighbour (no white gap).'})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Space Above"}),(0,ea.jsxs)(eb,{value:t.spaceAbove||"auto",onValueChange:e=>l("spaceAbove",e),children:[(0,ea.jsx)(sb,{className:"h-9 text-xs","data-testid":"space-above-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto (default)"}),(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"small",children:"Small"}),(0,ea.jsx)(rb,{value:"medium",children:"Medium"}),(0,ea.jsx)(rb,{value:"large",children:"Large"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Space Below"}),(0,ea.jsxs)(eb,{value:t.spaceBelow||"auto",onValueChange:e=>l("spaceBelow",e),children:[(0,ea.jsx)(sb,{className:"h-9 text-xs","data-testid":"space-below-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto (default)"}),(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"small",children:"Small"}),(0,ea.jsx)(rb,{value:"medium",children:"Medium"}),(0,ea.jsx)(rb,{value:"large",children:"Large"})]})]})]})]})})]}),(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(t.showAsCard?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-card-style",children:[(0,ea.jsx)(Aj,{size:18}),(0,ea.jsx)("span",{children:"Card"})]})}),(0,ea.jsx)(hq,{className:"w-72 p-3",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Show as Card"}),(0,ea.jsx)(wb,{checked:t.showAsCard||!1,onCheckedChange:e=>{s(d(d({},t),{},e?{showAsCard:!0,backgroundColor:t.backgroundColor||"#ffffff",shadow:t.shadow||"md",borderRadius:t.borderRadius||"12px",padding:t.padding||"24px",borderColor:t.borderColor||"#e2e8f0",borderWidth:t.borderWidth||"1px"}:{showAsCard:!1}))}})]}),t.showAsCard&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"border-t pt-3",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Card Presets"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2 mt-2",children:[(0,ea.jsx)("button",{onClick:()=>s(d(d({},t),{},{showAsCard:!0,backgroundColor:"#ffffff",shadow:"md",borderRadius:"12px",borderColor:"#e2e8f0"})),className:"p-2 rounded border border-slate-200 hover:border-indigo-300 text-xs",children:"Clean"}),(0,ea.jsx)("button",{onClick:()=>s(d(d({},t),{},{showAsCard:!0,backgroundColor:"#f8fafc",shadow:"lg",borderRadius:"16px",borderColor:"transparent"})),className:"p-2 rounded border border-slate-200 hover:border-indigo-300 text-xs",children:"Elevated"}),(0,ea.jsx)("button",{onClick:()=>s(d(d({},t),{},{showAsCard:!0,backgroundColor:"#ffffff",shadow:"none",borderRadius:"8px",borderColor:"#6366f1",borderWidth:"2px"})),className:"p-2 rounded border border-slate-200 hover:border-indigo-300 text-xs",children:"Bordered"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Card Backgroun
2d"}),(0,ea.jsx)(BN,{type:"color",value:t.backgroundColor||"#ffffff",onChange:e=>l("backgroundColor",e.target.value),className:"h-8 w-full mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Card Padding"}),(0,ea.jsxs)(eb,{value:t.padding||"24px",onValueChange:e=>l("padding",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"12px",children:"Compact"}),(0,ea.jsx)(rb,{value:"16px",children:"Small"}),(0,ea.jsx)(rb,{value:"24px",children:"Medium"}),(0,ea.jsx)(rb,{value:"32px",children:"Large"}),(0,ea.jsx)(rb,{value:"48px",children:"Extra Large"})]})]})]})]})]})})]}),(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(t.backgroundColor&&"transparent"!==t.backgroundColor?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-bg-color",children:[(0,ea.jsx)(Dw,{size:18}),(0,ea.jsx)("span",{children:"BG"})]})}),(0,ea.jsx)(hq,{className:"w-64 p-3",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Preset Colors"}),(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-2 mt-2",children:[{name:"None",value:"transparent"},{name:"White",value:"#ffffff"},{name:"Light Gray",value:"#f8fafc"},{name:"Light Blue",value:"#dbeafe"},{name:"Light Green",value:"#dcfce7"},{name:"Light Yellow",value:"#fef3c7"},{name:"Light Pink",value:"#fce7f3"},{name:"Light Purple",value:"#f3e8ff"}].map(e=>(0,ea.jsx)("button",{onClick:()=>l("backgroundColor",e.value),className:"w-8 h-8 rounded border-2 ".concat(t.backgroundColor===e.value?"border-indigo-500":"border-slate-200"),style:{backgroundColor:"transparent"===e.value?"#fff":e.value},title:e.name,children:"transparent"===e.value&&(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"\u2205"})},e.value))})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Custom Color"}),(0,ea.jsx)(BN,{type:"color",value:t.backgroundColor||"#ffffff",onChange:e=>l("backgroundColor",e.target.value),className:"h-8 w-full mt-1"})]})]})})]}),(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(t.borderRadius&&"0px"!==t.borderRadius?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-shape",children:[(0,ea.jsx)(Sq,{size:18}),(0,ea.jsx)("span",{children:"Shape"})]})}),(0,ea.jsx)(hq,{className:"w-72 p-3",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Border Radius"}),(0,ea.jsx)("div",{className:"grid grid-cols-5 gap-1 mt-2",children:[{name:"None",value:"
20px"},{name:"Subtle",value:"4px"},{name:"Rounded",value:"8px"},{name:"More Rounded",value:"16px"},{name:"Pill",value:"9999px"}].map(e=>(0,ea.jsx)("button",{onClick:()=>l("borderRadius",e.value),className:"p-2 rounded border text-xs ".concat(t.borderRadius===e.value?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 hover:border-slate-300"),title:e.name,children:(0,ea.jsx)("div",{className:"w-6 h-6 mx-auto bg-slate-300",style:{borderRadius:e.value}})},e.value))})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Border Color"}),(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-2 mt-2",children:[{name:"None",value:"transparent"},{name:"Gray",value:"#e2e8f0"},{name:"Blue",value:"#3b82f6"},{name:"Green",value:"#22c55e"},{name:"Red",value:"#ef4444"},{name:"Purple",value:"#a855f7"},{name:"Indigo",value:"#6366f1"}].map(e=>(0,ea.jsx)("button",{onClick:()=>l("borderColor",e.value),className:"w-8 h-8 rounded border-2 ".concat(t.borderColor===e.value?"border-indigo-500":"border-slate-200"),style:{backgroundColor:"transparent"===e.value?"#fff":e.value},title:e.name,children:"transparent"===e.value&&(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"\u2205"})},e.value))})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Border Width"}),(0,ea.jsxs)(eb,{value:t.borderWidth||"0px",onValueChange:e=>l("borderWidth",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"0px",children:"None"}),(0,ea.jsx)(rb,{value:"1px",children:"1px"}),(0,ea.jsx)(rb,{value:"2px",children:"2px"}),(0,ea.jsx)(rb,{value:"4px",children:"4px"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Padding"}),(0,ea.jsxs)(eb,{value:t.padding||"16px",onValueChange:e=>l("padding",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"0px",children:"None"}),(0,ea.jsx)(rb,{value:"8px",children:"S"}),(0,ea.jsx)(rb,{value:"16px",children:"M"}),(0,ea.jsx)(rb,{value:"24px",children:"L"}),(0,ea.jsx)(rb,{value:"32px",children:"XL"})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Shadow"}),(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-1 mt-2",children:[{name:"None",value:"none"},{name:"Subtle",value:"sm"},{name:"Medium",value:"md"},{name:"Large",value:"lg"},{name:"Extra Large",value:"xl"},{name:"Inner",value:"inner"}].map(e=>(0,ea.jsx)("button",{onClick:()=>l("shadow",e.value),className:"py-1.5 px-2 rounded border text-xs ".concat(t.shadow===e.value?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 hover:border-slate-300"),children:e.name},e.value))})]})]})})]}),(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(t.hoverEffect&&"none"!==t.hoverEffect?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-hover",children:[(0,ea.jsx)(Eq,{size:18}),(0,ea.jsx)("span",{children:"Hover"})]})}),(0,ea.jsx)(hq,{className:"w-56 p-3",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Hover Effect"}),(0,ea.jsxs)(eb,{value:t.hoverEffect||"none",onValueChange:e=>l("hoverEffect",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{name:"None",value:"none"},{name:"Lift",value:"lift"},{name:"Shadow",value:"shadow"},{name:"Glow",value:"glow"},{name:"Darken",value:"darken"},{name:"Scale",value:"scale"},{name:"Border Highlight",value:"border-highlight"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.name},e.value))})]})]}),"glow"===t.hoverEffect&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Glow Color"}),(0,ea.jsx)(BN,{type:"color",value:t.glowColor||"#6366f1",onChange:e=>l("glowColor",e.target.value),className:"h-8 w-full mt-1"})]}),"border-highlight"===t.hoverEffect&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Highlight Color"}),(0,ea.jsx)(BN,{type:"color",value:t.highlightColor||"#6366f1",onChange:e=>l("highlightColor",e.target.value),className:"h-8 w-full mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Transition Speed"}),(0,ea.jsxs)(eb,{value:t.transitionDuration||"0.2s",onValueChange:e=>l("transitionDuration",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"0.1s",children:"Fast"}),(0,ea.jsx)(rb,{value:"0.2s",children:"Normal"}),(0,ea.jsx)(rb,{value:"0.3s",children:"Slow"}),(0,ea.jsx)(rb,{value:"0.5s",children:"Very Slow"})]})]})]})]})})]}),(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(t.clickEffect&&"none"!==t.clickEffect?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-click",children:[(0,ea.jsx)(Gl,{size:18}),(0,ea.jsx)("span",{children:"Click"})]})}),(0,ea.jsx)(hq,{className:"w-48 p-3",children:(0,ea.jsx)("div",{className:"space-y-3",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Click Effect"}),(0,ea.jsxs)(eb,{value:t.clickEffect||"none",onValueChange:e=>l("clickEffect",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{name:"None",value:"none"},{name:"Scale Down",value:"scale-down"},{name:"Ripple",value:"ripple"},{name:"Flash",value:"flash"},{name:"Shake",value:"shake"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.name},e.value))})]})]})})})]}),(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white","data-testid":"block-image-size",children:[(0,ea.jsx)(Aq,{size:18}),(0,ea.jsx)("span",{children:"Image"})]})}),(0,ea.jsx)(hq,{className:"w-56 p-3",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Size By"}),(0,ea.jsxs)(eb,{value:t.imageSizeMode||"width",onValueChange:e=>l("imageSizeMode",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"width",children:"Width (auto height)"}),(0,ea.jsx)(rb,{value:"height",children:"Height (auto width)"})]})]})]}),"width"===(t.imageSizeMode||"width")?(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Width"}),(0,ea.jsxs)(eb,{value:t.imageWidth||"100%",onValueChange:e=>l("imageWidth",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"25%",children:"25%"}),(0,ea.jsx)(rb,{value:"50%",children:"50%"}),(0,ea.jsx)(rb,{value:"75%",children:"75%"}),(0,ea.jsx)(rb,{value:"100%",children:"100%"}),(0,ea.jsx)(rb,{value:"200px",children:"200px"}),(0,ea.jsx)(rb,{value:"300px",children:"300px"}),(0,ea.jsx)(rb,{value:"500px",children:"500px"})]})]})]}):(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Height"}),(0,ea.jsxs)(eb,{value:t.imageHeight||"300px",onValueChange:e=>l("imageHeight",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"100px",children:"100px"}),(0,ea.jsx)(rb,{value:"150px",children:"150px"}),(0,ea.jsx)(rb,{value:"200px",children:"200px"}),(0,ea.jsx)(rb,{value:"300px",children:"300px"}),(0,ea.jsx)(rb,{value:"400px",children:"400px"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Alignment"}),(0,ea.jsxs)(eb,{value:t.imageAlign||"center",onValueChange:e=>l("imageAlign",e),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]})})]}),(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(t.containerWidth&&"100%"!==t.containerWidth?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-width",children:[(0,ea.jsx)(Fq,{size:18}),(0,ea.jsx)("span",{children:"Width"})]})}),(0,ea.jsx)(hq,{className:"w-72 p-3",children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-2.5 py-2 text-[11px] leading-snug text-amber-900",children:[(0,ea.jsx)("strong",{children:"What Width does:"})," resizes the block's ",(0,ea.jsx)("em",{children:"box"})," (background, border area) within its column \u2014 not the text itself. On plain-text blocks the change may just look like indentation. Add a Backgroun
2d Color or Border to see it clearly."]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs font-medium",children:"Container Width"}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-500 mb-2",children:"Adjust the width of this block"}),(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-1 mb-3",children:[{label:"25%",value:"25%"},{label:"50%",value:"50%"},{label:"75%",value:"75%"},{label:"100%",value:"100%"}].map(e=>(0,ea.jsx)("button",{onClick:()=>l("containerWidth",e.value),className:"py-1.5 px-2 rounded border text-xs font-medium transition-all ".concat((t.containerWidth||"100%")===e.value?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 hover:border-slate-300"),children:e.label},e.value))}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Custom:"}),(0,ea.jsx)(BN,{type:"number",min:"100",max:"1200",value:parseInt(t.containerWidthPx)||800,onChange:e=>l("containerWidthPx","".concat(e.target.value,"px")),className:"h-7 w-20 text-xs"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"px"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{l("containerWidth","custom")},children:"Apply"})]})]}),(0,ea.jsxs)("div",{className:"border-t pt-3",children:[(0,ea.jsx)(tf,{className:"text-xs font-medium",children:"Max Width Presets"}),(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-1 mt-2",children:[{label:"Small",value:"640px"},{label:"Medium",value:"768px"},{label:"Large",value:"1024px"},{label:"XL",value:"1280px"},{label:"Full",value:"100vw"},{label:"None",value:"none"}].map(e=>(0,ea.jsx)("button",{onClick:()=>l("maxWidth",e.value),className:"py-1.5 px-2 rounded border text-xs ".concat(t.maxWidth===e.value?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 hover:border-slate-300"),children:e.label},e.value))})]}),(0,ea.jsxs)("div",{className:"border-t pt-3",children:[(0,ea.jsx)(tf,{className:"text-xs font-medium",children:"Horizontal Alignment"}),(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-1 mt-2",children:[{label:"Left",value:"flex-start"},{label:"Center",value:"center"},{label:"Right",value:"flex-end"}].map(e=>(0,ea.jsx)("button",{onClick:()=>l("containerAlign",e.value),className:"py-1.5 px-2 rounded border text-xs ".concat((t.containerAlign||"center")===e.value?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 hover:border-slate-300"),children:e.label},e.value))})]})]})})]}),n&&(0,ea.jsxs)(uq,{children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)("button",{className:"flex flex-col items-center justify-center gap-1 p-3 rounded-lg border text-xs font-medium transition-all ".concat(a.anchor_id?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-white"),"data-testid":"block-anchor-id",children:[(0,ea.jsx)(Tq,{size:18}),(0,ea.jsx)("span",{children:"Anchor"})]})}),(0,ea.jsx)(hq,{className:"w-72 p-3",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Anchor ID"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Create a link target so other buttons can jump to this section"})]}),(0,ea.jsx)(BN,{value:a.anchor_id||"",onChange:e=>{const t=e.target.value.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");n(d(d({},a),{},{anchor_id:t}))},placeholder:"e.g., contact-form, about-section",className:"h-8"}),a.anchor_id&&(0,ea.jsxs)("div",{className:"text-xs bg-slate-800/50 text-slate-300 px-2 py-1.5 rounded",children:["Link to this block: ",(0,ea.jsxs)("code",{className:"text-indigo-400",children:["#",a.anchor_id]})]})]})})]})]})},Mq=e=>{let{sizeMode:t="width",width:s=200,height:a=200,align:n="center",onSizeModeChange:l,onWidthChange:r,onHeightChange:i,onAlignChange:o,compact:c=!1}=e;return c?(0,ea.jsxs)("div",{className:"flex gap-2 items-center flex-wrap",children:[(0,ea.jsxs)(eb,{value:t,onValueChange:l,children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"width",children:"Width"}),(0,ea.jsx)(rb,{value:"height",children:"Height"}),(0,ea.jsx)(rb,{value:"custom",children:"Custom"})]})]}),"custom"===t?(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:s,onChange:e=>r(parseInt(e.target.value)||200),className:"w-14 h-7 text-xs",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:a,onChange:e=>i(parseInt(e.target.value)||200),className:"w-14 h-7 text-xs",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):"width"===t?(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(BN,{type:"number",value:s,onChange:e=>r(parseInt(e.target.value)||200),className:"w-16 h-7 text-xs",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(BN,{type:"number",value:a,onChange:e=>i(parseInt(e.target.value)||200),className:"w-16 h-7 text-xs",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),(0,ea.jsxs)(eb,{value:n,onValueChange:o,children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}):(0,ea.jsxs)("div",{className:"flex gap-3 items-center flex-wrap text-sm",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsxs)(eb,{value:t,onValueChange:l,children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"width",children:"By Width"}),(0,ea.jsx)(rb,{value:"height",children:"By Height"}),(0,ea.jsx)(rb,{value:"custom",children:"Custom (W\xd7H)"})]})]})]}),"custom"===t?(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:s,onChange:e=>r(parseInt(e.target.value)||200),className:"w-16 h-8 text-sm",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:a,onChange:e=>i(parseInt(e.target.value)||200),className:"w-16 h-8 text-sm",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):"width"===t?(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:s,onChange:e=>r(parseInt(e.target.value)||200),className:"w-20 h-8 text-sm",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:a,onChange:e=>i(parseInt(e.target.value)||200),className:"w-20 h-8 text-sm",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Align:"}),(0,ea.jsxs)(eb,{value:n,onValueChange:o,children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]})},Pq=["__scopeScrollArea","type","dir","scrollHideDelay"],Bq=["__scopeScrollArea","children","nonce"],Rq=["forceMount"],Lq=["forceMount"],Iq=["forceMount"],Oq=["forceMount"],Uq=["orientation"],Hq=["sizes","onSizesChange"],Wq=["sizes","onSizesChange"],Vq=["__scopeScrollArea","sizes","hasThumb","onThumbChange","onThumbPointerUp","onThumbPointerDown","onThumbPositionChange","onDragScroll","onWheelScroll","onResize"],qq=["forceMount"],$q=["__scopeScrollArea","style"],Gq=["__scopeScrollArea"];var Kq="ScrollArea",[Yq,Jq]=jr(Kq),[Qq,Xq]=Yq(Kq),Zq=t.forwardRef((e,s)=>{const{__scopeScrollArea:a,type:n="hover",dir:r,scrollHideDelay:i=600}=e,o=l(e,Pq),[c,u]=t.useState(null),[m,h]=t.useState(null),[x,p]=t.useState(null),[g,f]=t.useState(null),[v,b]=t.useState(null),[j,y]=t.useState(0),[N,w]=t.useState(0),[C,k]=t.useState(!1),[D,_]=t.useState(!1),S=fr(s,e=>u(e)),E=Qr(r);return(0,ea.jsx)(Qq,{scope:a,type:n,dir:E,scrollHideDelay:i,scrollArea:c,viewport:m,onViewportChange:h,content:x,onContentChange:p,scrollbarX:g,onScrollbarXChange:f,scrollbarXEnabled:C,onScrollbarXEnabledChange:k,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:D,onScrollbarYEnabledChange:_,onCornerWidthChange:y,onCornerHeight
2Change:w,children:(0,ea.jsx)(Tr.div,d(d({dir:E},o),{},{ref:S,style:d({position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":N+"px"},e.style)}))})});Zq.displayName=Kq;var e$="ScrollAreaViewport",t$=t.forwardRef((e,s)=>{const{__scopeScrollArea:a,children:n,nonce:r}=e,i=l(e,Bq),o=Xq(e$,a),c=fr(s,t.useRef(null),o.onViewportChange);return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.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:r}),(0,ea.jsx)(Tr.div,d(d({"data-radix-scroll-area-viewport":""},i),{},{ref:c,style:d({overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden"},e.style),children:(0,ea.jsx)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})}))]})});t$.displayName=e$;var s$="ScrollAreaScrollbar",a$=t.forwardRef((e,s)=>{const{forceMount:a}=e,n=l(e,Rq),r=Xq(s$,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=r,c="horizontal"===e.orientation;return t.useEffect(()=>(c?i(!0):o(!0),()=>{c?i(!1):o(!1)}),[c,i,o]),"hover"===r.type?(0,ea.jsx)(n$,d(d({},n),{},{ref:s,forceMount:a})):"scroll"===r.type?(0,ea.jsx)(l$,d(d({},n),{},{ref:s,forceMount:a})):"auto"===r.type?(0,ea.jsx)(r$,d(d({},n),{},{ref:s,forceMount:a})):"always"===r.type?(0,ea.jsx)(i$,d(d({},n),{},{ref:s})):null});a$.displayName=s$;var n$=t.forwardRef((e,s)=>{const{forceMount:a}=e,n=l(e,Lq),r=Xq(s$,e.__scopeScrollArea),[i,o]=t.useState(!1);return t.useEffect(()=>{const e=r.scrollArea;let t=0;if(e){const s=()=>{window.clearTimeout(t),o(!0)},a=()=>{t=window.setTimeout(()=>o(!1),r.scrollHideDelay)};return e.addEventListener("pointerenter",s),e.addEventListener("pointerleave",a),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",s),e.removeEventListener("pointerleave",a)}}},[r.scrollArea,r.scrollHideDelay]),(0,ea.jsx)(Jc,{present:a||i,children:(0,ea.jsx)(r$,d(d({"data-state":i?"visible":"hidden"},n),{},{ref:s}))})}),l$=t.forwardRef((e,s)=>{const{forceMount:a}=e,n=l(e,Iq),r=Xq(s$,e.__scopeScrollArea),i="horizontal"===e.orientation,o=D$(()=>u("SCROLL_END"),100),[c,u]=(m="hidden",h={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},t.useReducer((e,t)=>{const s=h[e][t];return null!==s&&void 0!==s?s:e},m));var m,h;return t.useEffect(()=>{if("idle"===c){const e=window.setTimeout(()=>u("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,r.scrollHideDelay,u]),t.useEffect(()=>{const e=r.viewport,t=i?"scrollLeft":"scrollTop";if(e){let s=e[t];const a=()=>{const a=e[t];s!==a&&(u("SCROLL"),o()),s=a};return e.addEventListener("scroll",a),()=>e.removeEventListener("scroll",a)}},[r.viewport,i,u,o]),(0,ea.jsx)(Jc,{present:a||"hidden"!==c,children:(0,ea.jsx)(i$,d(d({"data-state":"hidden"===c?"hidden":"visible"},n),{},{ref:s,onPointerEnter:xr(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:xr(e.onPointerLeave,()=>u("POINTER_LEAVE"))}))})}),r$=t.forwardRef((e,s)=>{const a=Xq(s$,e.__scopeScrollArea),{forceMount:n}=e,r=l(e,Oq),[i,o]=t.useState(!1),c="horizontal"===e.orientation,u=D$(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;o(c?e:t)}},10);return _$(a.viewport,u),_$(a.content,u),(0,ea.jsx)(Jc,{present:n||i,children:(0,ea.jsx)(i$,d(d({"data-state":i?"visible":"hidden"},r),{},{ref:s}))})}),i$=t.forwardRef((e,s)=>{const{orientation:a="vertical"}=e,n=l(e,Uq),r=Xq(s$,e.__scopeScrollArea),i=t.useRef(null),o=t.useRef(0),[c,u]=t.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=j$(c.viewport,c.content),h=d(d({},n),{},{sizes:c,onSizesChange:u,hasThumb:Boolean(m>0&&m<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e});function x(e,t){return function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"ltr";const n=y$(s),l=n/2,r=t||l,i=n-r,o=s.scrollbar.paddingStart+r,c=s.scrollbar.size-s.scrollbar.paddingEnd-i,d=s.content-s.viewport,u="ltr"===a?[0,d]:[-1*d,0];return w$([o,c],u)(e)}(e,o.current,c,t)}return"horizontal"===a?(0,ea.jsx)(o$,d(d({},h),{},{ref:s,onThumbPositionChange:()=>{if(r.viewport&&i.current){const e=N$(r.viewport.scrollLeft,c,r.dir);i.current.style.transform="translate3d(".concat(e,"px, 0, 0)")}},onWheelScroll:e=>{r.viewport&&(r.viewport.scrollLeft=e)},onDragScroll:e=>{r.viewport&&(r.viewport.scrollLeft=x(e,r.dir))}})):"vertical"===a?(0,ea.jsx)(c$,d(d({},h),{},{ref:s,onThumbPositionChange:()=>{if(r.viewport&&i.current){const e=N$(r.viewport.scrollTop,c);i.current.style.transform="translate3d(0, ".concat(e,"px, 0)")}},onWheelScroll:e=>{r.viewport&&(r.viewport.scrollTop=e)},onDragScroll:e=>{r.viewport&&(r.viewport.scrollTop=x(e))}})):null}),o$=t.forwardRef((e,s)=>{const{sizes:a,onSizesChange:n}=e,r=l(e,Hq),i=Xq(s$,e.__scopeScrollArea),[o,c]=t.useState(),u=t.useRef(null),m=fr(s,u,i.onScrollbarXChange);return t.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),(0,ea.jsx)(m$,d(d({"data-orientation":"horizontal"},r),{},{ref:m,sizes:a,style:d({bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":y$(a)+"px"},e.style),onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,s)=>{if(i.viewport){const a=i.viewport.scrollLeft+t.deltaX;
2e.onWheelScroll(a),C$(a,s)&&t.preventDefault()}},onResize:()=>{u.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:b$(o.paddingLeft),paddingEnd:b$(o.paddingRight)}})}}))}),c$=t.forwardRef((e,s)=>{const{sizes:a,onSizesChange:n}=e,r=l(e,Wq),i=Xq(s$,e.__scopeScrollArea),[o,c]=t.useState(),u=t.useRef(null),m=fr(s,u,i.onScrollbarYChange);return t.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),(0,ea.jsx)(m$,d(d({"data-orientation":"vertical"},r),{},{ref:m,sizes:a,style:d({top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":y$(a)+"px"},e.style),onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,s)=>{if(i.viewport){const a=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(a),C$(a,s)&&t.preventDefault()}},onResize:()=>{u.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:b$(o.paddingTop),paddingEnd:b$(o.paddingBottom)}})}}))}),[d$,u$]=Yq(s$),m$=t.forwardRef((e,s)=>{const{__scopeScrollArea:a,sizes:n,hasThumb:r,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:c,onThumbPositionChange:u,onDragScroll:m,onWheelScroll:h,onResize:x}=e,p=l(e,Vq),g=Xq(s$,a),[f,v]=t.useState(null),b=fr(s,e=>v(e)),j=t.useRef(null),y=t.useRef(""),N=g.viewport,w=n.content-n.viewport,C=Xr(h),k=Xr(u),D=D$(x,10);function _(e){if(j.current){const t=e.clientX-j.current.left,s=e.clientY-j.current.top;m({x:t,y:s})}}return t.useEffect(()=>{const e=e=>{const t=e.target;(null===f||void 0===f?void 0:f.contains(t))&&C(e,w)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[N,f,w,C]),t.useEffect(k,[n,k]),_$(f,D),_$(g.content,D),(0,ea.jsx)(d$,{scope:a,scrollbar:f,hasThumb:r,onThumbChange:Xr(i),onThumbPointerUp:Xr(o),onThumbPositionChange:k,onThumbPointerDown:Xr(c),children:(0,ea.jsx)(Tr.div,d(d({},p),{},{ref:b,style:d({position:"absolute"},p.style),onPointerDown:xr(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),j.current=f.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),_(e)}}),onPointerMove:xr(e.onPointerMove,_),onPointerUp:xr(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,g.viewport&&(g.viewport.style.scrollBehavior=""),j.current=null})}))})}),h$="ScrollAreaThumb",x$=t.forwardRef((e,t)=>{const{forceMount:s}=e,a=l(e,qq),n=u$(h$,e.__scopeScrollArea);return(0,ea.jsx)(Jc,{present:s||n.hasThumb,children:(0,ea.jsx)(p$,d({ref:t},a))})}),p$=t.forwardRef((e,s)=>{const{__scopeScrollArea:a,style:n}=e,r=l(e,$q),i=Xq(h$,a),o=u$(h$,a),{onThumbPositionChange:c}=o,u=fr(s,e=>o.onThumbChange(e)),m=t.useRef(void 0),h=D$(()=>{m.current&&(m.current(),m.current=void 0)},100);return t.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(h(),!m.current){const t=k$(e,c);m.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,h,c]),(0,ea.jsx)(Tr.div,d(d({"data-state":o.hasThumb?"visible":"hidden"},r),{},{ref:u,style:d({width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)"},n),onPointerDownCapture:xr(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),s=e.clientX-t.left,a=e.clientY-t.top;o.onThumbPointerDown({x:s,y:a})}),onPointerUp:xr(e.onPointerUp,o.onThumbPointerUp)}))});x$.displayName=h$;var g$="ScrollAreaCorner",f$=t.forwardRef((e,t)=>{const s=Xq(g$,e.__scopeScrollArea),a=Boolean(s.scrollbarX&&s.scrollbarY);return"scroll"!==s.type&&a?(0,ea.jsx)(v$,d(d({},e),{},{ref:t})):null});f$.displayName=g$;var v$=t.forwardRef((e,s)=>{const{__scopeScrollArea:a}=e,n=l(e,Gq),r=Xq(g$,a),[i,o]=t.useState(0),[c,u]=t.useState(0),m=Boolean(i&&c);return _$(r.scrollbarX,()=>{var e;const t=(null===(e=r.scrollbarX)||void 0===e?void 0:e.offsetHeight)||0;
2r.onCornerHeightChange(t),u(t)}),_$(r.scrollbarY,()=>{var e;const t=(null===(e=r.scrollbarY)||void 0===e?void 0:e.offsetWidth)||0;r.onCornerWidthChange(t),o(t)}),m?(0,ea.jsx)(Tr.div,d(d({},n),{},{ref:s,style:d({width:i,height:c,position:"absolute",right:"ltr"===r.dir?0:void 0,left:"rtl"===r.dir?0:void 0,bottom:0},e.style)})):null});function b$(e){return e?parseInt(e,10):0}function j$(e,t){const s=e/t;return isNaN(s)?0:s}function y$(e){const t=j$(e.viewport,e.content),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-s)*t;return Math.max(a,18)}function N$(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"ltr";const a=y$(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-n,r=t.content-t.viewport,i=l-a,o=sf(e,"ltr"===s?[0,r]:[-1*r,0]);return w$([0,r],[0,i])(o)}function w$(e,t){return s=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(s-e[0])}}function C$(e,t){return e>0&&e<t}var k$=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},s={left:e.scrollLeft,top:e.scrollTop},a=0;return function n(){const l={left:e.scrollLeft,top:e.scrollTop},r=s.left!==l.left,i=s.top!==l.top;(r||i)&&t(),s=l,a=window.requestAnimationFrame(n)}(),()=>window.cancelAnimationFrame(a)};function D$(e,s){const a=Xr(e),n=t.useRef(0);return t.useEffect(()=>()=>window.clearTimeout(n.current),[]),t.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(a,s)},[a,s])}function _$(e,t){const s=Xr(t);Nr(()=>{let t=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return a.observe(e),()=>{window.cancelAnimationFrame(t),a.unobserve(e)}}},[e,s])}var S$=Zq,E$=t$,A$=f$;const F$=["className","children"],T$=["className","orientation"],z$=t.forwardRef((e,t)=>{let{className:s,children:a}=e,n=l(e,F$);return(0,ea.jsxs)(S$,d(d({ref:t,className:Np("relative overflow-hidden",s)},n),{},{children:[(0,ea.jsx)(E$,{className:"h-full w-full rounded-[inherit]",children:a}),(0,ea.jsx)(M$,{}),(0,ea.jsx)(A$,{})]}))});z$.displayName=S$.displayName;const M$=t.forwardRef((e,t)=>{let{className:s,orientation:a="vertical"}=e,n=l(e,T$);return(0,ea.jsx)(a$,d(d({ref:t,orientation:a,className:Np("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s)},n),{},{children:(0,ea.jsx)(x$,{className:"relative flex-1 rounded-full bg-border"})}))});M$.displayName=a$.displayName;const P$={javascript:{label:"JavaScript",icon:"js",snippets:[{id:"js-fetch",name:"Fetch API Request",description:"Make an HTTP request using fetch",code:"// Fetch API - GET request\nasync function fetchData(url) {\n try {\n const response = await fetch(url);\n \n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n \n const data = await response.json();\n return data;\n } catch (error) {\n console.error('Fetch error:', error);\n throw error;\n }\n}\n\n// Usage\nfetchData('https://api.example.com/data')\n .then(data => console.log(data))\n .catch(err => console.error(err));"},{id:"js-fetch-post",name:"Fetch POST Request",description:"Send data with POST request",code:"// Fetch API - POST request\nasync function postData(url, data) {\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(data),\n });\n \n return response.json();\n}\n\n// Usage\npostData('https://api.example.com/users', {\n name: 'John Doe',\n email: '[email protected]'\n}).then(data => console.log(data));"},{id:"js-array-methods",name:"Array Methods",description:"Common array operations",code:"// Array Methods Examples\nconst numbers = [1, 2, 3, 4, 5];\n\n// map - transform each element\nconst doubled = numbers.map(n => n * 2);\n// [2, 4, 6, 8, 10]\n\n// filter - keep elements that pass test\nconst evens = numbers.filter(n => n % 2 === 0);\n// [2, 4]\n\n// reduce - accumulate to single value\nconst sum = numbers.reduce((acc, n) => acc + n, 0);\n// 15\n\n// find - get first matching element\nconst firstEven = numbers.find(n => n % 2 === 0);\n// 2\n\n// some/every - test conditions\nconst hasEven = numbers.some(n => n % 2 === 0); // true\nconst allEven = numbers.every(n => n % 2 === 0); // false"},{id:"js-event-listener",name:"Event Listener",description:"Handle DOM events",code:"// Event Listener Examples\n\n// Click event\ndocument.getElementById('myButton').addEventListener('click', (e) => {\n console.log('Button clicked!', e.target);\n});\n\n// Form submit\ndocument.querySelector('form').addEventListener('submit', (e) => {\n e.preventDefault(); // Prevent page reload\n const formData = new FormData(e.target);\n console.log('Form data:', Object.fromEntries(formData));\n});\n\n// Keyboard event\ndocument.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') {\n console.log('Escape pressed');\n }\n});\n\n// Remove listener\nconst handler = () => console.log('clicked');\nelement.addEventListener('click', handler);\nelement.removeEventListener('click', handler);"},{id:"js-async-await",name:"Async/Await Pattern",description:"Handle asynchronous operations",code:"// Async/Await Examples\n\n// Basic async function\nasync function getData() {\
2n const response = await fetch('/api/data');\n const data = await response.json();\n return data;\n}\n\n// Parallel requests\nasync function getMultiple() {\n const [users, posts] = await Promise.all([\n fetch('/api/users').then(r => r.json()),\n fetch('/api/posts').then(r => r.json())\n ]);\n return { users, posts };\n}\n\n// Error handling\nasync function safeFetch(url) {\n try {\n const response = await fetch(url);\n if (!response.ok) throw new Error('Request failed');\n return await response.json();\n } catch (error) {\n console.error('Error:', error.message);\n return null;\n }\n}\n\n// Sequential execution\nasync function processItems(items) {\n for (const item of items) {\n await processItem(item); // Wait for each\n }\n}"},{id:"js-debounce",name:"Debounce Function",description:"Limit function execution rate",code:"// Debounce - delay execution until pause in calls\nfunction debounce(func, wait) {\n let timeout;\n return function executedFunction(...args) {\n const later = () => {\n clearTimeout(timeout);\n func(...args);\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n\n// Usage - search input\nconst searchInput = document.getElementById('search');\nconst handleSearch = debounce((query) => {\n console.log('Searching for:', query);\n // API call here\n}, 300);\n\nsearchInput.addEventListener('input', (e) => {\n handleSearch(e.target.value);\n});"},{id:"js-local-storage",name:"LocalStorage Helper",description:"Store and retrieve data locally",code:"// LocalStorage Helper Functions\n\nconst storage = {\n // Set item (handles objects)\n set(key, value) {\n localStorage.setItem(key, JSON.stringify(value));\n },\n \n // Get item (parses JSON)\n get(key, defaultValue = null) {\n const item = localStorage.getItem(key);\n return item ? JSON.parse(item) : defaultValue;\n },\n \n // Remove item\n remove(key) {\n localStorage.removeItem(key);\n },\n \n // Clear all\n clear() {\n localStorage.clear();\n }\n};\n\n// Usage\nstorage.set('user', { name: 'John', id: 123 });\nconst user = storage.get('user');\nconsole.log(user.name); // 'John'"}]},python:{label:"Python",icon:"py",snippets:[{id:"py-api-request",name:"API Request",description:"Make HTTP requests with requests library",code:'# API Request with requests library\nimport requests\n\ndef fetch_data(url, headers=None):\n """Make a GET request and return JSON data."""\n try:\n response = requests.get(url, headers=headers)\n response.raise_for_status() # Raise exception for bad status\n return response.json()\n except requests.exceptions.RequestException as e:\n print(f"Request failed: {e}")\n return None\n\ndef post_data(url, data, headers=None):\n """Make a POST request with JSON data."""\n headers = headers or {\'Content-Type\': \'application/json\'}\n response = requests.post(url, json=data, headers=headers)\n return response.json()\n\n# Usage\ndata = fetch_data(\'https://api.example.com/users\')\nresult = post_data(\'https://api.example.com/users\', {\'name\': \'John\'})'},{id:"py-file-io",name:"File I/O",description:"Read and write files",code:"# File I/O Operations\n\n# Read entire file\nwith open('file.txt', 'r') as f:\n content = f.read()\n\n# Read lines\nwith open('file.txt', 'r') as f:\n lines = f.readlines()\n\n# Write to file\nwith open('output.txt', 'w') as f:\n f.write('Hello, World!')\n\n# Append to file\nwith open('log.txt', 'a') as f:\n f.write('New log entry\\n')\n\n# Read JSON\nimport json\nwith open('data.json', 'r') as f:\n data = json.load(f)\n\n# Write JSON\nwith open('data.json', 'w') as f:\n json.dump({'key': 'value'}, f, indent=2)\n\n# CSV handling\nimport csv\nwith open('data.csv', 'r') as f:\n reader = csv.DictReader(f)\n for row in reader:\n print(row)"},{id:"py-class",name:"Class Template",description:"Python class with common patterns",code:'# Python Class Template\nfrom dataclasses import dataclass\nfrom typing import Optional, List\n\n@dataclass\nclass User:\n """User class with dataclass decorator."""\n id: int\n name: str\n email: str\n active: bool = True\n \n def __post_init__(self):\n """Validate after initialization."""\n if \'@\' not in self.email:\n raise ValueError(\'Invalid email\')\n\n# Traditional class\nclass Product:\n """Product class with traditional approach."""\n \n def __init__(self, name: str, price: float):\n self.name = name\n self.price = price\n self._discount = 0\n \n @property\n def discount(self) -> float:\n return self._discount\n \n @discount.setter\n def discount(self, value: float):\n if 0 <= value <= 100:\n self._discount = value\n \n def get_final_price(self) -> float:\n return self.price * (1 - self._discount / 100)\n \n def __repr__(self):\n return f"Product(\'{self.name}\', {self.price})"'}
2,{id:"py-list-comprehension",name:"List Comprehension",description:"Concise list operations",code:"# List Comprehension Examples\n\nnumbers = [1, 2, 3, 4, 5]\n\n# Basic - square each number\nsquares = [x**2 for x in numbers]\n# [1, 4, 9, 16, 25]\n\n# With condition - even numbers only\nevens = [x for x in numbers if x % 2 == 0]\n# [2, 4]\n\n# Transform with condition\nresult = [x**2 if x % 2 == 0 else x for x in numbers]\n# [1, 4, 3, 16, 5]\n\n# Nested - flatten 2D list\nmatrix = [[1, 2], [3, 4], [5, 6]]\nflat = [x for row in matrix for x in row]\n# [1, 2, 3, 4, 5, 6]\n\n# Dictionary comprehension\nnames = ['alice', 'bob', 'charlie']\nname_lengths = {name: len(name) for name in names}\n# {'alice': 5, 'bob': 3, 'charlie': 7}\n\n# Set comprehension\nunique_lengths = {len(name) for name in names}\n# {3, 5, 7}"},{id:"py-decorator",name:"Decorator Pattern",description:"Function decorators",code:'# Python Decorators\nimport functools\nimport time\n\n# Basic decorator\ndef log_calls(func):\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n print(f"Calling {func.__name__}")\n result = func(*args, **kwargs)\n print(f"Finished {func.__name__}")\n return result\n return wrapper\n\n# Timer decorator\ndef timer(func):\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n start = time.time()\n result = func(*args, **kwargs)\n end = time.time()\n print(f"{func.__name__} took {end - start:.2f}s")\n return result\n return wrapper\n\n# Decorator with arguments\ndef retry(max_attempts=3):\n def decorator(func):\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n for attempt in range(max_attempts):\n try:\n return func(*args, **kwargs)\n except Exception as e:\n if attempt == max_attempts - 1:\n raise\n print(f"Attempt {attempt + 1} failed: {e}")\n return wrapper\n return decorator\n\n# Usage\n@timer\n@log_calls\ndef slow_function():\n time.sleep(1)\n return "Done"'},{id:"py-context-manager",name:"Context Manager",description:"Custom context manager",code:'# Context Manager Examples\nfrom contextlib import contextmanager\nimport time\n\n# Class-based context manager\nclass Timer:\n def __enter__(self):\n self.start = time.time()\n return self\n \n def __exit__(self, *args):\n self.elapsed = time.time() - self.start\n print(f"Elapsed: {self.elapsed:.2f}s")\n\n# Function-based with decorator\n@contextmanager\ndef timer():\n start = time.time()\n yield\n elapsed = time.time() - start\n print(f"Elapsed: {elapsed:.2f}s")\n\n# Database connection example\n@contextmanager\ndef db_connection(host):\n conn = create_connection(host)\n try:\n yield conn\n finally:\n conn.close()\n\n# Usage\nwith Timer() as t:\n # do something\n pass\n\nwith timer():\n # do something\n pass'}]},react:{label:"React",icon:"jsx",snippets:[{id:"react-component",name:"Functional Component",description:"Basic React component template",code:"// React Functional Component\nimport React from 'react';\n\ninterface Props {\n title: string;\n description?: string;\n onAction?: () => void;\n}\n\nconst MyComponent: React.FC<Props> = ({ \n title, \n description = 'Default description',\n onAction \n}) => {\n return (\n <div className=\"my-component\">\n <h2>{title}</h2>\n <p>{description}</p>\n {onAction && (\n <button onClick={onAction}>\n Click Me\n </button>\n )}\n </div>\n );\n};\n\nexport default MyComponent;"},{id:"react-usestate",name:"useState Hook",description:"State management with useState",code:"// useState Hook Examples\nimport React, { useState } from 'react';\n\nfunction Counter() {\n // Simple state\n const [count, setCount] = useState(0);\n \n // Object state\n const [user, setUser] = useState({ name: '', email: '' });\n \n // Array state\n const [items, setItems] = useState([]);\n \n // Update handlers\n const increment = () => setCount(prev => prev + 1);\n \n const updateUser = (field, value) => {\n setUser(prev => ({ ...prev, [field]: value }));\n };\n \n const addItem = (item) => {\n setItems(prev => [...prev, item]);\n };\n \n const removeItem = (index) =>
2 {\n setItems(prev => prev.filter((_, i) => i !== index));\n };\n\n return (\n <div>\n <p>Count: {count}</p>\n <button onClick={increment}>+1</button>\n \n <input \n value={user.name}\n onChange={(e) => updateUser('name', e.target.value)}\n placeholder=\"Name\"\n />\n </div>\n );\n}"},{id:"react-useeffect",name:"useEffect Hook",description:"Side effects with useEffect",code:"// useEffect Hook Examples\nimport React, { useState, useEffect } from 'react';\n\nfunction DataFetcher({ userId }) {\n const [data, setData] = useState(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(null);\n\n // Fetch on mount and when userId changes\n useEffect(() => {\n let cancelled = false;\n \n async function fetchData() {\n setLoading(true);\n try {\n const response = await fetch(`/api/users/${userId}`);\n const json = await response.json();\n if (!cancelled) {\n setData(json);\n setError(null);\n }\n } catch (err) {\n if (!cancelled) {\n setError(err.message);\n }\n } finally {\n if (!cancelled) {\n setLoading(false);\n }\n }\n }\n \n fetchData();\n \n // Cleanup function\n return () => {\n cancelled = true;\n };\n }, [userId]); // Dependency array\n\n if (loading) return <p>Loading...</p>;\n if (error) return <p>Error: {error}</p>;\n return <div>{JSON.stringify(data)}</div>;\n}"},{id:"react-custom-hook",name:"Custom Hook",description:"Create reusable logic with custom hooks",code:"// Custom Hook - useLocalStorage\nimport { useState, useEffect } from 'react';\n\nfunction useLocalStorage<T>(key: string, initialValue: T) {\n // Get stored value or use initial\n const [storedValue, setStoredValue] = useState<T>(() => {\n try {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n return initialValue;\n }\n });\n\n // Update localStorage when value changes\n useEffect(() => {\n try {\n window.localStorage.setItem(key, JSON.stringify(storedValue));\n } catch (error) {\n console.error('Error saving to localStorage:', error);\n }\n }, [key, storedValue]);\n\n return [storedValue, setStoredValue] as const;\n}\n\n// Usage\nfunction Settings() {\n const [theme, setTheme] = useLocalStorage('theme', 'light');\n const [user, setUser] = useLocalStorage('user', null);\n\n return (\n <button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>\n Toggle Theme ({theme})\n </button>\n );\n}"},{id:"react-context",name:"Context API",description:"Global state with Context",code:"// React Context API\nimport React, { createContext, useContext, useState, ReactNode } from 'react';\n\n// Define types\ninterface User {\n id: string;\n name: string;\n email: string;\n}\n\ninterface AuthContextType {\n user: User | null;\n login: (user: User) => void;\n logout: () => void;\n isAuthenticated: boolean;\n}\n\n// Create context\nconst AuthContext = createContext<AuthContextType | undefined>(undefined);\n\n// Provider component\nexport function AuthProvider({ children }: { children: ReactNode }) {\n const [user, setUser] = useState<User | null>(null);\n\n const login = (userData: User) => setUser(userData);\n const logout = () => setUser(null);\n\n return (\n <AuthContext.Provider value={{\n user,\n login,\n logout,\n isAuthenticated: !!user\n }}>\n {children}\n </AuthContext.Provider>\n );\n}\n\n// Custom hook to use context\nexport function useAuth() {\n const context = useContext(AuthContext);\n if (!context) {\n throw new Error('useAuth must be used within AuthProvider');\n }\n return context;\n}\n\n// Usage in component\nfunction Profile() {\n const { user, logout, isAuthenticated } = useAuth();\n \n if (!isAuthenticated) return <p>Please log in</p>;\n return <p>Welcome, {user?.name}!</p>;\n}"},{id:"react-form",name:"Form Handling",description:"Form with validation",code:"// React Form with Validation\nimport React, { useState, FormEvent } from 'react';\n\ninterface FormData {\n name: string;\n email: string;\n message: string;\n}\n\ninterface FormErrors {\n name?: string;\n email?: string;\n message?: string;\n}\n\nfunction ContactForm() {\n const [formData, setFormData] = useState<FormData>({\n name: '',\n email: '',\n message: ''\n });\n const [errors, setErrors] = useState<FormErrors>({});\n const [submitting, setSubmitting] = useState(false);\n\n const validate = (): boolean => {\n const newErrors: FormErrors = {};\n \n if (!formData.name.trim()) {\n newErrors.name = 'Name is required';\n }\n if (!formData.email.includes('@')) {\n newErrors.email = 'Valid email is required';\n }\n if (formData.message.length < 10) {\n newErrors.message = 'Message must be at least 10 characters';\n }\n \n setErrors(newErrors);\n return Object.keys(newErrors).length === 0;\n };\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault();\n if (!validate()) return;\n \n setSubmitting(true);\n try {\n await fetch('/api/contact', {\n method: 'POST',\n body: JSON.stringify(formData)\n });\n alert('Submitted!');\n } finally {\n setSubmitting(false);\n }\n };\n\n return (\n <form onSubmit={handleSubmit}>\n <input\n value={formData.name}\n onChange={(e) => setFormData({...formData, name: e.target.value})}\n placeholder=\"Name\"\n />\n {errors.name && <span className=\"error\">{errors.name}</span>}\n \n <button type=\"submit\" disabled={submitting}>\n {submitting ? 'Sending...' : 'Submit'}\n </button>\n </form>\n );\n}"}]},html:{label:"HTML",icon:"html",snippets:[{id:"html-form",name:"Form Template",description:"Accessible form with validation",code:'\x3c!-- Accessible Form Template --\x3e\n<form action="/submit" method="POST" class="form">\n <div class="form-group">\n <label for="name">Full Name *</label>\n <input \n type="text" \n id="name" \n name="name" \n required\n autocomplete="name"\n placeholder="John Doe"\n />\n </div>\n\n <div class="form-group">\n <label for="email">Email Address *</label>\n <input \n type="email" \n id="email" \n name="email" \n required\n autocomplete="email"\n placeholder="[email protected]"\n />\n </div>\n\n <div class="form-group">\n <label for="phone">Phone (optional)</label>\n <input \n type="tel" \n id="phone" \n name="phone"\n autocomplete="tel"\n pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"\n placeholder="123-456-7890"\n />\n </div>\n\n <div class="form-group">\n <label for="message">Message *</label>\n <textarea \n id="message" \n name="message" \n rows="4"\n required\n placeholder="Your message..."\n ></textarea>\n </div>\n\n <button type="submit">Send Message</button>\n</form>'}
2,{id:"html-card",name:"Card Component",description:"Reusable card layout",code:'\x3c!-- Card Component --\x3e\n<article class="card">\n <img \n src="/image.jpg" \n alt="Card image description"\n class="card-image"\n loading="lazy"\n />\n \n <div class="card-content">\n <span class="card-badge">Featured</span>\n \n <h3 class="card-title">Card Title</h3>\n \n <p class="card-description">\n Brief description of the card content goes here. \n Keep it concise and informative.\n </p>\n \n <div class="card-meta">\n <span class="card-date">Jan 15, 2025</span>\n <span class="card-author">By John Doe</span>\n </div>\n \n <div class="card-actions">\n <a href="/read-more" class="btn btn-primary">Read More</a>\n <button class="btn btn-secondary">Save</button>\n </div>\n </div>\n</article>'},{id:"html-nav",name:"Navigation",description:"Responsive navigation bar",code:'\x3c!-- Responsive Navigation --\x3e\n<header class="header">\n <nav class="nav" aria-label="Main navigation">\n <a href="/" class="nav-logo">\n <img src="/logo.svg" alt="Company Name" />\n </a>\n \n <button \n class="nav-toggle" \n aria-expanded="false"\n aria-controls="nav-menu"\n aria-label="Toggle navigation"\n >
2\n <span class="hamburger"></span>\n </button>\n \n <ul id="nav-menu" class="nav-menu">\n <li><a href="/" class="nav-link active">Home</a></li>\n <li><a href="/about" class="nav-link">About</a></li>\n <li><a href="/services" class="nav-link">Services</a></li>\n <li class="nav-dropdown">\n <button class="nav-link" aria-expanded="false">\n Products <span aria-hidden="true">\u25bc</span>\n </button>\n <ul class="dropdown-menu">\n <li><a href="/products/a">Product A</a></li>\n <li><a href="/products/b">Product B</a></li>\n <li><a href="/products/c">Product C</a></li>\n </ul>\n </li>\n <li><a href="/contact" class="nav-link">Contact</a></li>\n </ul>\n \n <div class="nav-actions">\n <a href="/login" class="btn btn-outline">Login</a>\n <a href="/signup" class="btn btn-primary">Sign Up</a>\n </div>\n </nav>\n</header>'},{id:"html-modal",name:"Modal Dialog",description:"Accessible modal/dialog",code:'\x3c!-- Accessible Modal Dialog --\x3e\n<div \n id="modal" \n class="modal" \n role="dialog" \n aria-modal="true"\n aria-labelledby="modal-title"\n aria-describedby="modal-description"\n hidden\n>\n <div class="modal-backdrop" data-close-modal></div>\n \n <div class="modal-content">\n <header class="modal-header">\n <h2 id="modal-title">Modal Title</h2>\n <button \n class="modal-close" \n data-close-modal\n aria-label="Close modal"\n >\n ×\n </button>\n </header>\n \n <div class="modal-body">\n <p id="modal-description">\n Modal content goes here. This could be a form,\n confirmation message, or any other content.\n </p>\n </div>\n \n <footer class="modal-footer">\n <button class="btn btn-secondary" data-close-modal>\n Cancel\n </button>\n <button class="btn btn-primary">\n Confirm\n </button>\n </footer>\n </div>\n</div>\n\n<script>\n// Toggle modal\nconst openModal = () => document.getElementById(\'modal\').hidden = false;\nconst closeModal = () => document.getElementById(\'modal\').hidden = true;\n\n// Close on backdrop click or close button\ndocument.querySelectorAll(\'[data-close-modal]\').forEach(el => {\n el.addEventListener(\'click\', closeModal);\n});\n\n// Close on Escape key\ndocument.addEventListener(\'keydown\', (e) => {\n if (e.key === \'Escape\') closeModal();\n});\n<\/script>'},{id:"html-table",name:"Data Table",description:"Accessible responsive table",code:'\x3c!-- Accessible Data Table --\x3e\n<div class="table-container">\n <table class="data-table">\n <caption>Monthly Sales Report</caption>\n \n <thead>\n <tr>\n <th scope="col">Product</th>\n <th scope="col">Category</th>\n <th scope="col" class="numeric">Price</th>\n <th scope="col" class="numeric">Quantity</th>\n <th scope="col" class="numeric">Total</th>\n <th scope="col">Actions</th>\n </tr>\n </thead>\n \n <tbody>\n <tr>\n <td data-label="Product">Widget Pro</td>\n <td data-label="Category">Electronics</td>\n <td data-label="Price" class="numeric">$99.00</td>\n <td data-label="Quantity" class="numeric">25</td>\n <td data-label="Total" class="numeric">$2,475.00</td>\n <td data-label="Actions">\n <button class="btn-icon" aria-label="Edit">\u270f\ufe0f</button>\n <button class="btn-icon" aria-label="Delete">\ud83d\uddd1\ufe0f</button>\n </td>\n </tr>\n <tr>\n <td data-label="Product">Gadget Plus</td>\n <td data-label="Category">Accessories</td>\n <td data-label="Price" class="numeric">$49.00</td>\n <td data-label="Quantity" class="numeric">50</td>\n <td data-label="Total" class="numeric">$2,450.00</td>\n <td data-label="Actions">\n <button class="btn-icon" aria-label="Edit">\u270f\ufe0f</button>\n <button class="btn-icon" aria-label="Delete">\ud83d\uddd1\ufe0f</button>\n </td>\n </tr>\n </tbody>\n \n <tfoot>\n <tr>\n <th scope="row" colspan="4">Grand Total</th>\n <td class="numeric"><strong>$4,925.00</strong></td>\n <td></td>\n </tr>\n </tfoot>\n </table>\n</div>'}
2]},css:{label:"CSS",icon:"css",snippets:[{id:"css-flexbox",name:"Flexbox Layout",description:"Common flexbox patterns",code:"/* Flexbox Layout Patterns */\n\n/* Center everything */\n.center-all {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n/* Space between items */\n.space-between {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n/* Vertical stack */\n.stack {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n\n/* Responsive wrap */\n.wrap-container {\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n}\n\n.wrap-container > * {\n flex: 1 1 300px; /* Grow, shrink, min-width */\n}\n\n/* Sidebar layout */\n.sidebar-layout {\n display: flex;\n gap: 2rem;\n}\n\n.sidebar {\n flex: 0 0 250px; /* Fixed width */\n}\n\n.main-content {\n flex: 1; /* Fill remaining space */\n}\n\n/* Holy grail layout */\n.holy-grail {\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n}\n\n.holy-grail main {\n flex: 1;\n}"},{id:"css-grid",name:"CSS Grid Layout",description:"Grid layout patterns",code:'/* CSS Grid Layout Patterns */\n\n/* Basic grid */\n.grid {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 1rem;\n}\n\n/* Responsive auto-fit */\n.auto-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n gap: 1.5rem;\n}\n\n/* Dashboard layout */\n.dashboard {\n display: grid;\n grid-template-columns: 250px 1fr;\n grid-template-rows: 60px 1fr;\n grid-template-areas:\n "sidebar header"\n "sidebar main";\n min-height: 100vh;\n}\n\n.dashboard-header { grid-area: header; }\n.dashboard-sidebar { grid-area: sidebar; }\n.dashboard-main { grid-area: main; }\n\n/* Card grid with featured item */\n.featured-grid {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n gap: 1rem;\n}\n\n.featured-grid .featured {\n grid-column: span 2;\n grid-row: span 2;\n}\n\n/* Masonry-like effect */\n.masonry {\n columns: 3 300px;\n column-gap: 1rem;\n}\n\n.masonry > * {\n break-inside: avoid;\n margin-bottom: 1rem;\n}'},{id:"css-animations",name:"CSS Animations",description:"Common animation patterns",code:"/* CSS Animation Patterns */\n\n/* Fade in */\n@keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.fade-in {\n animation: fadeIn 0.3s ease-in-out;\n}\n\n/* Slide up */\n@keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.slide-up {\n animation: slideUp 0.4s ease-out;\n}\n\n/* Pulse effect */\n@keyframes pulse {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(1.05); }\n}\n\n.pulse:hover {\n animation: pulse 0.5s ease-in-out infinite;\n}\n\n/* Skeleton loading */\n@keyframes shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n\n.skeleton {\n background: linear-gradient(\n 90deg,\n #f0f0f0 25%,\n #e0e0e0 50%,\n #f0f0f0 75%\n );\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n}\n\n/* Spin */\n@keyframes spin {\n to { transform: rotate(360deg); }\n}\n\n.spinner {\n width: 24px;\n height: 24px;\n border: 3px solid #f3f3f3;\n border-top: 3px solid #3498db;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n}"},{id:"css-buttons",name:"Button Styles",description:"Button component styles",code:'/* Button Styles */\n\n.btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n padding: 0.625rem 1.25rem;\n font-size: 0.875rem;\n font-weight: 500;\n line-height: 1.5;\n border-radius: 0.375rem;\n border: 1px solid transparent;\n cursor: pointer;\n transition: all 0.15s ease-in-out;\n}\n\n/* Primary */\n.btn-primary {\n background-color: #4f46e5;\n color: white;\n}\n\n.btn-primary:hover {\n background-color: #4338ca;\n}\n\n/* Secondary */\n.btn-secondary {\n background-color: #6b7280;\n color: white;\n}\n\n/* Outline */\n.btn-outline {\n background-color: transparent;\n border-color: #d1d5db;\n color: #374151;\n}\n\n.btn-outline:hover {\n background-color: #f3f4f6;\n}\n\n/* Ghost */\n.btn-ghost {\n background-color: transparent;\n color: #4f46e5;\n}\n\n.btn-ghost:hover {\n background-color: #eef2ff;\n}\n\n/* Sizes */\n.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
2\n.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }\n\n/* Disabled */\n.btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Loading state */\n.btn-loading {\n position: relative;\n color: transparent;\n}\n\n.btn-loading::after {\n content: "";\n position: absolute;\n width: 16px;\n height: 16px;\n border: 2px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n}'},{id:"css-variables",name:"CSS Variables",description:"Design system with CSS custom properties",code:"/* CSS Custom Properties - Design System */\n\n:root {\n /* Colors */\n --color-primary: #4f46e5;\n --color-primary-dark: #4338ca;\n --color-secondary: #6b7280;\n --color-success: #10b981;\n --color-warning: #f59e0b;\n --color-error: #ef4444;\n \n /* Neutrals */\n --color-gray-50: #f9fafb;\n --color-gray-100: #f3f4f6;\n --color-gray-200: #e5e7eb;\n --color-gray-500: #6b7280;\n --color-gray-900: #111827;\n \n /* Typography */\n --font-sans: 'Inter', system-ui, sans-serif;\n --font-mono: 'Fira Code', monospace;\n \n /* Font sizes */\n --text-xs: 0.75rem;\n --text-sm: 0.875rem;\n --text-base: 1rem;\n --text-lg: 1.125rem;\n --text-xl: 1.25rem;\n --text-2xl: 1.5rem;\n \n /* Spacing */\n --space-1: 0.25rem;\n --space-2: 0.5rem;\n --space-3: 0.75rem;\n --space-4: 1rem;\n --space-6: 1.5rem;\n --space-8: 2rem;\n \n /* Border radius */\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-full: 9999px;\n \n /* Shadows */\n --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);\n --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);\n --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);\n}\n\n/* Dark mode */\n@media (prefers-color-scheme: dark) {\n :root {\n --color-gray-50: #18181b;\n --color-gray-100: #27272a;\n --color-gray-900: #fafafa;\n }\n}"}]},sql:{label:"SQL",icon:"sql",snippets:[{id:"sql-select",name:"SELECT Queries",description:"Common SELECT patterns",code:"-- SELECT Query Examples\n\n-- Basic select\nSELECT * FROM users WHERE active = true;\n\n-- Select specific columns\nSELECT id, name, email \nFROM users \nWHERE created_at > '2024-01-01';\n\n-- With JOIN\nSELECT \n u.name,\n u.email,\n o.order_id,\n o.total\nFROM users u\nINNER JOIN orders o ON u.id = o.user_id\nWHERE o.status = 'completed';\n\n-- With aggregation\nSELECT \n category,\n COUNT(*) as total_products,\n AVG(price) as avg_price,\n SUM(quantity) as total_stock\nFROM products\nGROUP BY category\nHAVING COUNT(*) > 5\nORDER BY total_products DESC;\n\n-- Subquery\nSELECT * FROM users\nWHERE id IN (\n SELECT user_id \n FROM orders \n WHERE total > 100\n);\n\n-- CTE (Common Table Expression)\nWITH active_users AS (\n SELECT user_id, COUNT(*) as order_count\n FROM orders\n WHERE created_at > NOW() - INTERVAL '30 days'\n GROUP BY user_id\n)\nSELECT u.*, au.order_count\nFROM users u\nJOIN active_users au ON u.id = au.user_id;"},{id:"sql-crud",name:"CRUD Operations",description:"Insert, Update, Delete examples",code:"-- CRUD Operations\n\n-- INSERT single row\nINSERT INTO users (name, email, created_at)\nVALUES ('John Doe', '[email protected]', NOW());\n\n-- INSERT multiple rows\nINSERT INTO products (name, price, category) VALUES\n ('Widget A', 29.99, 'Electronics'),\n ('Widget B', 39.99, 'Electronics'),\n ('Gadget C', 19.99, 'Accessories');\n\n-- INSERT from SELECT\nINSERT INTO archive_orders (order_id, user_id, total)\nSELECT order_id, user_id, total\nFROM orders\nWHERE created_at < '2024-01-01';\n\n-- UPDATE\nUPDATE users \nSET \n name = 'Jane Doe',\n updated_at = NOW()\nWHERE id = 1;\n\n-- UPDATE with JOIN\nUPDATE products p\nSET price = p.price * 1.1\nFROM categories c\nWHERE p.category_id = c.id\nAND c.name = 'Electronics';\n\n-- DELETE\nDELETE FROM users WHERE id = 1;\n\n-- DELETE with subquery\nDELETE FROM orders\nWHERE user_id IN (\n SELECT id FROM users WHERE active = false\n);\n\n-- UPSERT (PostgreSQL)\nINSERT INTO users (email, name)\nVALUES ('[email protected]', 'John')\nON CONFLICT (email) \nDO UPDATE SET name = EXCLUDED.name;"},{id:"sql-create-table",name:"CREATE TABLE",description:"Table creation with constraints",code:"-- CREATE TABLE Examples\n\n-- Users table\nCREATE TABLE users (\n id SERIAL PRIMARY KEY,\n email VARCHAR(255)
2UNIQUE NOT NULL,\n name VARCHAR(100) NOT NULL,\n password_hash VARCHAR(255) NOT NULL,\n role VARCHAR(20) DEFAULT 'user',\n active BOOLEAN DEFAULT true,\n created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n\n-- Orders table with foreign key\nCREATE TABLE orders (\n id SERIAL PRIMARY KEY,\n user_id INTEGER NOT NULL REFERENCES users(id),\n status VARCHAR(20) DEFAULT 'pending',\n total DECIMAL(10, 2) NOT NULL,\n created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n \n CONSTRAINT valid_status CHECK (\n status IN ('pending', 'processing', 'completed', 'cancelled')\n )\n);\n\n-- Order items (many-to-many)\nCREATE TABLE order_items (\n id SERIAL PRIMARY KEY,\n order_id INTEGER REFERENCES orders(id) ON DELETE CASCADE,\n product_id INTEGER REFERENCES products(id),\n quantity INTEGER NOT NULL CHECK (quantity > 0),\n price DECIMAL(10, 2) NOT NULL,\n \n UNIQUE(order_id, product_id)\n);\n\n-- Create indexes\nCREATE INDEX idx_users_email ON users(email);\nCREATE INDEX idx_orders_user_id ON orders(user_id);\nCREATE INDEX idx_orders_created ON orders(created_at DESC);"}]},bash:{label:"Bash/Shell",icon:"sh",snippets:[{id:"bash-basics",name:"Bash Basics",description:"Variables, loops, conditions",code:'#!/bin/bash\n\n# Variables\nNAME="John"\nCOUNT=10\nFILES=$(ls -la)\n\n# Print\necho "Hello, $NAME"\necho "Count: $COUNT"\n\n# Conditionals\nif [ "$NAME" == "John" ]; then\n echo "Name is John"\nelif [ "$NAME" == "Jane" ]; then\n echo "Name is Jane"\nelse\n echo "Unknown name"\nfi\n\n# File checks\nif [ -f "file.txt" ]; then\n echo "File exists"\nfi\n\nif [ -d "directory" ]; then\n echo "Directory exists"\nfi\n\n# Loops\nfor i in {1..5}; do\n echo "Number: $i"\ndone\n\nfor file in *.txt; do\n echo "Processing: $file"\ndone\n\nwhile read -r line; do\n echo "Line: $line"\ndone < input.txt\n\n# Functions\ngreet() {\n local name=$1\n echo "Hello, $name!"\n}\n\ngreet "World"'},{id:"bash-file-ops",name:"File Operations",description:"Common file operations",code:'#!/bin/bash\n\n# Create directory structure\nmkdir -p project/{src,tests,docs}\n\n# Copy files\ncp source.txt destination.txt\ncp -r source_dir/ dest_dir/\n\n# Move/rename\nmv old_name.txt new_name.txt\n\n# Delete\nrm file.txt\nrm -rf directory/\n\n# Find files\nfind . -name "*.txt"\nfind . -type f -mtime -7 # Modified in last 7 days\nfind . -size +10M # Larger than 10MB\n\n# Search in files\ngrep "pattern" file.txt\ngrep -r "pattern" ./ # Recursive\ngrep -l "pattern" *.txt # List files only\n\n# Replace in files\nsed -i \'s/old/new/g\' file.txt\n\n# File permissions\nchmod 755 script.sh # rwxr-xr-x\nchmod +x script.sh # Add execute\nchown user:group file.txt\n\n# Archive\ntar -czvf archive.tar.gz directory/\ntar -xzvf archive.tar.gz\n\n# Disk usage\ndu -sh directory/ # Directory size\ndf -h # Disk free space'},{id:"bash-git",name:"Git Commands",description:"Common Git operations",code:'#!/bin/bash\n\n# Configuration\ngit config --global user.name "Your Name"\ngit config --global user.email "[email protected]"\n\n# Initialize & Clone\ngit init\ngit clone https://github.com/user/repo.git\n\n# Status & Diff\ngit status\ngit diff\ngit diff --staged\n\n# Staging & Committing\ngit add .\ngit add -p # Interactive staging\ngit commit -m "Message"\ngit commit --amend # Modify last commit\n\n# Branches\ngit branch # List branches\ngit branch feature-name # Create branch\ngit checkout feature-name # Switch branch\ngit checkout -b feature-name # Create & switch\ngit merge feature-name # Merge branch\ngit branch -d feature-name # Delete branch\n\n# Remote\ngit remote -v\ngit fetch origin\ngit pull origin main\ngit push origin main\ngit push -u origin feature # Set upstream\n\n# Stash\ngit stash\ngit stash list\ngit stash pop\ngit stash drop\n\n# History\ngit log --oneline\ngit log --graph --all\ngit show commit_hash\n\n# Undo\ngit checkout -- file.txt # Discard changes\ngit reset HEAD file.txt # Unstage\ngit reset --soft HEAD~1 # Undo commit, keep changes\ngit reset --hard HEAD~1 # Undo commit, discard changes\ngit revert commit_hash # Create undo commit'}]},api:{label:"API Examples",icon:"api",snippets:[{id:"api-rest",name:"REST API Endpoints",description:"RESTful API design patterns",code:'// REST API Endpoint Examples\n\n// GET - List resources\n// GET /api/users\n// GET /api/users?page=1&limit=10&sort=name\n\n// GET - Single resource\n// GET /api/users/123\n\n// POST - Create resource\n// POST /api/users\n// Body: { "name": "John", "email": "[email protected]" }\n\n// PUT - Full update\n// PUT /api/users/123\n// Body: { "name": "John Doe", "email": "[email protected]" }\n\n// PATCH - Partial update\n// PATCH /api/users/123\n// Body: { "name": "John Doe" }\n\n// DELETE - Remove resource\n// DELETE /api/users/123\n\n// Nested resources\n// GET /api/users/123/orders\n// POST /api/users/123/orders\n\n// Filtering & Search\n// GET /api/products?category=electronics&min_price=100\n// GET /api/users?search=john\n\n// Response format\n{\n "success": true,\n "data": {\n "id": 123,\n "name": "John Doe"\n },\n "meta": {\n "page": 1,\n "total": 100\n }\n}\n\n// Error response\n{\n "success": false,\n "error": {\n "code": "VALIDATION_ERROR",\n "message": "Email is required",\n "details": [\n { "field": "email", "message": "Required" }\n ]\n }\n}'},{id:"api-curl",name:"cURL Commands",description:"API testing with cURL",code:'# cURL API Testing Examples\n\n# GET request\ncurl https://api.example.com/users\n\n# GET with headers\ncurl -H "Authorization: Bearer TOKEN" \\\n -H "Accept: application/json" \\\n https://api.example.com/users\n\n# POST with JSON body\ncurl -X POST \\\n -H "Content-Type: application/json" \\\n -d \'{"name": "John", "email": "[email protected]"}\' \\\n https://api.example.com/users\n\n# POST form data\ncurl -X POST \\\n -F "name=John" \\\n -F "[email protected]" \\\n https://api.example.com/upload\n\n# PUT request\ncurl -X PUT \\\n -H "Content-Type: application/json" \\\n -d \'{"name": "John Doe"}\' \\\n https://api.example.com/users/123\n\n# DELETE request\ncurl -X DELETE \\\n -H "Authorization: Bearer TOKEN" \\\n https://api.example.com/users/123\n\n# Show response headers\ncurl -I https://api.example.com/users\n\n# Verbose output (debugging)\ncurl -v https://api.example.com/users\n\n# Save response to file\ncurl -o response.json https://api.example.com/users\n\n# Follow redirects\ncurl -L https://example.com/redirect'},{id:"api-express",name:"Express.js API",description:"Node.js Express API setup",code:"// Express.js REST API\nconst express = require('express');\nconst app = express();\n\n// Middleware\napp.use(express.json());\n\n// In-memory data (replace with database)\nlet users = [];\n\n// GET all users\napp.get('/api/users', (req, res) => {\n const { page = 1, limit = 10 } = req.query;\n const start = (page - 1) * limit;\n const paginatedUsers = users.slice(start, start + limit);\n \n res.json({\n data: paginatedUsers,\n meta: { page, limit, total: users.length }\n });\n});\n\n// GET single user\napp.get('/api/users/:id', (req, res) => {\n const user = users.find(u => u.id === req.params.id);\n if (!user) {\n return res.status(404).json({ error: 'User not found' });\n }\n res.json(user);\n});\n\n// POST create user\napp.post('/api/users', (req, res) => {\n const { name, email } = req.body;\n \n if (!name || !email) {\n return res.status(400).json({ error: 'Name and email required' });\n }\n \n const newUser = {\n id: Date.now().toString(),\n name,\n email,\n createdAt: new Date()\n };\n \n users.push(newUser);\n res.status(201).json(newUser);\n});\n\n// PUT update user\napp.put('/api/users/:id', (req, res) => {\n const index = users.findIndex(u => u.id === req.params.id);\n if (index === -1) {\n return res.status(404).json({ error: 'User not found' });\n }\n \n users[index] = { ...users[index], ...req.body };\n res.json(users[index]);\n});\n\n// DELETE user\napp.delete('/api/users/:id', (req, res) => {\n users = users.filter(u => u.id !== req.params.id);\n res.status(204).send();\n});\n\napp.listen(3000, () => console.log('Server running on port 3000'));"}]}},B$=e=>{const t=(()=>{const e=[];return Object.entries(P$).forEach(t=>{let[s,a]=t;
2a.snippets.forEach(t=>{e.push(d(d({},t),{},{category:s,categoryLabel:a.label}))})}),e})(),s=e.toLowerCase();return t.filter(e=>e.name.toLowerCase().includes(s)||e.description.toLowerCase().includes(s)||e.categoryLabel.toLowerCase().includes(s))},R$={javascript:"\ud83d\udfe8",python:"\ud83d\udc0d",react:"\u269b\ufe0f",html:"\ud83c\udf10",css:"\ud83c\udfa8",sql:"\ud83d\uddc4\ufe0f",bash:"\ud83d\udcbb",api:"\ud83d\udd0c"},L$=e=>{let{open:s,onClose:a,onSelect:n}=e;const[l,r]=(0,t.useState)("javascript"),[i,o]=(0,t.useState)(""),[c,d]=(0,t.useState)(null),[u,m]=(0,t.useState)(null),h=Object.entries(P$).map(e=>{let[t,s]=e;return{key:t,label:s.label,icon:R$[t]||"\ud83d\udcc4",count:s.snippets.length}}),x=(0,t.useMemo)(()=>{var e;return i.trim()?B$(i):(null===(e=P$[l])||void 0===e?void 0:e.snippets)||[]},[l,i]);return(0,ea.jsx)(Ok,{open:s,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-5xl h-[80vh] flex flex-col p-0 gap-0",children:[(0,ea.jsx)(Vk,{className:"px-6 py-4 border-b border-slate-200",children:(0,ea.jsxs)($k,{className:"flex items-center gap-2 text-xl",children:[(0,ea.jsx)(kE,{className:"text-indigo-600",size:24}),"Code Snippet Library"]})}),(0,ea.jsx)("div",{className:"px-6 py-3 border-b border-slate-200 bg-slate-50",children:(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search snippets...",value:i,onChange:e=>o(e.target.value),className:"pl-10"})]})}),(0,ea.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[!i&&(0,ea.jsx)("div",{className:"w-48 border-r border-slate-200 bg-slate-50 p-2",children:(0,ea.jsx)(z$,{className:"h-full",children:h.map(e=>(0,ea.jsxs)("button",{onClick:()=>r(e.key),className:"w-full text-left px-3 py-2 rounded-lg mb-1 flex items-center gap-2 transition-colors ".concat(l===e.key?"bg-indigo-100 text-indigo-700":"hover:bg-slate-200 text-slate-700"),children:[(0,ea.jsx)("span",{children:e.icon}),(0,ea.jsx)("span",{className:"flex-1 text-sm font-medium",children:e.label}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:e.count})]},e.key))})}),(0,ea.jsx)("div",{className:"".concat(c?"w-1/3":"flex-1"," border-r border-slate-200 overflow-hidden"),children:(0,ea.jsx)(z$,{className:"h-full",children:(0,ea.jsxs)("div",{className:"p-4 space-y-2",children:[i&&(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mb-3",children:[x.length," result",1!==x.length?"s":"",' for "',i,'"']}),0===x.length?(0,ea.jsxs)("div",{className:"text-center py-12 text-slate-500",children:[(0,ea.jsx)(kE,{size:48,className:"mx-auto mb-4 opacity-30"}),(0,ea.jsx)("p",{children:"No snippets found"})]}):x.map(e=>(0,ea.jsx)("div",{onClick:()=>d(e),className:"p-3 rounded-lg border cursor-pointer transition-all ".concat((null===c||void 0===c?void 0:c.id)===e.id?"border-indigo-300 bg-indigo-50":"border-slate-200 hover:border-slate-300 hover:bg-slate-50"),children:(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("h4",{className:"font-medium text-slate-900 truncate",children:e.name}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 line-clamp-2",children:e.description}),i&&e.categoryLabel&&(0,ea.jsx)("span",{className:"inline-block mt-1 text-xs px-2 py-0.5 bg-slate-200 rounded",children:e.categoryLabel})]}),(0,ea.jsx)(ax,{size:18,className:"text-slate-400 flex-shrink-0 mt-1"})]})},e.id))]})})}),c&&(0,ea.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,ea.jsxs)("div",{className:"px-4 py-3 border-b border-slate-200 bg-slate-50 flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"font-semibold text-slate-900",children:c.name}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:c.description})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>(async e=>{await navigator.clipboard.writeText(e.code),m(e.id),setTimeout(()=>m(null),2e3)})(c),children:u===c.id?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Xl,{size:14,className:"mr-1"}),"Copied"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(DD,{size:14,className:"mr-1"}),"Copy"]})}),(0,ea.jsx)(sg,{size:"sm",onClick:()=>{return n({code:(e=c).code,language:"react"===e.category?"typescript":"api"===e.category?"javascript":"bash"===e.category?"bash":e.category}),void a();var e},children:"Use Snippet"})]})]}),(0,ea.jsx)(z$,{className:"flex-1",children:(0,ea.jsx)("div",{className:"p-4",children:(0,ea.jsx)(qg,{code:c.code,language:"react"===c.category?"typescript":"api"===c.category?"javascript":"bash"===c.category?"bash":c.category||"javascript",theme:"github-dark",showLineNumbers:!0})})})]})]})]})})},I$=e=>
2{let{value:s="",onChange:a,pages:n=[],anchors:l=[],placeholder:r="https://example.com",label:i="Link",showAnchor:o=!0,showDownload:c=!0,testId:d="link-selector"}=e;const[u,m]=(0,t.useState)(null),h=null!==u?u:(x=s)?x.startsWith("mailto:")?"email":x.startsWith("tel:")?"phone":x.startsWith("download:")?"download":x.startsWith("http://")||x.startsWith("https://")?"external":x.startsWith("#")?"anchor":"internal":"none";var x;const p=e=>{if(!e)return"";let t=e;for(;t.startsWith("download:");)t=t.substring(9);return t},[g,f]=(0,t.useState)(null!==s&&void 0!==s&&s.startsWith("http")?s:""),[v,b]=(0,t.useState)(null!==s&&void 0!==s&&s.startsWith("#")?s.substring(1):""),[j,y]=(0,t.useState)(p(null!==s&&void 0!==s&&s.startsWith("download:")?s:"")),[N,w]=(0,t.useState)(null!==s&&void 0!==s&&s.startsWith("mailto:")?s.substring(7):""),[C,k]=(0,t.useState)(null!==s&&void 0!==s&&s.startsWith("tel:")?s.substring(4):"");return(0,ea.jsxs)("div",{className:"space-y-2","data-testid":d,children:[i&&(0,ea.jsx)("label",{className:"text-xs text-slate-500 block",children:i}),(0,ea.jsxs)(eb,{value:h,onValueChange:e=>{m(e),"none"===e&&(a(""),f(""),b(""),y(""),w(""),k(""))},children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{placeholder:"Select link type..."})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"No Link"}),(0,ea.jsx)(rb,{value:"internal",children:"Internal Page"}),(0,ea.jsx)(rb,{value:"external",children:"External URL"}),(0,ea.jsx)(rb,{value:"email",children:"Email"}),(0,ea.jsx)(rb,{value:"phone",children:"Phone"}),o&&(0,ea.jsx)(rb,{value:"anchor",children:"Anchor"}),c&&(0,ea.jsx)(rb,{value:"download",children:"Download File"})]})]}),"internal"===h&&(0,ea.jsxs)(eb,{value:!s||s.startsWith("http")||s.startsWith("#")||s.startsWith("download:")?"_none_":s.startsWith("/")?s.substring(1):s,onValueChange:e=>{a(e&&"_none_"!==e?"/".concat(e):"")},children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{placeholder:"Select a page..."})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"_none_",children:"-- Select a page --"}),[...n].sort((e,t)=>(e.title||"").localeCompare(t.title||"")).map(e=>{const t=e.full_path||e.slug;return(0,ea.jsxs)(rb,{value:t,children:[e.title," (/",t,")"]},e.page_id||e.slug)})]})]}),"external"===h&&(0,ea.jsx)(BN,{value:null!==s&&void 0!==s&&s.startsWith("http")?s:g,onChange:e=>{return t=e.target.value,f(t),void a(t);var t},placeholder:r,className:"h-8 text-xs"}),"anchor"===h&&(0,ea.jsxs)(ea.Fragment,{children:[l&&l.length>0?(0,ea.jsxs)(eb,{value:s&&s.startsWith("#")?s.substring(1):"_none_",onValueChange:e=>{if(e&&"_none_"!==e){const t=l.find(t=>t.id===e),s=null!==t&&void 0!==t&&t.pageSlug?"/".concat(t.pageSlug,"#").concat(e):"#".concat(e);a(s),b(e)}else a(""),b("")},children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{placeholder:"Select an anchor..."})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"_none_",children:"-- Select an anchor --"}),l.map((e,t)=>(0,ea.jsxs)(rb,{value:e.id,children:["#",e.id," ",e.name?"(".concat(e.name,")"):""," ",e.pageSlug?"- ".concat(e.pageSlug):""]},e.id||t))]})]}):(0,ea.jsx)(BN,{value:null!==s&&void 0!==s&&s.startsWith("#")?s.substring(1):v,onChange:e=>(e=>{const t=e.startsWith("#")?e.substring(1):e;b(t),a(t?"#".concat(t):"")})(e.target.value),placeholder:"section-name",className:"h-8 text-xs"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:l&&l.length>0?"Select an anchor from the list above":'Enter anchor ID manually (e.g., "contact" for #contact)'})]}),"download"===h&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(BN,{value:(s&&s.startsWith("download:")?p(s):"")||j,onChange:e=>(e=>{const t=p(e);y(t),a(t?"download:".concat(t):"")})(e.target.value),placeholder:"https://example.com/file.pdf or paste Media Library URL",className:"h-8 text-xs"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 flex items-center gap-1",children:[(0,ea.jsx)(jj,{size:12}),"Paste a direct URL to a PDF, image, document, etc. Opens as download."]})]}),"email"===h&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(BN,{type:"email",value:N,onChange:e=>(e=>{const t=e.replace(/^mailto:/i,"").trim();w(t),a(t?"mailto:".concat(t):"")})(e.target.value),placeholder:"[email protected]",className:"h-8 text-xs","data-testid":"".concat(d,"-email-input")}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 flex items-center gap-1",children:[(0,ea.jsx)(Yl,{size:12}),"Opens the visitor's email app with a new message to this address."]})]}),"phone"===h&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(BN,{type:"tel",value:C,onChange:e=>(e=>{const t=e.replace(/^tel:/i,"").trim();k(t),a(t?"tel:".concat(t):"")})(e.target.value),placeholder:"+61 412 345 678",className:"h-8 text-xs","data-testid":"".concat(d,"-phone-input")}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 flex items-center gap-1",children:[(0,ea.jsx)(Jl,{size:12}),"On mobile, tapping the button dials this number. Include the country code (e.g. +61)."]})]}),s&&(0,ea.jsx)("div",{className:"text-xs text-slate-400 bg-slate-100 px-2 py-1 rounded",children:s.startsWith("download:")?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(jj,{size:10,
2className:"inline mr-1"}),"Download: ",(0,ea.jsx)("code",{className:"text-indigo-600",children:s.substring(9)})]}):s.startsWith("mailto:")?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Yl,{size:10,className:"inline mr-1"}),"Email: ",(0,ea.jsx)("code",{className:"text-indigo-600",children:s.substring(7)})]}):s.startsWith("tel:")?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Jl,{size:10,className:"inline mr-1"}),"Phone: ",(0,ea.jsx)("code",{className:"text-indigo-600",children:s.substring(4)})]}):(0,ea.jsxs)(ea.Fragment,{children:["URL: ",(0,ea.jsx)("code",{className:"text-indigo-600",children:s})]})})]})},O$=["style","size","color","textColor","gradientColor","radius","hover","icon","iconPosition","iconColor"],U$={style:"buttonStyle",size:"buttonSize",color:"buttonColor",textColor:"buttonTextColor",gradientColor:"buttonGradientColor",radius:"buttonRadius",hover:"buttonHover",icon:"buttonIcon",iconPosition:"buttonIconPosition",iconColor:"buttonIconColor"},H$=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={};return O$.forEach(s=>{void 0!==e[s]&&(t[s]=e[s])}),t},W$=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={};return O$.forEach(s=>{const a=U$[s];void 0!==e[a]&&(t[s]=e[a])}),t},V$={style:"solid",size:"md",color:void 0,textColor:void 0,gradientColor:void 0,radius:"rounded",hover:"fade",icon:"none",iconPosition:"right",iconColor:void 0},q$=e=>{let{currentStyle:s,onApply:a}=e;const[n,l]=(0,t.useState)([]),[r,i]=(0,t.useState)("none"),[o,c]=(0,t.useState)("idle"),[d,u]=(0,t.useState)(""),m=async()=>l(await(async()=>{try{var e;return(null===(e=(await _l.get("/button-presets")).data)||void 0===e?void 0:e.presets)||[]}catch(G2){return[]}})());(0,t.useEffect)(()=>{m()},[]);const h=n.find(e=>e.preset_id===r),x=async()=>{const e=d.trim();if(e)try{var t;const a=await((e,t)=>_l.post("/button-presets",{name:e,style:t}))(e,s||{});qs.success('Saved button style "'.concat(e,'"')),u(""),c("idle"),await m(),null!==a&&void 0!==a&&null!==(t=a.data)&&void 0!==t&&t.preset_id&&i(a.data.preset_id)}catch(G2){var a,n;qs.error((null===(a=G2.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.detail)||"Failed to save preset")}else qs.error("Enter a preset name")};return(0,ea.jsxs)("div",{className:"mb-2 p-2 rounded-lg border border-indigo-100 bg-indigo-50/40",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,ea.jsx)(Dw,{size:12,className:"text-indigo-500"}),(0,ea.jsx)("span",{className:"text-[11px] font-semibold text-indigo-600",children:"Saved button styles"})]}),"confirmDelete"===o&&h?(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)("span",{className:"text-[11px] text-slate-700",children:["Delete \u201c",h.name,"\u201d completely?"]}),(0,ea.jsx)("button",{type:"button","data-testid":"preset-delete-confirm",onClick:async()=>{var e;if(h)try{await(e=h.preset_id,_l.delete("/button-presets/".concat(e))),i("none"),c("idle"),m(),qs.success("Preset deleted")}catch(K2){qs.error("Failed to delete preset")}},className:"px-2.5 py-1 rounded-md bg-red-600 text-white hover:bg-red-700 text-[11px] font-medium",children:"Delete"}),(0,ea.jsx)("button",{type:"button",onClick:()=>c("idle"),className:"px-2.5 py-1 rounded-md bg-white border border-slate-200 text-slate-600 hover:bg-slate-50 text-[11px]",children:"Cancel"})]}):"save"===o?(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsx)(BN,{autoFocus:!0,value:d,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x()},placeholder:"Name this style",className:"h-8 text-xs w-40","data-testid":"preset-name-input"}),(0,ea.jsx)("button",{type:"button",onClick:x,"data-testid":"preset-save-confirm",className:"px-3 py-1.5 rounded-md bg-indigo-600 text-white hover:bg-indigo-700 text-[11px] font-medium",children:"Save"}),(0,ea.jsx)("button",{type:"button",onClick:()=>{c("idle"),u("")},className:"px-2.5 py-1.5 rounded-md bg-white border border-slate-200 text-slate-600 hover:bg-slate-50 text-[11px]",children:"Cancel"})]}):(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:r,onValueChange:e=>{if(i(e),c("idle"),"none"===e)return null===a||void 0===a||a(V$),void qs.success("Reset to default button");const t=n.find(t=>t.preset_id===e);t&&(null===a||void 0===a||a(t.style||{}),qs.success('Applied "'.concat(t.name,'"')))},children:[(0,ea.jsx)(sb,{className:"h-8 text-xs w-48","data-testid":"preset-select",children:(0,ea.jsx)(tb,{placeholder:"None"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"None"}),n.map(e=>(0,ea.jsx)(rb,{value:e.preset_id,"data-testid":"preset-option-".concat(e.preset_id),children:e.name},e.preset_id))]})]}),(0,ea.jsx)("button",{type:"button","data-testid":"preset-delete-btn",disabled:!h,onClick:()=>c("confirmDelete"),title:h?'Delete "'.concat(h.name,'"'):"Select a preset to delete",className:"inline-flex items-center justify-center w-8 h-8 rounded-md border border-slate-200 bg-white text-slate-400 hover:text-red-500 hover:border-red-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:(0,ea.jsx)(wD,{size:14})}),(0,ea.jsxs)("button",{type:"button","data-testid":"save-preset-btn",onClick:()=>c("save"),className:"inline-flex items-center gap-1 px-3 py-1.5 rounded-md bg-indigo-600 text-white hover:bg-indigo-700 text-[11px] font-medium transition-colors",children:[(0,ea.jsx)(CE,{size:12})," Save as preset"]})]})]})},$$=e=>{let{fields:t={},onPatch:s,showVariant:a=!1,showPresets:n=!0,testPrefix:l="btn"}=e;return(0,ea.jsxs)("div",{className:"space-y-2",children:[n&&(0,ea.jsx)(q$,{currentStyle:W$(t),onApply:e=>s(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={};return O$.forEach(s=>{void 0!==e[s]&&(t[U$[s]]=e[s])}),t}(e))}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Style:"}),(0,ea.jsxs)(eb,{value:t.buttonStyle||"solid",onValueChange:e=>s({buttonStyle:e}),children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs","data-testid":"".concat(l,"-style"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline"}),(0,ea.jsx)(rb,{value:"ghost",children:"Ghost"}),(0,ea.jsx)(rb,{value:"gradient",children:"Gradient"}),(0,ea.jsx)(rb,{value:"soft",children:"Soft"})]})]})]}),"gradient"===t.buttonStyle&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Gradient:"}),(0,ea.jsx)("input",{type:"color","data-testid":"".concat(l,"-gradient-color"),value:t.buttonGradientColor||"#8b5cf6",onChange:e=>s({buttonGradientColor:e.target.value}),className:"w-6 h-6 rounded border cursor-pointer"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Corners:"}),(0,ea.jsxs)(eb,{value:t.buttonRadius||"rounded",onValueChange:e=>s({buttonRadius:e}),children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs","data-testid":"".concat(l,"-radius"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"square",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Hover:"}),(0,ea.jsxs)(eb,{value:t.buttonHover||"fade",onValueChange:e=>s({buttonHover:e}),children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs","data-testid":"".concat(l,"-hover"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"fade",children:"Fade"}),(0,ea.jsx)(rb,{value:"darken",children:"Darken"}),(0,ea.jsx)(rb,{value:"lift",children:"Lift"}),(0,ea.jsx)(rb,{value:"none",children:"None"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Icon:"}),(0,ea.jsxs)(eb,{value:t.buttonIcon||"none",onValueChange:e=>s({buttonIcon:e}),children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs","data-testid":"".concat(l,"-icon"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:$j.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),t.buttonIcon&&"none"!==t.buttonIcon&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Pos:"}),(0,ea.jsxs)(eb,{value:t.buttonIconPosition||"right",onValueChange:e=>s({buttonIconPosition:e}),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs","data-testid":"".concat(l,"-icon-position"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),t.buttonIcon&&"none"!==t.buttonIcon&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Icon color:"}),(0,ea.jsx)("input",{type:"color","data-testid":"".concat(l,"-icon-color"),value:t.buttonIconColor||"#ffffff",onChange:e=>s({buttonIconColor:e.target.value}),className:"w-6 h-6 rounded border cursor-pointer"}),t.buttonIconColor&&(0,ea.jsx)("button",{type:"button",onClick:()=>s({buttonIconColor:void 0}),className:"text-[10px] text-slate-400 hover:text-slate-600",title:"Reset to match text",children:"reset"})]})]})]})}
2,G$=[{value:"full",label:"Full Width",description:"Edge to edge (100%)"},{value:"container",label:"Container",description:"Matches page width"},{value:"large",label:"Large (75%)",description:"Centered large block"},{value:"medium",label:"Medium (60%)",description:"Centered medium block"},{value:"small",label:"Small (45%)",description:"Compact layout"}],K$=e=>{var s;let{content:a,onChange:n,openMediaPicker:l,blockId:r,pages:i=[],anchors:o=[]}=e;const[c,u]=(0,t.useState)(0),m=a.slides||[],h=()=>({imageUrl:a.imageUrl||"",imageAlt:a.imageAlt||"",textHtml:a.textHtml||"<p>Text content</p>",imagePosition:a.imagePosition||"left",imageSizeMode:a.imageSizeMode||"width",imageWidth:a.imageWidth||300,imageHeight:a.imageHeight||200,imageAlign:a.imageAlign||"center",shapeMask:a.shapeMask||"none",shapeSize:a.shapeSize||250,shapeBorderWidth:a.shapeBorderWidth||0,shapeBorderColor:a.shapeBorderColor||"#ffffff",paddingSide:a.paddingSide||"all",paddingSize:a.paddingSize||0}),x=m.length>0?m:[h()],p=x[c]||x[0],g=(e,t,s)=>{const l=[...x];l[e]=d(d({},l[e]),{},{[t]:s}),n(d(d({},a),{},{slides:l,carouselMode:l.length>1}))};return(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between bg-slate-50 p-2 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[x.map((e,t)=>(0,ea.jsx)("button",{onClick:()=>u(t),className:"w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ".concat(t===c?"bg-indigo-600 text-white":"bg-white border border-slate-200 text-slate-600 hover:bg-slate-100"),children:t+1},t)),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{const e=h(),t=[...x,e];n(d(d({},a),{},{slides:t,carouselMode:!0})),u(t.length-1)},className:"h-8 px-2",children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"}),"Add Slide"]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{u(e=>e>0?e-1:x.length-1)},className:"h-8 w-8 p-0",children:(0,ea.jsx)(vj,{size:16})}),(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:["Slide ",c+1," of ",x.length]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{u(e=>(e+1)%x.length)},className:"h-8 w-8 p-0",children:(0,ea.jsx)(ax,{size:16})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=[...x];t.splice(e+1,0,d({},x[e])),n(d(d({},a),{},{slides:t,carouselMode:!0})),u(e+1)})(c),className:"h-8 px-2",title:"Duplicate slide",children:(0,ea.jsx)(DD,{size:14})}),x.length>1&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{if(x.length<=1)return;const t=x.filter((t,s)=>s!==e);n(d(d({},a),{},{slides:t,carouselMode:t.length>1})),u(Math.min(c,t.length-1))})(c),className:"h-8 px-2 text-red-500 hover:text-red-700",title:"Delete slide",children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(NE,{size:14,className:"text-blue-500"}),(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Block Width"})]}),(0,ea.jsx)("div",{className:"grid grid-cols-5 gap-2",children:G$.map(e=>(0,ea.jsx)("button",{onClick:()=>n(d(d({},a),{},{blockWidth:e.value})),className:"p-2 rounded-lg border text-xs font-medium transition-all ".concat((a.blockWidth||"container")===e.value?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200 hover:border-indigo-300"),title:e.description,children:e.label.split(" ")[0]},e.value))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2",children:null===(s=G$.find(e=>e.value===(a.blockWidth||"container")))||void 0===s?void 0:s.description})]}),x.length>1&&(0,ea.jsxs)("div",{className:"flex items-center gap-4 p-2 bg-blue-50 rounded-lg",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==a.autoPlay,onChange:e=>n(d(d({},a),{},{autoPlay:e.target.checked})),className:"rounded border-slate-300"}),"Auto-play"]}),!1!==a.autoPlay&&(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Speed:"}),(0,ea.jsx)(BN,{type:"number",value:a.autoPlaySpeed||5e3,onChange:e=>n(d(d({},a),{},{autoPlaySpeed:parseInt(e.target.value)||5e3})),className:"w-20 h-8 text-xs",min:"1000",max:"15000",step:"500"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"ms"})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==a.showDots,onChange:e=>n(d(d({},a),{},{showDots:e.target.checked})),className:"rounded border-slate-300"}),"Show dots"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==a.showArrows,onChange:e=>n(d(d({},a),{},{showArrows:e.target.checked})),className:"rounded border-slate-300"}),"Show arrows"]})]}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-4 space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 border-b pb-2",children:[(0,ea.jsx)($N,{size:16}),"Slide ",c+1," Content"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Image Position:"}),(0,ea.jsxs)(eb,{value:p.imagePosition||"left",onValueChange:e=>g(c,"imagePosition",e),children:[(0,ea.jsx)(sb,{className:"w-32",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>l(r,c),children:[(0,ea.jsx)(jD,{size:16,className:"mr-2"}),p.imageUrl?"Change Image":"Select Image"]}),p.imageUrl&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-green-600 flex items-center gap-1",children:"\u2713 Image selected"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>g(c,"imageUrl",""),className:"h-8 px-2 text-red-500 hover:text-red-700 hover:bg-red-50",title:"Remove image",children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsx)(BN,{value:p.imageAlt||"",onChange:e=>g(c,"imageAlt",e.target.value),placeholder:"Alt text (for accessibility)"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 font-medium",children:"Size:"}),(0,ea.jsxs)(eb,{value:p.imageSizeMode||"width",onValueChange:e=>g(c,"imageSizeMode",e),children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"width",children:"By Width"}),(0,ea.jsx)(rb,{value:"height",children:"By Height"}),(0,ea.jsx)(rb,{value:"custom",children:"Custom (W\xd7H)"})]})]}),"custom"===p.imageSizeMode?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:p.imageWidth||300,onChange:e=>g(c,"imageWidth",parseInt(e.target.value)||300),className:"w-16 h-8 text-xs",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:p.imageHeight||200,onChange:e=>g(c,"imageHeight",parseInt(e.target.value)||200),className:"w-16 h-8 text-xs",min:"50",max:"800"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):"height"===p.imageSizeMode?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:p.imageHeight||200,onChange:e=>g(c,"imageHeight",parseInt(e.target.value)||200),className:"w-16 h-8 text-xs",min:"50",max:"800"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:p.imageWidth||300,onChange:e=>g(c,"imageWidth",parseInt(e.target.value)||300),className:"w-16 h-8 text-xs",min:"50",max:"1200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),(0,ea.jsxs)(eb,{value:p.imageAlign||"center",onValueChange:e=>g(c,"imageAlign",e),children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Corners:"}),(0,ea.jsxs)(eb,{value:p.imageCorners||"rounded",onValueChange:e=>g(c,"imageCorners",e),children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"square",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill (max)"})]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center flex-wrap",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Shape Mask:"}),(0,ea.jsxs)(eb,{value:p.shapeMask||"none",onValueChange:e=>g(c,"shapeMask",e),children:[(0,ea.jsx)(sb,{className:"w-28 h-8",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"none",label:"No Mask"},{value:"circle",label:"Circle"},{value:"ellipse",label:"Ellipse"},{value:"rounded",label:"Rounded"},{value:"diamond",label:"Diamond"},{value:"hexagon",label:"Hexagon"},{value:"octagon",label:"Octagon"},{value:"star",label:"Star"},{value:"arch",label:"Arch"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),p.shapeMask&&"none"!==p.shapeMask&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsx)(BN,{type:"number",value:p.shapeSize||250,onChange:e=>g(c,"shapeSize",parseInt(e.target.value)||250),className:"w-16 h-8 text-xs",min:"50",max:"600"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"}),(0,ea.jsx)("label",{className:"text-xs text-slate-500 ml-2",children:"Border:"}),(0,ea.jsx)(BN,{type:"number",value:p.shapeBorderWidth||0,onChange:e=>g(c,"shapeBorderWidth",parseInt(e.target.value)||0),className:"w-14 h-8 text-xs",min:"0",max:"20"}),(0,ea.jsx)("input",{type:"color",value:p.shapeBorderColor||"#ffffff",onChange:e=>g(c,"shapeBorderColor",e.target.value),className:"w-8 h-8 rounded border cursor-pointer",title:"Border Color"})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center flex-wrap",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Padding:"}),(0,ea.jsxs)(eb,{value:p.paddingSide||"all",onValueChange:e=>g(c,"paddingSide",e),children:[(0,ea.jsx)(sb,{className:"w-20 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All"}),(0,ea.jsx)(rb,{value:"top",children:"Top"}),(0,ea.jsx)(rb,{value:"right",children:"Right"}),(0,ea.jsx)(rb,{value:"bottom",children:"Bottom"}),(0,ea.jsx)(rb,{value:"left",children:"Left"})]})]}),(0,ea.jsx)(BN,{type:"number",value:p.paddingSize||0,onChange:e=>g(c,"paddingSize",parseInt(e.target.value)||0),className:"w-14 h-8 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 block",children:"Text Content"}),(0,ea.jsx)(Cq,{content:p.textHtml||"<p>Text content</p>",onChange:e=>g(c,"textHtml",e),placeholder:"Enter text content..."},"slide-".concat(c)),(0,ea.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:p.hasButton||!1,onChange:e=>g(c,"hasButton",e.target.checked),className:"w-4 h-4 rounded border-slate-300"}),(0,ea.jsx)("span",{className:"text-xs font-medium text-slate-600",children:"Add Button"})]}),p.hasButton&&(0,ea.jsxs)("div",{className:"mt-2 space-y-2 p-2 bg-slate-50 rounded-lg",children:[(0,ea.jsx)(BN,{value:p.buttonText||"Learn More",onCh
2ange:e=>g(c,"buttonText",e.target.value),placeholder:"Button Text",className:"h-8 text-sm"}),(0,ea.jsx)(I$,{value:p.buttonUrl||"",onChange:e=>g(c,"buttonUrl",e),pages:i,anchors:o,label:"Button URL",testId:"carousel-slide-".concat(c,"-button-url")}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:p.buttonStyle||"solid",onValueChange:e=>g(c,"buttonStyle",e),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline"}),(0,ea.jsx)(rb,{value:"ghost",children:"Ghost"}),(0,ea.jsx)(rb,{value:"gradient",children:"Gradient"}),(0,ea.jsx)(rb,{value:"soft",children:"Soft"})]})]}),(0,ea.jsxs)(eb,{value:p.buttonSize||"md",onValueChange:e=>g(c,"buttonSize",e),children:[(0,ea.jsx)(sb,{className:"w-16 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"sm",children:"Sm"}),(0,ea.jsx)(rb,{value:"md",children:"Md"}),(0,ea.jsx)(rb,{value:"lg",children:"Lg"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"BG:"}),(0,ea.jsx)("input",{type:"color",value:p.buttonColor||"#6366f1",onChange:e=>g(c,"buttonColor",e.target.value),className:"w-6 h-6 rounded border cursor-pointer"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Text:"}),(0,ea.jsx)("input",{type:"color",value:p.buttonTextColor||"#ffffff",onChange:e=>g(c,"buttonTextColor",e.target.value),className:"w-6 h-6 rounded border cursor-pointer"})]}),"gradient"===p.buttonStyle&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Grad:"}),(0,ea.jsx)("input",{type:"color",value:p.buttonGradientColor||"#8b5cf6",onChange:e=>g(c,"buttonGradientColor",e.target.value),className:"w-6 h-6 rounded border cursor-pointer"})]})]}),(0,ea.jsx)($$,{fields:p,testPrefix:"carousel-slide-".concat(c,"-btn"),onPatch:e=>Object.entries(e).forEach(e=>{let[t,s]=e;return g(c,t,s)})}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:p.buttonAlign||"left",onValueChange:e=>g(c,"buttonAlign",e),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500",children:[(0,ea.jsx)("input",{type:"checkbox",checked:p.buttonFullWidth||!1,onChange:e=>g(c,"buttonFullWidth",e.target.checked),className:"w-3 h-3 rounded"}),"Full Width"]})]}),(0,ea.jsx)("div",{className:"mt-2 p-2 bg-white rounded text-center",children:(0,ea.jsx)("div",{style:{textAlign:p.buttonAlign||"left"},children:(0,ea.jsx)("button",{className:"\n ".concat("sm"===p.buttonSize?"px-3 py-1 text-sm":"","\n ").concat("lg"===p.buttonSize?"px-6 py-3 text-lg":"","\n ").concat("md"!==p.buttonSize&&p.buttonSize?"":"px-4 py-2","\n ").concat(p.buttonFullWidth?"w-full":"","\n ").concat("outline"===p.buttonStyle?"bg-transparent border-2":"","\n ").concat("ghost"===p.buttonStyle?"bg-transparent":"","\n rounded-lg font-medium transition-all\n "),style:{backgroundColor:"solid"!==p.buttonStyle&&p.buttonStyle?"transparent":p.buttonColor||"#6366f1",color:"solid"!==p.buttonStyle&&p.buttonStyle?p.buttonColor||"#6366f1":p.buttonTextColor||"#ffffff",borderColor:"outline"===p.buttonStyle?p.buttonColor||"#6366f1":"transparent"},children:p.buttonText||"Learn More"})})})]})]})]}),p.imageUrl&&(0,ea.jsxs)("div",{className:"mt-2 p-2 bg-slate-50 rounded",style:{textAlign:p.imageAlign||"center"},children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-2",children:"Preview:"}),(0,ea.jsx)("img",{src:p.imageUrl,alt:p.imageAlt||"",className:"rounded inline-block max-h-40 object-cover",style:{maxWidth:"100%",width:p.shapeMask&&"none"!==p.shapeMask?"".concat(p.shapeSize||250,"px"):"".concat(p.imageWidth||300,"px")}
2})]})]})]})},Y$=[{value:"none",label:"No Overlay"},{value:"dark",label:"Dark",color:"rgba(0,0,0,0.5)"},{value:"darker",label:"Darker",color:"rgba(0,0,0,0.7)"},{value:"light",label:"Light",color:"rgba(255,255,255,0.5)"},{value:"gradient-dark",label:"Gradient (Dark)",color:"linear-gradient(to top, rgba(0,0,0,0.8), transparent)"},{value:"gradient-primary",label:"Gradient (Purple)",color:"linear-gradient(135deg, rgba(99,102,241,0.8), rgba(168,85,247,0.8))"},{value:"gradient-warm",label:"Gradient (Warm)",color:"linear-gradient(135deg, rgba(251,146,60,0.8), rgba(251,113,133,0.8))"},{value:"gradient-cool",label:"Gradient (Cool)",color:"linear-gradient(135deg, rgba(56,189,248,0.8), rgba(99,102,241,0.8))"},{value:"custom",label:"Custom Color & Opacity"}],J$=[{value:"left",label:"Left"},{value:"center",label:"Center"},{value:"right",label:"Right"}],Q$=[{value:"top",label:"Top"},{value:"middle",label:"Middle"},{value:"bottom",label:"Bottom"}],X$=[{value:"full",label:"Full Width Banner",description:"Edge to edge (100vw)"},{value:"container",label:"Container Width",description:"Matches page width"},{value:"large",label:"Large (75%)",description:"Centered large block"},{value:"medium",label:"Medium (60%)",description:"Centered medium block"},{value:"small",label:"Small (45%)",description:"Compact image with text"}],Z$=[{value:"",label:"Inherit from site theme"},{value:"Inter, sans-serif",label:"Inter (Sans)"},{value:'"Open Sans", sans-serif',label:"Open Sans"},{value:"Poppins, sans-serif",label:"Poppins"},{value:"Montserrat, sans-serif",label:"Montserrat"},{value:"Roboto, sans-serif",label:"Roboto"},{value:'"Playfair Display", serif',label:"Playfair Display (Serif)"},{value:"Merriweather, serif",label:"Merriweather (Serif)"},{value:"Georgia, serif",label:"Georgia (Serif)"},{value:'"Courier New", monospace',label:"Courier (Mono)"}],eG=e=>{let{label:t,style:s,defaultSize:a,prefix:n,onPatch:l}=e;return(0,ea.jsxs)("div",{className:"p-2 rounded-md bg-white border border-slate-200 space-y-2",children:[(0,ea.jsx)(tf,{className:"text-[11px] font-semibold text-slate-700",children:t}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Font family"}),(0,ea.jsxs)(eb,{value:s.fontFamily||"",onValueChange:e=>l({fontFamily:"inherit"===e?"":e}),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs","data-testid":"".concat(n,"-family"),children:(0,ea.jsx)(tb,{placeholder:"Inherit"})}),(0,ea.jsx)(lb,{children:Z$.map(e=>(0,ea.jsx)(rb,{value:e.value||"inherit",children:e.label},e.value||"inherit"))})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:10,max:140,value:s.fontSize||"",onChange:e=>l({fontSize:e.target.value?Number(e.target.value):void 0}),placeholder:String(a),className:"h-7 text-xs","data-testid":"".concat(n,"-size")})]}),(0,ea.jsxs)("div",{className:"space-y-1 col-span-2",children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"color",value:(s.color||"").startsWith("#")?s.color:"#111827",onChange:e=>l({color:e.target.value}),className:"w-7 h-7 rounded border cursor-pointer","data-testid":"".concat(n,"-color-swatch")}),(0,ea.jsx)(BN,{value:s.color||"",onChange:e=>l({color:e.target.value}),placeholder:"inherit",className:"h-7 text-xs font-mono flex-1","data-testid":"".concat(n,"-color-input")}),(s.color||s.fontFamily||s.fontSize)&&(0,ea.jsx)("button",{type:"button",onClick:()=>l({color:void 0,fontFamily:void 0,fontSize:void 0}),className:"text-[10px] text-slate-500 hover:text-slate-700 underline",title:"Reset this slide's typography",children:"Reset"})]})]})]})]})},tG=e=>{if(!e)return"";if(e.includes("youtube-nocookie.com")){const t=e.match(/embed\/([^?&#]+)/);return t?t[1]:""}const t=e.match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/);return t&&11===t[7].length?t[7]:""},sG=e=>{const t=null===e||void 0===e?void 0:e.match(/vimeo.*\/(\d+)/i);return t?t[1]:""},aG=e=>{var s,a,n,l,r,i;let{content:o,onChange:c,pages:u=[],anchors:m=[]}=e;const[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(0),f=o.slides||[],v=!1!==o.autoPlay,b=o.autoPlaySpeed||5e3,j=o.transitionEffect||"fade",{overlay:y="dark",textPositionH:N="center",textPositionV:w="middle",textColor:C="white",height:k=500,width:D="container"}=o,_=f.length>0?f.map(e=>d(d({},e),{},{headline:void 0!==e.headline?e.headline:"",subheadline:void 0!==e.subheadline?e.subheadline:"",buttonText:void 0!==e.buttonText?e.buttonText:""})):[{imageUrl:o.imageUrl||"",backgroundType:o.backgroundType||"image",videoUrl:o.videoUrl||"",backgroundColor:o.backgroundColor||"#6366f1",headline:void 0!==o.headline?o.headline:"Your Headline Here",subheadline:void 0!==o.subheadline?o.subheadline:"Add a compelling subheadline",buttonText:void 0!==o.buttonText?o.buttonText:"Learn More",buttonUrl:o.buttonUrl||"",headlineAnimation:o.headlineAnimation||{entrance:"fadeInUp",speed:"normal",delay:"0"},subheadlineAnimation:o.subheadlineAnimation||{entrance:"fadeInUp",speed:"normal",delay:"200"},buttonAnimation:o.buttonAnimation||{entrance:"fadeInUp",speed:"normal",delay:"400"}}],S=_[p]||_[0],E=(e,t,s)=>{const a=[..._];a[e]=d(d({},a[e]),{},{[t]:s}),c(d(d({},o),{},{slides:a}))},A=(e,t)=>
2{const s=[..._];s[e]=d(d({},s[e]),t),c(d(d({},o),{},{slides:s}))},F=(e,t,s)=>{const a=[..._],n=d(d({},a[e][t]||{}),s);Object.keys(n).forEach(e=>{void 0!==n[e]&&""!==n[e]||delete n[e]}),a[e]=d(d({},a[e]),{},{[t]:n}),c(d(d({},o),{},{slides:a}))},T=(e,t)=>{c(d(d({},o),{},{[e]:t}))};return(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between bg-slate-100 rounded-lg p-3 border border-slate-200",children:[(0,ea.jsxs)("span",{className:"text-sm text-slate-600 font-medium",children:["Block Width: ",(0,ea.jsx)("span",{className:"text-indigo-600",children:(null===(s=X$.find(e=>e.value===D))||void 0===s?void 0:s.label)||"Container"})]}),"full"!==D&&"container"!==D&&(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:null===(a=X$.find(e=>e.value===D))||void 0===a?void 0:a.description})]}),(0,ea.jsxs)("div",{className:"bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg p-3 text-white",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsx)("span",{className:"text-sm font-medium",children:_.length>1?"Carousel: ".concat(_.length," Slides"):"Single Image Hero"}),(0,ea.jsxs)(sg,{size:"sm",variant:"secondary",onClick:()=>{const e={imageUrl:"",backgroundType:"image",videoUrl:"",backgroundColor:"#6366f1",headline:"Slide ".concat(_.length+1," Headline"),subheadline:"Add your subheadline here",buttonText:"Learn More",buttonUrl:"",headlineAnimation:{entrance:"fadeInUp",speed:"normal",delay:"0"},subheadlineAnimation:{entrance:"fadeInUp",speed:"normal",delay:"200"},buttonAnimation:{entrance:"fadeInUp",speed:"normal",delay:"400"}},t=[..._,e];c(d(d({},o),{},{slides:t,carouselMode:t.length>1})),g(t.length-1)},className:"h-7 text-xs",children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"}),"Add Slide"]})]}),_.length>1&&(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("div",{className:"flex items-center gap-1 flex-1",children:_.map((e,t)=>(0,ea.jsx)("button",{onClick:()=>g(t),className:"h-2 rounded-full transition-all ".concat(t===p?"w-8 bg-white":"w-2 bg-white/50 hover:bg-white/70")},t))}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("span",{children:"Auto-play:"}),(0,ea.jsx)(wb,{checked:v,onCheckedChange:e=>T("autoPlay",e)})]})]})]}),(0,ea.jsxs)("div",{className:"relative rounded-lg overflow-hidden mx-auto",style:d({height:"".concat(Math.min(k,400),"px")},(()=>{switch(D){case"full":default:return{width:"100%",maxWidth:"none"};case"large":return{width:"75%",maxWidth:"1200px",margin:"0 auto"};case"medium":return{width:"60%",maxWidth:"900px",margin:"0 auto"};case"small":return{width:"45%",maxWidth:"600px",margin:"0 auto"}}})()),children:["video"===S.backgroundType&&S.videoUrl?(0,ea.jsx)("div",{className:"absolute inset-0",children:S.videoUrl.includes("youtube.com")||S.videoUrl.includes("youtu.be")||S.videoUrl.includes("youtube-nocookie.com")?(0,ea.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(tG(S.videoUrl),"?autoplay=1&mute=").concat(!1!==S.videoMuted?1:0,"&loop=1&playlist=").concat(tG(S.videoUrl),"&controls=").concat(!1===S.videoMuted?1:0,"&showinfo=0"),className:"absolute inset-0 w-full h-full",style:!1!==S.videoMuted?{transform:"scale(1.2)"}:{},frameBorder:"0",allow:"autoplay; encrypted-media; fullscreen",allowFullScreen:!0}):S.videoUrl.includes("vimeo.com")?(0,ea.jsx)("iframe",{src:!1===S.videoMuted?"https://player.vimeo.com/video/".concat(sG(S.videoUrl),"?autoplay=0&loop=0"):"https://player.vimeo.com/video/".concat(sG(S.videoUrl),"?autoplay=1&muted=1&loop=1&background=1"),className:"absolute inset-0 w-full h-full",style:!1!==S.videoMuted?{transform:"scale(1.2)"}:{},frameBorder:"0",allow:"autoplay; fullscreen",allowFullScreen:!0}):(0,ea.jsx)("video",{src:S.videoUrl,autoPlay:!0,muted:!1!==S.videoMuted,loop:!1!==S.videoLoop,playsInline:!0,className:"absolute inset-0 w-full h-full object-cover"})}):"color"===S.backgroundType||S.useBackgroundColor?(0,ea.jsx)("div",{className:"absolute inset-0",style:{backgroundColor:S.backgroundColor||"#6366f1"}}):S.imageUrl?(0,ea.jsx)("img",{src:S.imageUrl,alt:"Hero background",className:"absolute inset-0 w-full h-full object-cover"}):(0,ea.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-slate-700 to-slate-900 flex items-center justify-center",children:(0,ea.jsx)("p",{className:"text-slate-400",children:"Select Image, Video or Color for background"})}),"none"!==y&&(0,ea.jsx)("div",{className:"absolute inset-0",style:(()=>
2{if("none"===y)return{};if("custom"===y){const e=o.overlayColor||"#000000",t=void 0!==o.overlayOpacity?o.overlayOpacity:50,s=e.replace("#",""),a=parseInt(s.substring(0,2),16),n=parseInt(s.substring(2,4),16),l=parseInt(s.substring(4,6),16);return{background:"rgba(".concat(a,", ").concat(n,", ").concat(l,", ").concat(t/100,")")}}const e=Y$.find(e=>e.value===y);return e?{background:e.color}:{}})()}),(0,ea.jsx)("div",{className:"\n absolute inset-0 p-8 flex flex-col\n ".concat("left"===N?"items-start text-left":"","\n ").concat("center"===N?"items-center text-center":"","\n ").concat("right"===N?"items-end text-right":"","\n ").concat("top"===w?"justify-start":"","\n ").concat("middle"===w?"justify-center":"","\n ").concat("bottom"===w?"justify-end":"","\n ").concat((()=>{switch(C){case"black":return"text-slate-900";case"primary":return"text-indigo-600";default:return"text-white"}})(),"\n "),children:S.useHtml&&S.htmlContent?(0,ea.jsx)("div",{className:"hero-html-content max-w-4xl",dangerouslySetInnerHTML:{__html:S.htmlContent}}):(0,ea.jsxs)(ea.Fragment,{children:[S.headline&&(0,ea.jsx)("h2",{className:"text-4xl font-bold mb-4 hero-text-shadow max-w-2xl",children:S.headline}),S.subheadline&&(0,ea.jsx)("p",{className:"text-xl mb-6 hero-text-shadow max-w-xl opacity-90",children:S.subheadline}),S.buttonText&&(0,ea.jsx)("button",{className:"px-6 py-3 bg-white text-slate-900 rounded-lg font-semibold hover:bg-slate-100 transition-colors",children:S.buttonText})]})}),_.length>1&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("button",{onClick:()=>g(e=>e>0?e-1:_.length-1),className:"absolute left-2 top-1/2 -translate-y-1/2 w-8 h-8 bg-black/30 hover:bg-black/50 rounded-full flex items-center justify-center text-white",children:(0,ea.jsx)(vj,{size:18})}),(0,ea.jsx)("button",{onClick:()=>g(e=>e<_.length-1?e+1:0),className:"absolute right-2 top-1/2 -translate-y-1/2 w-8 h-8 bg-black/30 hover:bg-black/50 rounded-full flex items-center justify-center text-white",children:(0,ea.jsx)(ax,{size:18})})]})]}),_.length>0&&(0,ea.jsxs)("div",{className:"border border-indigo-200 rounded-lg p-4 bg-indigo-50/50",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ea.jsxs)("h3",{className:"font-semibold text-indigo-700 flex items-center gap-2",children:[(0,ea.jsx)($N,{size:16}),"Slide ",p+1," of ",_.length]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=d({},_[e]),s=[..._.slice(0,e+1),t,..._.slice(e+1)];c(d(d({},o),{},{slides:s,carouselMode:!0})),g(e+1)})(p),className:"h-7 w-7 p-0 text-indigo-600",title:"Duplicate slide",children:(0,ea.jsx)(DD,{size:14})}),_.length>1&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{if(_.length<=1)return;const t=_.filter((t,s)=>s!==e);c(d(d({},o),{},{slides:t,carouselMode:t.length>1})),g(Math.min(p,t.length-1))})(p),className:"h-7 w-7 p-0 text-red-500",title:"Delete slide",children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsxs)("div",{className:"space-y-3 mb-4",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Backgroun
2d"}),(0,ea.jsxs)("div",{className:"flex gap-2 mb-2",children:[(0,ea.jsxs)(sg,{variant:"image"===S.backgroundType||!S.backgroundType&&!S.useBackgroundColor?"default":"outline",size:"sm",onClick:()=>{A(p,{backgroundType:"image",useBackgroundColor:!1})},className:"flex-1 h-8 text-xs",children:[(0,ea.jsx)($N,{size:14,className:"mr-1"}),"Image"]}),(0,ea.jsxs)(sg,{variant:"video"===S.backgroundType?"default":"outline",size:"sm",onClick:()=>{A(p,{backgroundType:"video",useBackgroundColor:!1})},className:"flex-1 h-8 text-xs",children:[(0,ea.jsx)(Gg,{size:14,className:"mr-1"}),"Video"]}),(0,ea.jsxs)(sg,{variant:"color"===S.backgroundType||S.useBackgroundColor?"default":"outline",size:"sm",onClick:()=>{A(p,{backgroundType:"color",useBackgroundColor:!0})},className:"flex-1 h-8 text-xs",children:[(0,ea.jsx)(Dw,{size:14,className:"mr-1"}),"Color"]})]}),("image"===S.backgroundType||!S.backgroundType&&!S.useBackgroundColor&&"video"!==S.backgroundType)&&(0,ea.jsx)("div",{className:"space-y-2",children:S.imageUrl?(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-slate-100 rounded-lg",children:[(0,ea.jsx)("img",{src:S.imageUrl,alt:"Selected",className:"w-16 h-10 object-cover rounded"}),(0,ea.jsxs)("code",{className:"text-xs text-slate-600 truncate flex-1",children:[S.imageUrl.substring(0,40),"..."]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",className:"h-8",onClick:()=>x(!0),children:"Change"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-8 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>E(p,"imageUrl",""),children:(0,ea.jsx)(wD,{size:14})})]}):(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:S.imageUrl||"",onChange:e=>E(p,"imageUrl",e.target.value),placeholder:"Image URL or choose from library...",className:"flex-1 h-9"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>x(!0),children:"Choose"})]})}),"video"===S.backgroundType&&(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)("div",{className:"flex gap-2",children:(0,ea.jsx)(BN,{value:S.videoUrl||"",onChange:e=>E(p,"videoUrl",e.target.value),placeholder:"Video URL (MP4, WebM, YouTube, Vimeo)...",className:"flex-1 h-9"})}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between bg-slate-50 px-3 py-2 rounded-lg",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Muted"}),(0,ea.jsx)(wb,{checked:!1!==S.videoMuted,onCheckedChange:e=>E(p,"videoMuted",e)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between bg-slate-50 px-3 py-2 rounded-lg",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Loop"}),(0,ea.jsx)(wb,{checked:!1!==S.videoLoop,onCheckedChange:e=>E(p,"videoLoop",e)})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Supports: MP4, WebM, YouTube, Vimeo URLs. Videos auto-play muted by default."})]}),("color"===S.backgroundType||S.useBackgroundColor)&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsx)("div",{className:"relative",children:(0,ea.jsx)("input",{type:"color",value:S.backgroundColor||"#6366f1",onChange:e=>E(p,"backgroundColor",e.target.value),className:"w-12 h-9 rounded border border-slate-300 cursor-pointer"})}),(0,ea.jsx)(BN,{value:S.backgroundColor||"#6366f1",onChange:e=>E(p,"backgroundColor",e.target.value),placeholder:"#6366f1",className:"flex-1 h-9 font-mono text-sm"})]}),(0,ea.jsx)("div",{className:"flex gap-1 flex-wrap",children:["#6366f1","#8b5cf6","#ec4899","#f97316","#22c55e","#0ea5e9","#1e293b","#64748b"].map(e=>(0,ea.jsx)("button",{onClick:()=>E(p,"backgroundColor",e),className:"w-6 h-6 rounded border-2 transition-transform hover:scale-110 ".concat(S.backgroundColor===e?"border-slate-900 scale-110":"border-transparent"),style:{backgroundColor:e},title:e},e))})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-2 bg-white rounded border",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Use Custom HTML"}),(0,ea.jsx)(wb,{checked:S.useHtml||!1,onCheckedChange:e=>E(p,"useHtml",e)})]}),S.useHtml?(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-600 flex items-center gap-2",children:[(0,ea.jsx)(wE,{size:12}),"Custom HTML Content"]}),(0,ea.jsx)(YN,{value:S.htmlContent||"",onChange:e=>E(p,"htmlContent",e.target.value),placeholder:'<h1 class="text-5xl font-bold mb-4">Your Title</h1>\n<p class="text-xl mb-6">Your description here</p>\n<a href="#" class="bg-white text-black px-6 py-3 rounded-lg font-semibold">Learn More</a>',rows:6,className:"font-mono text-xs"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Use Tailwind CSS classes for styling. Content will be rendered inside the hero overlay."})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-600 flex items-center gap-2",children:[(0,ea.jsx)(wE,{size:12}),"Headline"]}),(0,ea.jsx)(BN,{value:S.headline,onChange:e=>E(p,"headline",e.target.value),placeholder:"Leave empty for no headline",className:"font-semibold h-9"}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400",children:"Leave empty for no headline"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Subheadline"}),(0,ea.jsx)(YN,{value:S.subheadline,onChange:e=>E(p,"subheadline",e.target.value),placeholder:"Leave empty for no subheadline",rows:2,className:"text-sm"}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400",children:"Leave empty for no subheadline"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Button Text"}),(0,ea.jsx)(BN,{value:S.buttonText,onChange:e=>E(p,"buttonText",e.target.value),placeholder:"Leave empty for no button",className:"h-9"}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400",children:"Leave empty for no button"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(I$,{value:S.buttonUrl||"",onChange:e=>E(p,"buttonUrl",e),pages:u,anchors:m,label:"Button URL",testId:"hero-slide-".concat(p,"-button-url"),disabled:!S.buttonText}),S.buttonText&&(0,ea.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-slate-500 pt-1 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:S.buttonOpenInNewTab||!1,onChange:e=>E(p,"buttonOpenInNewTab",e.target.checked),className:"w-3 h-3 rounded accent-indigo-600","data-testid":"hero-slide-".concat(p,"-button-new-tab")}),"Open in new window"]})]})]}),S.buttonText&&(0,ea.jsx)("div",{className:"pt-1",children:(0,ea.jsx)($$,{fields:S,testPrefix:"hero-slide-".concat(p,"-btn"),onPatch:e=>
2Object.entries(e).forEach(e=>{let[t,s]=e;return E(p,t,s)})})}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Slide Text Colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:S.textColor||C||"#ffffff",onChange:e=>E(p,"textColor",e.target.value),className:"w-9 h-9 rounded border cursor-pointer","data-testid":"hero-slide-".concat(p,"-text-color")}),(0,ea.jsx)(BN,{value:S.textColor||"",onChange:e=>E(p,"textColor",e.target.value),placeholder:C||"#ffffff",className:"h-9 text-sm font-mono flex-1"}),S.textColor&&(0,ea.jsx)("button",{type:"button",onClick:()=>E(p,"textColor",""),className:"text-xs text-slate-500 hover:text-slate-700 underline",title:"Reset to default",children:"Reset"})]}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400",children:"Applies only to this slide. Leave empty to use the block default below."})]}),(0,ea.jsxs)("div",{className:"pt-2 space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs font-semibold text-slate-700 flex items-center gap-2",children:[(0,ea.jsx)(wE,{size:12}),"Slide ",p+1," Typography"]}),(0,ea.jsx)(eG,{label:"Headline",style:S.headlineStyle||{},defaultSize:48,prefix:"hero-slide-".concat(p,"-headline"),onPatch:e=>F(p,"headlineStyle",e)}),(0,ea.jsx)(eG,{label:"Subheadline",style:S.subheadlineStyle||{},defaultSize:20,prefix:"hero-slide-".concat(p,"-subheadline"),onPatch:e=>F(p,"subheadlineStyle",e)}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400",children:"Overrides the block default for this slide only."})]})]})]}),(0,ea.jsxs)("div",{className:"mt-4 pt-4 border-t border-indigo-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-3 text-xs font-semibold text-indigo-700",children:[(0,ea.jsx)($g,{size:12}),"Slide ",p+1," Text Animations"]}),(0,ea.jsx)("div",{className:"space-y-3",children:(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Headline"}),(0,ea.jsxs)(eb,{value:(null===(n=S.headlineAnimation)||void 0===n?void 0:n.entrance)||"fadeInUp",onValueChange:e=>E(p,"headlineAnimation",d(d({},S.headlineAnimation),{},{entrance:e})),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:hj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Subheadline"}),(0,ea.jsxs)(eb,{value:(null===(l=S.subheadlineAnimation)||void 0===l?void 0:l.entrance)||"fadeInUp",onValueChange:e=>E(p,"subheadlineAnimation",d(d({},S.subheadlineAnimation),{},{entrance:e})),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:hj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Button"}),(0,ea.jsxs)(eb,{value:(null===(r=S.buttonAnimation)||void 0===r?void 0:r.entrance)||"fadeInUp",onValueChange:e=>E(p,"buttonAnimation",d(d({},S.buttonAnimation),{},{entrance:e})),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:hj.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]})})]})]}),_.length>1&&(0,ea.jsxs)("div",{className:"p-4 bg-amber-50 rounded-lg border border-amber-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-3 text-sm font-semibold text-amber-700",children:[(0,ea.jsx)(Gg,{size:14}),"Carousel Settings"]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Auto-play Speed"}),(0,ea.jsxs)(eb,{value:String(b),onValueChange:e=>T("autoPlaySpeed",parseInt(e)),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"3000",children:"Fast (3s)"}),(0,ea.jsx)(rb,{value:"5000",children:"Normal (5s)"}),(0,ea.jsx)(rb,{value:"7000",children:"Slow (7s)"}),(0,ea.jsx)(rb,{value:"10000",children:"Very Slow (10s)"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Transition Effect"}),(0,ea.jsxs)(eb,{value:j,onValueChange:e=>T("transitionEffect",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"fade",children:"Fade"}),(0,ea.jsx)(rb,{value:"slide",children:"Slide"}),(0,ea.jsx)(rb,{value:"zoom",children:"Zoom"})]})]})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-slate-700 pb-2 border-b border-slate-200",children:[(0,ea.jsx)(NE,{size:16,className:"text-blue-500"}),"Layout & Style"]}),(0,ea.jsxs)("div",{className:"space-y-2 pb-4 border-b border-slate-200",children:[(0,ea.jsxs)(tf,{className:"text-xs font-semibold flex items-center gap-1",children:[(0,ea.jsx)(NE,{size:12}),"Block Width"]}
2),(0,ea.jsx)("div",{className:"grid grid-cols-5 gap-2",children:X$.map(e=>(0,ea.jsx)("button",{onClick:()=>T("width",e.value),className:"p-2 rounded-lg border text-xs font-medium transition-all ".concat(D===e.value?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200 hover:border-indigo-300"),title:e.description,children:e.label.split(" ")[0]},e.value))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:null===(i=X$.find(e=>e.value===D))||void 0===i?void 0:i.description})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Horizontal Position"}),(0,ea.jsxs)(eb,{value:N,onValueChange:e=>T("textPositionH",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:J$.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Vertical Position"}),(0,ea.jsxs)(eb,{value:w,onValueChange:e=>T("textPositionV",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:Q$.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-1",children:[(0,ea.jsx)(Dw,{size:12}),"Overlay"]}),(0,ea.jsxs)(eb,{value:y,onValueChange:e=>T("overlay",e),children:[(0,ea.jsx)(sb,{className:"h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:Y$.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),"custom"===y&&(0,ea.jsxs)("div",{className:"space-y-3 mt-3 p-3 bg-slate-50 rounded-lg border",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Overlay Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:o.overlayColor||"#000000",onChange:e=>T("overlayColor",e.target.value),className:"w-10 h-10 rounded border cursor-pointer"}),(0,ea.jsx)(BN,{value:o.overlayColor||"#000000",onChange:e=>T("overlayColor",e.target.value),className:"h-9 font-mono text-sm",placeholder:"#000000"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Opacity: ",o.overlayOpacity||50,"%"]}),(0,ea.jsx)(dj,{value:[o.overlayOpacity||50],onValueChange:e=>{let[t]=e;return T("overlayOpacity",t)},min:0,max:100,step:5})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Default Text Colour (used when a slide has no override)"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:"string"===typeof C&&C.startsWith("#")?C:"#ffffff",onChange:e=>T("textColor",e.target.value),className:"w-9 h-9 rounded border cursor-pointer","data-testid":"hero-default-text-color"}),(0,ea.jsx)(BN,{value:C||"#ffffff",onChange:e=>T("textColor",e.target.value),placeholder:"#ffffff",className:"h-9 text-sm font-mono flex-1"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Height: ",k,"px"]}),(0,ea.jsx)(dj,{value:[k],onValueChange:e=>{let[t]=e;return T("height",t)},min:300,max:800,step:50})]})]}),(0,ea.jsx)(Dq,{open:h,onClose:()=>x(!1),onSelect:e=>{E(p,"imageUrl",e.url),e.alt_text&&E(p,"imageAlt",e.alt_text),x(!1)}})]})},nG=[{value:"full",label:"Full Width",description:"Edge to edge (100%)"},{value:"container",label:"Container",description:"Matches page width (default)"},{value:"large",label:"Large (75%)",description:"Centered large block"},{value:"medium",label:"Medium (60%)",description:"Centered medium block"},{value:"small",label:"Small (45%)",description:"Compact / narrow reading column"}],lG=e=>{var t;let{value:s="container",onChange:a,testIdPrefix:n="block-width"}=e;return(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(NE,{size:14,className:"text-blue-500"}),(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Block Width"})]}
2),(0,ea.jsx)("div",{className:"grid grid-cols-5 gap-1.5",children:nG.map(e=>(0,ea.jsx)("button",{type:"button",onClick:()=>a(e.value),"data-testid":"".concat(n,"-").concat(e.value),title:e.description,className:"p-2 rounded-lg border text-[11px] font-medium transition-all ".concat((s||"container")===e.value?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200 hover:border-indigo-300"),children:e.label.replace(/\s*\(.*\)/,"")},e.value))}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-500",children:null===(t=nG.find(e=>e.value===(s||"container")))||void 0===t?void 0:t.description})]})},rG=[{type:"heading",icon:wE,label:"Heading",description:"Large section heading",keywords:["h1","h2","title","header"]},{type:"paragraph",icon:wE,label:"Paragraph",description:"Plain text block",keywords:["text","p","body"]},{type:"image",icon:$N,label:"Image",description:"Upload or embed image",keywords:["photo","picture","img","media"]},{type:"button",icon:EE,label:"Button",description:"Call-to-action button",keywords:["cta","link","action","click","btn"]},{type:"hero",icon:SE,label:"Hero Banner",description:"Full-width hero with text overlay",keywords:["banner","header","cover","jumbotron"],category:"featured"},{type:"quote",icon:Zl,label:"Quote",description:"Blockquote for citations",keywords:["blockquote","citation","testimonial"]},{type:"list",icon:IE,label:"List",description:"Bulleted list",keywords:["bullet","ul","items"]},{type:"code",icon:kE,label:"Code",description:"Code block with syntax highlighting",keywords:["snippet","pre","programming"]},{type:"columns",icon:AE,label:"Columns (2-5)",description:"Multi-column layout",keywords:["grid","cols","layout","column"],category:"layout"},{type:"image-text-row",icon:FE,label:"Image + Text (Row)",description:"Side-by-side image and text",keywords:["side","horizontal","split"],category:"layout"},{type:"image-text-stack",icon:FE,label:"Image + Text (Stack)",description:"Stacked image and text",keywords:["vertical","stack","top"],category:"layout"}],iG=e=>{let{isOpen:s,onClose:a,onSelect:n,position:l,searchQuery:r=""}=e;const[i,o]=(0,t.useState)(rG),[c,d]=(0,t.useState)(0),u=(0,t.useRef)(null),m=(0,t.useRef)([]);(0,t.useEffect)(()=>{if(!r)return o(rG),void d(0);const e=r.toLowerCase(),t=rG.filter(t=>t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.keywords.some(t=>t.includes(e)));o(t),d(0)},[r]),(0,t.useEffect)(()=>{m.current[c]&&m.current[c].scrollIntoView({block:"nearest"})},[c]);const h=(0,t.useCallback)(e=>{if(s)switch(e.key){case"ArrowDown":e.preventDefault(),d(e=>e<i.length-1?e+1:0);break;case"ArrowUp":e.preventDefault(),d(e=>e>0?e-1:i.length-1);break;case"Enter":e.preventDefault(),i[c]&&n(i[c].type);break;case"Escape":e.preventDefault(),a()}},[s,i,c,n,a]);if((0,t.useEffect)(()=>(document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)),[h]),(0,t.useEffect)(()=>{const e=e=>{u.current&&!u.current.contains(e.target)&&a()};return s&&(document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[s,a]),!s)return null;const x=i.filter(e=>!e.category),p=i.filter(e=>"featured"===e.category),g=i.filter(e=>"layout"===e.category);let f=0;const v=()=>f++;return(0,ea.jsxs)("div",{ref:u,className:"fixed z-[55] bg-white rounded-xl shadow-2xl border border-slate-200 w-80 max-h-96 overflow-hidden",style:{top:(null===l||void 0===l?void 0:l.top)||"50%",left:(null===l||void 0===l?void 0:l.left)||"50%",transform:l?"none":"translate(-50%, -50%)"},"data-testid":"slash-command-menu",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-slate-100 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,ea.jsx)(UE,{size:14}),(0,ea.jsx)("span",{className:"font-medium",children:"Add Block"}),r&&(0,ea.jsxs)("span",{className:"text-indigo-600",children:['"',r,'"']})]}),(0,ea.jsx)("button",{onClick:a,className:"text-slate-400 hover:text-slate-600 transition-colors",children:(0,ea.jsx)(sr,{size:16})})]}),(0,ea.jsx)("div",{className:"overflow-y-auto max-h-72",children:0===i.length?(0,ea.jsxs)("div",{className:"px-4 py-8 text-center text-slate-500",children:[(0,ea.jsxs)("p",{className:"text-sm",children:['No blocks match "',r,'"']}),(0,ea.jsx)("p",{className:"text-xs mt-1",children:"Try different keywords"})]}):(0,ea.jsxs)("div",{className:"py-2",children:[x.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"px-4 py-1.5 text-xs font-semibold text-slate-500 uppercase tracking-wide",children:"Basic"}),x.map(e=>{const t=v(),s=e.icon;return(0,ea.jsxs)("button",{ref:e=>m.current[t]=e,onClick:()=>n(e.type),className:"w-full flex items-center gap-3 px-4 py-2.5 transition-colors text-left ".concat(c===t?"bg-indigo-50 text-indigo-700":"hover:bg-slate-50"),"data-testid":"slash-add-".concat(e.type),children:[(0,ea.jsx)("div",{className:"p-1.5 rounded-lg ".concat(c===t?"bg-indigo-100":"bg-slate-100"),children:(0,ea.jsx)(s,{size:16,className:c===t?"text-indigo-600":"text-slate-600"})}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("div",{className:"font-medium text-sm",children:e.label}),(0,ea.jsx)("div",{className:"text-xs text-slate-500 truncate",children:e.description})]})]},e.type)})]}),p.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"px-4 py-1.5 text-xs font-semibold text-purple-500 uppercase tracking-wide flex items-center gap-1 mt-1 border-t border-slate-100 pt-2",children:[(0,ea.jsx)($g,{size:10}),"Featured"]}),p.map(e=>{const t=v(),s=e.icon;return(0,ea.jsxs)("button",{ref:e=>m.current[t]=e,onClick:()=>n(e.type),className:"w-full flex items-center gap-3 px-4 py-2.5 transition-colors text-left ".concat(c===t?"bg-purple-50 text-purple-700":"hover:bg-purple-50/50"),"data-testid":"slash-add-".concat(e.type),children:[(0,ea.jsx)("div",{className:"p-1.5 rounded-lg ".concat(c===t?"bg-purple-100":"bg-purple-50"),children:(0,ea.jsx)(s,{size:16,className:"text-purple-600"})}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("div",{className:"font-medium text-sm text-purple-700",children:e.label}),(0,ea.jsx)("div",{className:"text-xs text-purple-500/70 truncate",children:e.description})]})]},e.type)})]}),g.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"px-4 py-1.5 text-xs font-semibold text-blue-500 uppercase tracking-wide mt-1 border-t border-slate-100 pt-2",children:"Layout"}),g.map(e=>{const t=v(),s=e.icon;return(0,ea.jsxs)("button",{ref:e=>m.current[t]=e,onClick:()=>n(e.type),className:"w-full flex items-center gap-3 px-4 py-2.5 transition-colors text-left ".concat(c===t?"bg-blue-50 text-blue-700":"hover:bg-blue-50/50"),"data-testid":"slash-add-".concat(e.type),children:[(0,ea.jsx)("div",{className:"p-1.5 rounded-lg ".concat(c===t?"bg-blue-100":"bg-blue-50"),children:(0,ea.jsx)(s,{size:16,className:"text-blue-600"})}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("div",{className:"font-medium text-sm text-blue-700",children:e.label}),(0,ea.jsx)("div",{className:"text-xs text-blue-500/70 truncate",children:e.description})]})]},e.type)})]})]})}),(0,ea.jsx)("div",{className:"px-4 py-2 border-t border-slate-100 bg-slate-50",children:(0,ea.jsxs)("div",{className:"flex items-center gap-4 text-xs text-slate-500",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)("kbd",{className:"px-1.5 py-0.5 bg-slate-200 rounded text-[10px] font-mono",children:"\u2191\u2193"}),"navigate"]}),(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)("kbd",{className:"px-1.5 py-0.5 bg-slate-200 rounded text-[10px] font-mono",children:"\u21b5"}),"select"]}),(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)("kbd",{className:"px-1.5 py-0.5 bg-slate-200 rounded text-[10px] font-mono",children:"esc"}),"close"]})]})})]})},oG=e=>{var t;let{form:s,style:a}=e;const{layout:n="stacked",formWidth:l="100",fieldWidth:r="100",fieldRadius:i="rounded",fieldSize:o="md",buttonWidth:c="auto",buttonStyle:u="solid",buttonRadius:m="rounded",buttonColor:h="#6366f1",buttonTextColor:x="#ffffff",buttonAlign:p="left",buttonText:g,labelColor:f="#374151",labelSize:v="sm",labelWeight:b="medium",fieldGap:j="16",formPadding:y="0",backgroundColor:N="#ffffff",transparentBg:w=!1}=a||{},C=()=>{switch(i){case"none":return"0";case"pill":return"9999px";default:return"8px"}},k={backgroundColor:w?"transparent":N,borderRadius:C(),padding:"0"!==y?"".concat(y,"px"):"24px",width:"".concat(l,"%"),margin:"100"!==l?"0 auto":void 0,border:w?"none":"1px solid #e2e8f0"},D={width:"100%",padding:(()=>{switch(o){case"sm":return"0.375rem 0.75rem";case"lg":return"0.75rem 1rem";default:return"0.5rem 1rem"}})(),borderRadius:C(),border:"1px solid #d1d5db",backgroundColor:"#ffffff",fontSize:"0.875rem"},_={color:f,fontSize:(()=>{switch(v){case"xs":return"0.75rem";case"md":return"1rem";case"lg":return"1.125rem";default:return"0.875rem"}})(),fontWeight:(()=>{switch(b){case"normal":return"400";
2case"semibold":return"600";case"bold":return"700";default:return"500"}})(),marginBottom:"0.25rem",display:"block"},S={textAlign:p,marginTop:"inline"===n?"0":"1.5rem"},E={backgroundColor:"solid"===u?h:"transparent",color:"solid"===u?x:h,borderRadius:(()=>{switch(m){case"none":return"0";case"pill":return"9999px";default:return"8px"}})(),border:"outline"===u?"2px solid ".concat(h):"none",width:"auto"===c?"auto":"".concat(c,"%"),padding:"0.75rem 1.5rem",fontWeight:"500",cursor:"pointer"};return(0,ea.jsxs)("div",{style:k,children:[(0,ea.jsxs)("div",{className:(()=>{switch(n){case"inline":return"flex flex-wrap items-end";case"two-column":return"grid grid-cols-2";case"three-column":return"grid grid-cols-3";default:return"flex flex-col"}})(),style:{gap:"".concat(j,"px")},children:[(s.fields||[]).slice(0,4).map((e,t)=>(0,ea.jsxs)("div",{style:"two-column"===n||"three-column"===n?{width:"100%"}:"inline"===n?{width:"".concat(r,"%"),paddingRight:"0.5rem",flexShrink:0}:{width:"".concat(r,"%"),margin:"100"!==r?"0 auto":void 0},children:[(0,ea.jsxs)("label",{style:_,children:[e.label,e.required&&(0,ea.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),"textarea"===e.type?(0,ea.jsx)("textarea",{style:d(d({},D),{},{minHeight:"60px"}),placeholder:e.placeholder,disabled:!0}):"select"===e.type?(0,ea.jsx)("select",{style:D,disabled:!0,children:(0,ea.jsx)("option",{children:e.placeholder||"Select..."})}):(0,ea.jsx)("input",{type:e.type,style:D,placeholder:e.placeholder,disabled:!0})]},t)),"inline"===n&&(0,ea.jsx)("div",{style:{flexShrink:0},children:(0,ea.jsx)("button",{type:"button",style:E,disabled:!0,children:g||s.submit_button_text||"Submit"})})]}),((null===(t=s.fields)||void 0===t?void 0:t.length)||0)>4&&(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-2",children:["+",s.fields.length-4," more fields..."]}),"inline"!==n&&(0,ea.jsx)("div",{style:S,children:(0,ea.jsx)("button",{type:"button",style:E,disabled:!0,children:g||s.submit_button_text||"Submit"})})]})},cG=e=>{var s,a;let{content:n,onChange:l}=e;const[r,i]=(0,t.useState)([]),[o,c]=(0,t.useState)(!0),[u,m]=(0,t.useState)(null);(0,t.useEffect)(()=>{h()},[]),(0,t.useEffect)(()=>{if(n.formId&&r.length>0){const e=r.find(e=>e.form_id===n.formId);m(e)}},[n.formId,r]);const h=async()=>{try{const e=await _l.get("/forms");i(e.data)}catch(e){console.error("Failed to fetch forms:",e)}finally{c(!1)}},x=(e,t)=>{l(d(d({},n),{},{style:d(d({},n.style),{},{[e]:t})}))},p=r.filter(e=>"active"===e.status),g=n.style||{};return(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(yw,{size:20,className:"text-sky-500"}),(0,ea.jsx)("span",{className:"font-medium text-slate-900",children:"Embed Form"})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:h,title:"Refresh forms list",children:(0,ea.jsx)(gq,{size:14})})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"mb-2 block",children:"Select Form"}),o?(0,ea.jsx)("div",{className:"text-sm text-slate-500",children:"Loading forms..."}):0===p.length?(0,ea.jsxs)("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-2",children:"No active forms found"}),(0,ea.jsxs)("a",{href:"/forms",target:"_blank",className:"text-sm text-indigo-600 hover:text-indigo-800 inline-flex items-center gap-1",children:["Create a form ",(0,ea.jsx)(bj,{size:12})]})]}):(0,ea.jsxs)(eb,{value:n.formId||"",onValueChange:e=>{const t=r.find(t=>t.form_id===e);l(d(d({},n),{},{formId:e,formName:(null===t||void 0===t?void 0:t.name)||""})),m(t)},children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Choose a form to embed..."})}),(0,ea.jsx)(lb,{children:p.map(e=>{var t;return(0,ea.jsx)(rb,{value:e.form_id,children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{children:e.name}),(0,ea.jsxs)("span",{className:"text-xs text-slate-400",children:["(",(null===(t=e.fields)||void 0===t?void 0:t.length)||0," fields)"]})]})},e.form_id)})})]})]}),u&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"font-medium text-slate-900",children:u.name}),u.description&&(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:u.description})]}),(0,ea.jsxs)(EC,{variant:"outline",children:[(null===(s=u.fields)||void 0===s?void 0:s.length)||0," fields"]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(u.fields||[]).slice(0,5).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-400",children:"\u2022"}),(0,ea.jsx)("span",{className:"text-slate-700",children:e.label}),e.required&&(0,ea.jsx)("span",{className:"text-xs text-red-500",children:"*"}),(0,ea.jsxs)("span",{className:"text-xs text-slate-400",children:["(",e.type,")"]})]},t)),((null===(a=u.fields)||void 0===a?void 0:a.length)||0)>5&&(0,ea.jsxs)("div",{className:"text-xs text-slate-400",children:["+",u.fields.length-5," more fields"]})]}),(0,ea.jsxs)("div",{className:"mt-4 pt-3 border-t border-slate-100 flex items-center justify-between",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-400",children:[u.submission_count||0," submissions"]}),(0,ea.jsxs)("a",{href:"/forms/".concat(u.form_id),target:"_blank",rel:"noreferrer",className:"text-xs text-indigo-600 hover:text-indigo-800 inline-flex items-center gap-1",children:["Edit form ",(0,ea.jsx)(bj,{size:10})]})]})]}),n.formId&&(0,ea.jsxs)("details",{className:"group border border-slate-200 rounded-lg",children:[(0,ea.jsxs)("summary",{className:"flex items-center gap-2 cursor-pointer p-3 bg-slate-50 rounded-t-lg hover:bg-slate-100",children:[(0,ea.jsx)(NE,{size:14,className:"text-indigo-500"}),(0,ea.jsx)("span",{className:"text-sm font-medium",children:"Layout & Styling"})]}),(0,ea.jsxs)("div",{className:"p-4 space-y-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block",children:"Layout"}),(0,ea.jsxs)(eb,{value:g.layout||"stacked",onValueChange:e=>x("layout",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"stacked",children:"Stacked (1 Column)"}),(0,ea.jsx)(rb,{value:"two-column",children:"2 Columns"}),(0,ea.jsx)(rb,{value:"three-column",children:"3 Columns"}
2),(0,ea.jsx)(rb,{value:"inline",children:"Inline (Fields + Button)"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block",children:"Form Width"}),(0,ea.jsxs)(eb,{value:g.formWidth||"100",onValueChange:e=>x("formWidth",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"25",children:"25%"}),(0,ea.jsx)(rb,{value:"33",children:"33%"}),(0,ea.jsx)(rb,{value:"40",children:"40%"}),(0,ea.jsx)(rb,{value:"50",children:"50%"}),(0,ea.jsx)(rb,{value:"60",children:"60%"}),(0,ea.jsx)(rb,{value:"70",children:"70%"}),(0,ea.jsx)(rb,{value:"80",children:"80%"}),(0,ea.jsx)(rb,{value:"90",children:"90%"}),(0,ea.jsx)(rb,{value:"100",children:"100%"})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-2 block font-medium flex items-center gap-1",children:(0,ea.jsx)("span",{children:"Field Styling"})}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Field Width"}),(0,ea.jsxs)(eb,{value:g.fieldWidth||"100",onValueChange:e=>x("fieldWidth",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"25",children:"25%"}),(0,ea.jsx)(rb,{value:"33",children:"33%"}),(0,ea.jsx)(rb,{value:"40",children:"40%"}),(0,ea.jsx)(rb,{value:"50",children:"50%"}),(0,ea.jsx)(rb,{value:"60",children:"60%"}),(0,ea.jsx)(rb,{value:"70",children:"70%"}),(0,ea.jsx)(rb,{value:"80",children:"80%"}),(0,ea.jsx)(rb,{value:"90",children:"90%"}),(0,ea.jsx)(rb,{value:"100",children:"100%"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Border Radius"}),(0,ea.jsxs)(eb,{value:g.fieldRadius||"rounded",onValueChange:e=>x("fieldRadius",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Field Size"}),(0,ea.jsxs)(eb,{value:g.fieldSize||"md",onValueChange:e=>x("fieldSize",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"sm",children:"Small"}),(0,ea.jsx)(rb,{value:"md",children:"Medium"}),(0,ea.jsx)(rb,{value:"lg",children:"Large"})]})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{className:"text-xs mb-2 block font-medium flex items-center gap-1",children:[(0,ea.jsx)(Dw,{size:12,className:"text-indigo-500"}),(0,ea.jsx)("span",{children:"Button Styling"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Button Width"}),(0,ea.jsxs)(eb,{value:g.buttonWidth||"auto",onValueChange:e=>x("buttonWidth",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto"}),(0,ea.jsx)(rb,{value:"50",children:"50%"}),(0,ea.jsx)(rb,{value:"75",children:"75%"}),(0,ea.jsx)(rb,{value:"100",children:"Full Width"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Button Style"}),(0,ea.jsxs)(eb,{value:g.buttonStyle||"solid",onValueChange:e=>x("buttonStyle",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline"}),(0,ea.jsx)(rb,{value:"ghost",children:"Ghost"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Button Radius"}),(0,ea.jsxs)(eb,{value:g.buttonRadius||"rounded",onValueChange:e=>x("buttonRadius",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-3 mt-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Button Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:g.buttonColor||"#6366f1",onChange:e=>x("buttonColor",e.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(BN,{value:g.buttonColor||"#6366f1",onChange:e=>x("buttonColor",e.target.value),className:"h-8 text-xs font-mono flex-1"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:g.buttonTextColor||"#ffffff",onChange:e=>x("buttonTextColor",e.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(BN,{value:g.buttonTextColor||"#ffffff",onChange:e=>x("buttonTextColor",e.target.value),className:"h-8 text-xs font-mono flex-1"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Alignment"}),(0,ea.jsxs)(eb,{value:g.buttonAlign||"left",onValueChange:e=>x("buttonAlign",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]}),(0,ea.jsxs)("div",{className:"mt-3",children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Button Text"}),(0,ea.jsx)(BN,{value:g.buttonText||"Submit",onChange:e=>x("buttonText",e.target.value),placeholder:"Submit",className:"h-8 text-xs"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-2 block font-medium",children:"Label Styling"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Label Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:g.labelColor||"#374151",onChange:e=>x("labelColor",e.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(BN,{value:g.labelColor||"#374151",onChange:e=>x("labelColor",e.target.value),className:"h-8 text-xs font-mono flex-1"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Label Size"}),(0,ea.jsxs)(eb,{value:g.labelSize||"sm",onValueChange:e=>x("labelSize",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"xs",children:"Extra Small"}),(0,ea.jsx)(rb,{value:"sm",children:"Small"}),(0,ea.jsx)(rb,{value:"md",children:"Medium"}),(0,ea.jsx)(rb,{value:"lg",children:"Large"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Label Weight"}),(0,ea.jsxs)(eb,{value:g.labelWeight||"medium",onValueChange:e=>x("labelWeight",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"normal",children:"Normal"}),(0,ea.jsx)(rb,{value:"medium",children:"Medium"}),(0,ea.jsx)(rb,{value:"semibold",children:"Semibold"}),(0,ea.jsx)(rb,{value:"bold",children:"Bold"})]})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-2 block font-medium",children:"Spacing"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Field Gap"}),(0,ea.jsxs)(eb,{value:g.fieldGap||"16",onValueChange:e=>x("fieldGap",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"8",children:"Compact (8px)"}),(0,ea.jsx)(rb,{value:"12",children:"Small (12px)"}),(0,ea.jsx)(rb,{value:"16",children:"Medium (16px)"}),(0,ea.jsx)(rb,{value:"24",children:"Large (24px)"}),(0,ea.jsx)(rb,{value:"32",children:"Extra Large (32px)"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Form Padding"}),(0,ea.jsxs)(eb,{value:g.formPadding||"0",onValueChange:e=>x("formPadding",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"0",children:"None"}),(0,ea.jsx)(rb,{value:"16",children:"Small (16px)"}),(0,ea.jsx)(rb,{value:"24",children:"Medium (24px)"}),(0,ea.jsx)(rb,{value:"32",children:"Large (32px)"}),(0,ea.jsx)(rb,{value:"48",children:"Extra Large (48px)"})]})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-2 block font-medium",children:"Backgroun
2d"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs mb-1.5 block text-slate-500",children:"Background Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:g.backgroundColor||"#ffffff",onChange:e=>x("backgroundColor",e.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(BN,{value:g.backgroundColor||"#ffffff",onChange:e=>x("backgroundColor",e.target.value),className:"h-8 text-xs font-mono flex-1"})]})]}),(0,ea.jsx)("div",{className:"flex items-end",children:(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:g.transparentBg||!1,onChange:e=>x("transparentBg",e.target.checked),className:"rounded border-slate-300"}),(0,ea.jsx)("span",{className:"text-xs text-slate-600",children:"Transparent"})]})})]})]})]})]}),u&&n.formId&&(0,ea.jsxs)("details",{className:"group border border-slate-200 rounded-lg",open:!0,children:[(0,ea.jsxs)("summary",{className:"flex items-center gap-2 cursor-pointer p-3 bg-indigo-50 rounded-t-lg hover:bg-indigo-100",children:[(0,ea.jsx)(bj,{size:14,className:"text-indigo-500"}),(0,ea.jsx)("span",{className:"text-sm font-medium text-indigo-700",children:"Live Preview"})]}),(0,ea.jsx)("div",{className:"p-4 bg-slate-50 rounded-b-lg overflow-auto",children:(0,ea.jsx)(oG,{form:u,style:g})})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"This form will be displayed on the published page. Visitors can submit responses."})]})},dG=["id"],uG={"image-text-stack":"Image + Text (Stack)","image-text-row":"Image + Text (Row)",columns:"Columns",hero:"Hero Banner",pricing:"Pricing Table",testimonials:"Testimonials",cta:"Call to Action"},mG=e=>{let{open:s,onClose:a,block:n,onSaved:r}=e;const[i,o]=(0,t.useState)(!1),[c,u]=(0,t.useState)("");(0,t.useEffect)(()=>{if(s&&n){const e=uG[n.type]||n.type||"Block";u("My ".concat(e))}},[s,n]);const m=async()=>{if(c.trim()){o(!0);try{const{id:e}=n,t=l(n,dG),s=d({},t.content||{});delete s.anchor_id;const i=d(d({},t),{},{content:s}),o=await _l.post("/templates",{name:c.trim(),category:"block",kind:"block",blocks:[i]});qs.success('Block saved! Find it under "My Saved Blocks" when adding a block.'),null===r||void 0===r||r(o.data),a()}catch(s){var e,t;console.error("Failed to save block:",s),qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save block")}finally{o(!1)}}else qs.error("Please enter a name for this block")};return(0,ea.jsx)(Ok,{open:s,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-md","data-testid":"save-block-template-modal",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(CE,{size:18,className:"text-indigo-600"}),"Save block as reusable"]})}),(0,ea.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Save this styled block so you can quickly add it to any page without rebuilding it."}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"block-template-name",children:"Block name *"}),(0,ea.jsx)(BN,{id:"block-template-name",value:c,onChange:e=>u(e.target.value),placeholder:"e.g. Promo card","data-testid":"save-block-name-input",onKeyDown:e=>{"Enter"===e.key&&m()}})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:a,disabled:i,"data-testid":"save-block-cancel",children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:m,disabled:i,"data-testid":"save-block-confirm",children:[(0,ea.jsx)(BD,{size:16,className:"mr-2"}),i?"Saving...":"Save Block"]})]})]})})},hG=Vl("layout-grid",[["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"}]]),xG=Vl("gallery-horizontal",[["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"}]]),pG=Vl("maximize-2",[["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"}]]),gG=[{id:"grid-2",name:"Grid 2 Columns",icon:AE,columns:2},{id:"grid-3",name:"Grid 3 Columns",icon:AE,columns:3},{id:"grid-4",name:"Grid 4 Columns",icon:hG,columns:4},{id:"masonry",name:"Masonry",icon:_E,description:"Pinterest-style layout"},{id:"carousel",name:"Carousel",icon:xG,description:"Horizontal slider"}
2,{id:"featured",name:"Featured + Thumbnails",icon:pG,description:"Large image with thumbnails"}],fG=e=>{let{media:s,selectedIds:a,onSelect:n,onClose:l}=e;const[r,i]=(0,t.useState)(new Set(a)),o=s.filter(e=>{var t;return null===(t=e.content_type)||void 0===t?void 0:t.startsWith("image/")});return(0,ea.jsxs)("div",{className:"flex flex-col flex-1 overflow-hidden",children:[(0,ea.jsx)("div",{className:"flex-1 overflow-y-auto p-2",children:0===o.length?(0,ea.jsx)("p",{className:"text-center text-slate-500 py-8",children:"No images in library"}):(0,ea.jsx)("div",{className:"grid grid-cols-5 gap-2",children:o.map(e=>(0,ea.jsxs)("button",{onClick:()=>(e=>{const t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(t)})(e.media_id),className:"relative aspect-square rounded overflow-hidden border-2 transition-all ".concat(r.has(e.media_id)?"border-indigo-500 ring-2 ring-indigo-200":"border-transparent hover:border-slate-300"),children:[(0,ea.jsx)("img",{src:e.url,alt:e.filename,className:"w-full h-full object-cover"}),r.has(e.media_id)&&(0,ea.jsx)("div",{className:"absolute top-1 right-1 w-5 h-5 bg-indigo-500 rounded-full flex items-center justify-center",children:(0,ea.jsx)("span",{className:"text-white text-xs",children:"\u2713"})})]},e.media_id))})}),(0,ea.jsxs)("div",{className:"flex justify-between items-center pt-3 border-t",children:[(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:[r.size," selected"]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:l,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:()=>{const e=s.filter(e=>r.has(e.media_id));n(e)},disabled:0===r.size,children:"Add Selected"})]})]})]})},vG=e=>{let{content:s,onChange:a}=e;const[n,l]=(0,t.useState)(!1),[r,i]=(0,t.useState)(!1),[o,c]=(0,t.useState)([]),[u,m]=(0,t.useState)([]),[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(!1),[f,v]=(0,t.useState)(!1),b=s.layout||"grid-3",j=s.images||[],y=s.linkedFolderId||null,N=s.linkedFolderName||null,w=s.gap||"16",C=s.imageRadius||"8",k=(s.showCaptions,!1!==s.enableLightbox),D=s.aspectRatio||"auto",_=s.imageAnimation||"none",S=s.animationSpeed||"0.3",E=s.hoverEffect||"zoom",A=(0,t.useCallback)(async()=>{x(!0);try{const[e,t]=await Promise.all([_l.get("/media"),_l.get("/media/folders")]);c(e.data),m(t.data)}catch(e){console.error("Failed to fetch media:",e)}finally{x(!1)}},[]);(0,t.useEffect)(()=>{A()},[A]);const F=(0,t.useCallback)(async()=>{if(y)try{const e=(await _l.get("/media?folder_id=".concat(y))).data.map(e=>({id:e.media_id,url:e.url,alt:e.filename,caption:""}));a(d(d({},s),{},{images:e}))}catch(e){console.error("Failed to fetch folder images:",e)}},[y,s,a]),T=async e=>{if(0===e.length)return;const t=Array.from(e).filter(e=>e.type.startsWith("image/"));if(0===t.length)return void qs.error("Please drop image files only");g(!0);const n=[...j];try{for(const e of t){const t=new FormData;t.append("file",e);const s=y?"/media/upload?folder_id=".concat(y):"/media/upload",a=await _l.post(s,t,{headers:{"Content-Type":"multipart/form-data"}});n.push({id:a.data.media_id,url:a.data.url,alt:e.name,caption:""})}a(d(d({},s),{},{images:n})),qs.success("".concat(t.length," image(s) uploaded")),A()}catch(l){qs.error("Failed to upload images")}finally{g(!1)}};return(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-2 block",children:"Gallery Layout"}),(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-2",children:gG.map(e=>(0,ea.jsxs)("button",{onClick:()=>a(d(d({},s),{},{layout:e.id}
2)),className:"p-3 rounded-lg border-2 text-center transition-all ".concat(b===e.id?"border-indigo-500 bg-indigo-50":"border-slate-200 hover:border-slate-300"),children:[(0,ea.jsx)(e.icon,{size:20,className:"mx-auto mb-1 text-slate-600"}),(0,ea.jsx)("span",{className:"text-xs font-medium",children:e.name})]},e.id))})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Gap"}),(0,ea.jsxs)(eb,{value:w,onValueChange:e=>a(d(d({},s),{},{gap:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"4",children:"Tight (4px)"}),(0,ea.jsx)(rb,{value:"8",children:"Small (8px)"}),(0,ea.jsx)(rb,{value:"16",children:"Medium (16px)"}),(0,ea.jsx)(rb,{value:"24",children:"Large (24px)"}),(0,ea.jsx)(rb,{value:"32",children:"Extra Large (32px)"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Image Corners"}),(0,ea.jsxs)(eb,{value:C,onValueChange:e=>a(d(d({},s),{},{imageRadius:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"0",children:"Sharp"}),(0,ea.jsx)(rb,{value:"4",children:"Subtle"}),(0,ea.jsx)(rb,{value:"8",children:"Rounded"}),(0,ea.jsx)(rb,{value:"16",children:"More Rounded"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Aspect Ratio"}),(0,ea.jsxs)(eb,{value:D,onValueChange:e=>a(d(d({},s),{},{aspectRatio:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto"}),(0,ea.jsx)(rb,{value:"1/1",children:"Square (1:1)"}),(0,ea.jsx)(rb,{value:"4/3",children:"Standard (4:3)"}),(0,ea.jsx)(rb,{value:"16/9",children:"Widescreen (16:9)"}),(0,ea.jsx)(rb,{value:"3/4",children:"Portrait (3:4)"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between pt-5",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Click to Enlarge"}),(0,ea.jsx)(wb,{checked:k,onCheckedChange:e=>a(d(d({},s),{},{enableLightbox:e}))})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-purple-50 rounded-lg border border-purple-200",children:[(0,ea.jsx)(tf,{className:"text-xs text-purple-700 font-medium mb-2 block",children:"Image Animation & Effects"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Entrance Animation"}),(0,ea.jsxs)(eb,{value:_,onValueChange:e=>a(d(d({},s),{},{imageAnimation:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"fadeIn",children:"Fade In"}),(0,ea.jsx)(rb,{value:"fadeInUp",children:"Fade In Up"}),(0,ea.jsx)(rb,{value:"zoomIn",children:"Zoom In"}),(0,ea.jsx)(rb,{value:"slideIn",children:"Slide In"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Animation Speed"}),(0,ea.jsxs)(eb,{value:S,onValueChange:e=>a(d(d({},s),{},{animationSpeed:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"0.2",children:"Fast (0.2s)"}),(0,ea.jsx)(rb,{value:"0.3",children:"Normal (0.3s)"}),(0,ea.jsx)(rb,{value:"0.5",children:"Slow (0.5s)"}),(0,ea.jsx)(rb,{value:"0.8",children:"Very Slow (0.8s)"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Hover Effect"}),(0,ea.jsxs)(eb,{value:E,onValueChange:e=>a(d(d({},s),{},{hoverEffect:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"zoom",children:"Zoom"}),(0,ea.jsx)(rb,{value:"brighten",children:"Brighten"}),(0,ea.jsx)(rb,{value:"darken",children:"Darken"}),(0,ea.jsx)(rb,{value:"grayscale",children:"Grayscale \u2192 Color"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between pt-5",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Stagger"}),(0,ea.jsx)(wb,{checked:!1!==s.staggerAnimation,onCheckedChange:e=>a(d(d({},s),{},{staggerAnimation:e}))})]})]})]}),"featured"===b&&(0,ea.jsxs)("div",{className:"p-3 bg-amber-50 rounded-lg border border-amber-200",children:[(0,ea.jsx)(tf,{className:"text-xs text-amber-700 font-medium mb-2 block",children:"Featured Layout Options"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("button",{onClick:()=>a(d(d({},s),{},{thumbnailPosition:"side"})),className:"p-2 rounded border text-xs flex items-center justify-center gap-2 transition-all ".concat("side"===(s.thumbnailPosition||"side")?"border-amber-500 bg-amber-100 text-amber-700":"border-slate-200 hover:border-amber-300"),children:[(0,ea.jsxs)("div",{className:"flex gap-1",children:[(0,ea.jsx)("div",{className:"w-6 h-4 bg-amber-400 rounded-sm"}),(0,ea.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,ea.jsx)("div",{className:"w-2 h-1 bg-amber-300 rounded-sm"}),(0,ea.jsx)("div",{className:"w-2 h-1 bg-amber-300 rounded-sm"}),(0,ea.jsx)("div",{className:"w-2 h-1 bg-amber-300 rounded-sm"})]})]}),(0,ea.jsx)("span",{children:"Side"})]}),(0,ea.jsxs)("button",{onClick:()=>a(d(d({},s),{},{thumbnailPosition:"bottom"})),className:"p-2 rounded border text-xs flex items-center justify-center gap-2 transition-all ".concat("bottom"===s.thumbnailPosition?"border-amber-500 bg-amber-100 text-amber-700":"border-slate-200 hover:border-amber-300"),children:[(0,ea.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ea.jsx)("div",{className:"w-8 h-3 bg-amber-400 rounded-sm"}),(0,ea.jsxs)("div",{className:"flex gap-0.5",children:[(0,ea.jsx)("div",{className:"w-2 h-1 bg-amber-300 rounded-sm"}),(0,ea.jsx)("div",{className:"w-2 h-1 bg-amber-300 rounded-sm"}),(0,ea.jsx)("div",{className:"w-2 h-1 bg-amber-300 rounded-sm"}),(0,ea.jsx)("div",{className:"w-2 h-1 bg-amber-300 rounded-sm"})]})]}),(0,ea.jsx)("span",{children:"Bottom"})]})]}),(0,ea.jsx)("p",{className:"text-[10px] text-amber-600 mt-2",children:"Click thumbnails to change the main image"})]}),y?(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-indigo-50 rounded-lg border border-indigo-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(jD,{size:18,className:"text-indigo-600"}),(0,ea.jsxs)("span",{className:"text-sm font-medium text-indigo-700",children:["Linked to: ",N]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{y&&(F(),qs.success("Gallery refreshed from folder"))},title:"Refresh from folder",children:(0,ea.jsx)(gq,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{a(d(d({},s),{},{linkedFolderId:null,linkedFolderName:null})),qs.info("Folder unlinked")},className:"text-red-500",children:(0,ea.jsx)(sr,{size:14})})]})]}):(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>i(!0),className:"w-full",children:[(0,ea.jsx)(jD,{size:14,className:"mr-2"}),"Link to Media Folder"]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>l(!0),className:"flex-1",children:[(0,ea.jsx)(TE,{size:14,className:"mr-2"}),"Select from Library"]}),(0,ea.jsxs)("label",{className:"flex-1",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",className:"w-full",disabled:p,asChild:!0,children:(0,ea.jsxs)("span",{children:[(0,ea.jsx)(kq,{size:14,className:"mr-2"}),p?"Uploading...":"Upload Images"]})}),(0,ea.jsx)("input",{type:"file",multiple:!0,accept:"image/*",onChange:async e=>{await T(e.target.files)},className:"hidden"})]})]}),(0,ea.jsxs)("div",{onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),v(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||v(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:async e=>{e.preventDefault(),e.stopPropagation(),v(!1);const t=e.dataTransfer.files;await T(t)},className:"relative",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-500 mb-2 block",children:["Gallery Images (",j.length,") - Drag & drop images here"]}),f&&(0,ea.jsx)("div",{className:"absolute inset-0 bg-indigo-500/20 border-2 border-dashed border-indigo-500 rounded-lg z-10 flex items-center justify-center",children:(0,ea.jsxs)("div",{className:"bg-white rounded-lg shadow-lg px-6 py-4 text-center",children:[(0,ea.jsx)(kq,{size:32,className:"mx-auto mb-2 text-indigo-600"}),(0,ea.jsx)("p",{className:"font-medium text-indigo-600",children:"Drop images here"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Images will be added to your gallery"})]})}),p&&(0,ea.jsx)("div",{className:"absolute inset-0 bg-white/80 rounded-lg z-10 flex items-center justify-center",children:(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"animate-spin w-8 h-8 border-2 border-indigo-600 border-t-transparent roun
2ded-full mx-auto mb-2"}),(0,ea.jsx)("p",{className:"text-sm font-medium text-indigo-600",children:"Uploading images..."})]})}),0===j.length?(0,ea.jsxs)("div",{className:"p-8 border-2 border-dashed rounded-lg text-center transition-colors ".concat(f?"border-indigo-500 bg-indigo-50":"border-slate-200 text-slate-400"),children:[(0,ea.jsx)(kq,{size:32,className:"mx-auto mb-2 opacity-50"}),(0,ea.jsx)("p",{className:"text-sm font-medium",children:"Drag & drop images here"}),(0,ea.jsx)("p",{className:"text-xs mt-1",children:"or use the buttons above to add images"})]}):(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-2 max-h-64 overflow-y-auto p-2 rounded-lg transition-colors ".concat(f?"bg-indigo-50 ring-2 ring-indigo-500":"bg-slate-50"),children:j.map((e,t)=>(0,ea.jsxs)("div",{className:"relative group aspect-square bg-white rounded overflow-hidden border border-slate-200",children:[(0,ea.jsx)("img",{src:e.url,alt:e.alt,className:"w-full h-full object-cover"}),(0,ea.jsx)("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-1",children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-white hover:bg-white/20",onClick:()=>{return t=e.id,void a(d(d({},s),{},{images:j.filter(e=>e.id!==t)}));var t},children:(0,ea.jsx)(wD,{size:14})})}),(0,ea.jsx)("span",{className:"absolute bottom-1 left-1 bg-black/60 text-white text-[10px] px-1 rounded",children:t+1})]},e.id))})]}),(0,ea.jsx)(Ok,{open:n,onOpenChange:l,children:(0,ea.jsxs)(Wk,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Select Images from Library"})}),(0,ea.jsx)(fG,{media:o,selectedIds:j.map(e=>e.id),onSelect:e=>{const t=[...j];e.forEach(e=>{t.find(t=>t.id===e.media_id)||t.push({id:e.media_id,url:e.url,alt:e.filename,caption:""})}),a(d(d({},s),{},{images:t})),l(!1)},onClose:()=>l(!1)})]})}),(0,ea.jsx)(Ok,{open:r,onOpenChange:i,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Select a Folder"})}),(0,ea.jsx)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:0===u.length?(0,ea.jsx)("p",{className:"text-sm text-slate-500 text-center py-4",children:"No folders yet. Create folders in the Media Library."}):u.map(e=>(0,ea.jsxs)("button",{onClick:()=>(async e=>{try{const t=(await _l.get("/media?folder_id=".concat(e.folder_id))).data.map(e=>({id:e.media_id,url:e.url,alt:e.filename,caption:""}));a(d(d({},s),{},{linkedFolderId:e.folder_id,linkedFolderName:e.name,images:t})),i(!1),qs.success('Linked to folder "'.concat(e.name,'"'))}catch(t){qs.error("Failed to link folder")}})(e),className:"w-full flex items-center gap-3 p-3 rounded-lg border border-slate-200 hover:border-indigo-300 hover:bg-indigo-50 transition-all text-left",children:[(0,ea.jsx)(jD,{size:20,className:"text-amber-500"}),(0,ea.jsx)("span",{className:"font-medium",children:e.name})]},e.folder_id))})]})})]})},bG=Vl("move-up",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),jG=Vl("move-down",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),yG=e=>{let{content:s,onChange:a,openMediaPicker:n,blockId:l}=e;const[r,i]=(0,t.useState)(null),o=s.items||[],c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"text";const t={id:"item-".concat(Date.now()),type:e,text:"text"===e?"Your text here":"",imageUrl:"",imageAlt:"",link:""};a(d(d({},s),{},{items:[...o,t]}))},u=(e,t)=>{const n=[...o];n[e]=d(d({},n[e]),t),a(d(d({},s),{},{items:n}))},m=(e,t)=>{const n=e+t;if(n<0||n>=o.length)return;const l=[...o];[l[e],l[n]]=[l[n],l[e]],a(d(d({},s),{},{items:l}))},h=e=>{n("".concat(l,":ticker:").concat(e))};return(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Ticker Settings"})}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Animation"}),(0,ea.jsxs)(eb,{value:s.animationStyle||"continuous",onValueChange:e=>a(d(d({},s),{},{animationStyle:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"continuous",children:"Continuous Scroll"}),(0,ea.jsx)(rb,{value:"step",children:"Step-by-Step"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Direction"}),(0,ea.jsxs)(eb,{value:s.direction||"left",onValueChange:e=>a(d(d({},s),{},{direction:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"\u2190 Left"}),(0,ea.jsx)(rb,{value:"right",children:"\u2192 Right"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Speed"}),(0,ea.jsxs)(eb,{value:s.speed||"medium",onValueChange:e=>a(d(d({},s),{},{speed:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"slow",children:"Slow"}),(0,ea.jsx)(rb,{value:"medium",children:"Medium"}),(0,ea.jsx)(rb,{value:"fast",children:"Fast"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Hover Behavior"}),(0,ea.jsxs)(eb,{value:s.pauseOnHover?"pause":"continue",onValueChange:e=>a(d(d({},s),{},{pauseOnHover:"pause"===e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"pause",children:"Pause on Hover"}),(0,ea.jsx)(rb,{value:"continue",children:"Continue on Hover"})]})]})]})]})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Styling"})}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 ga
2p-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Background"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:s.backgroundColor||"#f8fafc",onChange:e=>a(d(d({},s),{},{backgroundColor:e.target.value})),className:"w-8 h-8 rounded border cursor-pointer"}),(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500",children:[(0,ea.jsx)("input",{type:"checkbox",checked:s.transparentBg||!1,onChange:e=>a(d(d({},s),{},{transparentBg:e.target.checked})),className:"w-3 h-3 rounded"}),"None"]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Item Spacing"}),(0,ea.jsx)(BN,{type:"number",value:s.itemSpacing||48,onChange:e=>a(d(d({},s),{},{itemSpacing:parseInt(e.target.value)||48})),className:"h-8 text-xs",min:"16",max:"200"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Logo/Image Height"}),(0,ea.jsx)(BN,{type:"number",value:s.itemHeight||48,onChange:e=>a(d(d({},s),{},{itemHeight:parseInt(e.target.value)||48})),className:"h-8 text-xs",min:"24",max:"200"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Vertical Padding"}),(0,ea.jsx)(BN,{type:"number",value:s.verticalPadding||16,onChange:e=>a(d(d({},s),{},{verticalPadding:parseInt(e.target.value)||16})),className:"h-8 text-xs",min:"0",max:"100"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Logo Filter"}),(0,ea.jsxs)(eb,{value:s.logoFilter||"none",onValueChange:e=>a(d(d({},s),{},{logoFilter:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"Full Color"}),(0,ea.jsx)(rb,{value:"grayscale",children:"Grayscale"}),(0,ea.jsx)(rb,{value:"grayscale-hover",children:"Grayscale \u2192 Color on Hover"})]})]})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)(tf,{className:"text-sm font-medium",children:["Ticker Items (",o.length,")"]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>c("image"),className:"h-7 text-xs gap-1",children:[(0,ea.jsx)($N,{size:12}),"Add Logo"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>c("text"),className:"h-7 text-xs gap-1",children:[(0,ea.jsx)(wE,{size:12}),"Add Text"]})]})]}),0===o.length&&(0,ea.jsx)("div",{className:"p-6 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"No items yet. Add logos or text to create your ticker tape."})}),(0,ea.jsx)("div",{className:"space-y-2",children:o.map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-white border border-slate-200 rounded-lg group",children:[(0,ea.jsx)("div",{className:"text-slate-300 cursor-grab",children:(0,ea.jsx)(yE,{size:16})}),(0,ea.jsx)("div",{className:"w-8 h-8 rounded flex items-center justify-center ".concat("image"===e.type?"bg-pink-100 text-pink-600":"bg-blue-100 text-blue-600"),children:"image"===e.type?(0,ea.jsx)($N,{size:14}):(0,ea.jsx)(wE,{size:14})}),(0,ea.jsx)("div",{className:"flex-1 min-w-0",children:"image"===e.type?(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.imageUrl?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",className:"h-8 max-w-[100px] object-contain rounded"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>h(t),className:"h-7 text-xs",children:"Change"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>u(t,{imageUrl:"",imageAlt:""}),className:"h-7 text-xs text-red-500 hover:text-red-700",children:"Remove"})]}):(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>h(t),className:"h-7 text-xs gap-1",children:[(0,ea.jsx)(jD,{size:12}),"Select Image"]}),(0,ea.jsx)(BN,{value:e.link||"",onChange:e=>u(t,{link:e.target.value}),placeholder:"Link URL (optional)",className:"h-7 text-xs flex-1 max-w-[200px]"})]}):(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{value:e.text||"",onChange:e=>u(t,{text:e.target.value}),placeholder:"Enter text...",className:"h-8 text-sm flex-1"}),(0,ea.jsx)(BN,{value:e.link||"",onChange:e=>u(t,{link:e.target.value}),placeholder:"Link URL (optional)",className:"h-7 text-xs w-[180px]"})]})}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m(t,-1),disabled:0===t,className:"h-7 w-7 p-0 text-slate-400 hover:text-slate-600",children:(0,ea.jsx)(bG,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m(t,1),disabled:t===o.length-1,className:"h-7 w-7 p-0 text-slate-400 hover:text-slate-600",children:(0,ea.jsx)(jG,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=o.filter((t,s)=>s!==e);a(d(d({},s),{},{items:t}))})(t),className:"h-7 w-7 p-0 text-red-400 hover:text-red-600",children:(0,ea.jsx)(wD,{size:14})})]})]},e.id||t))})]}),o.length>0&&(0,ea.jsxs)("div",{className:"mt-4",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-500 mb-2 block",children:["Preview (scroll direction: ",s.direction||"left",")"]}),(0,ea.jsx)("div",{className:"overflow-hidden rounded-lg border border-slate-200",style:{backgroundColor:s.transparentBg?"transparent":s.backgroundColor||"#f8fafc",padding:"".concat(s.verticalPadding||16,"px 0")},children:(0,ea.jsx)("div",{className:"flex items-center",style:{gap:"".concat(s.itemSpacing||48,"px")},children:o.map((e,t)=>(0,ea.jsx)("div",{className:"flex-shrink-0 ".concat("grayscale"===s.logoFilter?"grayscale":""),children:"image"===e.type?e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",style:{height:"".concat(s.itemHeight||48,"px"),maxWidth:"150px",objectFit:"contain"}}):(0,ea.jsx)("div",{className:"bg-slate-200 rounded flex items-center justify-center text-slate-400",style:{width:"100px",height:"".concat(s.itemHeight||48,"px")},children:(0,ea.jsx)($N,{size:20})}):(0,ea.jsx)("span",{className:"text-slate-700 font-medium whitespace-nowrap",children:e.text||"Text item"})},t))})})]})]})},NG=e=>{let{content:s,onChange:a}=e;const[n,l]=(0,t.useState)([]);(0,t.useEffect)(()=>{r()},[]);const r=async()=>{try{const e=await _l.get("/articles/categories/list");l(e.data||[])}catch(e){console.error("Failed to fetch categories:",e)}},i=(e,t)=>{a(d(d({},s),{},{[e]:t}))};return(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Display Settings"})}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Layout"}),(0,ea.jsxs)(eb,{value:s.layout||"grid",onValueChange:e=>i("layout",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"grid",children:"Card Grid"}),(0,ea.jsx)(rb,{value:"list",children:"List View"})]})]})]}),"grid"===(s.layout||"grid")&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Columns"}),(0,ea.jsxs)(eb,{value:String(s.columns||3),onValueChange:e=>i("columns",parseInt(e)),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"2",children:"2 Columns"}),(0,ea.jsx)(rb,{value:"3",children:"3 Columns"}),(0,ea.jsx)(rb,{value:"4",children:"4 Columns"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Show Articles"}),(0,ea.jsx)(BN,{type:"number",value:s.limit||6,onChange:e=>i("limit",parseInt(e.target.value)||6),className:"h-8 text-xs",min:"1",max:"50"})]})]})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Filter & Search"})}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Filter by Categories"}),(()=>{const e=s.categoryFilters||(s.categoryFilter?[s.categoryFilter]:[]),t=t=>{const n=e.includes(t)?e.filter(e=>e!==t):[...e,t];a(d(d({},s),{},{categoryFilters:n,categoryFilter:n[0]||""}))};return(0,ea.jsxs)("div",{children:[e.length>0&&(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1 mb-2",children:[e.map(e=>(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-100 text-indigo-700 rounded text-xs",children:[e,(0,ea.jsx)("button",{onClick:()=>t(e),className:"hover:text-indigo-900",children:(0,ea.jsx)(sr,{size:10})})]},e)),(0,ea.jsx)("button",{onClick:()=>{a(d(d({},s),{},{categoryFilters:[],categoryFilter:""}))},className:"text-xs text-slate-400 hover:text-slate-600 px-1",children:"Clear all"})]}),(0,ea.jsx)("div",{className:"max-h-32 overflow-y-auto border rounded-md bg-white",children:0===n.length?(0,ea.jsx)("p",{className:"px-3 py-2 text-xs text-slate-400",children:"No categories found"}):n.map(s=>(0,ea.jsxs)("label",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-slate-50 cursor-pointer text-xs text-slate-700",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.includes(s),onChange:()=>t(s),className:"w-3 h-3 rounded"}),s]},s))}),0===e.length&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"No filter \u2014 showing all categories"})]})})()]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Search Bar"}),(0,ea.jsxs)(eb,{value:s.showSearch?"yes":"no",onValueChange:e=>i("showSearch","yes"===e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"no",children:"Hidden"}),(0,ea.jsx)(rb,{value:"yes",children:"Show Search"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Public Category Filter"}),(0,ea.jsxs)(eb,{value:s.showCategoryFilter?"yes":"no",onValueChange:e=>i("showCategoryFilter","yes"===e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"no",children:"Hidden"}),(0,ea.jsx)(rb,{value:"yes",children:"Show Filter Buttons"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:s.showCategoryFilter?"Visitors can filter articles by category on the public site":"Category filter is hidden from visitors"})]})]})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Click Behavior"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"When article is clicked"}),(0,ea.jsxs)(eb,{value:s.openAs||"popup",onValueChange:e=>i("openAs",e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"popup",children:"Open as Popup"}),(0,ea.jsx)(rb,{value:"newpage",children:"Open in New Page"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"newpage"===s.openAs?"Article opens in a dedicated page with full URL":"Article opens in a modal overlay on the current page"})]})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Pagination"})}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Pagination"}),(0,ea.jsxs)(eb,{value:s.enablePagination?"yes":"no",onValueChange:e=>i("enablePagination","yes"===e),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"no",children:"Disabled"}),(0,ea.jsx)(rb,{value:"yes",children:"Enabled"})]})]})]}),s.enablePagination&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Per Page"}),(0,ea.jsx)(BN,{type:"number",value:s.perPage||6,onChange:e=>i("perPage",parseInt(e.target.value)||6),className:"h-8 text-xs",min:"1",max:"50"})]})]})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Card Options"})}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==s.showImage,onChange:e=>i("showImage",e.target.checked),className:"w-3 h-3 rounded"}),"Show featured images"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==s.showDate,onChange:e=>i("showDate",e.target.checked),className:"w-3 h-3 rounded"}),"Show article date"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==s.showExcerpt,onChange:e=>i("showExcerpt",e.target.checked),className:"w-3 h-3 rounded"}),"Show excerpt/preview text"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==s.showCategory,onChange:e=>i("showCategory",e.target.checked),className:"w-3 h-3 rounded"}),"Show category badge"]})]})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-700",children:"Section Heading (Optional)"})}),(0,ea.jsx)(BN,{value:s.heading||"",onChange:e=>i("heading",e.target.value),placeholder:"e.g., Latest Articles, News, Blog Posts...",className:"h-8 text-xs"})]}),(0,ea.jsx)("div",{className:"p-3 bg-indigo-50 rounded-lg border border-indigo-200",children:(0,ea.jsxs)("p",{className:"text-xs text-indigo-700",children:[(0,ea.jsx)("strong",{children:"Note:"})," This block will display published articles from your Articles section. Create and publish articles in the Articles menu to see them here."]})})]})},wG=e=>{var s;
2let{content:a,onChange:n}=e;const[l,r]=(0,t.useState)([]),i=e=>n(d(d({},a),e));return(0,t.useEffect)(()=>{let e=!0;return _l.get("/events/groups").then(t=>{e&&r(t.data||[])}).catch(()=>{}),()=>{e=!1}},[]),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{"data-testid":"events-block-title",value:a.title||"",onChange:e=>i({title:e.target.value}),placeholder:"Upcoming Events"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Default view"}),(0,ea.jsxs)(eb,{value:a.defaultView||"calendar",onValueChange:e=>i({defaultView:e}),children:[(0,ea.jsx)(sb,{"data-testid":"events-block-view",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"calendar",children:"Calendar (month grid)"}),(0,ea.jsx)(rb,{value:"list",children:"List (upcoming)"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Show events for"}),(0,ea.jsxs)(eb,{value:a.groupId||"all",onValueChange:e=>i({groupId:"all"===e?"":e}),children:[(0,ea.jsx)(sb,{"data-testid":"events-block-group",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All events (everyone)"}),l.map(e=>(0,ea.jsx)(rb,{value:e.group_id,children:e.name},e.group_id))]})]}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:'Filters to "everyone" events plus events targeted at this group.'})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Max events shown (list view)"}),(0,ea.jsx)(BN,{type:"number",min:"1","data-testid":"events-block-limit",value:null!==(s=a.limit)&&void 0!==s?s:10,onChange:e=>i({limit:parseInt(e.target.value,10)||10})})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between border rounded-lg p-3 bg-slate-50",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Allow RSVP in the popup"}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Visitors can register without leaving this page."})]}),(0,ea.jsx)(wb,{"data-testid":"events-block-rsvp",checked:!1!==a.showRsvp,onCheckedChange:e=>i({showRsvp:e})})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between border rounded-lg p-3 bg-slate-50",children:[(0,ea.jsx)("div",{children:(0,ea.jsx)(tf,{className:"text-xs",children:'Show "Subscribe (iCal)" button'})}),(0,ea.jsx)(wb,{"data-testid":"events-block-ical",checked:!1!==a.showIcal,onCheckedChange:e=>i({showIcal:e})})]})]})},CG=e=>{var t,s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N;
2let{content:w,onChange:C,label:k="Add Button",pages:D=[],anchors:_=[]}=e;const S=null===(t=w.blockButton)||void 0===t?void 0:t.enabled,E=w.blockButton||{},A=e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),e)}));return(0,ea.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:S||!1,onChange:e=>{var t,s,a,n,l,r,i,o,c,u,m,h,x,p;return C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{enabled:e.target.checked,text:(null===(t=w.blockButton)||void 0===t?void 0:t.text)||"Click Me",url:(null===(s=w.blockButton)||void 0===s?void 0:s.url)||"",style:(null===(a=w.blockButton)||void 0===a?void 0:a.style)||"solid",size:(null===(n=w.blockButton)||void 0===n?void 0:n.size)||"md",color:(null===(l=w.blockButton)||void 0===l?void 0:l.color)||"#6366f1",textColor:(null===(r=w.blockButton)||void 0===r?void 0:r.textColor)||"#ffffff",gradientColor:(null===(i=w.blockButton)||void 0===i?void 0:i.gradientColor)||"#8b5cf6",radius:(null===(o=w.blockButton)||void 0===o?void 0:o.radius)||"rounded",hover:(null===(c=w.blockButton)||void 0===c?void 0:c.hover)||"fade",icon:(null===(u=w.blockButton)||void 0===u?void 0:u.icon)||"none",iconPosition:(null===(m=w.blockButton)||void 0===m?void 0:m.iconPosition)||"right",align:(null===(h=w.blockButton)||void 0===h?void 0:h.align)||"center",fullWidth:(null===(x=w.blockButton)||void 0===x?void 0:x.fullWidth)||!1,marginTop:(null===(p=w.blockButton)||void 0===p?void 0:p.marginTop)||16})}))},className:"w-4 h-4 rounded border-slate-300 accent-indigo-600 cursor-pointer"}),(0,ea.jsx)("span",{className:"text-xs font-medium text-slate-600",children:k})]}),S&&(0,ea.jsxs)("div",{className:"mt-2 space-y-2 p-2 bg-slate-50 rounded-lg",children:[(0,ea.jsx)(q$,{currentStyle:H$(E),onApply:e=>A(e)}),(0,ea.jsx)(BN,{value:(null===(s=w.blockButton)||void 0===s?void 0:s.text)||"Click Me",onChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{text:e.target.value})})),placeholder:"Button Text",className:"h-8 text-sm"}),(0,ea.jsx)(I$,{value:(null===(a=w.blockButton)||void 0===a?void 0:a.url)||"",onChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{url:e})})),pages:D,anchors:_,label:"Button URL",testId:"block-button-url"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:(null===(n=w.blockButton)||void 0===n?void 0:n.style)||"solid",onValueChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{style:e})})),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs","data-testid":"block-button-style",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline"}),(0,ea.jsx)(rb,{value:"ghost",children:"Ghost"}),(0,ea.jsx)(rb,{value:"gradient",children:"Gradient"}),(0,ea.jsx)(rb,{value:"soft",children:"Soft"})]})]}),(0,ea.jsxs)(eb,{value:(null===(l=w.blockButton)||void 0===l?void 0:l.size)||"md",onValueChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{size:e})})),children:[(0,ea.jsx)(sb,{className:"w-16 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"sm",children:"Sm"}),(0,ea.jsx)(rb,{value:"md",children:"Md"}),(0,ea.jsx)(rb,{value:"lg",children:"Lg"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"BG:"}),(0,ea.jsx)(wq,{value:(null===(r=w.blockButton)||void 0===r?void 0:r.color)||"#6366f1",onChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{color:e.target.value})})),"data-testid":"block-button-bg-color"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Text:"}),(0,ea.jsx)(wq,{value:(null===(i=w.blockButton)||void 0===i?void 0:i.textColor)||"#ffffff",onChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{textColor:e.target.value})})),"data-testid":"block-button-text-color"})]}),"gradient"===E.style&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Gradient:"}),(0,ea.jsx)(wq,{"data-testid":"block-button-gradient-color",value:(null===(o=w.blockButton)||void 0===o?void 0:o.gradientColor)||"#8b5cf6",onChange:e=>A({gradientColor:e.target.value})})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Corners:"}),(0,ea.jsxs)(eb,{value:(null===(c=w.blockButton)||void 0===c?void 0:c.radius)||"rounded",onValueChange:e=>A({radius:e}),children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs","data-testid":"block-button-radius",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"square",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Hover:"}),(0,ea.jsxs)(eb,{value:(null===(u=w.blockButton)||void 0===u?void 0:u.hover)||"fade",onValueChange:e=>A({hover:e}),children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs","data-testid":"block-button-hover",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"fade",children:"Fade"}),(0,ea.jsx)(rb,{value:"darken",children:"Darken"}),(0,ea.jsx)(rb,{value:"lift",children:"Lift"}),(0,ea.jsx)(rb,{value:"none",children:"None"})]})]})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Icon:"}),(0,ea.jsxs)(eb,{value:(null===(m=w.blockButton)||void 0===m?void 0:m.icon)||"none",onValueChange:e=>A({icon:e}),children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs","data-testid":"block-button-icon",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:$j.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),E.icon&&"none"!==E.icon&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Position:"}),(0,ea.jsxs)(eb,{value:(null===(h=w.blockButton)||void 0===h?void 0:h.iconPosition)||"right",onValueChange:e=>A({iconPosition:e}),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs","data-testid":"block-button-icon-position",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),E.icon&&"none"!==E.icon&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Icon color:"}),(0,ea.jsx)(wq,{"data-testid":"block-button-icon-color",value:(null===(x=w.blockButton)||void 0===x?void 0:x.iconColor)||(null===(p=w.blockButton)||void 0===p?void 0:p.textColor)||"#ffffff",onChange:e=>A({iconColor:e.target.value})}),(null===(g=w.blockButton)||void 0===g?void 0:g.iconColor)&&(0,ea.jsx)("button",{type:"button",onClick:()=>A({iconColor:void 0}),className:"text-[10px] text-slate-400 hover:text-slate-600",title:"Match text color",children:"reset"})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:(null===(f=w.blockButton)||void 0===f?void 0:f.align)||"center",onValueChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{align:e})})),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]}),(0,ea.jsxs)(eb,{value:(null===(v=w.blockButton)||void 0===v?void 0:v.verticalAlign)||"bottom",onValueChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{verticalAlign:e})})),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"top",children:"Top"}),(0,ea.jsx)(rb,{value:"middle",children:"Middle"}),(0,ea.jsx)(rb,{value:"bottom",children:"Bottom"})]})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500",children:[(0,ea.jsx)("input",{type:"checkbox",checked:(null===(b=w.blockButton)||void 0===b?void 0:b.fullWidth)||
2!1,onChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{fullWidth:e.target.checked})})),className:"w-3 h-3 rounded accent-indigo-600 cursor-pointer"}),"Full Width"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500",children:[(0,ea.jsx)("input",{type:"checkbox",checked:(null===(j=w.blockButton)||void 0===j?void 0:j.openInNewTab)||!1,onChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{openInNewTab:e.target.checked})})),className:"w-3 h-3 rounded accent-indigo-600 cursor-pointer","data-testid":"block-button-new-tab"}),"New window"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Top:"}),(0,ea.jsx)(BN,{type:"number",value:(null===(y=w.blockButton)||void 0===y?void 0:y.marginTop)||16,onChange:e=>C(d(d({},w),{},{blockButton:d(d({},w.blockButton),{},{marginTop:parseInt(e.target.value)||0})})),className:"w-12 h-7 text-xs",min:"0",max:"100"})]})]}),(0,ea.jsx)("div",{className:"mt-2 p-2 bg-white rounded text-center",children:(0,ea.jsx)("div",{style:{textAlign:(null===(N=w.blockButton)||void 0===N?void 0:N.align)||"center"},children:(0,ea.jsxs)("button",{"data-testid":"block-button-preview",className:"inline-flex items-center justify-center gap-2 ".concat(Qj(E.size)," ").concat(E.fullWidth?"w-full":""," font-medium transition-all ").concat(Jj(E.hover)),style:Xj(E),children:[E.icon&&"none"!==E.icon&&"left"===(E.iconPosition||"right")&&Kj(E.icon,"lg"===E.size?20:16,E.iconColor),E.text||"Click Me",E.icon&&"none"!==E.icon&&"right"===(E.iconPosition||"right")&&Kj(E.icon,"lg"===E.size?20:16,E.iconColor)]})})})]})]})},kG=Vl("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"}]]),DG=Vl("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),_G=Vl("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),SG=[{id:"settings",label:"Settings",icon:Oj},{id:"style",label:"Style",icon:kG},{id:"animation",label:"Animation",icon:$g}],EG=e=>{let{activeTab:t,onTabChange:s,disabledTabs:a=[],onMoveUp:n,onMoveDown:l,onDuplicate:r,onDelete:i,onTogglePublished:o,isFirst:c=!1,isLast:d=!1,isPublished:u=!0,showQuickActions:m=!0}=e;return(0,ea.jsxs)("div",{className:"relative -mx-4 px-4 mb-0",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[m&&(0,ea.jsxs)("div",{className:"flex items-center gap-1 pb-2",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:n,disabled:c,className:"h-7 w-7 p-0 ".concat(c?"text-slate-300":"text-slate-500 hover:text-indigo-600 hover:bg-indigo-50"),title:"Move up",children:(0,ea.jsx)(DG,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:l,disabled:d,className:"h-7 w-7 p-0 ".concat(d?"text-slate-300":"text-slate-500 hover:text-indigo-600 hover:bg-indigo-50"),title:"Move down",children:(0,ea.jsx)(_G,{size:14})}),(0,ea.jsx)("div",{className:"w-px h-5 bg-slate-200 mx-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:o,className:"h-7 w-7 p-0 ".concat(u?"text-emerald-500 hover:text-emerald-700":"text-amber-500 hover:text-amber-700"),title:u?"Hide block":"Show block",children:u?(0,ea.jsx)(IN,{size:14}):(0,ea.jsx)(LN,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:r,className:"h-7 w-7 p-0 text-slate-500 hover:text-blue-600 hover:bg-blue-50",title:"Duplicate",children:(0,ea.jsx)(DD,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:i,className:"h-7 w-7 p-0 text-slate-500 hover:text-red-600 hover:bg-red-50",title:"Delete",children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)("div",{className:"flex items-end",children:SG.map(e=>{const n=e.icon,l=t===e.id,r=a.includes(e.id);return(0,ea.jsxs)("button",{onClick:()=>!r&&s(e.id),disabled:r,"data-testid":"block-tab-".concat(e.id),className:"\n relative flex items-center gap-1.5 px-4 py-2 text-xs font-medium transition-all\n ".concat(l?"bg-white text-indigo-700 border border-slate-200 border-b-white rounded-t-lg -mb-px z-10":r?"text-slate-300 cursor-not-allowed px-3 py-1.5 mb-0.5":"text-slate-500 hover:text-slate-700 hover:bg-slate-50 rounded-t-lg px-3 py-1.5 mb-0.5","\n "),children:[(0,ea.jsx)(n,{size:14}),(0,ea.jsx)("span",{className:"hidden sm:inline",children:e.label})]},e.id)})})]}),(0,ea.jsx)("div",{className:"border-b border-slate-200"})]})},AG=e=>{let{contentPane:t,settingsPane:s,showRightPane:a=!1}=e;return a?(0,ea.jsxs)("div",{className:"flex gap-4 min-h-[120px]",children:[(0,ea.jsxs)("div",{className:"flex-1 min-w-0 border-r border-slate-100 pr-4",children:[(0,ea.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-slate-400 font-semibold mb-2",children:"Content"}),t]}),(0,ea.jsx)("div",{className:"w-[320px] flex-shrink-0",children:s})]}):(0,ea.jsx)("div",{className:"w-full",children:t})},FG=e=>{let{children:t,isActive:s}=e;return s?(0,ea.jsx)("div",{className:"border border-t-0 border-slate-200 rounded-b-lg bg-white p-4 mb-2",children:t}):null},TG=e=>
2{var s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y;let{content:N,onChange:w}=e;const C=null===(s=N.sectionHeader)||void 0===s?void 0:s.enabled;return(0,ea.jsxs)("div",{className:"mb-3 pb-3 border-b border-slate-200",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer mb-2",children:[(0,ea.jsx)("input",{type:"checkbox",checked:C||!1,onChange:e=>{var t,s,a,n,l,r,i,o,c;return w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{enabled:e.target.checked,text:(null===(t=N.sectionHeader)||void 0===t?void 0:t.text)||"",headingTag:(null===(s=N.sectionHeader)||void 0===s?void 0:s.headingTag)||"h2",fontSize:(null===(a=N.sectionHeader)||void 0===a?void 0:a.fontSize)||"28",fontFamily:(null===(n=N.sectionHeader)||void 0===n?void 0:n.fontFamily)||"inherit",color:(null===(l=N.sectionHeader)||void 0===l?void 0:l.color)||"#1e293b",align:(null===(r=N.sectionHeader)||void 0===r?void 0:r.align)||"left",fontWeight:(null===(i=N.sectionHeader)||void 0===i?void 0:i.fontWeight)||"bold",marginTop:(null===(o=N.sectionHeader)||void 0===o?void 0:o.marginTop)||"0",marginBottom:(null===(c=N.sectionHeader)||void 0===c?void 0:c.marginBottom)||"16"})}))},className:"w-4 h-4 rounded border-slate-300"}),(0,ea.jsx)("span",{className:"text-xs font-medium text-slate-600",children:"Add Section Header"})]}),C&&(0,ea.jsxs)("div",{className:"space-y-2 p-2 bg-slate-50 rounded-lg",onClick:e=>e.stopPropagation(),children:[(0,ea.jsx)(BN,{value:(null===(a=N.sectionHeader)||void 0===a?void 0:a.text)||"",onChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{text:e.target.value})})),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),placeholder:"Section title (leave empty for spacer)",className:"h-9 text-sm font-medium"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Tag:"}),(0,ea.jsxs)(eb,{value:(null===(n=N.sectionHeader)||void 0===n?void 0:n.headingTag)||"h2",onValueChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{headingTag:e})})),children:[(0,ea.jsx)(sb,{className:"w-16 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"h1",children:"H1"}),(0,ea.jsx)(rb,{value:"h2",children:"H2"}),(0,ea.jsx)(rb,{value:"h3",children:"H3"}),(0,ea.jsx)(rb,{value:"h4",children:"H4"}),(0,ea.jsx)(rb,{value:"h5",children:"H5"}),(0,ea.jsx)(rb,{value:"h6",children:"H6"}),(0,ea.jsx)(rb,{value:"p",children:"P"}),(0,ea.jsx)(rb,{value:"div",children:"DIV"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsxs)(eb,{value:(null===(l=N.sectionHeader)||void 0===l?void 0:l.fontSize)||"28",onValueChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{fontSize:e})})),children:[(0,ea.jsx)(sb,{className:"w-16 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"14",children:"14"}),(0,ea.jsx)(rb,{value:"16",children:"16"}),(0,ea.jsx)(rb,{value:"18",children:"18"}),(0,ea.jsx)(rb,{value:"20",children:"20"}),(0,ea.jsx)(rb,{value:"24",children:"24"}),(0,ea.jsx)(rb,{value:"28",children:"28"}),(0,ea.jsx)(rb,{value:"32",children:"32"}),(0,ea.jsx)(rb,{value:"36",children:"36"}),(0,ea.jsx)(rb,{value:"42",children:"42"}),(0,ea.jsx)(rb,{value:"48",children:"48"}),(0,ea.jsx)(rb,{value:"56",children:"56"}),(0,ea.jsx)(rb,{value:"64",children:"64"}),(0,ea.jsx)(rb,{value:"72",children:"72"}),(0,ea.jsx)(rb,{value:"76",children:"76"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Font:"}),(0,ea.jsxs)(eb,{value:(null===(r=N.sectionHeader)||void 0===r?void 0:r.fontFamily)||"inherit",onValueChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{fontFamily:e})})),children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:xq.map(e=>(0,ea.jsx)(rb,{value:e.value,style:{fontFamily:e.value},children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Weight:"}),(0,ea.jsxs)(eb,{value:(null===(i=N.sectionHeader)||void 0===i?void 0:i.fontWeight)||"bold",onValueChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{fontWeight:e})})),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"normal",children:"Normal"}),(0,ea.jsx)(rb,{value:"500",children:"Medium"}),(0,ea.jsx)(rb,{value:"600",children:"Semi"}),(0,ea.jsx)(rb,{value:"bold",children:"Bold"}),(0,ea.jsx)(rb,{value:"800",children:"Extra"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Color:"}),(0,ea.jsx)("input",{type:"color",value:(null===(o=N.sectionHeader)||void 0===o?void 0:o.color)||"#1e293b",onChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{color:e.target.value})})),className:"w-7 h-7 rounded border cursor-pointer"})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Align:"}),(0,ea.jsxs)(eb,{value:(null===(c=N.sectionHeader)||void 0===c?void 0:c.align)||"left",onValueChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{align:e})})),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Space above:"}),(0,ea.jsx)(BN,{type:"number",value:(null===(u=N.sectionHeader)||void 0===u?void 0:u.marginTop)||"0",onChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{marginTop:e.target.value})})),className:"w-14 h-7 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Space below:"}),(0,ea.jsx)(BN,{type:"number",value:(null===(m=N.sectionHeader)||void 0===m?void 0:m.marginBottom)||"16",onChange:e=>w(d(d({},N),{},{sectionHeader:d(d({},N.sectionHeader),{},{marginBottom:e.target.value})})),className:"w-14 h-7 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]}),(0,ea.jsxs)("div",{className:"mt-2 p-2 bg-white rounded border border-slate-200",children:[(0,ea.jsxs)("p",{className:"text-[10px] text-slate-400 mb-1",children:["Preview: <",(null===(h=N.sectionHeader)||void 0===h?void 0:h.headingTag)||"h2",">"]}),t.createElement((null===(x=N.sectionHeader)||void 0===x?void 0:x.headingTag)||"h2",{style:{fontSize:"".concat((null===(p=N.sectionHeader)||void 0===p?void 0:p.fontSize)||28,"px"),fontFamily:(null===(g=N.sectionHeader)||void 0===g?void 0:g.fontFamily)||"inherit",fontWeight:(null===(f=N.sectionHeader)||void 0===f?void 0:f.fontWeight)||"bold",color:(null===(v=N.sectionHeader)||void 0===v?void 0:v.color)||"#1e293b",textAlign:(null===(b=N.sectionHeader)||void 0===b?void 0:b.align)||"left",minHeight:null!==(j=N.sectionHeader)&&void 0!==j&&j.text?"auto":"20px",margin:0}},(null===(y=N.sectionHeader)||void 0===y?void 0:y.text)||(0,ea.jsx)("span",{className:"text-slate-300 italic text-sm",children:"(sp
2acer)"}))]})]})]})},zG=e=>{let{content:t,onChange:s,styles:a,onStylesChange:n,testIdPrefix:l="title"}=e;const r=t.titleStyle||{},i=e=>s(d(d({},t),{},{titleStyle:d(d({},r),e)})),o="function"===typeof n,c=a&&a.backgroundColor||"",u=e=>n(d(d({},a||{}),{},{backgroundColor:e}));return(0,ea.jsxs)("div",{className:"p-2 bg-slate-50 rounded-lg space-y-2",onClick:e=>e.stopPropagation(),children:[(0,ea.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-wide text-slate-500",children:"Title & Section"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsxs)(eb,{value:r.fontSize||"36",onValueChange:e=>i({fontSize:e}),children:[(0,ea.jsx)(sb,{className:"w-16 h-7 text-xs","data-testid":"".concat(l,"-size"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:["14","16","18","20","24","28","32","36","42","48","56","64","72","76"].map(e=>(0,ea.jsx)(rb,{value:e,children:e},e))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Font:"}),(0,ea.jsxs)(eb,{value:r.fontFamily||"inherit",onValueChange:e=>i({fontFamily:e}),children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs","data-testid":"".concat(l,"-font"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:xq.map(e=>(0,ea.jsx)(rb,{value:e.value,style:{fontFamily:e.value},children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Weight:"}),(0,ea.jsxs)(eb,{value:r.fontWeight||"bold",onValueChange:e=>i({fontWeight:e}),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs","data-testid":"".concat(l,"-weight"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"normal",children:"Normal"}),(0,ea.jsx)(rb,{value:"500",children:"Medium"}),(0,ea.jsx)(rb,{value:"600",children:"Semi"}),(0,ea.jsx)(rb,{value:"bold",children:"Bold"}),(0,ea.jsx)(rb,{value:"800",children:"Extra"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Color:"}),(0,ea.jsx)("input",{type:"color",value:r.color||"#1e293b",onChange:e=>i({color:e.target.value}),className:"w-7 h-7 rounded border cursor-pointer","data-testid":"".concat(l,"-color")}),r.color&&(0,ea.jsx)("button",{type:"button",onClick:()=>i({color:""}),className:"text-[10px] text-slate-400 hover:text-slate-600 underline",title:"Use theme color",children:"reset"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Align:"}),(0,ea.jsxs)(eb,{value:r.align||"center",onValueChange:e=>i({align:e}),children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs","data-testid":"".concat(l,"-align"),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),o&&(0,ea.jsxs)("div",{className:"flex items-center gap-1 border-l border-slate-300 pl-3 ml-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Backgroun
2d:"}),(0,ea.jsx)("input",{type:"color",value:c&&c.startsWith("#")?c:"#ffffff",onChange:e=>u(e.target.value),className:"w-7 h-7 rounded border cursor-pointer","data-testid":"".concat(l,"-bg")}),c&&(0,ea.jsx)("button",{type:"button",onClick:()=>u(""),className:"text-[10px] text-slate-400 hover:text-slate-600 underline",title:"Clear background",children:"clear"})]})]})]})};var MG=Symbol("radix.slottable");function PG(e){const t=e=>{let{children:t}=e;return(0,ea.jsx)(ea.Fragment,{children:t})};return t.displayName="".concat(e,".Slottable"),t.__radixId=MG,t}const BG=["__scopeAlertDialog"],RG=["__scopeAlertDialog"],LG=["__scopeAlertDialog"],IG=["__scopeAlertDialog"],OG=["__scopeAlertDialog","children"],UG=["__scopeAlertDialog"],HG=["__scopeAlertDialog"],WG=["__scopeAlertDialog"],VG=["__scopeAlertDialog"];var qG="AlertDialog",[$G,GG]=jr(qG,[YC]),KG=YC(),YG=e=>{const{__scopeAlertDialog:t}=e,s=l(e,BG),a=KG(t);return(0,ea.jsx)(Dk,d(d(d({},a),s),{},{modal:!0}))};YG.displayName=qG;var JG=t.forwardRef((e,t)=>{const{__scopeAlertDialog:s}=e,a=l(e,RG),n=KG(s);return(0,ea.jsx)(_k,d(d(d({},n),a),{},{ref:t}))});JG.displayName="AlertDialogTrigger";var QG=e=>{const{__scopeAlertDialog:t}=e,s=l(e,LG),a=KG(t);return(0,ea.jsx)(Sk,d(d({},a),s))};QG.displayName="AlertDialogPortal";var XG=t.forwardRef((e,t)=>{const{__scopeAlertDialog:s}=e,a=l(e,IG),n=KG(s);return(0,ea.jsx)(Ek,d(d(d({},n),a),{},{ref:t}))});XG.displayName="AlertDialogOverlay";var ZG="AlertDialogContent",[eK,tK]=$G(ZG),sK=PG("AlertDialogContent"),aK=t.forwardRef((e,s)=>{const{__scopeAlertDialog:a,children:n}=e,r=l(e,OG),i=KG(a),o=t.useRef(null),c=fr(s,o),u=t.useRef(null);return(0,ea.jsx)(Nk,{contentName:ZG,titleName:nK,docsSlug:"alert-dialog",children:(0,ea.jsx)(eK,{scope:a,cancelRef:u,children:(0,ea.jsxs)(Ak,d(d(d({role:"alertdialog"},i),r),{},{ref:c,onOpenAutoFocus:xr(r.onOpenAutoFocus,e=>{var t;e.preventDefault(),null===(t=u.current)||void 0===t||t.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,ea.jsx)(sK,{children:n}),(0,ea.jsx)(uK,{contentRef:o})]}))})})});aK.displayName=ZG;var nK="AlertDialogTitle",lK=t.forwardRef((e,t)=>{const{__scopeAlertDialog:s}=e,a=l(e,UG),n=KG(s);return(0,ea.jsx)(Fk,d(d(d({},n),a),{},{ref:t}))});lK.displayName=nK;var rK="AlertDialogDescription",iK=t.forwardRef((e,t)=>{const{__scopeAlertDialog:s}=e,a=l(e,HG),n=KG(s);return(0,ea.jsx)(Tk,d(d(d({},n),a),{},{ref:t}))});iK.displayName=rK;var oK=t.forwardRef((e,t)=>{const{__scopeAlertDialog:s}=e,a=l(e,WG),n=KG(s);return(0,ea.jsx)(zk,d(d(d({},n),a),{},{ref:t}))});oK.displayName="AlertDialogAction";var cK="AlertDialogCancel",dK=t.forwardRef((e,t)=>{const{__scopeAlertDialog:s}=e,a=l(e,VG),{cancelRef:n}=tK(cK,s),r=KG(s),i=fr(t,n);return(0,ea.jsx)(zk,d(d(d({},r),a),{},{ref:i}))});dK.displayName=cK;var uK=e=>{let{contentRef:s}=e;const a="`".concat(ZG,"` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the `").concat(ZG,"` by passing a `").concat(rK,"` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, 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 `").concat(ZG,"`. 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.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog");return t.useEffect(()=>{var e;document.getElementById(null===(e=s.current)||void 0===e?void 0:e.getAttribute("aria-describedby"))||console.warn(a)},[a,s]),null},mK=XG,hK=aK,xK=oK,pK=dK,gK=lK,fK=iK;const vK=["className"],bK=["className"],jK=["className"],yK=["className"],NK=["className"],wK=["className"],CK=["className"],kK=["className"],DK=YG,_K=QG,SK=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,vK);return(0,ea.jsx)(mK,d(d({className:Np("fixed inset-0 z-[60] 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",s)},a),{},{ref:t}))});SK.displayName=mK.displayName;const EK=t.forwardRef((e,t)=>
2{let{className:s}=e,a=l(e,bK);return(0,ea.jsxs)(_K,{children:[(0,ea.jsx)(SK,{}),(0,ea.jsx)(hK,d({ref:t,className:Np("fixed left-[50%] top-[50%] z-[60] 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",s)},a))]})});EK.displayName=hK.displayName;const AK=e=>{let{className:t}=e,s=l(e,jK);return(0,ea.jsx)("div",d({className:Np("flex flex-col space-y-2 text-center sm:text-left",t)},s))};AK.displayName="AlertDialogHeader";const FK=e=>{let{className:t}=e,s=l(e,yK);return(0,ea.jsx)("div",d({className:Np("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},s))};FK.displayName="AlertDialogFooter";const TK=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,NK);return(0,ea.jsx)(gK,d({ref:t,className:Np("text-lg font-semibold",s)},a))});TK.displayName=gK.displayName;const zK=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,wK);return(0,ea.jsx)(fK,d({ref:t,className:Np("text-sm text-muted-foreground",s)},a))});zK.displayName=fK.displayName;const MK=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,CK);return(0,ea.jsx)(xK,d({ref:t,className:Np(tg(),s)},a))});MK.displayName=xK.displayName;const PK=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,kK);return(0,ea.jsx)(pK,d({ref:t,className:Np(tg({variant:"outline"}),"mt-2 sm:mt-0",s)},a))});PK.displayName=pK.displayName;const BK=["id"],RK=["preset","presetStyles"],LK=["color","hoverColor","gradientColor"],IK=(e,t,s)=>{const a=[...e||[]];if(t<0||s<0||t>=a.length||s>=a.length)return a;const[n]=a.splice(t,1);return a.splice(s,0,n),a},OK=e=>{let{index:t,total:s,onMove:a,testIdPrefix:n}=e;return(0,ea.jsxs)("div",{className:"flex items-center",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-slate-500 hover:text-slate-800 disabled:opacity-30",disabled:0===t,onClick:()=>a(t,t-1),title:"Move left","data-testid":n?"".concat(n,"-move-left-").concat(t):void 0,children:(0,ea.jsx)(_j,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-slate-500 hover:text-slate-800 disabled:opacity-30",disabled:t===s-1,onClick:()=>a(t,t+1),title:"Move right","data-testid":n?"".concat(n,"-move-right-").concat(t):void 0,children:(0,ea.jsx)(wj,{size:14})})]})},UK=e=>{let{onClick:t,testId:s}=e;return(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-slate-500 hover:text-indigo-600",onClick:t,title:"Duplicate column","data-testid":s,children:(0,ea.jsx)(DD,{size:13})})},HK=e=>"".concat(e,"-").concat(Date.now(),"-").concat(Math.floor(1e3*Math.random())),WK=e=>{let{id:t,children:s}=e;const{attributes:a,listeners:n,setNodeRef:l,transform:r,transition:i,isDragging:o}=gE({id:t}),c={transform:i_.Transform.toString(r),transition:i,opacity:o?.5:1,position:"relative",zIndex:o?30:void 0};return(0,ea.jsxs)("div",{ref:l,style:c,children:[(0,ea.jsxs)("div",d(d(d({},a),n),{},{className:"flex items-center justify-center gap-1 py-1 mb-1 rounded bg-slate-100 hover:bg-slate-200 cursor-grab active:cursor-grabbing text-slate-400 hover:text-slate-600 touch-none select-none",title:"Drag to reorder","data-testid":"drag-col-".concat(t),children:[(0,ea.jsx)(yE,{size:12}),(0,ea.jsx)("span",{className:"text-[10px] uppercase tracking-wide",children:"Drag to reorder"})]})),s]})},VK=e=>{let{ids:t,onReorder:s,children:a}=e;return(0,ea.jsx)(YS,{collisionDetection:A_,onDragEnd:e=>{let{active:a,over:n}=e;if(n&&a.id!==n.id){const e=t.indexOf(a.id),l=t.indexOf(n.id);-1!==e&&-1!==l&&s(e,l)}},children:(0,ea.jsx)(cE,{items:t,strategy:rE,children:a})})},qK=[{value:"full",label:"Full",description:"Edge to edge (100vw)"},{value:"container",label:"Container",description:"Matches page width"},{value:"large",label:"Large",description:"Centered, 1200px cap"},{value:"medium",label:"Medium",description:"Centered, 900px cap"},{value:"small",label:"Small",description:"Centered, 600px cap"}],$K=[{value:"left",label:"Left"},{value:"center",label:"Center"},{value:"right",label:"Right"}],GK=[{value:"top",label:"Top"},{value:"middle",label:"Middle"},{value:"bottom",label:"Bottom"}],KK=[{value:"none",label:"No Overlay"},{value:"dark",label:"Dark"},{value:"darker",label:"Darker"},{value:"light",label:"Light"},{value:"gradient-dark",label:"Gradient (Dark)"},{value:"gradient-primary",label:"Gradient (Purple)"},{value:"gradient-warm",label:"Gradient (Warm)"},{value:"gradient-cool",label:"Gradient (Cool)"}],YK=e=>{var t;let{id:s,content:a,updateBlock:n,prefix:l,includeHeight:r=!0,includeOverlay:i=!1,includeTextColor:o=!1,includePosition:c=!0}=e;const u=a.width||"container",m=a.textPositionH||"center",h=a.textPositionV||"middle",x=a.overlay||"none",p=a.textColor||"#ffffff",g=a.height||500,f=e=>n(s,d(d({},a),e));return(0,ea.jsxs)("div",{className:"space-y-4 p-4 rounded-lg bg-slate-50 border border-slate-200","data-testid":"".concat(l,"-layout-style"),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-slate-700 pb-2 border-b border-slate-200",children:[(0,ea.jsx)(NE,{size:16,className:"text-blue-500"}),"Layout & Style"]}),(0,ea.jsxs)("div",{className:"space-y-2 pb-3 border-b border-slate-200",children:[(0,ea.jsxs)(tf,{className:"text-xs font-semibold flex items-center gap-1",children:[(0,ea.jsx)(NE,{size:12})," Block Width"]}
2),(0,ea.jsx)("div",{className:"grid grid-cols-5 gap-2",children:qK.map(e=>(0,ea.jsx)("button",{type:"button",onClick:()=>f({width:e.value}),className:"p-2 rounded-lg border text-xs font-medium transition-all ".concat(u===e.value?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200 hover:border-indigo-300"),title:e.description,"data-testid":"".concat(l,"-width-").concat(e.value,"-").concat(s),children:e.label},e.value))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:null===(t=qK.find(e=>e.value===u))||void 0===t?void 0:t.description})]}),c&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Horizontal Position"}),(0,ea.jsxs)(eb,{value:m,onValueChange:e=>f({textPositionH:e}),children:[(0,ea.jsx)(sb,{className:"h-9","data-testid":"".concat(l,"-posh-").concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:$K.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Vertical Position"}),(0,ea.jsxs)(eb,{value:h,onValueChange:e=>f({textPositionV:e}),children:[(0,ea.jsx)(sb,{className:"h-9","data-testid":"".concat(l,"-posv-").concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:GK.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]}),(i||o)&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[i&&(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Overlay"}),(0,ea.jsxs)(eb,{value:x,onValueChange:e=>f({overlay:e}),children:[(0,ea.jsx)(sb,{className:"h-9","data-testid":"".concat(l,"-overlay-").concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:KK.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),o&&(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Default Text Colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:p.startsWith("#")?p:"#ffffff",onChange:e=>f({textColor:e.target.value}),className:"w-9 h-9 rounded border cursor-pointer","data-testid":"".concat(l,"-textcolor-").concat(s)}),(0,ea.jsx)(yq,{value:a.textColor||"",onChange:e=>f({textColor:e.target.value}),placeholder:"#ffffff",className:"h-9 text-sm font-mono flex-1"})]})]})]}),r&&(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Height: ",g,"px"]}),(0,ea.jsx)(dj,{value:[g],onValueChange:e=>{let[t]=e;return f({height:t})},min:200,max:800,step:20,"data-testid":"".concat(l,"-height-").concat(s)})]})]})},JK=[{value:"",label:"Inherit from site theme"},{value:"Inter, sans-serif",label:"Inter (Sans)"},{value:'"Open Sans", sans-serif',label:"Open Sans"},{value:"Poppins, sans-serif",label:"Poppins"},{value:"Montserrat, sans-serif",label:"Montserrat"},{value:"Roboto, sans-serif",label:"Roboto"},{value:'"Playfair Display", serif',label:"Playfair Display (Serif)"},{value:"Merriweather, serif",label:"Merriweather (Serif)"},{value:"Georgia, serif",label:"Georgia (Serif)"},{value:'"Courier New", monospace',label:"Courier (Mono)"}],QK=[{value:"300",label:"Light 300"},{value:"400",label:"Regular 400"},{value:"500",label:"Medium 500"},{value:"600",label:"Semibold 600"},{value:"700",label:"Bold 700"},{value:"800",label:"Extrabold 800"},{value:"900",label:"Black 900"}],XK=e=>{let{label:t,styleKey:s,style:a,defaultSize:n,prefix:l,id:r,setC:i}=e;return(0,ea.jsxs)("div",{className:"p-3 rounded-md bg-white border border-slate-200 space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold text-slate-700",children:t}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Font family"}),(0,ea.jsxs)(eb,{value:a.fontFamily||"",onValueChange:e=>i(s,{fontFamily:e}),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs","data-testid":"".concat(l,"-").concat(s,"-family-").concat(r),children:(0,ea.jsx)(tb,{placeholder:"Inherit"})}),(0,ea.jsx)(lb,{children:JK.map(e=>(0,ea.jsx)(rb,{value:e.value||"inherit",children:e.label},e.value||"inherit"))})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Weight"}),(0,ea.jsxs)(eb,{value:a.fontWeight||"",onValueChange:e=>i(s,{fontWeight:e}),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs","data-testid":"".concat(l,"-").concat(s,"-weight-").concat(r),children:(0,ea.jsx)(tb,{placeholder:"Inherit"})}),(0,ea.jsx)(lb,{children:QK.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:10,max:140,value:a.fontSize||"",onChange:e=>i(s,{fontSize:e.target.value?Number(e.target.value):void 0}),placeholder:String(n),className:"h-8 text-xs","data-testid":"".concat(l,"-").concat(s,"-size-").concat(r)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(wq,{value:(a.color||"").startsWith("#")?a.color:"#111827",onChange:e=>i(s,{color:e.target.value}),className:"w-7 h-8 rounded border cursor-pointer","data-testid":"".concat(l,"-").concat(s,"-color-").concat(r)}),(0,ea.jsx)(BN,{value:a.color||"",onChange:e=>i(s,{color:e.target.value}),placeholder:"inherit",className:"h-8 text-xs font-mono flex-1"})]})]})]})]})},ZK=e=>{let{id:t,content:s,updateBlock:a,prefix:n}=e;const l=s.headlineStyle||{},r=s.subheadlineStyle||{},i=(e,n)=>a(t,d(d({},s),{},{[e]:d(d({},s[e]||{}),n)}));return(0,ea.jsxs)("div",{className:"space-y-3 p-4 rounded-lg bg-slate-50 border border-slate-200","data-testid":"".concat(n,"-typography"),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-slate-700 pb-2 border-b border-slate-200",children:[(0,ea.jsx)(wE,{size:16,className:"text-purple-500"}),"Typography"]}),(0,ea.jsx)(XK,{label:"Headline",styleKey:"headlineStyle",style:l,defaultSize:48,prefix:n,id:t,setC:i}),(0,ea.jsx)(XK,{label:"Subheadline",styleKey:"subheadlineStyle",style:r,defaultSize:18,prefix:n,id:t,setC:i})]})},eY=e=>{let{style:t,defaultSize:s,testPrefix:a,onPatch:n}=e;const l=t||{};return(0,ea.jsx)("div",{className:"p-2 rounded-md bg-white border border-slate-200 space-y-2",children:(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Font family"}),(0,ea.jsxs)(eb,{value:l.fontFamily||"",onValueChange:e=>n({fontFamily:"inherit"===e?void 0:e}),children:[(0,ea.jsx)(sb,{className:"h-7 text-xs","data-testid":"".concat(a,"-family"),children:(0,ea.jsx)(tb,{placeholder:"Inherit"})}),(0,ea.jsx)(lb,{children:JK.map(e=>(0,ea.jsx)(rb,{value:e.value||"inherit",children:e.label},e.value||"inherit"))})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:10,max:140,value:l.fontSize||"",onChange:e=>n({fontSize:e.target.value?Number(e.target.value):void 0}),placeholder:String(s),className:"h-7 text-xs","data-testid":"".concat(a,"-size")})]}),(0,ea.jsxs)("div",{className:"space-y-1 col-span-2",children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500",children:"Colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(wq,{value:(l.color||"").startsWith("#")?l.color:"#111827",onChange:e=>n({color:e.target.value}),className:"w-7 h-7 rounded border cursor-pointer","data-testid":"".concat(a,"-color")}),(0,ea.jsx)(BN,{value:l.color||"",onChange:e=>n({color:e.target.value||void 0}),placeholder:"inherit",className:"h-7 text-xs font-mono flex-1"}),(l.color||l.fontFamily||l.fontSize)&&(0,ea.jsx)("button",{type:"button",onClick:()=>n({color:void 0,fontFamily:void 0,fontSize:void 0,fontWeight:void 0}),className:"text-[10px] text-slate-500 hover:text-slate-700 underline",title:"Reset this item's typography",children:"Reset"})]})]})]})})},tY=e=>{var t;let s="";var a,n;if("heading"===e.type)s=(null===(a=e.content)||void 0===a||null===(n=a.html)||void 0===n?void 0:n.replace(/<[^>]*>/g,""))||"";else if("hero"===e.type){var l;s=(null===(l=e.content)||void 0===l?void 0:l.headline)||""}else if("paragraph"===e.type){var r,i;s=(null===(r=e.content)||void 0===r||null===(i=r.html)||void 0===i?void 0:i.replace(/<[^>]*>/g,"").substring(0,50))||""}else if("quote"===e.type){var o,c;s=(null===(o=e.content)||void 0===o||null===(c=o.html)||void 0===c?void 0:c.replace(/<[^>]*>/g,"").substring(0,50))||""}else if("form"===e.type){var d;s=(null===(d=e.content)||void 0===d?void 0:d.formName)||"form"}else if("gallery"===e.type)s="gallery";else if("article-feed"===e.type){var u;s=(null===(u=e.content)||void 0===u?void 0:u.heading)||"articles"}return s?s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").substring(0,50)||e.type:"".concat(e.type,"-").concat((null===(t=e.id)||void 0===t?void 0:t.split("-").pop())||"block")},sY={heading:{border:"#6366f1",bg:"#eef2ff",label:"Heading"},paragraph:{border:"#8b5cf6",bg:"#f5f3ff",label:"Paragraph"},image:{border:"#ec4899",bg:"#fdf2f8",label:"Image"},button:{border:"#10b981",bg:"#ecfdf5",label:"Button"},hero:{border:"#f59e0b",bg:"#fffbeb",label:"Hero"},quote:{border:"#14b8a6",bg:"#f0fdfa",label:"Quote"},list:{border:"#22c55e",bg:"#f0fdf4",label:"List"},code:{border:"#64748b",bg:"#f8fafc",label:"Code"},"custom-html":{border:"#ef4444",bg:"#fef2f2",label:"Custom HTML"},columns:{border:"#3b82f6",bg:"#eff6ff",label:"Columns"},"card-grid":{border:"#2563eb",bg:"#eff6ff",label:"Card Grid"},"two-column":{border:"#3b82f6",bg:"#eff6ff",label:"2-Column"}
2,"image-text-row":{border:"#f97316",bg:"#fff7ed",label:"Image + Text"},"image-text-stack":{border:"#f97316",bg:"#fff7ed",label:"Image + Text"},form:{border:"#0ea5e9",bg:"#f0f9ff",label:"Form"},gallery:{border:"#d946ef",bg:"#fdf4ff",label:"Gallery"},ticker:{border:"#06b6d4",bg:"#ecfeff",label:"Ticker Tape"},"article-feed":{border:"#f97316",bg:"#fff7ed",label:"Article Feed"},"logo-cloud":{border:"#0ea5e9",bg:"#f0f9ff",label:"Logo Cloud"},"hero-spotlight":{border:"#f59e0b",bg:"#fffbeb",label:"Animated Hero"},countdown:{border:"#e11d48",bg:"#fff1f2",label:"Countdown"},"before-after":{border:"#0d9488",bg:"#f0fdfa",label:"Before / After"},"hero-tabs":{border:"#6366f1",bg:"#eef2ff",label:"Hero Tabs"},"hero-feature-cards":{border:"#16a34a",bg:"#f0fdf4",label:"Hero Feature Cards"},"hero-split-stats":{border:"#2563eb",bg:"#eff6ff",label:"Hero Split + Stats"},"hero-split-cards":{border:"#9333ea",bg:"#faf5ff",label:"Hero Split Cards"},unsubscribe:{border:"#dc2626",bg:"#fef2f2",label:"Unsubscribe"},"newsletter-header":{border:"#8b5cf6",bg:"#f5f3ff",label:"Newsletter Header"},search:{border:"#0891b2",bg:"#ecfeff",label:"Site Search"},"expandable-tabs":{border:"#6366f1",bg:"#eef2ff",label:"Expandable Tabs"},sparkles:{border:"#8b5cf6",bg:"#f5f3ff",label:"Sparkles"},"gallery-carousel":{border:"#ec4899",bg:"#fdf2f8",label:"Gallery Carousel"},"testimonial-deck":{border:"#f59e0b",bg:"#fffbeb",label:"Testimonial Cards"},"liquid-glass":{border:"#0ea5e9",bg:"#f0f9ff",label:"Liquid Glass"},"testimonials-columns":{border:"#14b8a6",bg:"#f0fdfa",label:"Testimonials Columns"},typewriter:{border:"#eab308",bg:"#fefce8",label:"Typewriter"},"gooey-text":{border:"#7c3aed",bg:"#f5f3ff",label:"Gooey Text"},"text-cycle":{border:"#0ea5e9",bg:"#f0f9ff",label:"Animated Text Cycle"},"circular-testimonials":{border:"#0d9488",bg:"#f0fdfa",label:"Block Testimonials"},"stagger-testimonials":{border:"#e11d48",bg:"#fff1f2",label:"Stagger Testimonials"},"steps-icons":{border:"#7c3aed",bg:"#f5f3ff",label:"Steps \u2014 Icons & Arrows"},"steps-cards":{border:"#7c3aed",bg:"#f5f3ff",label:"Steps \u2014 Numbered Cards"},"steps-grid-image":{border:"#7c3aed",bg:"#f5f3ff",label:"Steps \u2014 Grid + Image"},"steps-timeline-image":{border:"#7c3aed",bg:"#f5f3ff",label:"Steps \u2014 Timeline + Image"},"handwriting-text":{border:"#9333ea",bg:"#faf5ff",label:"Hand Writing Text"},"typewriter-smooth":{border:"#2563eb",bg:"#eff6ff",label:"Typewriter (Smooth)"},"folder-gallery":{border:"#d97706",bg:"#fff7ed",label:"Folder Gallery"}},aY=e=>{var s,a,n,l,r,i,o,c,u;let{block:m,index:h,children:x,onDuplicate:p,onDelete:g,onStyleClick:f,onMoveUp:v,onMoveDown:b,isFirst:j,isLast:y,isCollapsed:N,onToggleCollapse:w,onAnchorChange:C,isDuplicateAnchor:k,allAnchorIds:D,onApplyPreset:_,onApplyColumnPreset:S,onTogglePublished:E,onSaveBlock:A}=e;const[F,T]=(0,t.useState)(!1),[z,M]=(0,t.useState)(""),[P,B]=(0,t.useState)(!1),R=!1!==m.isPublished,{attributes:L,listeners:I,setNodeRef:O,transform:U,transition:H,isDragging:W}=gE({id:m.id}),V=m.styles||{},q=sY[m.type]||{border:"#94a3b8",bg:"#f8fafc",label:m.type},$=d({transform:i_.Transform.toString(U),transition:W?H:"all ".concat(V.transitionDuration||"0.2s"," ease"),opacity:W?.5:R?1:.5,backgroundColor:R?q.bg:"#f1f5f9",borderColor:R?"#e2e8f0":"#cbd5e1",borderWidth:"1px",borderStyle:R?"solid":"dashed",borderRadius:"0.5rem",padding:"1rem",borderLeftWidth:"4px",borderLeftColor:R?q.border:"#94a3b8"},"glow"===V.hoverEffect?{"--glow-color":V.glowColor||"#6366f1"}:"border-highlight"===V.hoverEffect?{"--highlight-color":V.highlightColor||"#6366f1"}:{});return(0,ea.jsxs)("div",{ref:O,style:$,"data-testid":"block-".concat(m.type,"-").concat(h),className:"group relative mb-4 transition-all ".concat((()=>{switch(V.hoverEffect){case"shadow":return"hover:shadow-xl";case"lift":return"hover:-translate-y-1 hover:shadow-lg";case"glow":case"border-highlight":default:return"";case"darken":return"hover:brightness-95";case"scale":return"hover:scale-[1.02]"}})()," ").concat((()=>{switch(V.clickEffect){case"scale-down":return"active:scale-[0.98]";case"flash":return"active:opacity-70";case"shake":return"active:animate-shake";default:return""}})()," ").concat((()=>{switch(V.shadow){case"sm":return"shadow-sm";case"md":return"shadow-md";case"lg":return"shadow-lg";case"xl":return"shadow-xl";case"inner":return"shadow-inner";default:return""}})()," ").concat(W?"shadow-lg ring-2 ring-indigo-400 z-50":""," ").concat("glow"===V.hoverEffect?"hover:shadow-[0_0_20px_var(--glow-color)]":""," ").concat("border-highlight"===V.hoverEffect?"hover:border-[var(--highlight-color)]":""),children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("div",{className:"px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider rounded-full",style:{backgroundColor:R?q.border:"#94a3b8",color:"white",boxShadow:"0 1px 2px rgba(0,0,0,0.1)"},children:q.label}),!R&&(0,ea.jsx)("div",{className:"px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider rounded-full bg-amber-100 text-amber-700 border border-amber-300",children:"Hidden"}),F?(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"#"}),(0,ea.jsx)("input",{type:"text",value:z,onChange:e=>{const t=e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");M(t)},onBlur:()=>{z.trim()&&C(m.id,z.trim()),T(!1)},onKeyDown:e=>{"Enter"===e.key?(z.trim()&&C(m.id,z.trim()),T(!1)):"Escape"===e.key&&T(!1)},className:"text-xs font-mono w-32 px-1 py-0.5 border rounded ".concat(k?"border-red-500 bg-red-50":"border-indigo-300"),autoFocus:!0,placeholder:"anch
2or-id"}),k&&(0,ea.jsx)("span",{className:"text-[10px] text-red-500",children:"Duplicate!"})]}):(0,ea.jsxs)("button",{onClick:()=>{var e;const t=(null===(e=m.content)||void 0===e?void 0:e.anchor_id)||tY(m);M(t),T(!0)},className:"text-xs font-mono px-1.5 py-0.5 rounded hover:bg-indigo-100 transition-colors ".concat(k?"text-red-600 bg-red-50":"text-indigo-600"),title:"Click to edit anchor ID",children:["#",(null===(s=m.content)||void 0===s?void 0:s.anchor_id)||tY(m),k&&(0,ea.jsx)("span",{className:"ml-1 text-[10px]",children:"\u26a0\ufe0f"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("div",d(d(d({},L),I),{},{className:"cursor-grab active:cursor-grabbing p-1.5 hover:bg-slate-100 rounded text-slate-400 hover:text-slate-600",title:"Drag to reorder",children:(0,ea.jsx)(yE,{size:16})})),A&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>A(m),className:"h-7 w-7 p-0 text-slate-400 hover:text-indigo-600 hover:bg-indigo-50",title:"Save this block as reusable","data-testid":"save-block-".concat(m.id),children:(0,ea.jsx)(CE,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>B(!0),className:"h-7 w-7 p-0 text-slate-400 hover:text-red-600 hover:bg-red-50",title:"Delete this block","data-testid":"delete-block-".concat(m.id),children:(0,ea.jsx)(wD,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:w,className:"h-7 w-7 p-0 text-slate-400 hover:text-slate-600",title:N?"Expand block":"Collapse block",children:N?(0,ea.jsx)(tr,{size:14}):(0,ea.jsx)(er,{size:14})}),(0,ea.jsx)(DK,{open:P,onOpenChange:B,children:(0,ea.jsxs)(EK,{children:[(0,ea.jsxs)(AK,{children:[(0,ea.jsx)(TK,{children:"Delete Block?"}),(0,ea.jsxs)(zK,{children:["Are you sure you want to delete this ",q.label," block? This action cannot be undone."]})]}),(0,ea.jsxs)(FK,{children:[(0,ea.jsx)(PK,{children:"Cancel"}),(0,ea.jsx)(MK,{onClick:()=>g(m.id),className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})})]})]}),!N&&(0,ea.jsx)("div",{className:"pl-2 pr-2",children:x}),N&&(0,ea.jsx)("div",{className:"text-xs text-slate-400 italic pl-2 truncate",children:"heading"===m.type||"paragraph"===m.type?((null===(a=m.content)||void 0===a?void 0:a.text)||(null===(n=m.content)||void 0===n||null===(l=n.html)||void 0===l?void 0:l.replace(/<[^>]*>/g,""))||"Empty block").substring(0,80)+"...":"image"===m.type?"Image: ".concat((null===(r=m.content)||void 0===r?void 0:r.alt)||(null===(i=m.content)||void 0===i?void 0:i.url)||"No image"):"columns"===m.type?"".concat((null===(o=m.content)||void 0===o?void 0:o.columnCount)||2," columns"):"card-grid"===m.type?"".concat(((null===(c=m.content)||void 0===c?void 0:c.columns)||[]).length," cards \xb7 ").concat((null===(u=m.content)||void 0===u?void 0:u.cardsPerRow)||3,"/row"):"Click to expand"})]})},nY=e=>{let{blocks:s,onChange:a,pages:n=[],allPagesAnchors:r=[],siteTheme:i=null}=e;const o=(null===i||void 0===i?void 0:i.primary_color)||"#6366f1",c=(null===i||void 0===i?void 0:i.link_hover_color)||(null===i||void 0===i?void 0:i.primary_color)||"#4f46e5",u=(null===i||void 0===i?void 0:i.secondary_color)||"#8b5cf6",[m,h]=(0,t.useState)(!1),[x,p]=(0,t.useState)(!1),[g,f]=(0,t.useState)(null),[v,b]=(0,t.useState)(null),[j,y]=(0,t.useState)(!1),[N,w]=(0,t.useState)(null),[C,k]=(0,t.useState)(null),[D,_]=(0,t.useState)([]),[S,E]=(0,t.useState)(!1),A=(0,t.useCallback)(async()=>{E(!0);try{var e;const t=await _l.get("/templates",{params:{kind:"block"}});_((null===(e=t.data)||void 0===e?void 0:e.custom)||[])}catch(G2){console.error("Failed to load saved blocks",G2)}finally{E(!1)}},[]),F=(0,t.useCallback)(e=>{k(e)},[]),T=(0,t.useCallback)(e=>{var t;const n=null===e||void 0===e||null===(t=e.blocks)||void 0===t?void 0:t[0];if(!n)return void qs.error("This saved block is empty");const{id:r}=n,i=l(n,BK),o=d({},i.content||{});delete o.anchor_id;const c=d(d({},i),{},{id:"block-".concat(Date.now()),content:o});a([...s,c]),h(!1),qs.success("Block added")},[s,a]),z=(0,t.useCallback)(async(e,t)=>{null===t||void 0===t||t.stopPropagation();try{await _l.delete("/templates/".concat(e)),_(t=>t.filter(t=>t.template_id!==e)),qs.success("Saved block removed")}catch(K2){qs.error("Failed to remove saved block")}},[]),[M,P]=(0,t.useState)({}),B=e=>M[e]||"content",R=(e,t)=>{P(s=>d(d({},s),{},{[e]:t}))},[L,I]=(0,t.useState)([]),[O,U]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(async()=>
2{if(s.some(e=>"article-card"===e.type)||!(L.length>0)){U(!0);try{const e=await fetch("/api/articles",{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token"))}});if(e.ok){const t=await e.json();I((null===t||void 0===t?void 0:t.articles)||t||[])}}catch(e){console.error("Failed to fetch articles:",e)}finally{U(!1)}}})()},[s.length]);const[H,W]=(0,t.useState)(new Set),[V,q]=(0,t.useState)(!1),[$,G]=(0,t.useState)(""),[K,Y]=(0,t.useState)(null),J=(0,t.useRef)(null),Q=((0,t.useRef)(null),(0,t.useCallback)(()=>s.map(e=>{var t;return(null===(t=e.content)||void 0===t?void 0:t.anchor_id)||tY(e)}),[s])),X=(0,t.useCallback)(()=>{const e=Q(),t=new Set,s=new Set;return e.forEach(e=>{t.has(e)&&s.add(e),t.add(e)}),s},[Q]),Z=(0,t.useMemo)(()=>s.filter(e=>{var t;return(null===(t=e.content)||void 0===t?void 0:t.anchor_id)||["heading","hero","form","gallery","article-feed"].includes(e.type)}).map(e=>{var t,s,a;let n=e.type.charAt(0).toUpperCase()+e.type.slice(1);return"heading"===e.type&&null!==(t=e.content)&&void 0!==t&&t.text?n=e.content.text.substring(0,30):"heading"===e.type&&null!==(s=e.content)&&void 0!==s&&s.html&&(n=e.content.html.replace(/<[^>]*>/g,"").substring(0,30)),{id:(null===(a=e.content)||void 0===a?void 0:a.anchor_id)||tY(e),name:n,pageSlug:""}}),[s]),ee=(0,t.useMemo)(()=>[...Z.map(e=>d(d({},e),{},{name:e.name+" (this page)"})),...r],[Z,r]),te=(0,t.useCallback)((e,t)=>{const n=s.map(s=>s.id===e?d(d({},s),{},{content:d(d({},s.content),{},{anchor_id:t})}):s);a(n)},[s,a]),se=(0,t.useCallback)(e=>{var t;const s=(null===(t=e.content)||void 0===t?void 0:t.anchor_id)||tY(e);return X().has(s)},[X]),ae=e=>{const t=s.map(t=>t.id===e?d(d({},t),{},{isPublished:!1===t.isPublished}):t);a(t)},ne=e=>{if(0===e)return;const t=[...s];[t[e-1],t[e]]=[t[e],t[e-1]],a(t)},le=e=>{if(e===s.length-1)return;const t=[...s];[t[e],t[e+1]]=[t[e+1],t[e]],a(t)},re=N_(y_(pS),y_(dS,{coordinateGetter:bE})),ie=e=>{const t={entrance:"none",speed:"normal",delay:"0"};switch(e){case"heading":return{text:"Heading",level:2,html:"<h2>Heading</h2>",animation:t};case"paragraph":return{text:"",html:"<p>Start typing...</p>",animation:t};case"image":return{url:"",alt:"",animation:t};case"button":return{text:"Click Here",url:"#",style:"solid",size:"md",textColor:"#ffffff",align:"left",fullWidth:!1,borderRadius:"rounded",openInNewTab:!1,icon:"none",iconPosition:"right",animation:t};case"hero":return{imageUrl:"",headline:"Your Headline Here",subheadline:"Add a compelling subheadline to engage your audience",buttonText:"Learn More",buttonUrl:"",overlay:"dark",textPositionH:"center",textPositionV:"middle",textColor:"white",height:500,headlineAnimation:{entrance:"fadeInUp",speed:"normal",delay:"0"},subheadlineAnimation:{entrance:"fadeInUp",speed:"normal",delay:"200"},buttonAnimation:{entrance:"fadeInUp",speed:"normal",delay:"400"}};case"code":return{code:'// Your code here\nconst greeting = "Hello World";\nconsole.log(greeting);',language:"javascript",theme:"github-dark",showLineNumbers:!0,animation:t};case"custom-html":return{html:'\x3c!-- Your custom HTML here --\x3e\n<div class="custom-content">\n <h2>Custom HTML Block</h2>\n <p>Add your own HTML, CSS, and even embedded scripts.</p>\n</div>',enableScripts:!1,animation:t};case"quote":return{text:"",html:"<blockquote></blockquote>",animation:t};case"list":return{items:[""],animation:t};case"columns":return{columnCount:2,showAsCards:!1,cardStyle:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"16px",shadow:!1},columns:[{type:"text",html:"<p>Column 1</p>",imageUrl:"",imageAlt:"",imageWidth:200,imageAlign:"center",textAlign:"left"},{type:"text",html:"<p>Column 2</p>",imageUrl:"",imageAlt:"",imageWidth:200,imageAlign:"center",textAlign:"left"}],animation:t};case"card-grid":return{cardsPerRow:3,showAsCards:!0,cardStyle:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"16px",shadow:!0},columns:[{type:"card",html:"<h3>Card 1</h3><p>Card description</p>",imageUrl:"",imageAlt:"",imageWidth:200,imageAlign:"center",textAlign:"left"},{type:"card",html:"<h3>Card 2</h3><p>Card description</p>",imageUrl:"",imageAlt:"",imageWidth:200,imageAlign:"center",textAlign:"left"},{type:"card",html:"<h3>Card 3</h3><p>Card description</p>",imageUrl:"",imageAlt:"",imageWidth:200,imageAlign:"center",textAlign:"left"}],animation:t};case"two-column":return{leftHtml:"<p>Left column text</p>",rightHtml:"<p>Right column text</p>",animation:t};case"image-text-row":return{imageUrl:"",imageAlt:"",imagePosition:"left",textHtml:"<p>Text content</p>",animation:t};case"image-text-stack":return{imageUrl:"",imageAlt:"",imagePosition:"top",textHtml:"<p>Text content</p>"};case"form":return{formId:"",formName:"",animation:t};case"gallery":return{layout:"grid-3",images:[],linkedFolderId:null,linkedFolderName:null,gap:"16",imageRadius:"8",showCaptions:!1,enableLightbox:!0,aspectRatio:"auto",animation:t};case"ticker":return{items:[],animationStyle:"continuous",direction:"left",speed:"medium",pauseOnHover:!0,backgroundColor:"#f8fafc",transparentBg:!1,itemSpacing:48,itemHeight:48,verticalPadding:16,logoFilter:"none",animation:t};case"article-feed":return{layout:"grid",columns:3,limit:6,categoryFilter:"",showSearch:!1,enablePagination:!1,perPage:6,showImage:!0,showDate:!0,showExcerpt:!0,showCategory:!0,heading:"",animation:t};case"events-calendar":return{title:"Upcoming Events",defaultView:"calendar",groupId:"",limit:10,showRsvp:!0,showIcal:!0,animation:t};case"article-card":return{articleId:"",articleTitle:"",articleSlug:"",displayStyle:"card",showImage:!0,showExcerpt:!0,showDate:!0,showReadMore:!0,readMoreText:"Read Full Article",animation:t};case"newsletter-header":return{logoUrl:"",logoAlt:"Logo",logoWidth:150,showLogo:!0,backgroundColor:"#6366f1",textColor:"#ffffff",links:[{text:"Home",url:"#"},{text:"About",url:"#"},{text:"Contact",url:"#"}],alignment:"center",padding:20};case"video":return{videoUrl:"",caption:"",width:"large",aspectRatio:"16:9",autoplay:!1,muted:!1,loop:!1,controls:!0,animation:t};case"testimonials":return{title:"What Our Customers Say",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},items:[{id:"ti-".concat(Date.now(),"-1"),quote:"Absolutely brilliant service \u2014 exceeded our expectations.",author:"Jane Smith",role:"CEO, Acme Co",avatar:""},{id:"ti-".concat(Date.now(),"-2"),quote:"A game changer for our team. Highly recommended.",author:"John Doe",role:"Marketing Director",avatar:""}],animation:t};case"pricing":return{title:"Pricing Plans",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},items:[{id:"pp-".concat(Date.now(),"-1"),name:"Basic",price:"$9",period:"/month",features:["Feature 1","Feature 2"],highlighted:!1,buttonText:"Get Started",buttonUrl:"#"},{id:"pp-".concat(Date.now(),"-2"),name:"Pro",price:"$29",period:"/month",features:["Everything in Basic","Feature 3","Feature 4"],highlighted:!0,buttonText:"Get Started",buttonUrl:"#"},{id:"pp-".concat(Date.now(),"-3"),name:"Enterprise",price:"$99",period:"/month",features:["Everything in Pro","Priority Support","Custom Integrations"],highlighted:!1,buttonText:"Contact Sales",buttonUrl:"#"}],animation:t};case"faq":return{title:"Frequently Asked Questions",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},items:[{id:"fq-".concat(Date.now(),"-1"),question:"What is your service?",answer:"We provide a range of solutions tailored to our customers."},{id:"fq-".concat(Date.now(),"-2"),question:"How do I get started?",answer:"Just click the sign-up button and follow the simple steps."},{id:"fq-".concat(Date.now(),"-3"),question:"Can I cancel anytime?",answer:"Yes, you can cancel your subscription at any time from your account."}],animation:t};case"cta":return{title:"Ready to Get Started?",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitle:"Join thousands of satisfied customers today",buttonText:"Start Now",buttonUrl:"#",style:"primary",animation:t};case"team":return{title:"Meet Our Team",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},members:[{id:"tm-".concat(Date.now(),"-1"),name:"Jane Smith",role:"CEO",image:"",bio:""},{id:"tm-".concat(Date.now(),"-2"),name:"John Doe",role:"CTO",image:"",bio:""},{id:"tm-".concat(Date.now(),"-3"),name:"Sarah Lee",role:"Designer",image:"",bio:""}],animation:t};case"stats":return{title:"",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},items:[{id:"st-".concat(Date.now(),"-1"),value:"100+",label:"Customers"},{id:"st-".concat(Date.now(),"-2"),value:"50+",label:"Projects"},{id:"st-".concat(Date.now(),"-3"),value:"99%",label:"Satisfaction"},{id:"st-".concat(Date.now(),"-4"),value:"24/7",label:"Support"}],animation:t};case"feature-comparison":{const e=Date.now();return{title:"Compare Plans",subtitle:"Find the plan that fits your team",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},enableRecommender:!1,recommenderTitle:"Find the right plan for you",recommenderSubtitle:"Answer a few quick questions and we'll recommend the best fit.",recommenderQuestions:[{id:"rq-".concat(e,"-1"),text:"Do you need to support more than 10 team members?",yesPlanIds:["pl-".concat(e,"-2"),"pl-".concat(e,"-3")]},{id:"rq-".concat(e,"-2"),text:"Do you require SSO / SAML?",yesPlanIds:["pl-".concat(e,"-3")]},{id:"rq-".concat(e,"-3"),text:"Just trying things out?",yesPlanIds:["pl-".concat(e,"-1")]}],plans:[{id:"pl-".concat(e,"-1"),name:"Starter",price:"$0",period:"/month",highlighted:!1,buttonText:"Get Started",buttonUrl:"#"},{id:"pl-".concat(e,"-2"),name:"Pro",price:"$29",period:"/month",highlighted:!0,badge:"Most Popular",buttonText:"Try Pro",buttonUrl:"#"},{id:"pl-".concat(e,"-3"),name:"Enterprise",price:"Custom",period:"",highlighted:!1,buttonText:"Contact Sales",buttonUrl:"#"}],categories:[{id:"cat-".concat(e,"-1"),name:"Core",features:[{id:"f-".concat(e,"-1"),name:"Users",values:{["pl-".concat(e,"-1")]:"3",["pl-".concat(e,"-2")]:"25",["pl-".concat(e,"-3")]:"Unl
2imited"}},{id:"f-".concat(e,"-2"),name:"Projects",values:{["pl-".concat(e,"-1")]:"1",["pl-".concat(e,"-2")]:"20",["pl-".concat(e,"-3")]:"Unlimited"}},{id:"f-".concat(e,"-3"),name:"Storage",values:{["pl-".concat(e,"-1")]:"1 GB",["pl-".concat(e,"-2")]:"100 GB",["pl-".concat(e,"-3")]:"1 TB"}}]},{id:"cat-".concat(e,"-2"),name:"Collaboration",features:[{id:"f-".concat(e,"-4"),name:"Real-time editing",values:{["pl-".concat(e,"-1")]:"no",["pl-".concat(e,"-2")]:"yes",["pl-".concat(e,"-3")]:"yes"}},{id:"f-".concat(e,"-5"),name:"Comments",values:{["pl-".concat(e,"-1")]:"yes",["pl-".concat(e,"-2")]:"yes",["pl-".concat(e,"-3")]:"yes"}},{id:"f-".concat(e,"-6"),name:"SSO / SAML",values:{["pl-".concat(e,"-1")]:"no",["pl-".concat(e,"-2")]:"no",["pl-".concat(e,"-3")]:"yes"}}]},{id:"cat-".concat(e,"-3"),name:"Support",features:[{id:"f-".concat(e,"-7"),name:"Email support",values:{["pl-".concat(e,"-1")]:"yes",["pl-".concat(e,"-2")]:"yes",["pl-".concat(e,"-3")]:"yes"}},{id:"f-".concat(e,"-8"),name:"Priority support",values:{["pl-".concat(e,"-1")]:"no",["pl-".concat(e,"-2")]:"yes",["pl-".concat(e,"-3")]:"yes"}},{id:"f-".concat(e,"-9"),name:"Dedicated CSM",values:{["pl-".concat(e,"-1")]:"no",["pl-".concat(e,"-2")]:"no",["pl-".concat(e,"-3")]:"yes"}}]}],animation:t}}case"plan-comparison":{const e=Date.now();return{title:"Compare Plans",subtitle:"All the features, side-by-side.",titleStyle:{fontSize:"36",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},source:"pricing",plans:[],rows:[],enableRecommender:!1,recommenderTitle:"Find the right plan for you",recommenderSubtitle:"Answer a few quick questions and we'll recommend the best fit.",recommenderQuestions:[{id:"rq-".concat(e,"-1"),text:"Do you need priority support?",yesPlanIds:[]}],animation:t}}case"logo-cloud":return{title:"Trusted by leading teams",titleStyle:{fontSize:"30",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},grayscale:!0,columns:5,logos:[{id:"lg-".concat(Date.now(),"-1"),imageUrl:"",name:"Acme",link:""},{id:"lg-".concat(Date.now(),"-2"),imageUrl:"",name:"Globex",link:""},{id:"lg-".concat(Date.now(),"-3"),imageUrl:"",name:"Initech",link:""},{id:"lg-".concat(Date.now(),"-4"),imageUrl:"",name:"Umbrella",link:""},{id:"lg-".concat(Date.now(),"-5"),imageUrl:"",name:"Soylent",link:""}],animation:t};case"hero-spotlight":return{eyebrow:"NEW",headline:"Build something people love",subheadline:"A modern, animated hero section to make a strong first impression.",primaryButtonText:"Get Started",primaryButtonUrl:"",secondaryButtonText:"Learn more",secondaryButtonUrl:"",align:"center",height:560,animation:t};case"countdown":{const e=new Date(Date.now()+6048e5),s=e=>String(e).padStart(2,"0");return{heading:"Launching soon",subheading:"Don't miss it \u2014 the countdown is on.",targetDate:"".concat(e.getFullYear(),"-").concat(s(e.getMonth()+1),"-").concat(s(e.getDate()),"T").concat(s(e.getHours()),":").concat(s(e.getMinutes())),expiredText:"We're live!",buttonText:"Notify me",buttonUrl:"",align:"center",animation:t}}case"before-after":return{heading:"See the difference",beforeImage:"",afterImage:"",beforeLabel:"Before",afterLabel:"After",height:420,animation:t};case"hero-tabs":return{eyebrow:"Featured",headline:"One platform, endless possibilities",subtitle:"A modern hero with a tabbed showcase. Switch tabs to highlight different views.",ctaText:"Get Started",ctaUrl:"",titleStyle:{fontSize:"52",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",tabs:[{id:"t-".concat(Date.now(),"-1"),label:"Dashboard",imageUrl:""},{id:"t-".concat(Date.now(),"-2"),label:"Analytics",imageUrl:""},{id:"t-".concat(Date.now(),"-3"),label:"Reports",imageUrl:""}],animation:t};case"hero-feature-cards":return{headline:"Invest in what shares your",accentWord:"values.",subtitle:"A simple, transparent platform designed for people who care about impact.",ctaText:"Join the waitlist",ctaUrl:"",titleStyle:{fontSize:"52",fontFamily:"inherit",fontWeight:"bold",color:"",align:"left"},subtitleColor:"",features:[{id:"f-".concat(Date.now(),"-1"),title:"Fight deforestation",imageUrl:"",link:""},{id:"f-".concat(Date.now(),"-2"),title:"Ocean health",imageUrl:"",link:""},{id:"f-".concat(Date.now(),"-3"),title:"Animal welfare",imageUrl:"",link:""}],animation:t};case"hero-split-stats":return{headline:"A new way to learn & grow",subtitle:"Courses and materials from skilled mentors around the world.",primaryButtonText:"Get Started",primaryButtonUrl:"",secondaryButtonText:"Learn more",secondaryButtonUrl:"",titleStyle:{fontSize:"50",fontFamily:"inherit",fontWeight:"bold",color:"",align:"left"},subtitleColor:"",stats:[{value:"15.2K",label:"Active students"},{value:"4.5K",label:"Mentors"},{value:"500+",label:"Resources"}],images:[{id:"i-".concat(Date.now(),"-1"),imageUrl:""},{id:"i-".concat(Date.now(),"-2"),imageUrl:""},{id:"i-".concat(Date.now(),"-3"),imageUrl:""}],animation:t};case"hero-split-cards":return{headline:"Ready to transform your",accentWord:"workflow?",subtitle:"Experience the future of your operations with our platform. Start today!",buttonText:"Download app",buttonUrl:"",titleStyle:{fontSize:"50",fontFamily:"inherit",fontWeight:"bold",color:"",align:"left"},subtitleColor:"",imageUrl1:"",imageUrl2:"",animation:t};case"expandable-tabs":return{heading:"Quick navigation",subheading:"Hover or tap an item to reveal its label.",titleStyle:{fontSize:"34",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",tabs:[{id:"et-".concat(Date.now(),"-1"),label:"Dashboard",icon:"home",url:""},{id:"et-".concat(Date.now(),"-2"),label:"Notifications",icon:"bell",url:""},{type:"separator"},{id:"et-".concat(Date.now(),"-3"),label:"Settings",icon:"settings",url:""},{id:"et-".concat(Date.now(),"-4"),label:"Support",icon:"help",url:""}],animation:t};case"sparkles":return{headline:"Build faster",subheadline:"A glowing sparkles hero to make a stunning first impression.",buttonText:"Get Started",buttonUrl:"",backgroundColor:"#020617",particleColor:"#FFFFFF",de
2nsity:120,height:460,titleStyle:{fontSize:"64",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",animation:t};case"gallery-carousel":return{title:"Projects",description:"A swipeable gallery of full-height image cards. Drag or use the arrows to browse.",titleStyle:{fontSize:"40",fontFamily:"inherit",fontWeight:"bold",color:"",align:"left"},subtitleColor:"",items:[{id:"gc-".concat(Date.now(),"-1"),title:"Case study one",description:"A short summary of this project and the results achieved.",href:"",imageUrl:""},{id:"gc-".concat(Date.now(),"-2"),title:"Case study two",description:"A short summary of this project and the results achieved.",href:"",imageUrl:""},{id:"gc-".concat(Date.now(),"-3"),title:"Case study three",description:"A short summary of this project and the results achieved.",href:"",imageUrl:""}],animation:t};case"testimonial-deck":return{heading:"Loved by teams everywhere",subheading:"Don\u2019t just take our word for it.",autoplay:!0,titleStyle:{fontSize:"38",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",items:[{id:"td-".concat(Date.now(),"-1"),quote:"This product completely changed how our team works. Onboarding was effortless.",name:"Sarah Chen",role:"Head of Product, Acme",avatarUrl:"",rating:5},{id:"td-".concat(Date.now(),"-2"),quote:"The best investment we made this year. Support is incredibly responsive.",name:"Marcus Lee",role:"CTO, Northwind",avatarUrl:"",rating:5},{id:"td-".concat(Date.now(),"-3"),quote:"Beautiful, fast, and reliable. Our customers noticed the difference immediately.",name:"Priya Nair",role:"Founder, Bloom",avatarUrl:"",rating:5}],animation:t};case"liquid-glass":return{eyebrow:"NEW",headline:"Crafted with liquid glass",subtitle:"A frosted, translucent surface that floats above your content.",buttonText:"Get Started",buttonUrl:"",glassTint:"light",backgroundImageUrl:"",backgroundColor:"",textColor:"",titleStyle:{fontSize:"44",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},animation:t};case"testimonials-columns":return{badge:"Testimonials",heading:"What our users say",subheading:"See how teams are shipping faster with our platform.",speed:40,titleStyle:{fontSize:"40",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",items:[{id:"tc-".concat(Date.now(),"-1"),quote:"Absolutely seamless experience from day one.",name:"Alex Rivera",role:"@alexr",avatarUrl:""},{id:"tc-".concat(Date.now(),"-2"),quote:"We cut our launch time in half. Incredible.",name:"Jamie Wu",role:"@jamiew",avatarUrl:""},{id:"tc-".concat(Date.now(),"-3"),quote:"The support team is fantastic and quick.",name:"Dana Kim",role:"@danak",avatarUrl:""},{id:"tc-".concat(Date.now(),"-4"),quote:"Our conversion rate jumped 30% after switching.",name:"Sam Patel",role:"@samp",avatarUrl:""},{id:"tc-".concat(Date.now(),"-5"),quote:"Clean, intuitive, and a joy to use daily.",name:"Robin Fox",role:"@robinf",avatarUrl:""},{id:"tc-".concat(Date.now(),"-6"),quote:"Best decision we made for our stack.",name:"Lee Morgan",role:"@leem",avatarUrl:""}],animation:t};case"typewriter":return{prefixText:"We're born \ud83c\udf1e to ",phrases:["experience","dance","love","be alive","create things that matter"],speed:70,deleteSpeed:40,waitTime:1500,loop:!0,cursorChar:"_",titleStyle:{fontSize:"44",fontFamily:"inherit",fontWeight:"bold",color:"",align:"left"},animation:t};case"gooey-text":return{texts:["Design","Engineering","Is","Awesome"],morphTime:1,cooldownTime:.25,titleStyle:{fontSize:"64",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},animation:t};case"text-cycle":return{prefix:"Your",words:["business","team","workflow","productivity","analytics","platform"],suffix:"deserves better tools",interval:3e3,titleStyle:{fontSize:"44",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},animation:t};case"circular-testimonials":return{heading:"",autoplay:!0,titleStyle:{fontSize:"38",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",items:[{id:"ct-".concat(Date.now(),"-1"),quote:"I was impressed by the quality! The team was friendly and attentive. I'll definitely be back for more.",name:"Tamar Mendelson",designation:"Restaurant Critic",imageUrl:""},{id:"ct-".concat(Date.now(),"-2"),quote:"This place exceeded all expectations! The atmosphere is inviting and the staff goes above and beyond.",name:"Joe Charlescraft",designation:"Frequent Visitor",imageUrl:""},{id:"ct-".concat(Date.now(),"-3"),quote:"A hidden gem! The impeccable service and attention to detail created a memorable experience.",name:"Martina Edelweist",designation:"Satisfied Customer",imageUrl:""}],animation:t};case"stagger-testimonials":return{heading:"What people are saying",autoplay:!0,titleStyle:{fontSize:"38",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",items:[{id:"st-".concat(Date.now(),"-1"),quote:"My favorite solution in the market. We work 5x faster now.",name:"Alex",role:"CEO at TechCorp",avatarUrl:""},{id:"st-".concat(Date.now(),"-2"),quote:"I'm confident my data is safe. I can't say that about other providers.",name:"Dan",role:"CTO at SecureNet",avatarUrl:""},{id:"st-".concat(Date.now(),"-3"),quote:"We were lost before we found them. Can't thank you guys enough!",name:"Stephanie",role:"COO at InnovateCo",avatarUrl:""},{id:"st-".concat(Date.now(),"-4"),quote:"Planning for the future is seamless now. Highly recommend!",name:"Marie",role:"CFO at FuturePlanning",avatarUrl:""},{id:"st-".concat(Date.now(),"-5"),quote:"If I could give 11 stars, I'd give 12.",name:"Andre",role:"Head of Design",avatarUrl:""}],animation:t};case"steps-icons":return{badge:"Brand new",badgeColor:"#10b981",heading:"How
2it works in three simple steps",subheading:"Everything you need to get up and running, explained clearly.",accentColor:"",subtitleColor:"",titleStyle:{fontSize:"44",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},steps:[{id:"si-".concat(Date.now(),"-1"),icon:"zap",title:"Step 1",description:"Create your free account in seconds and connect your data.",linkText:"Learn more",linkUrl:""},{id:"si-".concat(Date.now(),"-2"),icon:"zap",title:"Step 2",description:"Customise your workspace and invite your team members.",linkText:"Learn more",linkUrl:""},{id:"si-".concat(Date.now(),"-3"),icon:"zap",title:"Step 3",description:"Publish and watch everything come together beautifully.",linkText:"Learn more",linkUrl:""}],animation:t};case"steps-cards":return{badge:"Brand new",badgeColor:"#10b981",heading:"A clear path from start to finish",subheading:"Follow the numbered steps to reach your goal.",accentColor:"",subtitleColor:"",buttonText:"Learn more",buttonUrl:"",buttonColor:"",buttonTextColor:"",titleStyle:{fontSize:"44",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},steps:[{id:"sc-".concat(Date.now(),"-1"),title:"Believe",description:"Start with a clear vision of what you want to achieve."},{id:"sc-".concat(Date.now(),"-2"),title:"Plan",description:"Break the vision into achievable, measurable milestones."},{id:"sc-".concat(Date.now(),"-3"),title:"Build",description:"Execute step by step with focus and consistency."},{id:"sc-".concat(Date.now(),"-4"),title:"Ship",description:"Launch with confidence and iterate from real feedback."}],animation:t};case"steps-grid-image":return{heading:"Before you begin",subheading:"",accentColor:"",subtitleColor:"",imageUrl:"",imagePosition:"right",titleStyle:{fontSize:"40",fontFamily:"inherit",fontWeight:"bold",color:"",align:"left"},steps:[{id:"sg-".concat(Date.now(),"-1"),title:"Read the recipe",description:"Take a good look at the recipe. Don't just skim it; read it through from start to finish.",badgeColor:"#7c3aed",highlight:!0},{id:"sg-".concat(Date.now(),"-2"),title:"Know the assumptions",description:"All recipes are written using certain conventions, which define common ingredients.",badgeColor:"#10b981",highlight:!1},{id:"sg-".concat(Date.now(),"-3"),title:"Figure out the timing",description:"Check the prep time and total time listed at the top to be sure you have enough time.",badgeColor:"#10b981",highlight:!1},{id:"sg-".concat(Date.now(),"-4"),title:"Plan ahead",description:"Missing a prep instruction can leave you scrambling in the middle of a recipe.",badgeColor:"#7c3aed",highlight:!1}],animation:t};case"steps-timeline-image":return{heading:"",subheading:"",accentColor:"",subtitleColor:"",imageUrl:"",imagePosition:"right",successLabel:"Success",showSuccess:!0,titleStyle:{fontSize:"40",fontFamily:"inherit",fontWeight:"bold",color:"",align:"left"},steps:[{id:"stl-".concat(Date.now(),"-1"),title:"Step 1",description:"All recipes are written using certain conventions, which define the characteristics of common ingredients."},{id:"stl-".concat(Date.now(),"-2"),title:"Step 2",description:"The first mate and his Skipper too will do their very best to make the others comfortable."},{id:"stl-".concat(Date.now(),"-3"),title:"Step 3",description:"Plan your milestones and set clear expectations for each stage."},{id:"stl-".concat(Date.now(),"-4"),title:"Step 4",description:"Execute with focus and review the outcome against your goals."}],animation:t};case"handwriting-text":return{title:"Hello, World",subtitle:"A hand-drawn title that writes itself in.",titleStyle:{fontSize:"64",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",animation:t};case"typewriter-smooth":return{prefix:"The road to freedom starts from here",words:["Build","awesome","apps","with","NexusCMS"],button1Text:"Join now",button1Url:"",button2Text:"Sign up",button2Url:"",titleStyle:{fontSize:"56",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",animation:t};case"folder-gallery":return{heading:"Our Gallery",subheading:"Click the folder to fan out the photos.",folderLabel:"Photos",folderColor:"#d97706",closedHint:"Click the folder to open",o
2penHint:"Click the folder to close",titleStyle:{fontSize:"34",fontFamily:"inherit",fontWeight:"bold",color:"",align:"center"},subtitleColor:"",items:[{id:"fg-".concat(Date.now(),"-1"),imageUrl:""},{id:"fg-".concat(Date.now(),"-2"),imageUrl:""},{id:"fg-".concat(Date.now(),"-3"),imageUrl:""},{id:"fg-".concat(Date.now(),"-4"),imageUrl:""},{id:"fg-".concat(Date.now(),"-5"),imageUrl:""}],animation:t};default:return{}}},oe=(0,t.useCallback)(e=>{const t={id:"block-".concat(Date.now()),type:e,content:ie(e),order:s.length,styles:{}};a([...s,t]),h(!1),q(!1),G("")},[s,a]),ce=(0,t.useCallback)(e=>{const t=e.target.value;if(t.startsWith("/")){if(G(t.slice(1)),!V){const t=e.target.getBoundingClientRect();Y({top:t.bottom+8,left:t.left}),q(!0)}}else q(!1),G("")},[V]),de=(0,t.useCallback)(e=>{oe(e),q(!1),G(""),J.current&&(J.current.value="")},[oe]),ue=(0,t.useCallback)(e=>{"Escape"===e.key&&(q(!1),G(""),J.current&&(J.current.value=""))},[]),me=(e,t,n)=>{a(s.map(s=>s.id===e?d(d({},s),{},{content:void 0!==t?t:s.content,styles:void 0!==n?n:s.styles}):s))},he=e=>{a(s.filter(t=>t.id!==e))},xe=e=>{const t=d(d({},e),{},{id:"block-".concat(Date.now()),order:s.length});a([...s,t])},pe=(e,t)=>{const a=s.find(t=>t.id===e);if(a)if(null===t.preset){const t=d({},a.content);delete t.preset,delete t.presetStyles,me(e,t)}else me(e,d(d({},a.content),{},{preset:t.preset,presetStyles:t}))},ge=(e,t,a)=>{var n;const r=s.find(t=>t.id===e);if(!r||"columns"!==r.type||null===(n=r.content)||void 0===n||!n.columns)return;const i=r.content.columns.map((e,s)=>
2{if(a.includes(s)){if(null===t.preset){const{preset:t,presetStyles:s}=e;return l(e,RK)}return d(d({},e),{},{preset:t.preset,presetStyles:t})}return e});me(e,d(d({},r.content),{},{columns:i}))},fe=e=>{f(e),p(!0)},ve=function(e,t){var a,r,i,m,h,x,g;let b=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{id:j,type:N,styles:C}=e,k=e.content||{},{onMoveUp:D=()=>{},onMoveDown:_=()=>{},onDuplicate:S=()=>{},onDelete:E=()=>{},onTogglePublished:A=()=>{},isFirst:F=!1,isLast:T=!1,isPublished:z=!0}=b,M=["columns","card-grid","image-text-row","image-text-stack","image","gallery","form","video","code","ticker","quote","list","article-feed","paragraph","heading","testimonials","pricing","feature-comparison","plan-comparison","faq","cta","team","stats","hero-spotlight","hero-tabs","hero-feature-cards","hero-split-stats","hero-split-cards","logo-cloud","countdown","before-after","expandable-tabs","sparkles","gallery-carousel","testimonial-deck","liquid-glass","testimonials-columns","typewriter","gooey-text","text-cycle","circular-testimonials","stagger-testimonials","handwriting-text","typewriter-smooth","folder-gallery","steps-icons","steps-cards","steps-grid-image","steps-timeline-image"].includes(N),P=!["hero","heading"].includes(N)&&["columns","card-grid","image-text-row","image-text-stack","image","gallery","form","video","code","ticker","quote","list","article-feed","paragraph","testimonials","pricing","feature-comparison","plan-comparison","faq","cta","team","stats"].includes(N);return(0,ea.jsxs)(ea.Fragment,{children:[M&&(0,ea.jsx)(TG,{content:k,onChange:e=>me(j,e)}),P&&(0,ea.jsx)("div",{className:"mb-3 p-3 bg-slate-50 border border-slate-200 rounded-lg",children:(0,ea.jsx)(lG,{value:k.blockWidth||"container",onChange:e=>me(j,d(d({},k),{},{blockWidth:e})),testIdPrefix:"block-width-".concat(j)})}),v===j&&(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)}),("heading"===N||"paragraph"===N)&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"content"!==B(j)&&null!==B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)(Cq,{content:k.html||("heading"===N?"<h2>Heading</h2>":"<p>Start typing...</p>"),onChange:e=>{me(j,d(d({},k),{},{html:e,text:e.replace(/<[^>]*>/g,"")}))},placeholder:"heading"===N?"Enter heading...":"Start typing...",enableAiAssist:!0}),(0,ea.jsx)(CG,{content:k,onChange:e=>me(j,e),label:"Add Button",pages:n,anchors:ee})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsx)("div",{className:"space-y-4",children:(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Typography"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Font:"}),(0,ea.jsxs)(eb,{value:(()=>{const e=k.fontFamily||"inherit";if(xq.find(t=>t.value===e))return e;const t=xq.find(t=>t.value.toLowerCase().startsWith(e.toLowerCase()));return t?t.value:"inherit"})(),onValueChange:e=>me(j,d(d({},k),{},{fontFamily:e})),children:[(0,ea.jsx)(sb,{className:"w-32 h-8 text-xs",children:(0,ea.jsx)(tb,{placeholder:"Font"})}),(0,ea.jsx)(lb,{children:xq.map(e=>(0,ea.jsx)(rb,{value:e.value,style:{fontFamily:e.value},children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsxs)(eb,{value:k.fontSize||"16",onValueChange:e=>me(j,d(d({},k),{},{fontSize:e})),children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"12",children:"12px"}),(0,ea.jsx)(rb,{value:"14",children:"14px"}),(0,ea.jsx)(rb,{value:"16",children:"16px"}),(0,ea.jsx)(rb,{value:"18",children:"18px"}),(0,ea.jsx)(rb,{value:"20",children:"20px"}),(0,ea.jsx)(rb,{value:"24",children:"24px"}),(0,ea.jsx)(rb,{value:"28",children:"28px"}),(0,ea.jsx)(rb,{value:"32",children:"32px"}),(0,ea.jsx)(rb,{value:"36",children:"36px"}),(0,ea.jsx)(rb,{value:"48",children:"48px"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Weight:"}),(0,ea.jsxs)(eb,{value:k.fontWeight||"normal",onValueChange:e=>me(j,d(d({},k),{},{fontWeight:e})),children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"normal",children:"Normal"}),(0,ea.jsx)(rb,{value:"medium",children:"Medium"}),(0,ea.jsx)(rb,{value:"semibold",children:"Semibold"}),(0,ea.jsx)(rb,{value:"bold",children:"Bold"})]})]})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Align:"}),(0,ea.jsxs)(eb,{value:k.textAlign||"left",onValueChange:e=>me(j,d(d({},k),{},{textAlign:e})),children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Color:"}),(0,ea.jsx)(wq,{value:k.textColor||"#1e293b",onChange:e=>me(j,d(d({},k),{},{textColor:e.target.value})),className:"w-8 h-8 rounded border cursor-pointer"})]})]})]})})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"image"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"content"!==B(j)&&null!==B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>fe(j),"data-testid":"open-media-library-".concat(t),children:[(0,ea.jsx)(jD,{size:16,className:"mr-2"}),k.url?"Change Image":"Select Image"]}),k.url&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-green-600 flex items-center gap-1",children:"\u2713 Image selected"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>me(j,d(d({},k),{},{url:"",alt:""})),className:"h-8 px-2 text-red-500 hover:text-red-700 hover:bg-red-50",title:"Remove image",children:(0,ea.jsx)(wD,{size:14})})]})]}),k.url&&(0,ea.jsx)("div",{style:{textAlign:(null===C||void 0===C?void 0:C.imageAlign)||"center"},children:k.shapeMask&&"none"!==k.shapeMask?(0,ea.jsx)("div",{className:"inline-block overflow-hidden",style:{width:"".concat(k.shapeSize||300,"px"),height:"ellipse"===k.shapeMask?"".concat(1.25*(k.shapeSize||300),"px"):"".concat(k.shapeSize||300,"px"),maxWidth:"100%",borderRadius:"circle"===k.shapeMask||"ellipse"===k.shapeMask?"50%":"rounded"===k.shapeMask?"20px":"0",clipPath:"diamond"===k.shapeMask?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===k.shapeMask?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===k.shapeMask?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===k.shapeMask?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===k.shapeMask?"ellipse(50% 100% at 50% 100%)":"none",border:k.shapeBorderWidth?"".concat(k.shapeBorderWidth,"px solid ").concat(k.shapeBorderColor||"#ffffff"):"none"},children:(0,ea.jsx)("img",{src:k.url,alt:k.alt||"",className:"w-full h-full object-cover"})}):(0,ea.jsx)("img",{src:k.url,alt:k.alt||"",className:"rounded mt-2 inline-block",style:{width:"height"===(null===C||void 0===C?void 0:C.imageSizeMode)?"auto":(null===C||void 0===C?void 0:C.imageWidth)||"100%",height:"height"===(null===C||void 0===C?void 0:C.imageSizeMode)?(null===C||void 0===C?void 0:C.imageHeight)||"300px":"auto",maxWidth:"100%"}})}),(0,ea.jsx)(CG,{content:k,onChange:e=>me(j,e),label:"Add Button Below Image",pages:n,anchors:ee})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Alt Text (Accessibility)"}),(0,ea.jsx)(BN,{value:k.alt||"",onChange:e=>me(j,d(d({},k),{},{alt:e.target.value})),placeholder:"Describe image for screen readers","data-testid":"image-alt-input-".concat(t)})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Caption (Visible below image)"}),(0,ea.jsx)(BN,{value:k.caption||"",onChange:e=>me(j,d(d({},k),{},{caption:e.target.value})),placeholder:"Optional visible caption","data-testid":"image-caption-input-".concat(t)})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Link URL (Make image clickable)"}),(0,ea.jsx)(BN,{value:k.linkUrl||"",onChange:e=>me(j,d(d({},k),{},{linkUrl:e.target.value})),placeholder:"https://...","data-testid":"image-link-url-".concat(t)}),k.linkUrl&&(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs text-slate-500 mt-1.5 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.linkNewTab,onChange:e=>me(j,d(d({},k),{},{linkNewTab:e.target.checked})),className:"rounded border-slate-300"}),"Open in new tab"]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Layout"}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:k.fullWidth||!1,onChange:e=>me(j,d(d({},k),{},{fullWidth:e.target.checked})),className:"rounded border-slate-300"}),(0,ea.jsx)("span",{children:"Full Width Banner"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Padding:"}),(0,ea.jsxs)(eb,{value:k.paddingSide||"all",onValueChange:e=>me(j,d(d({},k),{},{paddingSide:e})),children:[(0,ea.jsx)(sb,{className:"w-20 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All"}),(0,ea.jsx)(rb,{value:"top",children:"Top"}),(0,ea.jsx)(rb,{value:"right",children:"Right"}),(0,ea.jsx)(rb,{value:"bottom",children:"Bottom"}),(0,ea.jsx)(rb,{value:"left",children:"Left"})]})]}),(0,ea.jsx)(BN,{type:"number",value:k.paddingSize||0,onChange:e=>me(j,d(d({},k),{},{paddingSize:parseInt(e.target.value)||0})),className:"w-20 h-8 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Shape Mask"}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(eb,{value:k.shapeMask||"none",onValueChange:e=>me(j,d(d({},k),{},{shapeMask:e})),children:[(0,ea.jsx)(sb,{className:"w-full h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"No Mask"}),(0,ea.jsx)(rb,{value:"circle",children:"Circle"}),(0,ea.jsx)(rb,{value:"ellipse",children:"Ellipse"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"diamond",children:"Diamond"}),(0,ea.jsx)(rb,{value:"hexagon",children:"Hexagon"}),(0,ea.jsx)(rb,{value:"octagon",children:"Octagon"}),(0,ea.jsx)(rb,{value:"star",children:"Star"}),(0,ea.jsx)(rb,{value:"arch",children:"Arch"})]})]}),k.shapeMask&&"none"!==k.shapeMask&&(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsx)(BN,{type:"number",value:k.shapeSize||300,onChange:e=>me(j,d(d({},k),{},{shapeSize:parseInt(e.target.value)||300})),className:"w-20 h-8 text-xs",min:"50",max:"800"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Border:"}),(0,ea.jsx)(BN,{type:"number",value:k.shapeBorderWidth||0,onChange:e=>me(j,d(d({},k),{},{shapeBorderWidth:parseInt(e.target.value)||0})),className:"w-20 h-8 text-xs",min:"0",max:"20"}),(0,ea.jsx)(wq,{value:k.shapeBorderColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{shapeBorderColor:e.target.value})),className:"w-8 h-8 rounded border cursor-pointer",title:"Border Color"})]})]})]})]})]})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"button"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:["settings","style","animation"].includes(B(j)),contentPane:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)(q$,{currentStyle:{style:k.style,size:k.size,color:k.color,textColor:k.textColor,gradientColor:k.gradientColor,radius:k.borderRadius},onApply:e=>{const t={};void 0!==e.style&&(t.style=e.style),void 0!==e.size&&(t.size=e.size),void 0!==e.color&&(t.color=e.color),void 0!==e.textColor&&(t.textColor=e.textColor),void 0!==e.gradientColor&&(t.gradientColor=e.gradientColor),void 0!==e.radius&&(t.borderRadius=e.radius),me(j,d(d({},k),t))}}),(0,ea.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg border border-slate-200",style:{textAlign:k.align||"left"},children:[(0,ea.jsxs)("a",{href:k.url||"#",target:k.openInNewTab?"_blank":"_self",rel:k.openInNewTab?"noopener noreferrer":"",className:"\n inline-flex items-center gap-2 font-medium transition-all\n ".concat("sm"===k.size?"px-3 py-1.5 text-sm":"","\n ").concat("md"!==k.size&&k.size?"":"px-5 py-2.5 text-base","\n ").concat("lg"===k.size?"px-6 py-3 text-lg":"","\n ").concat("xl"===k.size?"px-8 py-4 text-xl":"","\n ").concat(k.fullWidth?"w-full justify-center":"","\n ").concat("square"===k.borderRadius?"rounded-none":"","\n ").concat("rounded"!==k.borderRadius&&k.borderRadius?"":"rounded-lg","\n ").concat("pill"===k.borderRadius?"rounded-full":"","\n "),style:d({},"gradient"===k.style?{background:"linear-gradient(135deg, ".concat(k.color||o,", ").concat(k.gradientColor||u,")"),color:k.textColor||"#ffffff"}:"soft"===k.style?{backgroundColor:"".concat(k.color||o,"26"),color:k.color||o}:{backgroundColor:"solid"!==k.style&&k.style?"transparent":k.color||o,color:"solid"!==k.style&&k.style?k.color||o:k.textColor||"#ffffff",border:"outline"===k.style?"2px solid ".concat(k.color||o):"none"}),onClick:e=>e.preventDefault(),children:[k.icon&&"none"!==k.icon&&"left"===k.iconPosition&&(0,ea.jsx)("span",{className:"inline-flex items-center",children:Kj(k.icon,16,k.iconColor)}),k.text||"Click Here",k.icon&&"none"!==k.icon&&("right"===k.iconPosition||!k.iconPosition)&&(0
2,ea.jsx)("span",{className:"inline-flex items-center",children:Kj(k.icon,16,k.iconColor)})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-2",children:"Preview (click disabled)"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Button Text"}),(0,ea.jsx)(BN,{value:k.text||"",onChange:e=>me(j,d(d({},k),{},{text:e.target.value})),placeholder:"Click Here","data-testid":"button-text-".concat(t)})]}),(0,ea.jsx)(I$,{value:k.url||"",onChange:e=>me(j,d(d({},k),{},{url:e})),pages:n,anchors:ee,label:"Link URL",testId:"button-url-".concat(t)})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Appearance"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Style"}),(0,ea.jsxs)(eb,{value:k.style||"solid",onValueChange:e=>me(j,d(d({},k),{},{style:e})),children:[(0,ea.jsx)(sb,{className:"h-9","data-testid":"button-style-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline"}),(0,ea.jsx)(rb,{value:"ghost",children:"Ghost"}),(0,ea.jsx)(rb,{value:"gradient",children:"Gradient"}),(0,ea.jsx)(rb,{value:"soft",children:"Soft"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Size"}),(0,ea.jsxs)(eb,{value:k.size||"md",onValueChange:e=>me(j,d(d({},k),{},{size:e})),children:[(0,ea.jsx)(sb,{className:"h-9","data-testid":"button-size-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"sm",children:"Small"}),(0,ea.jsx)(rb,{value:"md",children:"Medium"}),(0,ea.jsx)(rb,{value:"lg",children:"Large"}),(0,ea.jsx)(rb,{value:"xl",children:"Extra Large"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Corners"}),(0,ea.jsxs)(eb,{value:k.borderRadius||"rounded",onValueChange:e=>me(j,d(d({},k),{},{borderRadius:e})),children:[(0,ea.jsx)(sb,{className:"h-9","data-testid":"button-radius-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"square",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Alignment"}),(0,ea.jsxs)(eb,{value:k.align||"left",onValueChange:e=>me(j,d(d({},k),{},{align:e})),children:[(0,ea.jsx)(sb,{className:"h-9","data-testid":"button-align-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wide",children:"Colors"}),(k.color||k.hoverColor||k.gradientColor)&&(0,ea.jsx)("button",{type:"button","data-testid":"button-reset-theme-colors-".concat(t),onClick:()=>{const{color:e,hoverColor:t,gradientColor:s}=k,a=l(k,LK);me(j,a)},className:"text-[10px] font-medium text-indigo-600 hover:text-indigo-700 underline",title:"Clear the colours below so this button follows your site theme",children:"Reset to theme"})]}),!(k.color||k.hoverColor||k.gradientColor)&&(0,ea.jsx)("div",{className:"mb-3 text-[11px] text-indigo-600 bg-indigo-50 border border-indigo-100 rounded px-2 py-1.5",children:"Following site theme. Pick a colour below to override."}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Button Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:k.color||o,onChange:e=>me(j,d(d({},k),{},{color:e.target.value})),className:"w-9 h-9 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(BN,{value:k.color||"",onChange:e=>me(j,d(d({},k),{},{color:e.target.value})),className:"h-9 font-mono text-xs flex-1",placeholder:"Theme (".concat(o,")")})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:k.textColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{textColor:e.target.value})),className:"w-9 h-9 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(yq,{value:k.textColor||"",onChange:e=>me(j,d(d({},k),{},{textColor:e.target.value})),className:"h-9 font-mono text-xs flex-1",placeholder:"#ffffff"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Hover Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:k.hoverColor||c,onChange:e=>me(j,d(d({},k),{},{hoverColor:e.target.value})),className:"w-9 h-9 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(BN,{value:k.hoverColor||"",onChange:e=>me(j,d(d({},k),{},{hoverColor:e.target.value})),className:"h-9 font-mono text-xs flex-1",placeholder:"Theme (".concat(c,")")})]})]}),"gradient"===k.style&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Gradient End Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{"data-testid":"button-gradient-color-".concat(t),value:k.gradientColor||u,onChange:e=>me(j,d(d({},k),{},{gradientColor:e.target.value})),className:"w-9 h-9 rounded border border-slate-200 cursor-pointer"}),(0,ea.jsx)(BN,{value:k.gradientColor||"",onChange:e=>me(j,d(d({},k),{},{gradientColor:e.target.value})),className:"h-9 font-mono text-xs flex-1",placeholder:"Theme (".concat(u,")")})]})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Options"}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:k.fullWidth||!1,onChange:e=>me(j,d(d({},k),{},{fullWidth:e.target.checked})),className:"rounded border-slate-300"}),(0,ea.jsx)("span",{className:"text-xs",children:"Full Width"})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:k.openInNewTab||!1,onChange:e=>me(j,d(d({},k),{},{openInNewTab:e.target.checked})),className:"rounded border-slate-300"}),(0,ea.jsx)("span",{className:"text-xs",children:"Open in New Tab"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Icon"}),(0,ea.jsxs)(eb,{value:k.icon||"none",onValueChange:e=>me(j,d(d({},k),{},{icon:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{className:"max-h-72",children:$j.map(e=>(0,ea.jsx)(rb,{value:e.value,children:(0,ea.jsxs)("span",{className:"inline-flex items-center gap-2",children:["none"!==e.value&&Kj(e.value,14),e.label]})},e.value))})]})]}),k.icon&&"none"!==k.icon&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Icon Position"}),(0,ea.jsxs)(eb,{value:k.iconPosition||"right",onValueChange:e=>me(j,d(d({},k),{},{iconPosition:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]})]})]})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"quote"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:["settings","style","animation"].includes(B(j)),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)("blockquote",{className:"border-l-4 pl-4 py-2",style:{borderColor:k.color||"#4F46E5"},children:(0,ea.jsx)(YN,{value:k.text||"",onChange:e=>me(j,d(d({},k),{},{text:e.target.value})),className:"border-none p-0 focus:ring-0 resize-none bg-transparent",style:{fontFamily:k.fontFamily||"Merriweather, serif",fontSize:k.fontSize?"".concat(k.fontSize,"px"):"20px",fontStyle:k.fontStyle||"italic",fontWeight:k.fontWeight||"normal",color:k.color||"#334155",textAlign:k.align||"left"},placeholder:"Quote text...",rows:3,"data-testid":"quote-input-".concat(t)})}),(0,ea.jsx)(BN,{value:k.author||"",onChange:e=>me(j,d(d({},k),{},{author:e.target.value})),placeholder:"Attribution (optional, e.g., Mark Twain)",className:"text-sm","data-testid":"quote-author-".concat(t)})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsx)("div",{className:"space-y-3",children:(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100 space-y-2",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wide",children:"Typography"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500
2w-16",children:"Font:"}),(0,ea.jsxs)(eb,{value:k.fontFamily||"Merriweather, serif",onValueChange:e=>me(j,d(d({},k),{},{fontFamily:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs flex-1","data-testid":"quote-font-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:xq.map(e=>(0,ea.jsx)(rb,{value:e.value,style:{fontFamily:e.value},children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 w-16",children:"Size:"}),(0,ea.jsxs)(eb,{value:String(k.fontSize||20),onValueChange:e=>me(j,d(d({},k),{},{fontSize:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs flex-1","data-testid":"quote-size-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:["14","16","18","20","24","28","32","36","42","48","56"].map(e=>(0,ea.jsxs)(rb,{value:e,children:[e,"px"]},e))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 w-16",children:"Style:"}),(0,ea.jsxs)(eb,{value:k.fontStyle||"italic",onValueChange:e=>me(j,d(d({},k),{},{fontStyle:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs flex-1","data-testid":"quote-style-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"normal",children:"Normal"}),(0,ea.jsx)(rb,{value:"italic",children:"Italic"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 w-16",children:"Weight:"}),(0,ea.jsxs)(eb,{value:k.fontWeight||"normal",onValueChange:e=>me(j,d(d({},k),{},{fontWeight:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs flex-1","data-testid":"quote-weight-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"normal",children:"Normal"}),(0,ea.jsx)(rb,{value:"500",children:"Medium"}),(0,ea.jsx)(rb,{value:"600",children:"Semi Bold"}),(0,ea.jsx)(rb,{value:"bold",children:"Bold"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 w-16",children:"Color:"}),(0,ea.jsx)(wq,{value:k.color||"#334155",onChange:e=>me(j,d(d({},k),{},{color:e.target.value})),className:"w-8 h-8 rounded border cursor-pointer","data-testid":"quote-color-".concat(t)}),(0,ea.jsx)(yq,{value:k.color||"",onChange:e=>me(j,d(d({},k),{},{color:e.target.value})),className:"h-8 text-xs flex-1 font-mono",placeholder:"#334155"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 w-16",children:"Align:"}),(0,ea.jsxs)(eb,{value:k.align||"left",onValueChange:e=>me(j,d(d({},k),{},{align:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs flex-1","data-testid":"quote-align-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]})})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"list"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(FG,{isActive:"content"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-2",children:[null===(a=k.items)||void 0===a?void 0:a.map((e,s)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-slate-400",children:"\u2022"}),(0,ea.jsx)(BN,{value:e,onChange:e=>{const t=[...k.items];t[s]=e.target.value,me(j,d(d({},k),{},{items:t}))},placeholder:"Item ".concat(s+1),"data-testid":"list-item-input-".concat(t,"-").concat(s)}),k.items.length>1&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{const e=k.items.filter((e,t)=>t!==s);me(j,d(d({},k),{},{items:e}))},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:14})})]},s)),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{items:[...k.items,""]})),"data-testid":"add-list-item-".concat(t),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"}),"Add Item"]})]})}),(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsx)("div",{className:"text-sm text-slate-500 p-4 bg-slate-50 rounded-lg",children:"No additional settings for list blocks."})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]}),"code"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(FG,{isActive:"content"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)(YN,{value:k.code||"",onChange:e=>me(j,d(d({},k),{},{code:e.target.value})),className:"font-mono text-sm min-h-[200px] bg-slate-900 text-slate-100 border-slate-700",placeholder:"// Enter your co
2de here...","data-testid":"code-input-".concat(t),spellCheck:!1}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-2 block",children:"Preview:"}),(0,ea.jsx)(qg,{code:k.code||"// Your code here",language:k.language||"javascript",theme:k.theme||"github-dark",showLineNumbers:!1!==k.showLineNumbers})]})]})}),(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Code Settings"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Language:"}),(0,ea.jsxs)(eb,{value:k.language||"javascript",onValueChange:e=>me(j,d(d({},k),{},{language:e})),children:[(0,ea.jsx)(sb,{className:"w-36",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:Vg.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Theme:"}),(0,ea.jsxs)(eb,{value:k.theme||"github-dark",onValueChange:e=>me(j,d(d({},k),{},{theme:e})),children:[(0,ea.jsx)(sb,{className:"w-40",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:Wg.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{id:"line-numbers-".concat(j),checked:!1!==k.showLineNumbers,onCheckedChange:e=>me(j,d(d({},k),{},{showLineNumbers:e}))}),(0,ea.jsx)(tf,{htmlFor:"line-numbers-".concat(j),className:"text-sm",children:"Line Numbers"})]})]})]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>(w(j),void y(!0)),className:"gap-2",children:[(0,ea.jsx)(kE,{size:14}),"Browse Snippets"]})]})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]}),"unsubscribe"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z,disabledTabs:["style","animation"]}),(0,ea.jsx)(FG,{isActive:"content"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 pb-3 border-b border-slate-200",children:[(0,ea.jsx)(DE,{size:16,className:"text-red-500"}),(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-700",children:"Unsubscribe Link Block"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Link Text"}),(0,ea.jsx)(BN,{value:k.text||"Unsubscribe from this newsletter",onChange:e=>me(j,d(d({},k),{},{text:e.target.value})),placeholder:"Unsubscribe from this newsletter",className:"mt-1"})]}),(0,ea.jsx)("div",{className:"bg-slate-50 rounded-lg p-4 text-center",children:(0,ea.jsx)("span",{className:"text-slate-600 underline cursor-pointer",children:k.text||"Unsubscribe from this newsletter"})})]})}),(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsx)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:(0,ea.jsxs)("p",{className:"text-sm text-amber-800",children:[(0,ea.jsx)("strong",{children:"Note:"})," The unsubscribe link is automatically personalized for each recipient when the newsletter is sent. It will mark them as unsubscribed from your mailing list."]})})})]}),"article-card"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z,disabledTabs:["style","animation"]}),(0,ea.jsx)(FG,{isActive:"content"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Select Article"}),(0,ea.jsxs)(eb,{value:k.articleId||"",onValueChange:e=>{const t=L.find(t=>t.article_id===e);me(j,d(d({},k),{}
2,{articleId:e,articleTitle:(null===t||void 0===t?void 0:t.title)||"",articleSlug:(null===t||void 0===t?void 0:t.slug)||"",articleImage:(null===t||void 0===t?void 0:t.image_url)||"",articleExcerpt:(null===t||void 0===t?void 0:t.excerpt)||"",articleDate:(null===t||void 0===t?void 0:t.date)||""}))},children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{placeholder:O?"Loading articles...":"Choose an article"})}),(0,ea.jsxs)(lb,{children:[L.filter(e=>"published"===e.status).map(e=>(0,ea.jsx)(rb,{value:e.article_id,children:e.title},e.article_id)),0===L.filter(e=>"published"===e.status).length&&(0,ea.jsx)(rb,{value:"__none__",disabled:!0,children:"No published articles"})]})]})]}),k.articleId&&(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 border border-slate-200",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"Preview:"}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg overflow-hidden border border-slate-200",children:[!1!==k.showImage&&k.articleImage&&(0,ea.jsx)("img",{src:k.articleImage,alt:"",className:"w-full h-32 object-cover"}),(0,ea.jsxs)("div",{className:"p-4",children:[(0,ea.jsx)("h3",{className:"font-semibold text-slate-800",children:k.articleTitle}),!1!==k.showDate&&k.articleDate&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:new Date(k.articleDate).toLocaleDateString()}),!1!==k.showExcerpt&&k.articleExcerpt&&(0,ea.jsx)("p",{className:"text-sm text-slate-600 mt-2 line-clamp-2",children:k.articleExcerpt}),!1!==k.showReadMore&&(0,ea.jsxs)("p",{className:"text-sm text-indigo-600 mt-3 font-medium",children:[k.readMoreText||"Read Full Article"," \u2192"]})]})]})]}),!k.articleId&&(0,ea.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,ea.jsx)("p",{className:"text-sm text-blue-800",children:"Select an article above to insert it into your newsletter. The article link will direct readers to the full article on your website."})})]})}),(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Display Style"}),(0,ea.jsxs)(eb,{value:k.displayStyle||"card",onValueChange:e=>me(j,d(d({},k),{},{displayStyle:e})),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"card",children:"Card (image, title, excerpt)"}),(0,ea.jsx)(rb,{value:"headline",children:"Headline Only (title + link)"}),(0,ea.jsx)(rb,{value:"full",children:"Full Content (embed article)"})]})]})]}),"headline"!==k.displayStyle&&(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Show in Card"}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.showImage,onChange:e=>me(j,d(d({},k),{},{showImage:e.target.checked})),className:"rounded"}),"Image"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.showExcerpt,onChange:e=>me(j,d(d({},k),{},{showExcerpt:e.target.checked})),className:"rounded"}),"Excerpt"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.showDate,onChange:e=>me(j,d(d({},k),{},{showDate:e.target.checked})),className:"rounded"}),"Date"]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Read More Link"}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.showReadMore,onChange:e=>me(j,d(d({},k),{},{showReadMore:e.target.checked})),className:"rounded"}),'Show "Read More" Link']}),!1!==k.showReadMore&&(0,ea.jsx)(BN,{value:k.readMoreText||"Read Full Article",onChange:e=>me(j,d(d({},k),{},{readMoreText:e.target.value})),placeholder:"Read Full Article",className:"mt-1"})]})]})]})})]}),"newsletter-header"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z,disabledTabs:["style","animation"]}),(0,ea.jsx)(FG,{isActive:"content"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Navigation Links (2-5)"}),(k.links||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{value:e.text||"",onChange:e=>{const s=[...k.links||[]];s[t]=d(d({},s[t]),{},{text:e.target.value}),me(j,d(d({},k),{},{links:s}))},placeholder:"Link text",className:"h-8 flex-1"}),(0,ea.jsx)(BN,{value:e.url||"",onChange:e=>{const s=[...k.links||[]];s[t]=d(d({},s[t]),{},{url:e.target.value}),me(j,d(d({},k),{},{links:s}))},placeholder:"URL",className:"h-8 flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{const e=(k.links||[]).filter((e,s)=>s!==t);me(j,d(d({},k),{},{links:e}))},className:"h-8 w-8 p-0 text-red-500 hover:text-red-700",disabled:(k.links||[]).length<=2,children:"\xd7"})]},t)),(k.links||[]).length<5&&(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>{const e=[...k.links||[],{text:"",url:"#"}];me(j,d(d({},k),{},{links:e}))},className:"w-full",children:"+ Add Link"})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 border border-slate-200",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"Preview:"}),(0,ea.jsxs)("div",{className:"rounded-lg p-4",style:{backgroundColor:k.backgroundColor||"#6366f1",textAlign:k.alignment||"center"},children:[!1!==k.showLogo&&k.logoUrl&&(0,ea.jsx)("img",{src:k.logoUrl,alt:k.logoAlt||"L
2ogo",style:{width:k.logoWidth||150,display:"center"===k.alignment?"block":"inline-block",margin:"center"===k.alignment?"0 auto 12px":"0 0 12px"}}),(0,ea.jsx)("div",{style:{marginTop:(!1!==k.showLogo&&k.logoUrl,"0")},children:(k.links||[]).map((e,t)=>(0,ea.jsxs)("span",{children:[(0,ea.jsx)("a",{href:"#",style:{color:k.textColor||"#ffffff",textDecoration:"none",fontWeight:500,fontSize:"14px"},onClick:e=>e.preventDefault(),children:e.text||"Link ".concat(t+1)}),t<(k.links||[]).length-1&&(0,ea.jsx)("span",{style:{color:k.textColor||"#ffffff",margin:"0 12px",opacity:.5},children:"|"})]},t))})]})]})]})}),(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Logo"}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.showLogo,onChange:e=>me(j,d(d({},k),{},{showLogo:e.target.checked})),className:"rounded"}),"Show Logo"]}),!1!==k.showLogo&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:k.logoUrl||"",onChange:e=>me(j,d(d({},k),{},{logoUrl:e.target.value})),placeholder:"Logo URL",className:"flex-1","data-testid":"newsletter-header-logo-url"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{f(j),p(!0)},"data-testid":"newsletter-header-logo-media-picker",children:[(0,ea.jsx)(jD,{size:14,className:"mr-1"}),k.logoUrl?"Change":"Select"]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Width:"}),(0,ea.jsx)(BN,{type:"number",value:k.logoWidth||150,onChange:e=>me(j,d(d({},k),{},{logoWidth:parseInt(e.target.value)||150})),className:"w-20 h-8",min:50,max:300}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Colors"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:k.backgroundColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{backgroundColor:e.target.value})),className:"w-8 h-8 rounded cursor-pointer"}),(0,ea.jsx)(yq,{value:k.backgroundColor||"",onChange:e=>me(j,d(d({},k),{},{backgroundColor:e.target.value})),className:"h-8 text-xs flex-1",placeholder:"#6366f1"})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Text/Link Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:k.textColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{textColor:e.target.value})),className:"w-8 h-8 rounded cursor-pointer"}),(0,ea.jsx)(yq,{value:k.textColor||"",onChange:e=>me(j,d(d({},k),{},{textColor:e.target.value})),className:"h-8 text-xs flex-1",placeholder:"#ffffff"})]})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Layout"}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:"Alignment"}),(0,ea.jsxs)(eb,{value:k.alignment||"center",onValueChange:e=>me(j,d(d({},k),{},{alignment:e})),children:[(0,ea.jsx)(sb,{className:"h-8",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]})]})})]}),"search"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(FG,{isActive:"content"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 pb-3 border-b border-slate-200",children:[(0,ea.jsx)(fj,{size:16,className:"text-cyan-500"}),(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-700",children:"Site Search Block"})]}),(0,ea.jsx)("div",{className:"bg-slate-50 rounded-lg p-4",children:(0,ea.jsxs)("div",{className:"flex gap-2 max-w-md mx-auto",children:[(0,ea.jsxs)("div",{className:"flex-1 relative",children:[(0,ea.jsx)(fj,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)("input",{type:"text",placeholder:k.placeholder||"Search pages and articles...",className:"w-full pl-10 pr-4 py-2 border border-slate-300 rounded-lg text-sm",disabled:!0})]}),(0,ea.jsx)("button",{className:"px-4 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium",children:k.buttonText||"Search"})]})})]})}),(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Text"}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Placeholder Text"}),(0,ea.jsx)(BN,{value:k.placeholder||"Search pages and articles...",onChange:e=>me(j,d(d({},k),{},{placeholder:e.target.value})),placeholder:"Search pages and articles...",className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Button Text"}),(0,ea.jsx)(BN,{value:k.buttonText||"Search",onChange:e=>me(j,d(d({},k),{},{buttonText:e.target.value})),placeholder:"Search",className:"mt-1"})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Search Options"}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.searchPages,onChange:e=>me(j,d(d({},k),{},{searchPages:e.target.checked}
2)),className:"h-4 w-4 rounded border-slate-300"}),(0,ea.jsx)(tf,{className:"text-sm",children:"Search Pages"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.searchArticles,onChange:e=>me(j,d(d({},k),{},{searchArticles:e.target.checked})),className:"h-4 w-4 rounded border-slate-300"}),(0,ea.jsx)(tf,{className:"text-sm",children:"Search Articles"})]})]})]})]})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]}),"custom-html"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:["settings","style","animation"].includes(B(j)),contentPane:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)(YN,{value:k.html||"",onChange:e=>me(j,d(d({},k),{},{html:e.target.value})),className:"font-mono text-sm min-h-[250px] bg-slate-900 text-slate-100 border-slate-700",placeholder:"\x3c!-- Enter your custom HTML here --\x3e","data-testid":"custom-html-input-".concat(t),spellCheck:!1}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-2 block",children:"Preview (isolated):"}),(0,ea.jsx)("iframe",{srcDoc:'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <style>\n body { margin: 0; padding: 16px; font-family: system-ui, sans-serif; }\n </style>\n</head>\n<body>'.concat(k.html||'<p style="color: #999;">No content yet</p>',"</body>\n</html>"),className:"w-full border border-slate-200 rounded-lg bg-white",style:{minHeight:"150px",height:"auto"},sandbox:k.enableScripts?"allow-scripts":"",title:"HTML Preview",onLoad:e=>{try{var t,s;const a=e.target,n=null===(t=a.contentDocument)||void 0===t||null===(s=t.body)||void 0===s?void 0:s.scrollHeight;n&&n>100&&(a.style.height=Math.min(n+40,500)+"px")}catch(K2){}}})]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Script Settings"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{id:"enable-scripts-".concat(j),checked:k.enableScripts||!1,onCheckedChange:e=>me(j,d(d({},k),{},{enableScripts:e}))}),(0,ea.jsx)(tf,{htmlFor:"enable-scripts-".concat(j),className:"text-sm",children:"Allow Scripts"})]})]}),k.enableScripts&&(0,ea.jsx)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:(0,ea.jsxs)("p",{className:"text-sm text-amber-800",children:[(0,ea.jsx)("strong",{children:"\u26a0\ufe0f Warning:"})," Scripts are enabled. Only add trusted code as malicious scripts can compromise your site."]})}),(0,ea.jsx)("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-3",children:(0,ea.jsxs)("p",{className:"text-xs text-slate-600",children:[(0,ea.jsx)("strong",{children:"Tips:"}),' You can add HTML, inline CSS with <style> tags, and embedded widgets. For scripts, enable "Allow Scripts" above. Use Tailwind classes for styling.']})})]})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),("columns"===N||"card-grid"===N)&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsxs)("div",{className:"style"===B(j)||"animation"===B(j)?"opacity-40 pointer-events-none max-h-[200px] overflow-hidden relative transition-all duration-200":"transition-all duration-200",children:[("style"===B(j)||"animation"===B(j))&&(0,ea.jsx)("div",{className:"absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-white to-transparent z-10"}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"text-xs font-semibold text-slate-500 flex items-center gap-1 uppercase tracking-wide",children:[(0,ea.jsx)(_E,{size:12}),"Layout Settings"]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mb-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"card-grid"===N?"Cards per row:":"Columns:"}),(0,ea.jsxs)(eb,{value:String("card-grid"===N?k.cardsPerRow||3:k.columnCount||2),onValueChange:e=>{const t=parseInt(e);if("card-grid"===N)return void me(j,d(d({},k),{},{cardsPerRow:t}));const s=k.columns||[];let a=[...s];if(t>s.length)for(let n=s.length;n<t;n++)a.push({type:"text",html:"<p>Column ".concat(n+1,"</p>"),imageUrl:"",imageAlt:"",imageWidth:200,imageAlign:"center",textAlign:"left"});else a=a.slice(0,t);me(j,d(d({},k),{},{columnCount:t,columns:a}))},children:[(0,ea.jsx)(sb,{className:"w-16","data-testid":"columns-count-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"2",children:"2"}),(0,ea.jsx)(rb,{value:"3",children:"3"}),(0,ea.jsx)(rb,{value:"4",children:"4"}),(0,ea.jsx)(rb,{value:"5",children:"5"})]})]})]}),"card-grid"===N&&(0,ea.jsxs)(sg,{type:"button",size:"sm",variant:"outline","data-testid":"card-grid-add-".concat(t),onClick:()=>{const e=[...k.columns||[]];e.push({type:"card",html:"<h3>Card ".concat(e.length+1,"</h3><p>Card description</p>"),imageUrl:"",imageAlt:"",imageWidth:200,imageAlign:"center",textAlign:"left"}),me(j,d(d({},k),{},{columns:e}))},children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add card"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Show as Cards:"}),(0,ea.jsx)("input",{type:"checkbox",checked:k.showAsCards||!1,onChange:e=>me(j,d(d({},k),{},{showAsCards:e.target.checked})),className:"w-4 h-4 rounded border-slate-300"})]})]}),(0,ea.jsxs)("div",{className:"mb-3 p-3 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Column Widths"}),(0,ea.jsxs)(eb,{value:k.columnWidthPreset||"equal",onValueChange:e=>{const t=k.columnCount||2;let s=[];s="equal"===e?Array(t).fill(Math.floor(100/t)):"2-1"===e&&2===t?[66,34]:"1-2"===e&&2===t?[34,66]:"3-1"===e&&2===t?[75,25]:"1-3"===e&&2===t?[25,75]:"2-1-1"===e&&3===t?[50,25,25]:"1-2-1"===e&&3===t?[25,50,25]:"1-1-2"===e&&3===t?[25,25,50]:"custom"===e&&k.columnWidths||Array(t).fill(Math.floor(100/t)),me(j,d(d({},k),{},{columnWidthPreset:e,columnWidths:s}))},children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs",children:(0,ea.jsx)(tb,{placeholder:"Equal"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"equal",children:"Equal"}),2===(k.columnCount||2)&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(rb,{value:"2-1",children:"2:1 (Wide Left)"}),(0,ea.jsx)(rb,{value:"1-2",children:"1:2 (Wide Right)"}),(0,ea.jsx)(rb,{value:"3-1",children:"3:1 (Wider Left)"}),(0,ea.jsx)(rb,{value:"1-3",children:"1:3 (Wider Right)"})]}),3===(k.columnCount||2)&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(rb,{value:"2-1-1",children:"2:1:1 (Wide Left)"}),(0,ea.jsx)(rb,{value:"1-2-1",children:"1:2:1 (Wide Center)"}),(0,ea.jsx)(rb,{value:"1-1-2",children:"1:1:2 (Wide Right)"})]}),(0,ea.jsx)(rb,{value:"custom",children:"Custom"})]})]})]}),"custom"===k.columnWidthPreset&&(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2 mt-2",children:[(k.columns||[]).map((e,t)=>{var s;return(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Col ",t+1,":"]}),(0,ea.jsx)(BN,{type:"number",min:"10",max:"90",value:(null===(s=k.columnWidths)||void 0===s?void 0:s[t])||Math.floor(100/(k.columnCount||2)),onChange:e=>{const s=[...k.columnWidths||Array(k.columnCount||2).fill(Math.floor(100/(k.columnCount||2)))];s[t]=parseInt(e.target.value)||25,me(j,d(d({},k),{},{columnWidths:s}))},className:"w-20 h-7 text-xs"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"%"})]},t)}),(0,ea.jsxs)("span",{className:"text-[10px] text-slate-400 ml-2",children:["(Total: ",(k.columnWidths||[]).reduce((e,t)=>
2e+t,0),"%)"]})]}),(0,ea.jsx)("div",{className:"flex gap-1 mt-2 h-4 rounded overflow-hidden",children:(k.columns||[]).map((e,t)=>{var s;const a=(null===(s=k.columnWidths)||void 0===s?void 0:s[t])||Math.floor(100/(k.columnCount||2));return(0,ea.jsx)("div",{className:"bg-indigo-200 flex items-center justify-center",style:{width:"".concat(a,"%")},children:(0,ea.jsxs)("span",{className:"text-[8px] text-indigo-700 font-medium",children:[a,"%"]})},t)})})]}),(0,ea.jsxs)("div",{className:"mb-3 p-3 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Column Height"}),(0,ea.jsxs)(eb,{value:k.columnHeight||"auto",onValueChange:e=>me(j,d(d({},k),{},{columnHeight:e})),children:[(0,ea.jsx)(sb,{className:"w-32 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto (Fit Content)"}),(0,ea.jsx)(rb,{value:"match",children:"Match Tallest"}),(0,ea.jsx)(rb,{value:"200",children:"200px"}),(0,ea.jsx)(rb,{value:"250",children:"250px"}),(0,ea.jsx)(rb,{value:"300",children:"300px"}),(0,ea.jsx)(rb,{value:"350",children:"350px"}),(0,ea.jsx)(rb,{value:"400",children:"400px"}),(0,ea.jsx)(rb,{value:"450",children:"450px"}),(0,ea.jsx)(rb,{value:"500",children:"500px"})]})]})]}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400 mt-1",children:k.columnHeight&&"auto"!==k.columnHeight?"match"===k.columnHeight?"All columns will stretch to match the tallest one":"All columns will be ".concat(k.columnHeight,"px tall"):"Each column fits its content"})]}),(0,ea.jsxs)("div",{className:"space-y-3 mb-3",children:[k.showAsCards&&(0,ea.jsxs)("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-3",children:[(0,ea.jsx)("p",{className:"text-[10px] font-semibold text-slate-400 uppercase tracking-wider mb-2",children:"Card Defaults"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"BG:"}),(0,ea.jsx)(wq,{value:(null===(r=k.cardStyle)||void 0===r?void 0:r.backgroundColor)||"#ffffff",onChange:e=>me(j,d(d({},k),{},{cardStyle:d(d({},k.cardStyle),{},{backgroundColor:e.target.value})})),className:"w-8 h-6 rounded border cursor-pointer"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Shadow:"}),(0,ea.jsx)("input",{type:"checkbox",checked:!1!==(null===(i=k.cardStyle)||void 0===i?void 0:i.shadow),onChange:e=>me(j,d(d({},k),{},{cardStyle:d(d({},k.cardStyle),{},{shadow:e.target.checked})})),className:"w-4 h-4 rounded border-slate-300"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Radius:"}),(0,ea.jsx)("input",{type:"number",min:"0",max:"50",value:parseInt(null===(m=k.cardStyle)||void 0===m?void 0:m.borderRadius)||8,onChange:e=>me(j,d(d({},k),{},{cardStyle:d(d({},k.cardStyle),{},{borderRadius:"".concat(e.target.value,"px")})})),className:"w-16 h-7 text-xs border rounded px-2","data-testid":"card-radius-input"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",title:"Default animation for all cards (can be overridden per card below)",children:"Anim:"}),(0,ea.jsxs)(eb,{value:(null===(h=k.cardStyle)||void 0===h?void 0:h.animation)||"none",onValueChange:e=>me(j,d(d({},k),{},{cardStyle:d(d({},k.cardStyle),{},{animation:e})})),children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"fadeIn",children:"Fade In"}),(0,ea.jsx)(rb,{value:"fadeInUp",children:"Fade In Up"}),(0,ea.jsx)(rb,{value:"fadeInDown",children:"Fade In Down"}),(0,ea.jsx)(rb,{value:"slideLeft",children:"Slide Left"}),(0,ea.jsx)(rb,{value:"slideRight",children:"Slide Right"}),(0,ea.jsx)(rb,{value:"zoomIn",children:"Zoom In"}),(0,ea.jsx)(rb,{value:"bounce",children:"Bounce"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",title:"Stagger animation timing for each card",children:"Stagger:"}),(0,ea.jsx)("input",{type:"checkbox",checked:!1!==(null===(x=k.cardStyle)||void 0===x?void 0:x.stagger),onChange:e=>me(j,d(d({},k),{},{cardStyle:d(d({},k.cardStyle),{},{stagger:e.target.checked})})),className:"w-4 h-4 rounded border-slate-300",title:"Stagger animation for each card"})]})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[k.showAsCards&&(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Column Widths:"}),(0,ea.jsxs)(eb,{value:k.columnWidths||"equal",onValueChange:e=>me(j,d(d({},k),{},{columnWidths:e})),children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"equal",children:"Equal"}),(0,ea.jsx)(rb,{value:"1-2",children:"1:2"}),(0,ea.jsx)(rb,{value:"2-1",children:"2:1"}),(0,ea.jsx)(rb,{value:"1-1-2",children:"1:1:2"}),(0,ea.jsx)(rb,{value:"2-1-1",children:"2:1:1"}),(0,ea.jsx)(rb,{value:"1-2-1",children:"1:2:1"}),(0,ea.jsx)(rb,{value:"custom",children:"Custom"})]})]})]}),k.showAsCards&&"custom"===k.columnWidths&&(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Custom Widths:"}),(0,ea.jsx)("div",{className:"flex items-center gap-1",children:null===(g=k.columns)||void 0===g?void 0:g.map((e,t)=>{var s;return(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"number",value:(null===(s=k.customWidths)||void 0===s?void 0:s[t])||Math.floor(100/k.columns.length),onChange:e=>{const s=[...k.customWidths||k.columns.map(()=>Math.floor(100/k.columns.length))];s[t]=parseInt(e.target.value)||0,me(j,d(d({},k),{},{customWidths:s}))},className:"w-12 h-6 text-xs border rounded px-1",min:"5",max:"90"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"%"}),t<k.columns.length-1&&(0,ea.jsx)("span",{className:"text-xs text-slate-400 mx-1",children:":"})]},t)})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 ml-4 border-l pl-4 border-slate-200",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Padding:"}),(0,ea.jsx)("div",{className:"flex items-center gap-1",children:["top","right","bottom","left"].map(e=>(0,ea.jsxs)("label",{className:"flex items-center gap-0.5 text-xs cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:(k.paddingSides||["top","right","bottom","left"]).includes(e),onChange:t=>{const s=k.paddingSides||["top","right","bottom","left"],a=t.target.checked?[...s,e]:s.filter(t=>t!==e);me(j,d(d({},k),{},{paddingSides:a}))},className:"w-3 h-3 rounded"}),(0,ea.jsx)("span",{className:"capitalize",children:e[0].toUpperCase()})]},e))}),(0,ea.jsx)(BN,{type:"number",value:k.paddingSize||0,onChange:e=>me(j,d(d({},k),{},{paddingSize:parseInt(e.target.value)||0})),className:"w-20 h-7 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]})]}),(0,ea.jsx)("div",{className:"grid gap-4",style:{gridTemplateColumns:"card-grid"===N?"repeat(".concat(k.cardsPerRow||3,", minmax(0, 1fr))"):Array.isArray(k.columnWidths)?k.columnWidths.map(e=>"".concat(e,"fr")).join(" "):"1-2"===k.columnWidths?"1fr 2fr":"2-1"===k.columnWidths?"2fr 1fr":"1-1-2"===k.columnWidths?"1fr 1fr 2fr":"2-1-1"===k.columnWidths?"2fr 1fr 1fr":"1-2-1"===k.columnWidths?"1fr 2fr 1fr":"custom"===k.columnWidths&&Array.isArray(k.customWidths)?k.customWidths.map(e=>"".concat(e,"fr")).join(" "):"repeat(".concat(k.columnCount||2,", 1fr)")},children:(0,ea.jsx)(VK,{ids:(k.columns||[]).map((e,t)=>"col-".concat(t)),onReorder:(e,t)=>{const s=d(d({},k),{},{columns:tE(k.columns||[],e,t)});Array.isArray(k.columnWidths)&&(s.columnWidths=tE(k.columnWidths,e,t)),Array.isArray(k.customWidths)&&(s.customWidths=tE(k.customWidths,e,t)),me(j,s)},children:(k.columns||[]).map((e,s)=>(0,ea.jsx)(WK,{id:"col-".concat(s),children:(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-3 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsxs)("label",{className:"text-xs font-medium text-slate-600",children:["card-grid"===N?"Card":"Column"," ",s+1]}),"card-grid"===N&&(k.columns||[]).length>1&&(0,ea.jsxs)(eb,{value:String(s+1),onValueChange:e=>{const t=parseInt(e,10)-1;isNaN(t)||t===s||me(j,d(d({},k),{},{columns:tE(k.columns||[],s,t)}))},children:[(0,ea.jsx)(sb,{className:"w-14 h-7 text-xs ml-1",title:"Set position \u2014 the card moves here and the others shift","data-testid":"card-position-".concat(t,"-").concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:(k.columns||[]).map((e,t)=>(0,ea.jsx)(rb,{value:String(t+1),children:t+1},t))})]}),(0,ea.jsx)(OK,{index:s,total:(k.columns||[]).length,testIdPrefix:"column-".concat(t),onMove:(e,t)=>
2{const s=d(d({},k),{},{columns:IK(k.columns,e,t)});Array.isArray(k.columnWidths)&&(s.columnWidths=IK(k.columnWidths,e,t)),Array.isArray(k.customWidths)&&(s.customWidths=IK(k.customWidths,e,t)),me(j,s)}}),(0,ea.jsx)(UK,{testId:"column-".concat(t,"-dup-").concat(s),onClick:()=>{const t=[...k.columns];t.splice(s+1,0,d({},e));const a=d(d({},k),{},{columns:t,columnCount:t.length});if(Array.isArray(k.columnWidths)){const e=[...k.columnWidths];e.splice(s+1,0,e[s]),a.columnWidths=e}if(Array.isArray(k.customWidths)){const e=[...k.customWidths];e.splice(s+1,0,e[s]),a.customWidths=e}me(j,a)}})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(eb,{value:e.type||"text",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{type:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-32 h-7 text-xs","data-testid":"column-type-".concat(t,"-").concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"text",children:"Text Only"}),(0,ea.jsx)(rb,{value:"image",children:"Image Only"}),(0,ea.jsx)(rb,{value:"video",children:"Video Only"}),(0,ea.jsx)(rb,{value:"card",children:"Media + Text"}),(0,ea.jsx)(rb,{value:"avatar",children:"Letter Circle"})]})]}),k.columns.length>1&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>{const e=k.columns.filter((e,t)=>t!==s),t=Array.isArray(k.columnWidths)?k.columnWidths.filter((e,t)=>t!==s):null;me(j,d(d({},k),{},{columns:e,columnCount:e.length,columnWidths:t}))},title:"Delete this column","data-testid":"delete-column-".concat(t,"-").concat(s),children:(0,ea.jsx)(wD,{size:14})})]})]}),"video"===e.type&&(0,ea.jsxs)("div",{className:"space-y-2 border border-slate-200 rounded p-2 bg-white",children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-slate-600 block",children:"Video"}),(0,ea.jsx)(BN,{value:e.videoUrl||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoUrl:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"YouTube, Vimeo, or video URL",className:"h-8 text-xs"}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400",children:"Supports YouTube, Vimeo, or direct video links"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Height:"}),(0,ea.jsxs)(eb,{value:e.videoHeight||"250",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoHeight:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"150",children:"150px"}),(0,ea.jsx)(rb,{value:"200",children:"200px"}),(0,ea.jsx)(rb,{value:"250",children:"250px"}),(0,ea.jsx)(rb,{value:"300",children:"300px"}),(0,ea.jsx)(rb,{value:"350",children:"350px"}),(0,ea.jsx)(rb,{value:"400",children:"400px"})]})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"video-autoplay-".concat(j,"-").concat(s),checked:!1!==e.videoAutoplay,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoAutoplay:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"video-autoplay-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Autoplay"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"video-muted-".concat(j,"-").concat(s),checked:!1!==e.videoMuted,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoMuted:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"video-muted-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Muted"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"video-loop-".concat(j,"-").concat(s),checked:!1!==e.videoLoop,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoLoop:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"video-loop-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Loop"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"video-controls-".concat(j,"-").concat(s),checked:!1!==e.videoControls,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoControls:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"video-controls-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Controls"})]})]})]}),"card"===e.type&&(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-indigo-50 rounded border border-indigo-100",children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-indigo-700",children:"Media Position:"}),(0,ea.jsxs)(eb,{value:e.imagePosition||"top",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imagePosition:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"top",children:"Above Text"}),(0,ea.jsx)(rb,{value:"bottom",children:"Below Text"})]})]})]}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded p-2 bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-slate-600",children:"Media Type:"}),(0,ea.jsxs)(eb,{value:e.mediaType||"image",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{mediaType:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"image",children:"Image"}),(0,ea.jsx)(rb,{value:"video",children:"Video"})]})]})]}),"image"===(e.mediaType||"image")&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{f("".concat(j,":").concat(s)),p(!0)},className:"h-8",children:[(0,ea.jsx)(jD,{size:14,className:"mr-1"}),e.imageUrl?"Change":"Select"]}),e.imageUrl&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-green-600",children:"\u2713"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{const e=[...k.columns];e[s]=d(d({},e[s]),{},{imageUrl:"",imageAlt:""}),me(j,d(d({},k),{},{columns:e}))},className:"h-7 px-2 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]})]}),e.imageUrl&&(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",className:"w-full h-24 object-cover rounded"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsxs)(eb,{value:e.cardImageSizeMode||"height",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{cardImageSizeMode:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"height",children:"By Height"}),(0,ea.jsx)(rb,{value:"width",children:"By Width"}),(0,ea.jsx)(rb,{value:"custom",children:"Custom (W\xd7H)"})]})]}),"custom"===e.cardImageSizeMode?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:e.cardImageWidth||200,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{cardImageWidth:parseInt(e.target.value)||200}
2),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-7 text-xs",min:"50",max:"800"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:e.cardImageHeight||200,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{cardImageHeight:parseInt(e.target.value)||200}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-7 text-xs",min:"50",max:"800"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):"width"===e.cardImageSizeMode?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:e.cardImageWidth||200,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{cardImageWidth:parseInt(e.target.value)||200}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-7 text-xs",min:"50",max:"800"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:e.cardImageHeight||200,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{cardImageHeight:parseInt(e.target.value)||200}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-7 text-xs",min:"50",max:"800"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Fit:"}),(0,ea.jsxs)(eb,{value:e.cardImageFit||"contain",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{cardImageFit:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"contain",children:"Show Full"}),(0,ea.jsx)(rb,{value:"cover",children:"Fill & Crop"})]})]})]}),(0,ea.jsx)(BN,{value:e.imageAlt||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageAlt:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"Alt text",className:"h-7 text-xs"}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center flex-wrap pt-2 border-t border-slate-100",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Shape:"}),(0,ea.jsxs)(eb,{value:e.shapeMask||"none",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shapeMask:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs","data-testid":"card-shape-mask-".concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"No Mask"}),(0,ea.jsx)(rb,{value:"circle",children:"Circle"}),(0,ea.jsx)(rb,{value:"ellipse",children:"Ellipse"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"diamond",children:"Diamond"}),(0,ea.jsx)(rb,{value:"hexagon",children:"Hexagon"}),(0,ea.jsx)(rb,{value:"octagon",children:"Octagon"}),(0,ea.jsx)(rb,{value:"star",children:"Star"}),(0,ea.jsx)(rb,{value:"arch",children:"Arch"})]})]}),e.shapeMask&&"none"!==e.shapeMask&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Border:"}),(0,ea.jsx)(BN,{type:"number",value:e.shapeBorderWidth||0,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shapeBorderWidth:parseInt(e.target.value)||0}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-7 text-xs",min:"0",max:"20"}),(0,ea.jsx)(wq,{value:e.shapeBorderColor||"#ffffff",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shapeBorderColor:e.target.value}),me(j,d(d({},k),{},{columns:t}))},className:"w-7 h-7 rounded border cursor-pointer",title:"Border Color"})]})]})]}),"video"===e.mediaType&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(BN,{value:e.videoUrl||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoUrl:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"YouTube, Vimeo, or video URL",className:"h-8 text-xs"}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400",children:"Supports YouTube, Vimeo, or direct video links"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Height:"}),(0,ea.jsxs)(eb,{value:e.videoHeight||"200",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoHeight:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"150",children:"150px"}),(0,ea.jsx)(rb,{value:"200",children:"200px"}),(0,ea.jsx)(rb,{value:"250",children:"250px"}),(0,ea.jsx)(rb,{value:"300",children:"300px"}),(0,ea.jsx)(rb,{value:"350",children:"350px"})]})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"autoplay-".concat(j,"-").concat(s),checked:!1!==e.videoAutoplay,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoAutoplay:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"autoplay-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Autoplay"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"muted-".concat(j,"-").concat(s),checked:!1!==e.videoMuted,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoMuted:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"muted-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Muted"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"loop-".concat(j,"-").concat(s),checked:!1!==e.videoLoop,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoLoop:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"loop-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Loop"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",id:"controls-".concat(j,"-").concat(s),checked:!1!==e.videoControls,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{videoControls:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),(0,ea.jsx)("label",{htmlFor:"controls-".concat(j,"-").concat(s),className:"text-[10px] text-slate-500",children:"Controls"})]})]})]})]}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded p-2 bg-white",children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-slate-600 mb-2 block",children:"Text Content"}),(0,ea.jsx)(Cq,{content:e.html||"<p>Enter text...</p>",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{html:e}),me(j,d(d({},k),{},{columns:t}))},placeholder:"Enter text content...",enableAiAssist:!0})]})]}),"avatar"===e.type&&(0,ea.jsxs)("div",{className:"space-y-2 border border-slate-200 rounded p-2 bg-white",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Letter / Initials"}),(0,ea.jsx)(BN,{value:e.avatarText||"",maxLength:3,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{avatarText:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"A",className:"h-8 text-xs","data-testid":"column-avatar-text-".concat(t,"-").concat(s)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Circle Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wq,{value:e.avatarColor||"#4F46E5",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{avatarColor:e.target.value}),me(j,d(d({},k),{},{columns:t}))}}),(0,ea.jsx)("span",{className:"text-xs font-mono text-slate-500",children:e.avatarColor||"#4F46E5"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Title (optional)"}),(0,ea.jsx)(BN,{value:e.avatarTitle||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{avatarTitle:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"e.g. Acme Inc.",className:"h-8 text-xs","data-testid":"column-avatar-title-".concat(t,"-").concat(s)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Subtitle (optional)"}),(0,ea.jsx)(BN,{value:e.avatarSubtitle||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{avatarSubtitle:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"e.g. Enterprise partner",className:"h-8 text-xs"})]}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Renders a colored circle with your letter \u2014 like the Team cards. Leave the letter blank to auto-use the Title's first character."})]}),"text"===e.type&&(0,ea.jsx)("div",{className:"space-y-2",children:(0,ea.jsx)(Cq,{content:e.html||"<p>Enter text...</p>",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{html:e}),me(j,d(d({},k),{},{columns:t}))},placeholder:"Enter column text...",minHeight:"80px",className:"bg-white rounded border border-slate-200",showToolbar:!0,enableAiAssist:!0})}),"image"===e.type&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{f("".concat(j,":").concat(s)),p(!0)},className:"h-8","data-testid":"column-media-library-".concat(t,"-").concat(s),children:[(0,ea.jsx)(jD,{size:14,className:"mr-1"}),e.imageUrl?"Change":"Select Image"]}),e.imageUrl&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-green-600",children:"\u2713 Image selected"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{const e=[...k.columns];e[s]=d(d({},e[s]),{},{imageUrl:"",imageAlt:""}),me(j,d(d({},k),{},{columns:e}))},className:"h-8 px-2 text-red-500 hover:text-red-700 hover:bg-red-50",title:"Remove image",children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.imageAlt||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageAlt:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"Alt text (accessibility)",className:"h-8 text-sm","data-testid":"column-image-alt-".concat(t,"-").concat(s)}),(0,ea.jsx)(BN,{value:e.imageCaption||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageCaption:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"Caption (visible)",className:"h-8 text-sm","data-testid":"column-image-caption-".concat(t,"-").concat(s)})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center flex-wrap",children:[(0,ea.jsxs)(eb,{value:e.imageSizeMode||"width",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageSizeMode:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs","data-testid":"column-image-size-mode-".concat(t,"-").concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"width",children:"By Width"}),(0,ea.jsx)(rb,{value:"height",children:"By Height"})]})]}),"width"===(e.imageSizeMode||"width")?(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"W:"}),(0,ea.jsx)(BN,{type:"number",value:e.imageWidth||200,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageWidth:parseInt(e.target.value)||200}
2),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-8 text-sm",min:"50",max:"1000","data-testid":"column-image-width-".concat(t,"-").concat(s)}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"px"})]}):(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsx)(BN,{type:"number",value:e.imageHeight||200,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageHeight:parseInt(e.target.value)||200}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-8 text-sm",min:"50",max:"1000","data-testid":"column-image-height-".concat(t,"-").concat(s)}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"px"})]}),(0,ea.jsxs)(eb,{value:e.imageAlign||"center",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageAlign:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs","data-testid":"column-image-align-".concat(t,"-").concat(s),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center mt-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Corners:"}),(0,ea.jsxs)(eb,{value:e.imageCorners||"rounded",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{imageCorners:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"square",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center flex-wrap mt-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Shape:"}),(0,ea.jsxs)(eb,{value:e.shapeMask||"none",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shapeMask:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"No Mask"}),(0,ea.jsx)(rb,{value:"circle",children:"Circle"}),(0,ea.jsx)(rb,{value:"ellipse",children:"Ellipse"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"diamond",children:"Diamond"}),(0,ea.jsx)(rb,{value:"hexagon",children:"Hexagon"}),(0,ea.jsx)(rb,{value:"octagon",children:"Octagon"}),(0,ea.jsx)(rb,{value:"star",children:"Star"}),(0,ea.jsx)(rb,{value:"arch",children:"Arch"})]})]}),e.shapeMask&&"none"!==e.shapeMask&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsx)(BN,{type:"number",value:e.shapeSize||200,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shapeSize:parseInt(e.target.value)||200}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-8 text-xs",min:"50",max:"600"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"}),(0,ea.jsx)("label",{className:"text-xs text-slate-500 ml-2",children:"Border:"}),(0,ea.jsx)(BN,{type:"number",value:e.shapeBorderWidth||0,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shapeBorderWidth:parseInt(e.target.value)||0}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-8 text-xs",min:"0",max:"20"}),(0,ea.jsx)(wq,{value:e.shapeBorderColor||"#ffffff",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shapeBorderColor:e.target.value}),me(j,d(d({},k),{},{columns:t}))},className:"w-8 h-8 rounded border cursor-pointer",title:"Border Color"})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 items-center flex-wrap mt-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Padding:"}),(0,ea.jsxs)(eb,{value:e.paddingSide||"all",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{paddingSide:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-20 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All"}),(0,ea.jsx)(rb,{value:"top",children:"Top"}),(0,ea.jsx)(rb,{value:"right",children:"Right"}),(0,ea.jsx)(rb,{value:"bottom",children:"Bottom"}),(0,ea.jsx)(rb,{value:"left",children:"Left"})]})]}),(0,ea.jsx)(BN,{type:"number",value:e.paddingSize||0,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{paddingSize:parseInt(e.target.value)||0}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-8 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]}),e.imageUrl&&(0,ea.jsxs)("div",{style:{textAlign:e.imageAlign||"center"},children:[(0,ea.jsx)("div",{className:"inline-block mt-2 overflow-hidden",style:d({width:e.shapeMask&&"none"!==e.shapeMask?"".concat(e.shapeSize||200,"px"):"height"===e.imageSizeMode?"auto":"".concat(e.imageWidth||200,"px"),height:e.shapeMask&&"none"!==e.shapeMask?"ellipse"===e.shapeMask?"".concat(1.25*(e.shapeSize||200),"px"):"".concat(e.shapeSize||200,"px"):"height"===e.imageSizeMode?"".concat(e.imageHeight||200,"px"):"auto",borderRadius:"circle"===e.shapeMask||"ellipse"===e.shapeMask?"50%":"rounded"===e.shapeMask?"20px":"0",clipPath:"diamond"===e.shapeMask?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===e.shapeMask?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===e.shapeMask?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===e.shapeMask?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===e.shapeMask?"ellipse(50% 100% at 50% 100%)":"none",border:e.shapeBorderWidth&&"none"!==e.shapeMask?"".concat(e.shapeBorderWidth,"px solid ").concat(e.shapeBorderColor||"#ffffff"):"none"},e.paddingSize?{paddingTop:"all"!==e.paddingSide&&"top"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingRight:"all"!==e.paddingSide&&"right"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingBottom:"all"!==e.paddingSide&&"bottom"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px"),paddingLeft:"all"!==e.paddingSide&&"left"!==e.paddingSide&&e.paddingSide?"0":"".concat(e.paddingSize,"px")}:{}),children:(0,ea.jsx)("img",{src:e.imageUrl,alt:e.imageAlt||"",className:"w-full h-full object-cover"})}),e.imageCaption&&(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1 italic",style:{textAlign:e.imageAlign||"center"},children:e.imageCaption})]})]}),!e.hasColumnLink&&(0,ea.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.hasButton||!1,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{hasButton:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-4 h-4 rounded border-slate-300"}),(0,ea.jsx)("span",{className:"text-xs font-medium text-slate-600",children:"Add Button"})]}),e.hasButton&&(0,ea.jsxs)("div",{className:"mt-2 space-y-2 p-2 bg-slate-100 rounded",children:[(0,ea.jsx)(BN,{value:e.buttonText||"Click Me",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonText:e.target.value}),me(j,d(d({},k),{},{columns:t}))},placeholder:"Button Text",className:"h-8 text-sm"}),(0,ea.jsx)(I$,{value:e.buttonUrl||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonUrl:e}),me(j,d(d({},k),{},{columns:t}))},pages:n,anchors:ee,label:"Button Link",testId:"col-".concat(s,"-button-url")}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:e.buttonStyle||"solid",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonStyle:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{placeholder:"Style"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline"}),(0,ea.jsx)(rb,{value:"ghost",children:"Ghost"}),(0,ea.jsx)(rb,{value:"gradient",children:"Gradient"}),(0,ea.jsx)(rb,{value:"soft",children:"Soft"})]})]}),(0,ea.jsxs)(eb,{value:e.buttonSize||"md",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonSize:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{placeholder:"Size"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"sm",children:"Small"}),(0,ea.jsx)(rb,{value:"md",children:"Medium"}),(0,ea.jsx)(rb,{value:"lg",children:"Large"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"BG:"}),(0,ea.jsx)(wq,{value:e.buttonColor||"#6366f1",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonColor:e.target.value}),me(j,d(d({},k),{},{columns:t}))},className:"w-7 h-7 rounded border cursor-pointer"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Text:"}),(0,ea.jsx)(wq,{value:e.buttonTextColor||"#ffffff",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonTextColor:e.target.value}),me(j,d(d({},k),{},{columns:t}))},className:"w-7 h-7 rounded border cursor-pointer"})]}),"gradient"===e.buttonStyle&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Grad:"}),(0,ea.jsx)(wq,{value:e.buttonGradientColor||"#8b5cf6",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonGradientColor:e.target.value}),me(j,d(d({},k),{},{columns:t}))},className:"w-7 h-7 rounded border cursor-pointer"})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.buttonFullWidth||!1,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonFullWidth:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3 rounded"}),"Full Width"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.buttonOpenInNewTab||!1,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonOpenInNewTab:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3 rounded accent-indigo-600","data-testid":"card-col-".concat(s,"-new-tab")}),"New window"]})]}),(0,ea.jsx)("div",{className:"mt-2",children:(0,ea.jsx)($$,{fields:e,testPrefix:"col-".concat(s,"-btn"),onPatch:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),e),me(j,d(d({},k),{},{columns:t}))}})}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"H:"}),(0,ea.jsxs)(eb,{value:e.buttonAlign||"center",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonAlign:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"V:"}),(0,ea.jsxs)(eb,{value:e.buttonVerticalAlign||"bottom",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonVerticalAlign:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"top",children:"Top"}),(0,ea.jsx)(rb,{value:"middle",children:"Middle"}),(0,ea.jsx)(rb,{value:"bottom",children:"Bottom"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Top:"}),(0,ea.jsx)(BN,{type:"number",value:e.buttonMarginTop||16,onChange:e=>{const t=parseInt(e.target.value),a=Number.isFinite(t)?Math.min(200,Math.max(0,t)):0,n=[...k.columns];n[s]=d(d({},n[s]),{},{buttonMarginTop:a}),me(j,d(d({},k),{},{columns:n}))},className:"w-20 h-7 text-xs",min:"0",max:"200"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]}),k.showAsCards&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-2 p-2 bg-indigo-50 rounded",children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-indigo-700",children:"Card Position:"}),(0,ea.jsxs)(eb,{value:e.buttonCardPosition||"inside",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{buttonCardPosition:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"inside",children:"Inside"}),(0,ea.jsx)(rb,{value:"outside",children:"Outside"})]})]}),(0,ea.jsx)("span",{className:"text-[10px] text-indigo-600",children:"outside"===e.buttonCardPosition?"(Below card)":"(Within card)"})]}),(0,ea.jsx)("div",{className:"mt-2 p-2 bg-white rounded text-center",children:(0,ea.jsx)("button",{className:"\n ".concat("sm"===e.buttonSize?"px-3 py-1 text-sm":"","\n ").concat("lg"===e.buttonSize?"px-6 py-3 text-lg":"","\n ").concat("md"!==e.buttonSize&&e.buttonSize?"":"px-4 py-2","\n ").concat(e.buttonFullWidth?"w-full":"","\n ").concat("outline"===e.buttonStyle?"bg-transparent border-2":"","\n ").concat("ghost"===e.buttonStyle?"bg-transparent":"","\n rounded-lg font-medium transition-all\n "),style:{backgroundColor:"solid"!==e.buttonStyle&&e.buttonStyle?"transparent":e.buttonColor||"#6366f1",color:"solid"!==e.buttonStyle&&e.buttonStyle?e.buttonColor||"#6366f1":e.buttonTextColor||"#ffffff",borderColor:"outline"===e.buttonStyle?e.buttonColor||"#6366f1":"transparent"},children:e.buttonText||"Click Me"})})]})]}),!e.hasButton&&(0,ea.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.hasColumnLink||!1,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{hasColumnLink:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-4 h-4 rounded border-slate-300"}),(0,ea.jsx)("span",{className:"text-xs font-medium text-slate-600",children:"Make Column Clickable"})]}),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400 mt-1",children:"When enabled, clicking anywhere on this column navigates to the link"}),e.hasColumnLink&&(0,ea.jsxs)("div",{className:"mt-2 p-2 bg-slate-100 rounded",children:[(0,ea.jsx)(I$,{value:e.columnUrl||"",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{columnUrl:e}),me(j,d(d({},k),{},{columns:t}))},pages:n,anchors:ee,label:"Column Link",testId:"col-".concat(s,"-column-url")}),(0,ea.jsx)("div",{className:"flex items-center gap-2 mt-2",children:(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.columnLinkNewTab||!1,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{columnLinkNewTab:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3 rounded"}),"Open in new tab"]})})]})]}),(0,ea.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-200",children:[(0,ea.jsx)("div",{className:"flex items-center gap-1 mb-2",children:(0,ea.jsx)("span",{className:"text-xs font-medium text-slate-600",children:"Column Style"})}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"BG:"}),(0,ea.jsx)(wq,{value:e.backgroundColor||"#ffffff",onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{backgroundColor:e.target.value}),me(j,d(d({},k),{},{columns:t}))},className:"w-7 h-7 rounded border cursor-pointer"}),(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-400",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.bgTransparent||!1,onChang
2e:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{bgTransparent:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3 rounded"}),"None"]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Shadow:"}),(0,ea.jsxs)(eb,{value:e.shadow||"none",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{shadow:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-20 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"sm",children:"Small"}),(0,ea.jsx)(rb,{value:"md",children:"Medium"}),(0,ea.jsx)(rb,{value:"lg",children:"Large"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Hover:"}),(0,ea.jsxs)(eb,{value:e.hoverEffect||"none",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{hoverEffect:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-24 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"shadow",children:"Shadow"}),(0,ea.jsx)(rb,{value:"lift",children:"Lift"}),(0,ea.jsx)(rb,{value:"scale",children:"Scale"}),(0,ea.jsx)(rb,{value:"glow",children:"Glow"}),(0,ea.jsx)(rb,{value:"darken",children:"Darken"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",title:"0 = use Card Radius default",children:"Radius:"}),(0,ea.jsx)(BN,{type:"number",value:e.borderRadius||0,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{borderRadius:parseInt(e.target.value)||0}),me(j,d(d({},k),{},{columns:t}))},className:"w-12 h-7 text-xs",min:"0",max:"50"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Padding:"}),(0,ea.jsx)(BN,{type:"number",value:e.columnPadding||0,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{columnPadding:parseInt(e.target.value)||0}),me(j,d(d({},k),{},{columns:t}))},className:"w-20 h-7 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]}),(0,ea.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"text-xs font-semibold text-slate-600 mb-2 flex items-center gap-1",children:[(0,ea.jsx)(Oj,{size:12}),"Column Settings"]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Animation:"}),(0,ea.jsxs)(eb,{value:e.animation||"none",onValueChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{animation:e}),me(j,d(d({},k),{},{columns:t}))},children:[(0,ea.jsx)(sb,{className:"w-28 h-7 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"None"}),(0,ea.jsx)(rb,{value:"fadeIn",children:"Fade In"}),(0,ea.jsx)(rb,{value:"fadeInUp",children:"Fade In Up"}),(0,ea.jsx)(rb,{value:"fadeInDown",children:"Fade In Down"}),(0,ea.jsx)(rb,{value:"fadeInLeft",children:"Slide from Left"}),(0,ea.jsx)(rb,{value:"fadeInRight",children:"Slide from Right"}),(0,ea.jsx)(rb,{value:"zoomIn",children:"Zoom In"}),(0,ea.jsx)(rb,{value:"bounceIn",children:"Bounce In"}),(0,ea.jsx)(rb,{value:"pulse",children:"Pulse (Loop)"}),(0,ea.jsx)(rb,{value:"float",children:"Float (Loop)"}),(0,ea.jsx)(rb,{value:"bounce",children:"Bounce (Loop)"}),(0,ea.jsx)(rb,{value:"glowPulse",children:"Glow (Loop)"})]})]}),e.animation&&"none"!==e.animation&&!["pulse","float","bounce","glowPulse"].includes(e.animation)&&(0,ea.jsxs)("label",{className:"flex items-center gap-1 text-xs text-slate-500 ml-2",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.animateOnScroll||!1,onChange:e=>{const t=[...k.columns];t[s]=d(d({},t[s]),{},{animateOnScroll:e.target.checked}),me(j,d(d({},k),{},{columns:t}))},className:"w-3 h-3"}),"On scroll"]})]})]})]})},"col-".concat(s)))})})]})]}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsxs)(FG,{isActive:"animation"===B(j),children:[(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))}),k.animation&&k.animation.entrance&&"none"!==k.animation.entrance&&(0,ea.jsxs)("div",{className:"mt-4 p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[(0,ea.jsxs)("p",{className:"text-xs text-amber-700 mb-2",children:["This block has an entrance animation: ",(0,ea.jsx)("strong",{children:k.animation.entrance})]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{animation:{entrance:"none",speed:"normal",delay:"0",attention:"none"}})),className:"text-amber-700 border-amber-300 hover:bg-amber-100",children:"Clear All Animations"})]})]})]}),"two-column"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(FG,{isActive:"content"===B(j),children:(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Left Column"}),(0,ea.jsx)("div",{contentEditable:!0,suppressContentEditableWarning:!0,onBlur:e=>{me(j,d(d({},k),{},{leftHtml:e.currentTarget.innerHTML}))},dangerouslySetInnerHTML:{__html:k.leftHtml||"<p>Left column</p>"},className:"min-h-[100px] outline-none focus:ring-2 focus:ring-indigo-200 rounded p-2 border border-slate-200","data-testid":"two-column-left-".concat(t)})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Right Column"}),(0,ea.jsx)("div",{contentEditable:!0,suppressContentEditableWarning:!0,onBlur:e=>{me(j,d(d({},k),{}
2,{rightHtml:e.currentTarget.innerHTML}))},dangerouslySetInnerHTML:{__html:k.rightHtml||"<p>Right column</p>"},className:"min-h-[100px] outline-none focus:ring-2 focus:ring-indigo-200 rounded p-2 border border-slate-200","data-testid":"two-column-right-".concat(t)})]})]})}),(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsx)("div",{className:"text-sm text-slate-500 p-4 bg-slate-50 rounded-lg",children:"No additional settings for two-column blocks."})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]}),"image-text-row"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:["settings","style","animation"].includes(B(j)),contentPane:(0,ea.jsx)(K$,{content:k,onChange:e=>me(j,e),openMediaPicker:(e,t)=>{f("".concat(j,":carousel:").concat(t)),p(!0)},blockId:j,pages:n,anchors:ee}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsx)("div",{className:"text-sm text-slate-500 p-4 bg-slate-50 rounded-lg",children:"Image + Text settings are available in the Content panel on the left."})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"image-text-stack"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:["settings","style","animation"].includes(B(j)),contentPane:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>fe(j),"data-testid":"open-layout-stack-media-library-".concat(t),children:[(0,ea.jsx)(jD,{size:16,className:"mr-2"}),k.imageUrl?"Change Image":"Select Image"]}),k.imageUrl&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("span",{className:"text-xs text-green-600",children:"\u2713 Image selected"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>me(j,d(d({},k),{},{imageUrl:"",imageAlt:""})),className:"h-8 px-2 text-red-500 hover:text-red-700 hover:bg-red-50",title:"Remove image",children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Text Content"}),(0,ea.jsx)(Cq,{content:k.textHtml||"<p>Text content</p>",onChange:e=>me(j,d(d({},k),{},{textHtml:e})),placeholder:"Enter text content...",enableAiAssist:!0})]}),k.imageUrl&&(0,ea.jsx)("div",{className:"mt-2",style:{textAlign:k.imageAlign||"center"},children:k.shapeMask&&"none"!==k.shapeMask?(0,ea.jsx)("div",{className:"inline-block overflow-hidden",style:{width:"".concat(k.shapeSize||250,"px"),height:"ellipse"===k.shapeMask?"".concat(1.25*(k.shapeSize||250),"px"):"".concat(k.shapeSize||250,"px"),maxWidth:"100%",borderRadius:"circle"===k.shapeMask||"ellipse"===k.shapeMask?"50%":"rounded"===k.shapeMask?"20px":"0",clipPath:"diamond"===k.shapeMask?"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":"hexagon"===k.shapeMask?"polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)":"octagon"===k.shapeMask?"polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)":"star"===k.shapeMask?"polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)":"arch"===k.shapeMask?"ellipse(50% 100% at 50% 100%)":"none",border:k.shapeBorderWidth?"".concat(k.shapeBorderWidth,"px solid ").concat(k.shapeBorderColor||"#ffffff"):"none"},children:(0,ea.jsx)("img",{src:k.imageUrl,alt:k.imageAlt||"",className:"w-full h-full object-cover"})}):(0,ea.jsx)("img",{src:k.imageUrl,alt:k.imageAlt||"",className:"rounded inline-block",style:{width:"height"===k.imageSizeMode?"auto":"".concat(k.imageWidth||300,"px"),height:"height"===k.imageSizeMode?"".concat(k.imageHeight||200,"px"):"auto",maxWidth:"100%"}})})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"settings"===B(j),children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Layout"}),(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Image Position:"}),(0,ea.jsxs)(eb,{value:k.imagePosition||"top",onValueChange:e=>me(j,d(d({},k),{},{imagePosition:e})),children:[(0,ea.jsx)(sb,{className:"w-32","data-testid":"image-position-stack-".concat(t),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"top",children:"Top"}),(0,ea.jsx)(rb,{value:"bottom",children:"Bottom"})]})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Image Settings"}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(BN,{value:k.imageAlt||"",onChange:e=>me(j,d(d({},k),{},{imageAlt:e.target.value})),placeholder:"Alt text (for accessibility)","data-testid":"layout-stack-image-alt-".concat(t)}),(0,ea.jsx)(Mq,{sizeMode:k.imageSizeMode||"width",width:k.imageWidth||300,height:k.imageHeight||200,align:k.imageAlign||"center",onSizeModeChange:e=>me(j,d(d({},k),{},{imageSizeMode:e})),onWidthChange:e=>me(j,d(d({},k),{},{imageWidth:e})),onHeightChange:e=>me(j,d(d({},k),{},{imageHeight:e})),onAlignChange:e=>me(j,d(d({},k),{},{imageAlign:e}))}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 pt-2 border-t border-slate-200",children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Corners:"}),(0,ea.jsxs)(eb,{value:k.imageCorners||"rounded",onValueChange:e=>me(j,d(d({},k),{},{imageCorners:e})),children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"square",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Shape Mask"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:k.shapeMask||"none",onValueChange:e=>me(j,d(d({},k),{},{shapeMask:e})),children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"No Mask"}),(0,ea.jsx)(rb,{value:"circle",children:"Circle"}),(0,ea.jsx)(rb,{value:"ellipse",children:"Ellipse"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"diamond",children:"Diamond"}),(0,ea.jsx)(rb,{value:"hexagon",children:"Hexagon"}),(0,ea.jsx)(rb,{value:"octagon",children:"Octagon"}),(0,ea.jsx)(rb,{value:"star",children:"Star"}),(0,ea.jsx)(rb,{value:"arch",children:"Arch"})]})]}),k.shapeMask&&"none"!==k.shapeMask&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500",children:"Size:"}),(0,ea.jsx)(BN,{type:"number",value:k.shapeSize||250,onChange:e=>me(j,d(d({},k),{},{shapeSize:parseInt(e.target.value)||250})),className:"w-20 h-8 text-xs",min:"50",max:"600"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"}),(0,ea.jsx)("label",{className:"text-xs text-slate-500 ml-2",children:"Border:"}),(0,ea.jsx)(BN,{type:"number",value:k.shapeBorderWidth||0,onChange:e=>me(j,d(d({},k),{},{shapeBorderWidth:parseInt(e.target.value)||0})),className:"w-20 h-8 text-xs",min:"0",max:"20"}),(0,ea.jsx)(wq,{value:k.shapeBorderColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{shapeBorderColor:e.target.value})),className:"w-8 h-8 rounded border cursor-pointer",title:"Border Color"})]})]})]}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-100",children:[(0,ea.jsx)("div",{className:"text-xs font-semibold text-slate-500 mb-3 uppercase tracking-wide",children:"Padding"}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsxs)(eb,{value:k.paddingSide||"all",onValueChange:e=>me(j,d(d({},k),{},{paddingSide:e})),children:[(0,ea.jsx)(sb,{className:"w-20 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All"}),(0,ea.jsx)(rb,{value:"top",children:"Top"}),(0,ea.jsx)(rb,{value:"right",children:"Right"}),(0,ea.jsx)(rb,{value:"bottom",children:"Bottom"}),(0,ea.jsx)(rb,{value:"left",children:"Left"})]})]}),(0,ea.jsx)(BN,{type:"number",value:k.paddingSize||0,onChange:e=>me(j,d(d({},k),{},{paddingSize:parseInt(e.target.value)||0})),className:"w-20 h-8 text-xs",min:"0",max:"100"}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"px"})]})]})]})}),(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"video"===N&&(0,ea.jsxs)("div",{className:"space-y-3 mt-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-slate-500 mb-1 block",children:"Video URL"}),(0,ea.jsx)("input",{type:"text",value:k.videoUrl||"",onChange:e=>me(j,d(d({},k),{},{videoUrl:e.target.value})),placeholder:"YouTube, Vimeo, or direct video URL",className:"w-full px-3 py-2 text-sm border rounded-lg focus:ring-2 focus:ring-blue-300 focus:border-blue-400","data-testid":"video-url-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-slate-500 mb-1 block",children:"Width"}),(0,ea.jsxs)("select",{value:k.width||"large",onChange:e=>me(j,d(d({},k),{},{width:e.target.value})),className:"w-full px-2 py-1.5 text-sm border rounded-lg",children:[(0,ea.jsx)("option",{value:"full",children:"Full Width"}),(0,ea.jsx)("option",{value:"large",children:"Large"}),(0,ea.jsx)("option",{value:"medium",children:"Medium"}),(0,ea.jsx)("option",{value:"small",children:"Small"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-slate-500 mb-1 block",children:"Aspect Ratio"}),(0,ea.jsxs)("select",{value:k.aspectRatio||"16:9",onChange:e=>me(j,d(d({},k),{},{aspectRatio:e.target.value})),className:"w-full px-2 py-1.5 text-sm border rounded-lg",children:[(0,ea.jsx)("option",{value:"16:9",children:"16:9 (Widescreen)"}),(0,ea.jsx)("option",{value:"4:3",children:"4:3 (Standard)"}),(0,ea.jsx)("option",{value:"21:9",children:"21:9 (Cinema)"}),(0,ea.jsx)("option",{value:"1:1",children:"1:1 (Square)"})]})]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:k.autoplay||!1,onChange:e=>me(j,d(d({},k),{},{autoplay:e.target.checked})),className:"rounded border-slate-300"}),"Autoplay"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:k.muted||!1,onChange:e=>me(j,d(d({},k),{},{muted:e.target.checked})),className:"rounded border-slate-300"}),"Muted"]}),(0,ea.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:k.loop||!1,onChange:e=>me(j,d(d({},k),{},{loop:e.target.checked})),className:"rounded border-slate-300"}),"Loop"]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs font-medium text-slate-500 mb-1 block",children:"Caption (optional)"}),(0,ea.jsx)("input",{type:"text",value:k.caption||"",onChange:e=>me(j,d(d({},k),{},{caption:e.target.value})),placeholder:"Video caption",className:"w-full px-3 py-1.5 text-xs border rounded-lg","data-testid":"video-caption-input"})]})]}),"hero"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:["style","animation"].includes(B(j)),contentPane:(0,ea.jsx)(aG,{content:k,onChange:e=>me(j,e),pages:n,anchors:ee}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"form"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsx)(cG,{content:k,onChange:e=>me(j,e)}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"gallery"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsx)(vG,{content:k,onChange:e=>me(j,e)}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"ticker"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsx)(yG,{content:k,onChange:e=>me(j,e),openMediaPicker:fe,blockId:j}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"article-feed"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsx)(NG,{content:k,onChange:e=>me(j,e)}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"events-calendar"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsx)(wG,{content:k,onChange:e=>me(j,e)}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isAc
2tive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"testimonials"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{"data-testid":"testimonials-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"What Our Customers Say"})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"testimonials-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Testimonials"}),(0,ea.jsxs)(sg,{"data-testid":"testimonials-add-".concat(j),variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"ti-".concat(Date.now()),quote:"",author:"",role:"",avatar:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Testimonial ",t+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter(t=>t.id!==e.id)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(YN,{value:e.quote||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{quote:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Quote",rows:2}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.author||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{author:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Author name"}),(0,ea.jsx)(BN,{value:e.role||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{role:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Role / Company"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.avatar?(0,ea.jsx)("img",{src:e.avatar,alt:"",className:"h-10 w-10 object-cover rounded-full border"}):(0,ea.jsx)("div",{className:"h-10 w-10 border border-dashed rounded-full flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"testimonials-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":testiavatar:").concat(t)),children:"Choose from Library"})]}),(0,ea.jsx)(BN,{value:e.avatar||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{avatar:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"\u2026or paste avatar image URL",className:"h-8 text-xs"})]},e.id))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"pricing"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{"data-testid":"pricing-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Pricing Plans"})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"pricing-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1 pt-1 border-t border-slate-100",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Button style (applies to all plan buttons)"}),(0,ea.jsx)($$,{fields:k,testPrefix:"pricing-btn-".concat(j),onPatch:e=>me(j,d(d({},k),e))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Columns"}),(0,ea.jsxs)(eb,{value:String(k.columnCount||"auto"),onValueChange:e=>{const t="auto"===e?d({},k):d(d({},k),{},{columnCount:parseInt(e,10)});"auto"===e&&delete t.columnCount,me(j,t)},children:[(0,ea.jsx)(sb,{"data-testid":"pricing-columns-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto (up to 4)"}),(0,ea.jsx)(rb,{value:"1",children:"1 column"}),(0,ea.jsx)(rb,{value:"2",children:"2 columns"}),(0,ea.jsx)(rb,{value:"3",children:"3 columns"}),(0,ea.jsx)(rb,{value:"4",children:"4 columns"})]})]}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Controls how many plans show per row on desktop. On mobile, plans always stack vertically."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Pricing Plans"}),(0,ea.jsxs)(sg,{"data-testid":"pricing-add-".concat(j),variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"pp-".concat(Date.now()),name:"Plan",price:"$0",period:"/month",features:["Feature"],highlighted:!1,buttonText:"Get Started",buttonUrl:"#"}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add Plan"]})]}),(0,ea.jsx)(VK,{ids:(k.items||[]).map((e,t)=>e.id||"pricing-".concat(t)),onReorder:(e,t)=>me(j,d(d({},k),{},{items:tE(k.items||[],e,t)})),children:(k.items||[]).map((e,t)=>(0,ea.jsx)(WK,{id:e.id||"pricing-".concat(t),children:(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 ".concat(e.highlighted?"bg-indigo-50 border-indigo-300":"bg-slate-50"),children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Plan ",t+1]}),(0,ea.jsx)(OK,{index:t,total:(k.items||[]).length,testIdPrefix:"pricing-plan-".concat(j),onMove:(e,t)=>
2me(j,d(d({},k),{},{items:IK(k.items,e,t)}))}),(0,ea.jsx)(UK,{testId:"pricing-plan-".concat(j,"-dup-").concat(t),onClick:()=>{const s=[...k.items||[]];s.splice(t+1,0,d(d({},e),{},{id:HK("pp")})),me(j,d(d({},k),{},{items:s}))}})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("label",{className:"text-xs flex items-center gap-1 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!!e.highlighted,onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{highlighted:s.target.checked}),me(j,d(d({},k),{},{items:a}))}}),"Featured"]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter(t=>t.id!==e.id)})),children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,ea.jsx)(BN,{value:e.name||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{name:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Plan name"}),(0,ea.jsx)(BN,{value:e.price||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{price:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"$29"}),(0,ea.jsx)(BN,{value:e.period||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{period:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"/month"})]}),(0,ea.jsx)(YN,{value:(e.features||[]).join("\n"),onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{features:s.target.value.split("\n")}),me(j,d(d({},k),{},{items:a}))},placeholder:"Features (one per line)",rows:3}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.buttonText||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{buttonText:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Button text"}),(0,ea.jsx)(BN,{value:e.buttonUrl||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{buttonUrl:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Button URL"})]})]})},e.id||"pricing-".concat(t)))})]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"feature-comparison"===N&&(()=>{const e=k.plans||[],t=k.categories||[],s=e=>me(j,d(d({},k),{},{plans:e})),a=e=>me(j,d(d({},k),{},{categories:e}));return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{"data-testid":"fc-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Compare Plans"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(BN,{value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),placeholder:"Find the plan that fits your team"})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"fc-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-2 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Plan Recommender (Optional)"}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!!k.enableRecommender,onChange:e=>me(j,d(d({},k),{},{enableRecommender:e.target.checked})),"data-testid":"fc-enable-recommender-".concat(j)}),(0,ea.jsx)("span",{className:"text-xs",children:"Enable"})]})]}),k.enableRecommender&&(0,ea.jsxs)("div",{className:"space-y-2 p-3 bg-indigo-50/40 border border-indigo-100 rounded-lg",children:[(0,ea.jsx)(BN,{value:k.recommenderTitle||"",onChange:e=>me(j,d(d({},k),{},{recommenderTitle:e.target.value})),placeholder:"Wizard title",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:k.recommenderSubtitle||"",onChange:e=>me(j,d(d({},k),{},{recommenderSubtitle:e.target.value})),placeholder:"Short helper text",className:"h-8 text-xs"}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("span",{className:"text-[11px] text-slate-500 font-medium",children:"Yes / No Questions"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{recommenderQuestions:[...k.recommenderQuestions||[],{id:"rq-".concat(Date.now()),text:"New question?",yesPlanIds:[]}]})),className:"h-7 text-xs","data-testid":"fc-add-question-".concat(j),children:[(0,ea.jsx)(Vj,{size:12,className:"mr-1"})," Question"]})]}),(k.recommenderQuestions||[]).map((t,s)=>(0,ea.jsxs)("div",{className:"p-2 bg-white border border-slate-200 rounded-md space-y-1.5",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("span",{className:"text-[11px] text-slate-400 font-medium",children:["Q",s+1]}),(0,ea.jsx)(BN,{value:t.text||"",onChange:e=>me(j,d(d({},k),{},{recommenderQuestions:(k.recommenderQuestions||[]).map(s=>s.id===t.id?d(d({},s),{},{text:e.target.value}):s)})),placeholder:"e.g. Do you need SSO / SAML?",className:"h-7 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>me(j,d(d({},k),{},{recommenderQuestions:(k.recommenderQuestions||[]).filter(e=>e.id!==t.id)})),className:"h-7 w-7 p-0 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]}),(0,ea.jsxs)("div",{className:"pl-6",children:[(0,ea.jsx)("p",{className:"text-[11px] text-slate-500 mb-1",children:'If "Yes" \u2192 favours:'}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[0===e.length&&(0,ea.jsx)("span",{className:"text-[11px] text-slate-400 italic",children:"Add plans first"}),e.map(e=>{const s=(t.yesPlanIds||[]).includes(e.id);return(0,ea.jsxs)("label",{className:"px-2 py-0.5 rounded-full text-[11px] cursor-pointer border ".concat(s?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-300 hover:border-indigo-300"),children:[(0,ea.jsx)("input",{type:"checkbox",checked:s,onChange:()=>{const a=s?(t.yesPlanIds||[]).filter(t=>t!==e.id):[...t.yesPlanIds||[],e.id];me(j,d(d({},k),{},{recommenderQuestions:(k.recommenderQuestions||[]).map(e=>e.id===t.id?d(d({},e),{},{yesPlanIds:a}):e)}))},className:"hidden"}),e.name||"Plan"]},e.id)})]})]})]},t.id)),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:'Each "Yes" answer adds +1 to the favoured plan(s). After all answers, the highest-scoring plan is recommended.'})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Plans (Table Columns)"}),(0,ea.jsxs)(sg,{"data-testid":"fc-add-plan-".concat(j),variant:"outline",size:"sm",onClick:()=>{const t="pl-".concat(Date.now());s([...e,{id:t,name:"New Plan",price:"$0",period:"/month",highlighted:!1,buttonText:"Get Started",buttonUrl:"#"}])},children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add Plan"]})]}),(0,ea.jsx)(VK,{ids:e.map((e,t)=>e.id||"fc-".concat(t)),onReorder:(t,a)=>s(tE(e,t,a)),children:e.map((a,n)=>(0,ea.jsx)(WK,{id:a.id||"fc-".concat(n),children:(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 ".concat(a.highlighted?"bg-indigo-50 border-indigo-300":"bg-slate-50"),children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Plan ",n+1]}),(0,ea.jsx)(OK,{index:n,total:e.length,testIdPrefix:"fc-plan-".concat(j),onMove:(t,a)=>s(IK(e,t,a))}),(0,ea.jsx)(UK,{testId:"fc-plan-".concat(j,"-dup-").concat(n),onClick:()=>{const t=HK("pl"),s=[...e];s.splice(n+1,0,d(d({},a),{},{id:t}));me(j,d(d({},k),{},{plans:s,categories:(k.categories||[]).map(e=>d(d({},e),{},{features:(e.features||[]).map(e=>d(d({},e),{},{values:d(d({},e.values||{}),{},{[t]:(e.values||{})[a.id]})}))})),recommenderQuestions:(k.recommenderQuestions||[]).map(e=>{return d(d({},e),{},{yesPlanIds:(s=e.yesPlanIds,(s||[]).includes(a.id)?[...s,t]:s)});var s})}))}})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("label",{className:"text-xs flex items-center gap-1 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!!a.highlighted,onChange:t=>s(e.map(e=>e.id===a.id?d(d({},e),{},{highlighted:t.target.checked}):e))}),"Highlight"]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return s=a.id,void me(j,d(d({},k),{},{plans:e.filter(e=>e.id!==s),categories:t.map(e=>d(d({},e),{},{features:(e.features||[]).map(e=>{const t=d({},e.values||{});return delete t[s],d(d({},e),{},{values:t})})}))}));var s},className:"h-7 w-7 p-0 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:a.name||"",onChange:t=>s(e.map(e=>e.id===a.id?d(d({},e),{},{name:t.target.value}):e)),placeholder:"Plan name",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:a.badge||"",onChange:t=>s(e.map(e=>e.id===a.id?d(d({},e),{},{badge:t.target.value}):e)),placeholder:"Badge (e.g. Most Popular)",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:a.price||"",onChange:t=>s(e.map(e=>e.id===a.id?d(d({},e),{},{price:t.target.value}):e)),placeholder:"$29",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:a.period||"",onChange:t=>s(e.map(e=>e.id===a.id?d(d({},e),{},{period:t.target.value}):e)),placeholder:"/month",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:a.buttonText||"",onChange:t=>s(e.map(e=>e.id===a.id?d(d({},e),{},{buttonText:t.target.value}):e)),placeholder:"Button label",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:a.buttonUrl||"",onChange:t=>s(e.map(e=>e.id===a.id?d(d({},e),{},{buttonUrl:t.target.value}):e)),placeholder:"Button URL",className:"h-8 text-xs"})]})]})},a.id||"fc-".concat(n)))})]}),(0,ea.jsxs)("div",{className:"space-y-3 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Feature Categories"}),(0,ea.jsxs)(sg,{"data-testid":"fc-add-category-".concat(j),variant:"outline",size:"sm",onClick:()=>{a([...t,{id:"cat-".concat(Date.now()),name:"New Section",features:[]}])},children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add Section"]})]}),t.map(s=>(0,ea.jsxs)("div",{className:"border rounded-lg bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-2 border-b bg-slate-50",children:[(0,ea.jsx)(BN,{value:s.name||"",onChange:e=>a(t.map(t=>
2t.id===s.id?d(d({},t),{},{name:e.target.value}):t)),placeholder:"Section name (e.g. Core, Support)",className:"h-8 text-sm font-medium flex-1"}),(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",onClick:()=>{return e=s.id,void a(t.map(t=>t.id===e?d(d({},t),{},{features:[...t.features||[],{id:"f-".concat(Date.now()),name:"New feature",values:{}}]}):t));var e},className:"h-8 text-xs",children:[(0,ea.jsx)(Vj,{size:12,className:"mr-1"})," Feature"]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return e=s.id,void a(t.filter(t=>t.id!==e));var e},className:"h-8 w-8 p-0 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]}),(0,ea.jsxs)("div",{className:"p-2 space-y-1.5",children:[(s.features||[]).map(n=>(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{value:n.name||"",onChange:e=>a(t.map(t=>t.id===s.id?d(d({},t),{},{features:(t.features||[]).map(t=>t.id===n.id?d(d({},t),{},{name:e.target.value}):t)}):t)),placeholder:"Feature name",className:"h-7 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return e=s.id,l=n.id,void a(t.map(t=>t.id===e?d(d({},t),{},{features:(t.features||[]).filter(e=>e.id!==l)}):t));var e,l},className:"h-7 w-7 p-0 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]}),(0,ea.jsx)("div",{className:"grid gap-1 pl-3",style:{gridTemplateColumns:"repeat(".concat(Math.max(e.length,1),", minmax(0, 1fr))")},children:e.map(e=>(0,ea.jsx)(BN,{value:(n.values||{})[e.id]||"",onChange:l=>{return r=s.id,i=n.id,o=e.id,c=l.target.value,void a(t.map(e=>e.id===r?d(d({},e),{},{features:(e.features||[]).map(e=>e.id===i?d(d({},e),{},{values:d(d({},e.values||{}),{},{[o]:c})}):e)}):e));var r,i,o,c},placeholder:e.name||"value",className:"h-6 text-[11px]",title:"Use 'yes' / 'no' for check / cross, or any text"},e.id))})]},n.id)),0===(s.features||[]).length&&(0,ea.jsx)("p",{className:"text-[11px] text-slate-400 italic p-2",children:'No features yet. Click "+ Feature" to add one.'})]})]},s.id))]}),(0,ea.jsxs)("p",{className:"text-[11px] text-slate-400",children:["Tip: Use ",(0,ea.jsx)("code",{children:"yes"})," / ",(0,ea.jsx)("code",{children:"no"})," in a value cell to render a checkmark or cross."]})]}),rightPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{activeTab:B(j),tab:"style",children:(0,ea.jsx)(zq,{styles:C,onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e)})}),(0,ea.jsx)(FG,{activeTab:B(j),tab:"animation",children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]})})(),"plan-comparison"===N&&(e=>{const t="manual"===k.source?"manual":"pricing",a=k.plans||[],n=k.rows||[],l=(s||[]).find(e=>{var t;return"pricing"===e.type&&((null===(t=e.content)||void 0===t?void 0:t.items)||[]).length>0}),r=(e=>{const t=(e||[]).map(e=>({id:e.id,name:e.name,price:e.price,period:e.period,highlighted:!!e.highlighted,badge:e.highlighted?"Most Popular":"",buttonText:e.buttonText,buttonUrl:e.buttonUrl})),s=new Map;(e||[]).forEach(e=>(e.features||[]).forEach(e=>{const t=(e||"").trim(),a=t.toLowerCase();a&&!s.has(a)&&s.set(a,t)}));const a=Array.from(s.entries()).map(t=>{let[s,a]=t;return{id:"row-".concat(s.replace(/[^a-z0-9]+/g,"-")),label:a,values:(e||[]).reduce((e,t)=>(e[t.id]=((e,t)=>(e.features||[]).some(e=>(e||"").trim().toLowerCase()===t))(t,s)?"yes":"no",e),{})}}).filter(e=>t.some(t=>"yes"===e.values[t.id]));return{plans:t,rows:a}})((null===l||void 0===l||null===(e=l.content)||void 0===e?void 0:e.items)||[]),i="manual"===t?a:r.plans,o=e=>me(j,d(d({},k),{},{plans:e})),c=e=>me(j,d(d({},k),{},{rows:e}));return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{"data-testid":"pc-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Compare Plans"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(BN,{value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),placeholder:"All the features, side-by-side."})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"pc-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-2 pt-3 border-t border-slate-200",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Data Source"}),(0,ea.jsxs)(eb,{value:t,onValueChange:e=>me(j,d(d({},k),{},{source:e})),children:[(0,ea.jsx)(sb,{"data-testid":"pc-source-".concat(j),className:"h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"pricing",children:"Auto \u2014 from this page's Pricing block"}),(0,ea.jsx)(rb,{value:"manual",children:"Custom \u2014 edit plans & rows manually"})]})]}),"pricing"===t&&(0,ea.jsxs)("div",{className:"p-3 bg-indigo-50/50 border border-indigo-100 rounded-lg space-y-2",children:[l?(0,ea.jsxs)("p",{className:"text-[11px] text-slate-600",children:["Auto-generating from your ",(0,ea.jsx)("span",{className:"font-semibold",children:"Pricing block"})," (",r.plans.length," plans, ",r.rows.length," feature rows). A feature shows a \u2713 for every plan whose feature list includes it."]}):(0,ea.jsxs)("p",{className:"text-[11px] text-amber-700",children:["No Pricing block found on this page yet. Add a ",(0,ea.jsx)("span",{className:"font-semibold",children:"Pricing Table"})," block (with feature lists), or switch to Custom mode below."]}),(0,ea.jsx)(sg,{"data-testid":"pc-copy-to-custom-".concat(j),variant:"outline",size:"sm",className:"h-7 text-xs",disabled:!l,onClick:()=>me(j,d(d({},k),{},{source:"manual",plans:r.plans,rows:r.rows})),children:"Edit manually (copy current)"})]})]}),"manual"===t&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-2 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Plans (Columns)"}),(0,ea.jsxs)(sg,{"data-testid":"pc-add-plan-".concat(j),variant:"outline",size:"sm",onClick:()=>o([...a,{id:"pl-".concat(Date.now()),name:"New Plan",price:"$0",period:"/mo",highlighted:!1,badge:"",buttonText:"Get Started",buttonUrl:"#"}]),className:"h-7 text-xs",children:[(0,ea.jsx)(Vj,{size:12,className:"mr-1"})," Add Plan"]})]}),0===a.length&&(0,ea.jsx)("p",{className:"text-[11px] text-slate-400 italic",children:'No plans yet. Click "Add Plan".'}),(0,ea.jsx)(VK,{ids:a.map((e,t)=>e.id||"pc-".concat(t)),onReorder:(e,t)=>o(tE(a,e,t)),children:a.map((e,t)=>(0,ea.jsx)(WK,{id:e.id||"pc-".concat(t),children:(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 ".concat(e.highlighted?"bg-indigo-50 border-indigo-300":"bg-slate-50"),children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Plan ",t+1]}),(0,ea.jsx)(OK,{index:t,total:a.length,testIdPrefix:"pc-plan-".concat(j),onMove:(e,t)=>
2o(IK(a,e,t))}),(0,ea.jsx)(UK,{testId:"pc-plan-".concat(j,"-dup-").concat(t),onClick:()=>{const s=HK("pl"),n=[...a];n.splice(t+1,0,d(d({},e),{},{id:s})),me(j,d(d({},k),{},{plans:n,rows:(k.rows||[]).map(t=>d(d({},t),{},{values:d(d({},t.values||{}),{},{[s]:(t.values||{})[e.id]})}))}))}})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("label",{className:"text-xs flex items-center gap-1 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!!e.highlighted,onChange:t=>o(a.map(s=>s.id===e.id?d(d({},s),{},{highlighted:t.target.checked}):s))}),"Highlight"]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.id,me(j,d(d({},k),{},{plans:a.filter(e=>e.id!==t),rows:n.map(e=>{const s=d({},e.values||{});return delete s[t],d(d({},e),{},{values:s})})}));var t},className:"h-7 w-7 p-0 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.name||"",onChange:t=>o(a.map(s=>s.id===e.id?d(d({},s),{},{name:t.target.value}):s)),placeholder:"Plan name",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.badge||"",onChange:t=>o(a.map(s=>s.id===e.id?d(d({},s),{},{badge:t.target.value}):s)),placeholder:"Badge (e.g. Most Popular)",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.price||"",onChange:t=>o(a.map(s=>s.id===e.id?d(d({},s),{},{price:t.target.value}):s)),placeholder:"$29",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.period||"",onChange:t=>o(a.map(s=>s.id===e.id?d(d({},s),{},{period:t.target.value}):s)),placeholder:"/mo",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.buttonText||"",onChange:t=>o(a.map(s=>s.id===e.id?d(d({},s),{},{buttonText:t.target.value}):s)),placeholder:"Button label",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.buttonUrl||"",onChange:t=>o(a.map(s=>s.id===e.id?d(d({},s),{},{buttonUrl:t.target.value}):s)),placeholder:"Button URL",className:"h-8 text-xs"})]})]})},e.id||"pc-".concat(t)))})]}),(0,ea.jsxs)("div",{className:"space-y-2 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Feature Rows"}),(0,ea.jsxs)(sg,{"data-testid":"pc-add-row-".concat(j),variant:"outline",size:"sm",onClick:()=>c([...n,{id:"row-".concat(Date.now()),label:"New feature",values:{}}]),className:"h-7 text-xs",children:[(0,ea.jsx)(Vj,{size:12,className:"mr-1"})," Add Row"]})]}),0===n.length&&(0,ea.jsx)("p",{className:"text-[11px] text-slate-400 italic",children:'No rows yet. Click "Add Row".'}),n.map(e=>(0,ea.jsxs)("div",{className:"p-2 border border-slate-200 rounded-md bg-white space-y-1.5",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{value:e.label||"",onChange:t=>c(n.map(s=>s.id===e.id?d(d({},s),{},{label:t.target.value}):s)),placeholder:"Feature name",className:"h-7 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.id,c(n.filter(e=>e.id!==t));var t},className:"h-7 w-7 p-0 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]}),a.length>0&&(0,ea.jsx)("div",{className:"grid gap-1 pl-1",style:{gridTemplateColumns:"repeat(".concat(Math.max(a.length,1),", minmax(0, 1fr))")},children:a.map(t=>(0,ea.jsx)(BN,{value:(e.values||{})[t.id]||"",onChange:s=>{return a=e.id,l=t.id,r=s.target.value,c(n.map(e=>e.id===a?d(d({},e),{},{values:d(d({},e.values||{}),{},{[l]:r})}):e));var a,l,r},placeholder:t.name||"value",className:"h-6 text-[11px]",title:"Use 'yes' / 'no' for check / cross, or any text"},t.id))})]},e.id)),(0,ea.jsxs)("p",{className:"text-[11px] text-slate-400",children:["Tip: type ",(0,ea.jsx)("code",{children:"yes"})," / ",(0,ea.jsx)("code",{children:"no"}),' in a cell for a checkmark or cross, or any text like "5 GB".']})]})]}),(0,ea.jsxs)("div",{className:"space-y-2 pt-3 border-t border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold",children:"Plan Recommender (Optional)"}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!!k.enableRecommender,onCh
2ange:e=>me(j,d(d({},k),{},{enableRecommender:e.target.checked})),"data-testid":"pc-enable-recommender-".concat(j)}),(0,ea.jsx)("span",{className:"text-xs",children:"Enable"})]})]}),k.enableRecommender&&(0,ea.jsxs)("div",{className:"space-y-2 p-3 bg-indigo-50/40 border border-indigo-100 rounded-lg",children:[(0,ea.jsx)(BN,{value:k.recommenderTitle||"",onChange:e=>me(j,d(d({},k),{},{recommenderTitle:e.target.value})),placeholder:"Wizard title",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:k.recommenderSubtitle||"",onChange:e=>me(j,d(d({},k),{},{recommenderSubtitle:e.target.value})),placeholder:"Short helper text",className:"h-8 text-xs"}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("span",{className:"text-[11px] text-slate-500 font-medium",children:"Yes / No Questions"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{recommenderQuestions:[...k.recommenderQuestions||[],{id:"rq-".concat(Date.now()),text:"New question?",yesPlanIds:[]}]})),className:"h-7 text-xs","data-testid":"pc-add-question-".concat(j),children:[(0,ea.jsx)(Vj,{size:12,className:"mr-1"})," Question"]})]}),(k.recommenderQuestions||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"p-2 bg-white border border-slate-200 rounded-md space-y-1.5",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("span",{className:"text-[11px] text-slate-400 font-medium",children:["Q",t+1]}),(0,ea.jsx)(BN,{value:e.text||"",onChange:t=>me(j,d(d({},k),{},{recommenderQuestions:(k.recommenderQuestions||[]).map(s=>s.id===e.id?d(d({},s),{},{text:t.target.value}):s)})),placeholder:"e.g. Do you need SSO / SAML?",className:"h-7 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>me(j,d(d({},k),{},{recommenderQuestions:(k.recommenderQuestions||[]).filter(t=>t.id!==e.id)})),className:"h-7 w-7 p-0 text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:12})})]}),(0,ea.jsxs)("div",{className:"pl-6",children:[(0,ea.jsx)("p",{className:"text-[11px] text-slate-500 mb-1",children:'If "Yes" \u2192 favours:'}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[0===i.length&&(0,ea.jsx)("span",{className:"text-[11px] text-slate-400 italic",children:"Add plans / a pricing block first"}),i.map(t=>{const s=(e.yesPlanIds||[]).includes(t.id);return(0,ea.jsxs)("label",{className:"px-2 py-0.5 rounded-full text-[11px] cursor-pointer border ".concat(s?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-300 hover:border-indigo-300"),children:[(0,ea.jsx)("input",{type:"checkbox",checked:s,onChange:()=>{const a=s?(e.yesPlanIds||[]).filter(e=>e!==t.id):[...e.yesPlanIds||[],t.id];me(j,d(d({},k),{},{recommenderQuestions:(k.recommenderQuestions||[]).map(t=>t.id===e.id?d(d({},t),{},{yesPlanIds:a}):t)}))},className:"hidden"}),t.name||"Plan"]},t.id)})]})]})]},e.id)),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:'Each "Yes" answer adds +1 to the favoured plan(s). The highest-scoring plan is recommended.'})]})]})]})]}),rightPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{activeTab:B(j),tab:"style",children:(0,ea.jsx)(zq,{styles:C,onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e)})}),(0,ea.jsx)(FG,{activeTab:B(j),tab:"animation",children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]})})(),"faq"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{"data-testid":"faq-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Frequently Asked Questions"})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"faq-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Questions"}),(0,ea.jsxs)(sg,{"data-testid":"faq-add-".concat(j),variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"fq-".concat(Date.now()),question:"",answer:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["FAQ ",t+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter(t=>t.id!==e.id)}
2)),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.question||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{question:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Question"}),(0,ea.jsx)(YN,{value:e.answer||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{answer:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Answer",rows:2})]},e.id))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"cta"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title"}),(0,ea.jsx)(BN,{"data-testid":"cta-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Ready to Get Started?"})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"cta-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(BN,{value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),placeholder:"Join thousands of satisfied customers"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button Text"}),(0,ea.jsx)(BN,{value:k.buttonText||"",onChange:e=>me(j,d(d({},k),{},{buttonText:e.target.value})),placeholder:"Start Now"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button URL"}),(0,ea.jsx)(BN,{value:k.buttonUrl||"",onChange:e=>me(j,d(d({},k),{},{buttonUrl:e.target.value})),placeholder:"#contact"})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Color Scheme"}),(0,ea.jsxs)(eb,{value:k.style||"primary",onValueChange:e=>me(j,d(d({},k),{},{style:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"primary",children:"Primary (theme color)"}),(0,ea.jsx)(rb,{value:"secondary",children:"Secondary (theme accent)"}),(0,ea.jsx)(rb,{value:"dark",children:"Dark"})]})]})]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"team"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{"data-testid":"team-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Meet Our Team"})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"team-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Team Members"}),(0,ea.jsxs)(sg,{"data-testid":"team-add-".concat(j),variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{members:[...k.members||[],{id:"tm-".concat(Date.now()),name:"",role:"",image:"",bio:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.members||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Member ",t+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>me(j,d(d({},k),{},{members:(k.members||[]).filter(t=>t.id!==e.id)}
2)),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.name||"",onChange:s=>{const a=[...k.members||[]];a[t]=d(d({},e),{},{name:s.target.value}),me(j,d(d({},k),{},{members:a}))},placeholder:"Name"}),(0,ea.jsx)(BN,{value:e.role||"",onChange:s=>{const a=[...k.members||[]];a[t]=d(d({},e),{},{role:s.target.value}),me(j,d(d({},k),{},{members:a}))},placeholder:"Role"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.image?(0,ea.jsx)("img",{src:e.image,alt:"",className:"h-10 w-10 object-cover rounded-full border"}):(0,ea.jsx)("div",{className:"h-10 w-10 border border-dashed rounded-full flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"team-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":teammember:").concat(t)),children:"Choose from Library"})]}),(0,ea.jsx)(BN,{value:e.image||"",onChange:s=>{const a=[...k.members||[]];a[t]=d(d({},e),{},{image:s.target.value}),me(j,d(d({},k),{},{members:a}))},placeholder:"\u2026or paste photo URL",className:"h-8 text-xs"}),(0,ea.jsx)(YN,{value:e.bio||"",onChange:s=>{const a=[...k.members||[]];a[t]=d(d({},e),{},{bio:s.target.value}),me(j,d(d({},k),{},{members:a}))},placeholder:"Short bio (optional)",rows:2})]},e.id))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"stats"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"stats-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title (optional)"}),(0,ea.jsx)(BN,{"data-testid":"stats-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Section title"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2 p-2 rounded-md bg-slate-50 border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between col-span-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Value"}),(0,ea.jsx)(wq,{value:k.statValueColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{statValueColor:e.target.value})),className:"h-7 w-10 rounded border","data-testid":"stats-valuecolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between col-span-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Label"}),(0,ea.jsx)(wq,{value:k.statLabelColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{statLabelColor:e.target.value})),className:"h-7 w-10 rounded border","data-testid":"stats-labelcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"col-span-3 space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Stats font"}),(0,ea.jsxs)(eb,{value:k.statFontFamily||"inherit",onValueChange:e=>me(j,d(d({},k),{},{statFontFamily:e})),children:[(0,ea.jsx)(sb,{className:"h-8 text-xs","data-testid":"stats-font-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:xq.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Statistics"}),(0,ea.jsxs)(sg,{"data-testid":"stats-add-".concat(j),variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"st-".concat(Date.now()),value:"0",label:"Label"}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsx)(BN,{value:e.value||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{value:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"100+",className:"w-24"}),(0,ea.jsx)(BN,{value:e.label||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{label:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Label",className:"flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter(t=>t.id!==e.id)}
2)),children:(0,ea.jsx)(wD,{size:14})})]},e.id))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"logo-cloud"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title (optional)"}),(0,ea.jsx)(BN,{"data-testid":"logocloud-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value})),placeholder:"Trusted by leading teams"})]}),(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"logocloud-title-style-".concat(j)}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{"data-testid":"logocloud-grayscale-".concat(j),checked:!1!==k.grayscale,onCheckedChange:e=>me(j,d(d({},k),{},{grayscale:e}))}),(0,ea.jsx)(tf,{className:"text-xs cursor-pointer",children:"Grayscale (color on hover)"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Columns"}),(0,ea.jsxs)(eb,{value:String(k.columns||5),onValueChange:e=>me(j,d(d({},k),{},{columns:parseInt(e)})),children:[(0,ea.jsx)(sb,{className:"w-20 h-8 text-xs","data-testid":"logocloud-columns-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[3,4,5,6].map(e=>(0,ea.jsx)(rb,{value:String(e),children:e},e))})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Logos"}),(0,ea.jsxs)(sg,{"data-testid":"logocloud-add-".concat(j),variant:"outline",size:"sm",onClick:()=>me(j,d(d({},k),{},{logos:[...k.logos||[],{id:"lg-".concat(Date.now()),imageUrl:"",name:"",link:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.logos||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"logocloud-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"h-8 w-12 object-contain border rounded"}):(0,ea.jsx)("div",{className:"h-8 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"logocloud-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":logocloud:").concat(t)),children:"Image"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{logos:(k.logos||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.imageUrl||"",onChange:s=>{const a=[...k.logos||[]];a[t]=d(d({},e),{},{imageUrl:s.target.value}),me(j,d(d({},k),{},{logos:a}))},placeholder:"\u2026or paste image URL",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.name||"",onChange:s=>{const a=[...k.logos||[]];a[t]=d(d({},e),{},{name:s.target.value}),me(j,d(d({},k),{},{logos:a}))},placeholder:"Name (alt / fallback text)",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.link||"",onChange:s=>{const a=[...k.logos||[]];a[t]=d(d({},e),{},{link:s.target.value}),me(j,d(d({},k),{},{logos:a}))},placeholder:"Link (optional)",className:"h-8 text-xs"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"hero-spotlight"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"herospot-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"herospot",includeHeight:!0,includeOverlay:!0,includeTextColor:!0}),(0,ea.jsx)(ZK,{id:j,content:k,updateBlock:me,prefix:"herospot"}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Eyebrow (small badge)"}),(0,ea.jsx)(BN,{"data-testid":"herospot-eyebrow-".concat(j),value:k.eyebrow||"",onChange:e=>me(j,d(d({},k),{},{eyebrow:e.target.value})),placeholder:"NEW"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Headline"}),(0,ea.jsx)(BN,{"data-testid":"herospot-headline-".concat(j),value:k.headline||"",onChange:e=>me(j,d(d({},k),{},{headline:e.target.value})),placeholder:"Build something people love"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheadline"}),(0,ea.jsx)(YN,{"data-testid":"herospot-subheadline-".concat(j),value:k.subheadline||"",onChange:e=>me(j,d(d({},k),{},{subheadline:e.target.value})),rows:2,placeholder:"A short supporting sentence."})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Primary button"}),(0,ea.jsx)(BN,{"data-testid":"herospot-primary-text-".concat(j),value:k.primaryButtonText||"",onChange:e=>me(j,d(d({},k),{},{primaryButtonText:e.target.value})),placeholder:"Get Started"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Primary link"}),(0,ea.jsx)(BN,{"data-testid":"herospot-primary-url-".concat(j),value:k.primaryButtonUrl||"",onChange:e=>me(j,d(d({},k),{},{primaryButtonUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Secondary button"}),(0,ea.jsx)(BN,{"data-testid":"herospot-secondary-text-".concat(j),value:k.secondaryButtonText||"",onChange:e=>me(j,d(d({},k),{},{secondaryButtonText:e.target.value})),placeholder:"Learn more"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Secondary link"}),(0,ea.jsx)(BN,{"data-testid":"herospot-secondary-url-".concat(j),value:k.secondaryButtonUrl||"",onChange:e=>me(j,d(d({},k),{},{secondaryButtonUrl:e.target.value})),placeholder:"https://\u2026"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Primary button colour"}),(0,ea.jsx)(wq,{value:k.primaryButtonColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{primaryButtonColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herospot-pbtn-color-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Secondary button colour"}),(0,ea.jsx)(wq,{value:k.secondaryButtonColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{secondaryButtonColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herospot-sbtn-color-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Primary button text"}),(0,ea.jsx)(wq,{value:k.primaryButtonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{primaryButtonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herospot-pbtn-textcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Secondary button text"}),(0,ea.jsx)(wq,{value:k.secondaryButtonColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{secondaryButtonColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herospot-sbtn-textcolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Align"}),(0,ea.jsxs)(eb,{value:k.align||"center",onValueChange:e=>me(j,d(d({},k),{},{align:e})),children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs","data-testid":"herospot-align-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"left",children:"Left"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Height (px)"}),(0,ea.jsx)(BN,{type:"number","data-testid":"herospot-height-".concat(j),value:k.height||560,onChange:e=>me(j,d(d({},k),{},{height:parseInt(e.target.value)||560})),className:"w-24 h-8 text-xs"})]})]}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Tip: set the accent (glow + buttons) via \u201cBorder color\u201d and the base background under the Style tab."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"countdown"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"countdown-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"countdown-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value})),placeholder:"Launching soon"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading"}),(0,ea.jsx)(YN,{"data-testid":"countdown-subheading-".concat(j),value:k.subheading||"",onChange:e=>me(j,d(d({},k),{},{subheading:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Target date & time"}),(0,ea.jsx)(BN,{type:"datetime-local","data-testid":"countdown-date-".concat(j),value:k.targetDate||"",onChange:e=>me(j,d(d({},k),{},{targetDate:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"When expired, show"}),(0,ea.jsx)(BN,{"data-testid":"countdown-expired-".concat(j),value:k.expiredText||"",onChange:e=>me(j,d(d({},k),{},{expiredText:e.target.value})),placeholder:"We're live!"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text"}),(0,ea.jsx)(BN,{"data-testid":"countdown-btn-text-".concat(j),value:k.buttonText||"",onChange:e=>me(j,d(d({},k),{},{buttonText:e.target.value})),placeholder:"Notify me"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button link"}),(0,ea.jsx)(BN,{"data-testid":"countdown-btn-url-".concat(j),value:k.buttonUrl||"",onChange:e=>me(j,d(d({},k),{},{buttonUrl:e.target.value})),placeholder:"https://\u2026"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Time/date background"}),(0,ea.jsx)(wq,{value:k.boxBgColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{boxBgColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"countdown-boxbg-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Time/date font"}),(0,ea.jsx)(wq,{value:k.boxTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{boxTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"countdown-boxtext-".concat(j)})]}),(0,ea.jsxs)("div",{className:"col-span-2 flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"countdown-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"countdown-btn",onPatch:e=>me(j,d(d({},k),e))})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Align"}),(0,ea.jsxs)(eb,{value:k.align||"center",onValueChange:e=>me(j,d(d({},k),{},{align:e})),children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs","data-testid":"countdown-align-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Tip: set the digit / button color via \u201cBorder color\u201d under the Style tab."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"before-after"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading (optional)"}),(0,ea.jsx)(BN,{"data-testid":"beforeafter-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value})),placeholder:"See the difference"})]}),["before","after"].map(e=>{const t="after"===e?"afterImage":"beforeImage";return(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"beforeafter-item-".concat(e,"-").concat(j),children:[(0,ea.jsxs)(tf,{className:"text-xs capitalize",children:[e," image"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[k[t]?(0,ea.jsx)("img",{src:k[t],alt:"",className:"h-10 w-16 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-10 w-16 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"beforeafter-pick-".concat(e,"-").concat(j),onClick:()=>fe("".concat(j,":beforeafter:").concat(e)),children:"Choose"})]}),(0,ea.jsx)(BN,{value:k[t]||"",onChange:e=>me(j,d(d({},k),{},{[t]:e.target.value})),placeholder:"\u2026or paste image URL",className:"h-8 text-xs","data-testid":"beforeafter-urlinput-".concat(e,"-").concat(j)})]},e)}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Before label"}),(0,ea.jsx)(BN,{"data-testid":"beforeafter-beforelabel-".concat(j),value:k.beforeLabel
2||"",onChange:e=>me(j,d(d({},k),{},{beforeLabel:e.target.value})),placeholder:"Before"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"After label"}),(0,ea.jsx)(BN,{"data-testid":"beforeafter-afterlabel-".concat(j),value:k.afterLabel||"",onChange:e=>me(j,d(d({},k),{},{afterLabel:e.target.value})),placeholder:"After"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Height (px)"}),(0,ea.jsx)(BN,{type:"number","data-testid":"beforeafter-height-".concat(j),value:k.height||420,onChange:e=>me(j,d(d({},k),{},{height:parseInt(e.target.value)||420})),className:"w-24 h-8 text-xs"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Slider start position: ",null!=k.startPosition?k.startPosition:50,"%"]}),(0,ea.jsx)("input",{type:"range",min:"0",max:"100",step:"1","data-testid":"beforeafter-start-".concat(j),value:null!=k.startPosition?k.startPosition:50,onChange:e=>me(j,d(d({},k),{},{startPosition:parseInt(e.target.value)})),className:"w-full"}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Where the wipe handle sits when the page first loads."})]}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Drag the handle on the published page to wipe between the two images."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"hero-tabs"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"herotabs-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"herotabs"}),(0,ea.jsx)(ZK,{id:j,content:k,updateBlock:me,prefix:"herotabs"}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Eyebrow"}),(0,ea.jsx)(BN,{"data-testid":"herotabs-eyebrow-".concat(j),value:k.eyebrow||"",onChange:e=>me(j,d(d({},k),{},{eyebrow:e.target.value})),placeholder:"Featured"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Headline"}),(0,ea.jsx)(BN,{"data-testid":"herotabs-headline-".concat(j),value:k.headline||"",onChange:e=>me(j,d(d({},k),{},{headline:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(YN,{"data-testid":"herotabs-subtitle-".concat(j),value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herotabs-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tabs colour"}),(0,ea.jsx)(wq,{value:k.tabColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{tabColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herotabs-tabcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tab shape"}),(0,ea.jsxs)(eb,{value:k.tabShape||"rounded",onValueChange:e=>me(j,d(d({},k),{},{tabShape:e})),children:[(0,ea.jsx)(sb,{className:"w-28 h-8 text-xs","data-testid":"herotabs-tabshape-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"rectangle",children:"Rectangle"})]})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"CTA text"}),(0,ea.jsx)(BN,{"data-testid":"herotabs-cta-text-".concat(j),value:k.ctaText||"",onChange:e=>me(j,d(d({},k),{},{ctaText:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"CTA link"}),(0,ea.jsx)(BN,{"data-testid":"herotabs-cta-url-".concat(j),value:k.ctaUrl||"",onChange:e=>me(j,d(d({},k),{},{ctaUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"col-span-2 flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herotabs-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"herotabs-btn",onPatch:e=>me(j,d(d({},k),e))})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tabs (each shows an image)"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"herotabs-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{tabs:[...k.tabs||[],{id:"t-".concat(Date.now()),label:"",imageUrl:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.tabs||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"herotabs-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"h-8 w-12 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-8 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"herotabs-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":heroimg:tabs:").concat(t)),children:"Image"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{tabs:(k.tabs||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.label||"",onChange:s=>{const a=[...k.tabs||[]];a[t]=d(d({},e),{},{label:s.target.value}),me(j,d(d({},k),{},{tabs:a}))},placeholder:"Tab label",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.imageUrl||"",onChange:s=>{const a=[...k.tabs||[]];a[t]=d(d({},e),{},{imageUrl:s.target.value}),me(j,d(d({},k),{},{tabs:a}))},placeholder:"\u2026or paste image URL",className:"h-8 text-xs"}),(0,ea.jsxs)("details",{className:"text-xs",children:[(0,ea.jsx)("summary",{className:"cursor-pointer text-slate-500 hover:text-slate-700 py-1",children:"Tab label typography"}),(0,ea.jsx)("div",{className:"mt-2",children:(0,ea.jsx)(eY,{style:e.labelStyle||{},defaultSize:14,testPrefix:"herotabs-labelstyle-".concat(j,"-").concat(t),onPatch:s=>{const a=[...k.tabs||[]],n=d(d({},a[t].labelStyle||{}),s);
2Object.keys(n).forEach(e=>{void 0!==n[e]&&""!==n[e]||delete n[e]}),a[t]=d(d({},e),{},{labelStyle:n}),me(j,d(d({},k),{},{tabs:a}))}})})]})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"hero-feature-cards"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"herofeat-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"herofeat"}),(0,ea.jsx)(ZK,{id:j,content:k,updateBlock:me,prefix:"herofeat"}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Headline"}),(0,ea.jsx)(BN,{"data-testid":"herofeat-headline-".concat(j),value:k.headline||"",onChange:e=>me(j,d(d({},k),{},{headline:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent word (coloured)"}),(0,ea.jsx)(BN,{"data-testid":"herofeat-accent-".concat(j),value:k.accentWord||"",onChange:e=>me(j,d(d({},k),{},{accentWord:e.target.value})),placeholder:"values."})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent word colour"}),(0,ea.jsx)(wq,{value:k.accentColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{accentColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herofeat-accentcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Card text colour"}),(0,ea.jsx)(wq,{value:k.cardTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{cardTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herofeat-cardtextcolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(YN,{"data-testid":"herofeat-subtitle-".concat(j),value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herofeat-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"CTA text"}),(0,ea.jsx)(BN,{"data-testid":"herofeat-cta-text-".concat(j),value:k.ctaText||"",onChange:e=>me(j,d(d({},k),{},{ctaText:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"CTA link"}),(0,ea.jsx)(BN,{"data-testid":"herofeat-cta-url-".concat(j),value:k.ctaUrl||"",onChange:e=>me(j,d(d({},k),{},{ctaUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"col-span-2 flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herofeat-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"herofeat-btn",onPatch:e=>me(j,d(d({},k),e))})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Feature cards"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"herofeat-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{features:[...k.features||[],{id:"f-".concat(Date.now()),title:"",imageUrl:"",link:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.features||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"herofeat-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"h-8 w-12 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-8 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"herofeat-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":heroimg:features:").concat(t)),children:"Image"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{features:(k.features||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.title||"",onChange:s=>{const a=[...k.features||[]];a[t]=d(d({},e),{},{title:s.target.value}),me(j,d(d({},k),{},{features:a}))},placeholder:"Card title",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.link||"",onChange:s=>{const a=[...k.features||[]];a[t]=d(d({},e),{},{link:s.target.value}),me(j,d(d({},k),{},{features:a}))},placeholder:"Link (optional)",className:"h-8 text-xs"}),(0,ea.jsxs)("details",{className:"text-xs",children:[(0,ea.jsx)("summary",{className:"cursor-pointer text-slate-500 hover:text-slate-700 py-1",children:"Card title typography"}),(0,ea.jsx)("div",{className:"mt-2",children:(0,ea.jsx)(eY,{style:e.titleStyle||{},defaultSize:18,testPrefix:"herofeat-titlestyle-".concat(j,"-").concat(t),onPatch:s=>{const a=[...k.features||[]],n=d(d({},a[t].titleStyle||{}),s);
2Object.keys(n).forEach(e=>{void 0!==n[e]&&""!==n[e]||delete n[e]}),a[t]=d(d({},e),{},{titleStyle:n}),me(j,d(d({},k),{},{features:a}))}})})]})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"hero-split-stats"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"herostats-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"herostats"}),(0,ea.jsx)(ZK,{id:j,content:k,updateBlock:me,prefix:"herostats"}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Headline"}),(0,ea.jsx)(BN,{"data-testid":"herostats-headline-".concat(j),value:k.headline||"",onChange:e=>me(j,d(d({},k),{},{headline:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(YN,{"data-testid":"herostats-subtitle-".concat(j),value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herostats-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Stats colour"}),(0,ea.jsx)(wq,{value:k.statColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{statColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herostats-statcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Primary button"}),(0,ea.jsx)(BN,{"data-testid":"herostats-pbtn-text-".concat(j),value:k.primaryButtonText||"",onChange:e=>me(j,d(d({},k),{},{primaryButtonText:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Primary link"}),(0,ea.jsx)(BN,{"data-testid":"herostats-pbtn-url-".concat(j),value:k.primaryButtonUrl||"",onChange:e=>me(j,d(d({},k),{},{primaryButtonUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Secondary button"}),(0,ea.jsx)(BN,{"data-testid":"herostats-sbtn-text-".concat(j),value:k.secondaryButtonText||"",onChange:e=>me(j,d(d({},k),{},{secondaryButtonText:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Secondary link"}),(0,ea.jsx)(BN,{"data-testid":"herostats-sbtn-url-".concat(j),value:k.secondaryButtonUrl||"",onChange:e=>me(j,d(d({},k),{},{secondaryButtonUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Primary btn text"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herostats-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"herostats-btn",onPatch:e=>me(j,d(d({},k),e))})}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Secondary btn text"}),(0,ea.jsx)(wq,{value:k.secondaryButtonTextColor||"#0f172a",onChange:e=>me(j,d(d({},k),{},{secondaryButtonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herostats-sbtntextcolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Stats"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"herostats-addstat-".concat(j),onClick:()=>me(j,d(d({},k),{},{stats:[...k.stats||[],{value:"",label:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.stats||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"herostats-stat-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsx)(BN,{value:e.value||"",onChange:s=>{const a=[...k.stats||[]];a[t]=d(d({},e),{},{value:s.target.value}),me(j,d(d({},k),{},{stats:a}))},placeholder:"15.2K",className:"h-8 text-xs w-24"}),(0,ea.jsx)(BN,{value:e.label||"",onChange:s=>{const a=[...k.stats||[]];a[t]=d(d({},e),{},{label:s.target.value}),me(j,d(d({},k),{},{stats:a}))},placeholder:"Active students",className:"h-8 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{stats:(k.stats||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsxs)("details",{className:"text-xs",children:[(0,ea.jsx)("summary",{className:"cursor-pointer text-slate-500 hover:text-slate-700 py-1",children:"Stat typography (value / label)"}),(0,ea.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500 font-semibold",children:"Value"}),(0,ea.jsx)(eY,{style:e.valueStyle||{},defaultSize:30,testPrefix:"herostats-valstyle-".concat(j,"-").concat(t),onPatch:s=>{const a=[...k.stats||[]],n=d(d({},a[t].valueStyle||{}),s);
2Object.keys(n).forEach(e=>{void 0!==n[e]&&""!==n[e]||delete n[e]}),a[t]=d(d({},e),{},{valueStyle:n}),me(j,d(d({},k),{},{stats:a}))}})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-[10px] text-slate-500 font-semibold",children:"Label"}),(0,ea.jsx)(eY,{style:e.labelStyle||{},defaultSize:14,testPrefix:"herostats-lblstyle-".concat(j,"-").concat(t),onPatch:s=>{const a=[...k.stats||[]],n=d(d({},a[t].labelStyle||{}),s);Object.keys(n).forEach(e=>{void 0!==n[e]&&""!==n[e]||delete n[e]}),a[t]=d(d({},e),{},{labelStyle:n}),me(j,d(d({},k),{},{stats:a}))}})]})]})]})]},t))]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Images (up to 3)"}),(k.images||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2","data-testid":"herostats-img-".concat(j,"-").concat(t),children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"h-8 w-12 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-8 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"herostats-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":heroimg:images:").concat(t)),children:["Image ",t+1]}),(0,ea.jsx)(BN,{value:e.imageUrl||"",onChange:s=>{const a=[...k.images||[]];a[t]=d(d({},e),{},{imageUrl:s.target.value}),me(j,d(d({},k),{},{images:a}))},placeholder:"\u2026or URL",className:"h-8 text-xs flex-1"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"hero-split-cards"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"herocards-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"herocards"}),(0,ea.jsx)(ZK,{id:j,content:k,updateBlock:me,prefix:"herocards"}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Headline"}),(0,ea.jsx)(BN,{"data-testid":"herocards-headline-".concat(j),value:k.headline||"",onChange:e=>me(j,d(d({},k),{},{headline:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent word (coloured)"}),(0,ea.jsx)(BN,{"data-testid":"herocards-accent-".concat(j),value:k.accentWord||"",onChange:e=>me(j,d(d({},k),{},{accentWord:e.target.value})),placeholder:"workflow?"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent word colour"}),(0,ea.jsx)(wq,{value:k.accentColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{accentColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herocards-accentcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(YN,{"data-testid":"herocards-subtitle-".concat(j),value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herocards-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text"}),(0,ea.jsx)(BN,{"data-testid":"herocards-btn-text-".concat(j),value:k.buttonText||"",onChange:e=>me(j,d(d({},k),{},{buttonText:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button link"}),(0,ea.jsx)(BN,{"data-testid":"herocards-btn-url-".concat(j),value:k.buttonUrl||"",onChange:e=>me(j,d(d({},k),{},{buttonUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"col-span-2 flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"herocards-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"herocards-btn",onPatch:e=>me(j,d(d({},k),e))})})]}),["imageUrl1","imageUrl2"].map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"herocards-imgrow-".concat(j,"-").concat(t),children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Image ",t+1]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[k[e]?(0,ea.jsx)("img",{src:k[e],alt:"",className:"h-10 w-16 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-10 w-16 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"herocards-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":heroimg:").concat(e)),children:"Choose"})]}),(0,ea.jsx)(BN,{value:k[e]||"",onChange:t=>me(j,d(d({},k),{},{[e]:t.target.value})),placeholder:"\u2026or paste image URL",className:"h-8 text-xs"})]},e))]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"expandable-tabs"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"exptabs-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"exptabs-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading"}),(0,ea.jsx)(YN,{"data-testid":"exptabs-subheading-".concat(j),value:k.subheading||"",onChange:e=>me(j,d(d({},k),{},{subheading:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"exptabs-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tabs colour"}),(0,ea.jsx)(wq,{value:k.tabColor||"#6366f1",onChange:e=>me(j,d(d({},k),{},{tabColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"exptabs-tabcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tabs"}),(0,ea.jsxs)("div",{className:"flex gap-1",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"exptabs-add-sep-".concat(j),onClick:()=>me(j,d(d({},k),{},{tabs:[...k.tabs||[],{type:"separator"}]})),children:"| Sep"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"exptabs-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{tabs:[...k.tabs||[],{id:"et-".concat(Date.now()),label:"",icon:"star",url:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]})]}),(k.tabs||[]).map((e,t)=>"separator"===e.type?(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400 border border-dashed border-slate-200 rounded-md p-2","data-testid":"exptabs-item-".concat(j,"-").concat(t),children:[(0,ea.jsx)("span",{className:"flex-1",children:"\u2014 Separator \u2014"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{tabs:(k.tabs||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]},t):(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"exptabs-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("select",{value:e.icon||"star",onChange:s=>{const a=[...k.tabs||[]];a[t]=d(d({},e),{},{icon:s.target.value}),me(j,d(d({},k),{},{tabs:a}))},className:"h-8 text-xs border border-slate-200 rounded px-1","data-testid":"exptabs-icon-".concat(j,"-").concat(t),children:["home","bell","settings","help","shield","mail","user","file","lock","star","heart","globe","phone","calendar","cart","zap"].map(e=>(0,ea.jsx)("option",{value:e,children:e},e))}),(0,ea.jsx)(BN,{value:e.label||"",onChange:s=>{const a=[...k.tabs||[]];a[t]=d(d({},e),{},{label:s.target.value}),me(j,d(d({},k),{},{tabs:a}))},placeholder:"Label",className:"h-8 text-xs"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{tabs:(k.tabs||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.url||"",onChange:s=>{const a=[...k.tabs||[]];a[t]=d(d({},e),{},{url:s.target.value}),me(j,d(d({},k),{},{tabs:a}))},placeholder:"Link (optional)",className:"h-8 text-xs"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"sparkles"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"sparkles-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Headline"}),(0,ea.jsx)(BN,{"data-testid":"sparkles-headline-".concat(j),value:k.headline||"",onChange:e=>me(j,d(d({},k),{},{headline:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheadline"}),(0,ea.jsx)(YN,{"data-testid":"sparkles-subheadline-".concat(j),value:k.subheadline||"",onChange:e=>me(j,d(d({},k),{},{subheadline:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text"}),(0,ea.jsx)(BN,{"data-testid":"sparkles-btn-text-".concat(j),value:k.buttonText||"",onChange:e=>me(j,d(d({},k),{},{buttonText:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button link"}),(0,ea.jsx)(BN,{"data-testid":"sparkles-btn-url-".concat(j),value:k.buttonUrl||"",onChange:e=>me(j,d(d({},k),{},{buttonUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"col-span-2 flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"sparkles-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"sparkles-btn",onPatch:e=>me(j,d(d({},k),e))})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Backgroun
2d"}),(0,ea.jsx)(wq,{value:k.backgroundColor||"#020617",onChange:e=>me(j,d(d({},k),{},{backgroundColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"sparkles-bgcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Particles"}),(0,ea.jsx)(wq,{value:k.particleColor||"#FFFFFF",onChange:e=>me(j,d(d({},k),{},{particleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"sparkles-particlecolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Density (",k.density||120,")"]}),(0,ea.jsx)("input",{type:"range",min:"20",max:"400",step:"10",value:k.density||120,onChange:e=>me(j,d(d({},k),{},{density:parseInt(e.target.value)})),className:"w-full","data-testid":"sparkles-density-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Height (px)"}),(0,ea.jsx)(BN,{type:"number","data-testid":"sparkles-height-".concat(j),value:k.height||460,onChange:e=>me(j,d(d({},k),{},{height:parseInt(e.target.value)||460}))})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Tip: the gradient accent line uses Style \u2192 Border color."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"gallery-carousel"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"gallerycar-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title"}),(0,ea.jsx)(BN,{"data-testid":"gallerycar-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Description"}),(0,ea.jsx)(YN,{"data-testid":"gallerycar-desc-".concat(j),value:k.description||"",onChange:e=>me(j,d(d({},k),{},{description:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"gallerycar-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Card text colour"}),(0,ea.jsx)(wq,{value:k.cardTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{cardTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"gallerycar-cardtextcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Cards"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"gallerycar-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"gc-".concat(Date.now()),title:"",description:"",href:"",imageUrl:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"gallerycar-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"h-8 w-12 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-8 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"gallerycar-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":heroimg:items:").concat(t)),children:"Image"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.imageUrl||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{imageUrl:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"\u2026or paste image URL",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.title||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{title:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Card title",className:"h-8 text-xs"}),(0,ea.jsx)(YN,{value:e.description||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{description:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Description",rows:2,className:"text-xs"}),(0,ea.jsx)(BN,{value:e.href||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{href:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Link (optional)",className:"h-8 text-xs"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"testimonial-deck"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"tdeck-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"tdeck-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading"}),(0,ea.jsx)(YN,{"data-testid":"tdeck-subheading-".concat(j),value:k.subheading||"",onChange:e=>me(j,d(d({},k),{},{subheading:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"tdeck-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.autoplay,onChange:e=>me(j,d(d({},k),{},{autoplay:e.target.checked})),"data-testid":"tdeck-autoplay-".concat(j)})," Auto-rotate"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"every"}),(0,ea.jsx)(BN,{type:"number",min:"1","data-testid":"tdeck-autoplay-secs-".concat(j),value:k.autoplaySeconds||5,onChange:e=>me(j,d(d({},k),{},{autoplaySeconds:parseInt(e.target.value)||5})),className:"h-7 w-16 text-xs",disabled:!1===k.autoplay}),(0,ea.jsx)(tf,{className:"text-xs",children:"sec"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Max characters per quote"}),(0,ea.jsx)(BN,{type:"number",min:"0","data-testid":"tdeck-maxchars-".concat(j),value:k.maxChars||"",onChange:e=>me(j,d(d({},k),{},{maxChars:parseInt(e.target.value)||0})),placeholder:"0 = no limit",className:"h-7 w-24 text-xs"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Testimonials"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"tdeck-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"td-".concat(Date.now()),quote:"",name:"",role:"",avatarUrl:"",rating:5}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"tdeck-item-".concat(j,"-").concat(t),children:[(0,ea.jsx)(YN,{value:e.quote||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{quote:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Quote",rows:2,className:"text-xs"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.avatarUrl?(0,ea.jsx)("img",{src:e.avatarUrl,alt:"",className:"h-8 w-8 rounded-full object-cover border"}):(0,ea.jsx)("div",{className:"h-8 w-8 rounded-full border border-dashed flex items-center justify-center",children:(0,ea.jsx)($N,{size:12,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"tdeck-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":tavatar:").concat(t)),children:"Avatar"}),(0,ea.jsx)("select",{value:e.rating||5,onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{rating:parseInt(s.target.value)}),me(j,d(d({},k),{},{items:a}))},className:"h-8 text-xs border border-slate-200 rounded px-1 ml-auto","data-testid":"tdeck-rating-".concat(j,"-").concat(t),children:[5,4,3,2,1].map(e=>(0,ea.jsxs)("option",{value:e,children:[e,"\u2605"]},e))}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.name||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{name:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Name",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.role||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{role:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Role / company",className:"h-8 text-xs"})]}),(0,ea.jsx)(BN,{value:e.avatarUrl||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{avatarUrl:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"\u2026or paste avatar URL",className:"h-8 text-xs"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"liquid-glass"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"liquid-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Eyebrow"}),(0,ea.jsx)(BN,{"data-testid":"liquid-eyebrow-".concat(j),value:k.eyebrow||"",onChange:e=>me(j,d(d({},k),{},{eyebrow:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Headline"}),(0,ea.jsx)(BN,{"data-testid":"liquid-headline-".concat(j),value:k.headline||"",onChange:e=>me(j,d(d({},k),{},{headline:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(YN,{"data-testid":"liquid-subtitle-".concat(j),value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text"}),(0,ea.jsx)(BN,{"data-testid":"liquid-btn-text-".concat(j),value:k.buttonText||"",onChange:e=>me(j,d(d({},k),{},{buttonText:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button link"}),(0,ea.jsx)(BN,{"data-testid":"liquid-btn-url-".concat(j),value:k.buttonUrl||"",onChange:e=>me(j,d(d({},k),{},{buttonUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"col-span-2 flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#0f172a",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"liquid-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"liquid-btn",onPatch:e=>me(j,d(d({},k),e))})})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Glass tint"}
2),(0,ea.jsxs)("select",{value:k.glassTint||"light",onChange:e=>me(j,d(d({},k),{},{glassTint:e.target.value})),className:"w-full h-9 text-sm border border-slate-200 rounded px-2","data-testid":"liquid-tint-".concat(j),children:[(0,ea.jsx)("option",{value:"light",children:"Light glass (dark text)"}),(0,ea.jsx)("option",{value:"dark",children:"Dark glass (light text)"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2 border border-slate-200 rounded-md p-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Background image"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[k.backgroundImageUrl?(0,ea.jsx)("img",{src:k.backgroundImageUrl,alt:"",className:"h-10 w-16 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-10 w-16 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"liquid-pick-".concat(j),onClick:()=>fe("".concat(j,":heroimg:backgroundImageUrl")),children:"Choose"}),k.backgroundImageUrl&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{backgroundImageUrl:""})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:k.backgroundImageUrl||"",onChange:e=>me(j,d(d({},k),{},{backgroundImageUrl:e.target.value})),placeholder:"\u2026or paste image URL",className:"h-8 text-xs"}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Background height: ",k.height?"".concat(k.height,"px"):"auto"]}),(0,ea.jsx)("input",{type:"range",min:"0",max:"800",step:"20","data-testid":"liquid-height-".concat(j),value:k.height||0,onChange:e=>me(j,d(d({},k),{},{height:parseInt(e.target.value)||0})),className:"w-full"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Slide to 0 for auto height"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"No image? A gradient (from Style \u2192 Border color) is used."})]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"testimonials-columns"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"tcols-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Badge"}),(0,ea.jsx)(BN,{"data-testid":"tcols-badge-".concat(j),value:k.badge||"",onChange:e=>me(j,d(d({},k),{},{badge:e.target.value})),placeholder:"Testimonials"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"tcols-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading"}),(0,ea.jsx)(YN,{"data-testid":"tcols-subheading-".concat(j),value:k.subheading||"",onChange:e=>me(j,d(d({},k),{},{subheading:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"tcols-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Card text colour (all cards)"}),(0,ea.jsx)(wq,{value:k.cardTextColor||"#0f172a",onChange:e=>me(j,d(d({},k),{},{cardTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"tcols-cardtextcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs",children:["Scroll duration (",k.speed||40,"s \u2014 lower = faster)"]}),(0,ea.jsx)("input",{type:"range",min:"15",max:"90",step:"5",value:k.speed||40,onChange:e=>me(j,d(d({},k),{},{speed:parseInt(e.target.value)})),className:"w-full","data-testid":"tcols-speed-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Testimonials (spread across 3 columns)"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"tcols-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"tc-".concat(Date.now()),quote:"",name:"",role:"",avatarUrl:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"tcols-item-".concat(j,"-").concat(t),children:[(0,ea.jsx)(YN,{value:e.quote||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{quote:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Quote",rows:2,className:"text-xs"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.avatarUrl?(0,ea.jsx)("img",{src:e.avatarUrl,alt:"",className:"h-8 w-8 rounded-full object-cover border"}):(0,ea.jsx)("div",{className:"h-8 w-8 rounded-full border border-dashed flex items-center justify-center",children:(0,ea.jsx)($N,{size:12,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"tcols-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":tavatar:").concat(t)),children:"Avatar"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.name||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{name:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Name",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.role||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{role:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Role / @handle",className:"h-8 text-xs"})]})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"typewriter"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"typewriter-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Prefix text (static)"}),(0,ea.jsx)(BN,{"data-testid":"typewriter-prefix-".concat(j),value:k.prefixText||"",onChange:e=>me(j,d(d({},k),{},{prefixText:e.target.value})),placeholder:"We're born to "})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Phrases (one per line \u2014 typed & cycled)"}),(0,ea.jsx)(YN,{"data-testid":"typewriter-phrases-".concat(j),value:(k.phrases||[]).join("\n"),onChange:e=>me(j,d(d({},k),{},{phrases:e.target.value.split("\n").map(e=>e).filter(e=>e.trim().length||""===e)})),rows:4,className:"text-sm"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Animated word colour"}),(0,ea.jsx)(wq,{value:k.wordColor||"#eab308",onChange:e=>me(j,d(d({},k),{},{wordColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"typewriter-wordcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Type speed (ms)"}),(0,ea.jsx)(BN,{type:"number","data-testid":"typewriter-speed-".concat(j),value:k.speed||70,onChange:e=>me(j,d(d({},k),{},{speed:parseInt(e.target.value)||70})),className:"h-8 text-xs"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Delete speed"}),(0,ea.jsx)(BN,{type:"number",value:k.deleteSpeed||40,onChange:e=>me(j,d(d({},k),{},{deleteSpeed:parseInt(e.target.value)||40})),className:"h-8 text-xs"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Wait (ms)"}),(0,ea.jsx)(BN,{type:"number",value:k.waitTime||1500,onChange:e=>me(j,d(d({},k),{},{waitTime:parseInt(e.target.value)||1500})),className:"h-8 text-xs"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Cursor char"}),(0,ea.jsx)(BN,{value:k.cursorChar||"_",onChange:e=>me(j,d(d({},k),{},{cursorChar:e.target.value})),className:"h-8 text-xs w-20"})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs mt-4",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.loop,onChange:e=>me(j,d(d({},k),{},{loop:e.target.checked})),"data-testid":"typewriter-loop-".concat(j)})," Loop"]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Typed text colour = Style \u2192 Border color."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"gooey-text"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"gooey-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Texts (one per line \u2014 morphs between them)"}),(0,ea.jsx)(YN,{"data-testid":"gooey-texts-".concat(j),value:(k.texts||[]).join("\n"),onChange:e=>me(j,d(d({},k),{},{texts:e.target.value.split("\n")})),rows:4,className:"text-sm"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Morph time (s)"}),(0,ea.jsx)(BN,{type:"number",step:"0.1","data-testid":"gooey-morphtime-".concat(j),value:k.morphTime||1,onChange:e=>me(j,d(d({},k),{},{morphTime:parseFloat(e.target.value)||1})),className:"h-8 text-xs"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Cooldown (s)"}),(0,ea.jsx)(BN,{type:"number",step:"0.05",value:k.cooldownTime||.25,onChange:e=>me(j,d(d({},k),{},{cooldownTime:parseFloat(e.target.value)||.25})),className:"h-8 text-xs"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Text colour = Style \u2192 Border color;
2 dark Style \u2192 Background looks best."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"text-cycle"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"textcycle-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Prefix"}),(0,ea.jsx)(BN,{"data-testid":"textcycle-prefix-".concat(j),value:k.prefix||"",onChange:e=>me(j,d(d({},k),{},{prefix:e.target.value})),placeholder:"Your"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Suffix"}),(0,ea.jsx)(BN,{"data-testid":"textcycle-suffix-".concat(j),value:k.suffix||"",onChange:e=>me(j,d(d({},k),{},{suffix:e.target.value})),placeholder:"deserves better"})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Words (one per line \u2014 cycled in the middle)"}),(0,ea.jsx)(YN,{"data-testid":"textcycle-words-".concat(j),value:(k.words||[]).join("\n"),onChange:e=>me(j,d(d({},k),{},{words:e.target.value.split("\n")})),rows:4,className:"text-sm"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Cycled word colour"}),(0,ea.jsx)(wq,{value:k.wordColor||"#0ea5e9",onChange:e=>me(j,d(d({},k),{},{wordColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"textcycle-wordcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Interval (seconds)"}),(0,ea.jsx)(BN,{type:"number",min:"1","data-testid":"textcycle-interval-".concat(j),value:Math.round((k.interval||3e3)/1e3),onChange:e=>me(j,d(d({},k),{},{interval:1e3*(parseInt(e.target.value)||3)})),className:"h-8 text-xs"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Cycled word colour = Style \u2192 Border color."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"circular-testimonials"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"circtest-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading (optional)"}),(0,ea.jsx)(BN,{"data-testid":"circtest-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Role / title colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"circtest-subcolor-".concat(j)})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.autoplay,onChange:e=>me(j,d(d({},k),{},{autoplay:e.target.checked})),"data-testid":"circtest-autoplay-".concat(j)})," Auto-advance every 5s"]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Testimonials"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"circtest-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"ct-".concat(Date.now()),quote:"",name:"",designation:"",imageUrl:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"circtest-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"h-10 w-10 rounded-lg object-cover border"}):(0,ea.jsx)("div",{className:"h-10 w-10 rounded-lg border border-dashed flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"circtest-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":heroimg:items:").concat(t)),children:"Photo"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.imageUrl||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{imageUrl:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"\u2026or paste photo URL",className:"h-8 text-xs"}),(0,ea.jsx)(YN,{value:e.quote||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{quote:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Quote",rows:2,className:"text-xs"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.name||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{name:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Name",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.designation||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{designation:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Role / title",className:"h-8 text-xs"})]})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"stagger-testimonials"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"stagger-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"stagger-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Name / role colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stagger-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Active card colour"}
2),(0,ea.jsx)(wq,{value:k.cardColor||"#e11d48",onChange:e=>me(j,d(d({},k),{},{cardColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stagger-cardcolor-".concat(j)})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.autoplay,onChange:e=>me(j,d(d({},k),{},{autoplay:e.target.checked})),"data-testid":"stagger-autoplay-".concat(j)})," Auto-advance every 5s"]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Testimonials"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"stagger-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"st-".concat(Date.now()),quote:"",name:"",role:"",avatarUrl:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"stagger-item-".concat(j,"-").concat(t),children:[(0,ea.jsx)(YN,{value:e.quote||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{quote:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Quote",rows:2,className:"text-xs"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.avatarUrl?(0,ea.jsx)("img",{src:e.avatarUrl,alt:"",className:"h-8 w-8 rounded-full object-cover border"}):(0,ea.jsx)("div",{className:"h-8 w-8 rounded-full border border-dashed flex items-center justify-center",children:(0,ea.jsx)($N,{size:12,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"stagger-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":tavatar:").concat(t)),children:"Avatar"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.name||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{name:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Name",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.role||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{role:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"Role / company",className:"h-8 text-xs"})]})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"steps-icons"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"stepsicons-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"stepsicons",includePosition:!1}),(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Layout"}),(0,ea.jsxs)(eb,{value:k.layout||"horizontal",onValueChange:e=>me(j,d(d({},k),{},{layout:e})),children:[(0,ea.jsx)(sb,{className:"w-40 h-8 text-xs","data-testid":"stepsicons-layout-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"horizontal",children:"Horizontal (row)"}),(0,ea.jsx)(rb,{value:"vertical",children:"Vertical timeline"})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Badge text"}),(0,ea.jsx)(BN,{"data-testid":"stepsicons-badge-".concat(j),value:k.badge||"",onChange:e=>me(j,d(d({},k),{},{badge:e.target.value})),placeholder:"Brand new"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Badge colour"}),(0,ea.jsx)(wq,{value:k.badgeColor||"#10b981",onChange:e=>me(j,d(d({},k),{},{badgeColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepsicons-badgecolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"stepsicons-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading"}),(0,ea.jsx)(YN,{value:k.subheading||"",onChange:e=>me(j,d(d({},k),{},{subheading:e.target.value})),rows:2,className:"text-xs"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent colour"}),(0,ea.jsx)(wq,{value:k.accentColor||"#7c3aed",onChange:e=>me(j,d(d({},k),{},{accentColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepsicons-accent-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepsicons-subcolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Steps"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"stepsicons-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{steps:[...k.steps||[],{id:"si-".concat(Date.now()),icon:"zap",title:"",description:"",linkText:"",linkUrl:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.steps||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"stepsicons-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(eb,{value:e.icon||"zap",onValueChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{icon:s}),me(j,d(d({},k),{},{steps:a}))},children:[(0,ea.jsx)(sb,{className:"h-8 text-xs w-28",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:["zap","star","heart","shield","globe","settings","bell","calendar","mail","user","lock","cart","phone","file","home","help"].map(e=>(0,ea.jsx)(rb,{value:e,children:e},e))})]}),(0,ea.jsx)(BN,{value:e.title||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{title:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Step title",className:"h-8 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{steps:(k.steps||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(YN,{value:e.description||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{description:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Description",rows:2,className:"text-xs"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:e.linkText||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{linkText:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Link text",className:"h-8 text-xs"}),(0,ea.jsx)(BN,{value:e.linkUrl||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{linkUrl:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Link URL",className:"h-8 text-xs"})]})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"steps-cards"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"stepscards-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"stepscards",includePosition:!1}),(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Layout"}),(0,ea.jsxs)(eb,{value:k.layout||"horizontal",onValueChange:e=>me(j,d(d({},k),{},{layout:e})),children:[(0,ea.jsx)(sb,{className:"w-40 h-8 text-xs","data-testid":"stepscards-layout-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"horizontal",children:"Horizontal (row)"}),(0,ea.jsx)(rb,{value:"vertical",children:"Vertical timeline"})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Badge text"}),(0,ea.jsx)(BN,{"data-testid":"stepscards-badge-".concat(j),value:k.badge||"",onChange:e=>me(j,d(d({},k),{},{badge:e.target.value})),placeholder:"Brand new"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Badge colour"}),(0,ea.jsx)(wq,{value:k.badgeColor||"#10b981",onChange:e=>me(j,d(d({},k),{},{badgeColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepscards-badgecolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"stepscards-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading"}),(0,ea.jsx)(YN,{value:k.subheading||"",onChange:e=>me(j,d(d({},k),{},{subheading:e.target.value})),rows:2,className:"text-xs"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent / number colour"}),(0,ea.jsx)(wq,{value:k.accentColor||"#7c3aed",onChange:e=>me(j,d(d({},k),{},{accentColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepscards-accent-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepscards-subcolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text"}),(0,ea.jsx)(BN,{"data-testid":"stepscards-btn-text-".concat(j),value:k.buttonText||"",onChange:e=>me(j,d(d({},k),{},{buttonText:e.target.value})),placeholder:"Learn more"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button link"}),(0,ea.jsx)(BN,{"data-testid":"stepscards-btn-url-".concat(j),value:k.buttonUrl||"",onChange:e=>me(j,d(d({},k),{},{buttonUrl:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button colour"}),(0,ea.jsx)(wq,{value:k.buttonColor||"#7c3aed",onChange:e=>me(j,d(d({},k),{},{buttonColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepscards-btncolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepscards-btntextcolor-".concat(j)})]}),(0,ea.jsx)("div",{className:"col-span-2 pt-1",children:(0,ea.jsx)($$,{fields:k,testPrefix:"stepscards-btn",onPatch:e=>me(j,d(d({},k),e))})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Steps"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"stepscards-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{steps:[...k.steps||[],{id:"sc-".concat(Date.now()),title:"",description:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.steps||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"stepscards-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("span",{className:"text-xs font-bold text-slate-400 w-
25 shrink-0",children:[t+1,"."]}),(0,ea.jsx)(BN,{value:e.title||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{title:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Card title",className:"h-8 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{steps:(k.steps||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(YN,{value:e.description||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{description:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Description",rows:2,className:"text-xs"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"steps-grid-image"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"stepsgrid-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"stepsgrid",includePosition:!1}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading (optional)"}),(0,ea.jsx)(BN,{"data-testid":"stepsgrid-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent colour"}),(0,ea.jsx)(wq,{value:k.accentColor||"#7c3aed",onChange:e=>me(j,d(d({},k),{},{accentColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepsgrid-accent-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Text colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepsgrid-subcolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-md bg-slate-50 border border-slate-200",children:[k.imageUrl?(0,ea.jsx)("img",{src:k.imageUrl,alt:"",className:"h-12 w-12 object-cover rounded border"}):(0,ea.jsx)("div",{className:"h-12 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"stepsgrid-pick-".concat(j),onClick:()=>fe("".concat(j,":heroimg:imageUrl")),children:"Choose from Library"}),(0,ea.jsxs)(eb,{value:k.imagePosition||"right",onValueChange:e=>me(j,d(d({},k),{},{imagePosition:e})),children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs ml-auto","data-testid":"stepsgrid-imgpos-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Steps"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"stepsgrid-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{steps:[...k.steps||[],{id:"sg-".concat(Date.now()),title:"",description:"",badgeColor:"#7c3aed",highlight:!1}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.steps||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"stepsgrid-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{value:e.title||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{title:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Step title",className:"h-8 text-xs flex-1"}),(0,ea.jsx)(wq,{value:e.badgeColor||"#7c3aed",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{badgeColor:s.target.value}),me(j,d(d({},k),{},{steps:a}))},className:"h-8 w-9 rounded border",title:"Badge colour"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{steps:(k.steps||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(YN,{value:e.description||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{description:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Description",rows:2,className:"text-xs"}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!!e.highlight,onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{highlight:s.target.checked}),me(j,d(d({},k),{},{steps:a}))}})," Highlight this step"]})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"steps-timeline-image"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"stepstl-titlestyle-".concat(j)}),(0,ea.jsx)(YK,{id:j,content:k,updateBlock:me,prefix:"stepstl",includePosition:!1}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading (optional)"}),(0,ea.jsx)(BN,{"data-testid":"stepstl-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent colour"}),(0,ea.jsx)(wq,{value:k.accentColor||"#7c3aed",onChange:e=>me(j,d(d({},k),{},{accentColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepstl-accent-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Text colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"stepstl-subcolor-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-md bg-slate-50 border border-slate-200",children:[k.imageUrl?(0,ea.jsx)("img",{src:k.imageUrl,alt:"",className:"h-12 w-12 object-cover rounded border"}):(0,ea.jsx)("div",{className:"h-12 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"stepstl-pick-".concat(j),onClick:()=>fe("".concat(j,":heroimg:imageUrl")),children:"Choose from Library"}),(0,ea.jsxs)(eb,{value:k.imagePosition||"right",onValueChange:e=>me(j,d(d({},k),{},{imagePosition:e})),children:[(0,ea.jsx)(sb,{className:"w-24 h-8 text-xs ml-auto","data-testid":"stepstl-imgpos-".concat(j),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==k.showSuccess,onChange:e=>me(j,d(d({},k),{},{showSuccess:e.target.checked})),"data-testid":"stepstl-success-".concat(j)}),' Show final "Success" node']}),!1!==k.showSuccess&&(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Success label"}),(0,ea.jsx)(BN,{"data-testid":"stepstl-successlabel-".concat(j),value:k.successLabel||"",onChange:e=>me(j,d(d({},k),{},{successLabel:e.target.value})),placeholder:"Success",className:"h-8 text-xs"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Steps"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"stepstl-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{steps:[...k.steps||[],{id:"stl-".concat(Date.now()),title:"",description:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.steps||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"stepstl-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{value:e.title||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{title:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Step title",className:"h-8 text-xs flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>me(j,d(d({},k),{},{steps:(k.steps||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(YN,{value:e.description||"",onChange:s=>{const a=[...k.steps||[]];a[t]=d(d({},e),{},{description:s.target.value}),me(j,d(d({},k),{},{steps:a}))},placeholder:"Description",rows:2,className:"text-xs"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"handwriting-text"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"handwriting-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title (drawn)"}),(0,ea.jsx)(BN,{"data-testid":"handwriting-title-".concat(j),value:k.title||"",onChange:e=>me(j,d(d({},k),{},{title:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(YN,{"data-testid":"handwriting-subtitle-".concat(j),value:k.subtitle||"",onChange:e=>me(j,d(d({},k),{},{subtitle:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"handwriting-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Hand-drawn circle colour"}),(0,ea.jsx)(wq,{value:k.circleColor||"#9333ea",onChange:e=>me(j,d(d({},k),{},{circleColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"handwriting-circlecolor-".concat(j)})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!0===k.loop,onChange:e=>me(j,d(d({},k),{},{loop:e.target.checked})),"data-testid":"handwriting-loop-".concat(j)})," Loop the drawing animation"]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Hand-drawn stroke colour = Style \u2192 Border color."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"typewriter-smooth"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"twsmooth-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Prefix line (above)"}),(0,ea.jsx)(BN,{"data-testid":"twsmooth-prefix-".concat(j),value:k.prefix||"",onChange:e=>me(j,d(d({},k),{},{prefix:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Words (one per line \u2014 revealed; last word is accented)"}),(0,ea.jsx)(YN,{"data-testid":"twsmooth-words-".concat(j),value:(k.words||[]).join("\n"),onChange:e=>me(j,d(d({},k),{},{words:e.target.value.split("\n")})),rows:4,className:"text-sm"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Accent word / cursor colour"}),(0,ea.jsx)(wq,{value:k.wordColor||"#2563eb",onChange:e=>me(j,d(d({},k),{},{wordColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"twsmooth-wordcolor-".concat(j)})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!0===k.loop,onChange:e=>me(j,d(d({},k),{},{loop:e.target.checked})),"data-testid":"twsmooth-loop-".concat(j)})," Loop the reveal (with pause)"]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button 1 text"}),(0,ea.jsx)(BN,{"data-testid":"twsmooth-btn1-text-".concat(j),value:k.button1Text||"",onChange:e=>me(j,d(d({},k),{},{button1Text:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button 1 link"}),(0,ea.jsx)(BN,{value:k.button1Url||"",onChange:e=>me(j,d(d({},k),{},{button1Url:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button 2 text"}),(0,ea.jsx)(BN,{"data-testid":"twsmooth-btn2-text-".concat(j),value:k.button2Text||"",onChange:e=>me(j,d(d({},k),{},{button2Text:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button 2 link"}),(0,ea.jsx)(BN,{value:k.button2Url||"",onChange:e=>me(j,d(d({},k),{},{button2Url:e.target.value})),placeholder:"https://\u2026"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button 1 text colour"}),(0,ea.jsx)(wq,{value:k.buttonTextColor||"#ffffff",onChange:e=>me(j,d(d({},k),{},{buttonTextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"twsmooth-btn1-textcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button 2 text colour"}),(0,ea.jsx)(wq,{value:k.button2TextColor||"#0f172a",onChange:e=>me(j,d(d({},k),{},{button2TextColor:e.target.value})),className:"h-7 w-12 rounded border","data-testid":"twsmooth-btn2-textcolor-".concat(j)})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Accent (last word + cursor) = Style \u2192 Border color."})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),chi
2ldren:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]}),"folder-gallery"===N&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(EG,{activeTab:B(j),onTabChange:e=>R(j,e),onMoveUp:D,onMoveDown:_,onDuplicate:S,onDelete:E,onTogglePublished:A,isFirst:F,isLast:T,isPublished:z}),(0,ea.jsx)(AG,{showRightPane:"style"===B(j)||"animation"===B(j),contentPane:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(zG,{content:k,onChange:e=>me(j,e),styles:C,onStylesChange:e=>me(j,k,e),testIdPrefix:"folder-titlestyle-".concat(j)}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Heading"}),(0,ea.jsx)(BN,{"data-testid":"folder-heading-".concat(j),value:k.heading||"",onChange:e=>me(j,d(d({},k),{},{heading:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subheading"}),(0,ea.jsx)(YN,{"data-testid":"folder-subheading-".concat(j),value:k.subheading||"",onChange:e=>me(j,d(d({},k),{},{subheading:e.target.value})),rows:2})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Body text colour"}),(0,ea.jsx)(wq,{value:k.subtitleColor||"#475569",onChange:e=>me(j,d(d({},k),{},{subtitleColor:e.target.value})),className:"h-8 w-full rounded border cursor-pointer","data-testid":"folder-subcolor-".concat(j)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Folder (envelope) colour"}),(0,ea.jsx)(wq,{value:k.folderColor||"#d97706",onChange:e=>me(j,d(d({},k),{},{folderColor:e.target.value})),className:"h-8 w-full rounded border cursor-pointer","data-testid":"folder-color-".concat(j)})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Folder label"}),(0,ea.jsx)(BN,{"data-testid":"folder-label-".concat(j),value:k.folderLabel||"",onChange:e=>me(j,d(d({},k),{},{folderLabel:e.target.value})),placeholder:"Photos"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Photos (up to 6)"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"folder-add-".concat(j),onClick:()=>me(j,d(d({},k),{},{items:[...k.items||[],{id:"fg-".concat(Date.now()),imageUrl:""}]})),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),(k.items||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 space-y-2","data-testid":"folder-item-".concat(j,"-").concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[e.imageUrl?(0,ea.jsx)("img",{src:e.imageUrl,alt:"",className:"h-8 w-12 object-cover border rounded"}):(0,ea.jsx)("div",{className:"h-8 w-12 border border-dashed rounded flex items-center justify-center",children:(0,ea.jsx)($N,{size:14,className:"text-slate-300"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm","data-testid":"folder-pick-".concat(j,"-").concat(t),onClick:()=>fe("".concat(j,":heroimg:items:").concat(t)),children:"Photo"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 ml-auto",onClick:()=>me(j,d(d({},k),{},{items:(k.items||[]).filter((e,s)=>s!==t)})),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:e.imageUrl||"",onChange:s=>{const a=[...k.items||[]];a[t]=d(d({},e),{},{imageUrl:s.target.value}),me(j,d(d({},k),{},{items:a}))},placeholder:"\u2026or paste image URL",className:"h-8 text-xs"})]},e.id||t))]})]}),settingsPane:(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(FG,{isActive:"style"===B(j),children:(0,ea.jsx)(zq,{styles:C||{},onChange:e=>me(j,k,e),content:k,onContentChange:e=>me(j,e,C)})}),(0,ea.jsx)(FG,{isActive:"animation"===B(j),children:(0,ea.jsx)(gj,{animation:k.animation||{},onChange:e=>me(j,d(d({},k),{},{animation:e}))})})]})})]})]})},be=[{type:"heading",icon:wE,label:"Heading"},{type:"paragraph",icon:wE,label:"Paragraph"},{type:"image",icon:$N,label:"Image"},{type:"video",icon:SE,label:"Video Embed",category:"Media"},{type:"button",icon:EE,label:"Button"},{type:"hero",icon:SE,label:"Hero Banner",category:"Hero"},{type:"hero-spotlight",icon:$g,label:"Animated Hero (Spotlight)",category:"Hero"},{type:"hero-tabs",icon:NE,label:"Hero \u2014 Tabbed Showcase",category:"Hero"},{type:"hero-feature-cards",icon:AE,label:"Hero \u2014 Feature Cards",category:"Hero"},{type:"hero-split-stats",icon:FE,label:"Hero \u2014 Split + Stats",category:"Hero"},{type:"hero-split-cards",icon:TE,label:"Hero \u2014 Split + Image Cards",category:"Hero"},{type:"logo-cloud",icon:TE,label:"Logo Cloud / Clients",category:"Interactive"},{type:"countdown",icon:Kg,label:"Countdown Timer",category:"Interactive"},{type:"before-after",icon:zE,label:"Before / After Slider",category:"Interactive"}
2,{type:"expandable-tabs",icon:ME,label:"Expandable Tabs",category:"Interactive"},{type:"sparkles",icon:$g,label:"Sparkles Hero",category:"Interactive"},{type:"gallery-carousel",icon:TE,label:"Gallery Carousel",category:"Interactive"},{type:"folder-gallery",icon:jD,label:"Interactive Folder Gallery",category:"Interactive"},{type:"steps-icons",icon:PE,label:"Steps \u2014 Icons & Arrows",category:"Interactive"},{type:"steps-cards",icon:BE,label:"Steps \u2014 Numbered Cards",category:"Interactive"},{type:"steps-grid-image",icon:AE,label:"Steps \u2014 Grid + Image",category:"Interactive"},{type:"steps-timeline-image",icon:PE,label:"Steps \u2014 Timeline + Image",category:"Interactive"},{type:"liquid-glass",icon:$g,label:"Liquid Glass Card",category:"Interactive"},{type:"testimonial-deck",icon:RE,label:"Testimonial Cards (Deck)",category:"Testimonials"},{type:"testimonials-columns",icon:RE,label:"Testimonials Columns (Scrolling)",category:"Testimonials"},{type:"circular-testimonials",icon:RE,label:"Block Testimonials",category:"Testimonials"},{type:"stagger-testimonials",icon:RE,label:"Stagger Testimonials",category:"Testimonials"},{type:"typewriter",icon:wE,label:"Typewriter Text",category:"Text Effects"},{type:"typewriter-smooth",icon:wE,label:"Typewriter (Smooth Reveal)",category:"Text Effects"},{type:"gooey-text",icon:$g,label:"Gooey Text Morph",category:"Text Effects"},{type:"text-cycle",icon:wE,label:"Animated Text Cycle",category:"Text Effects"},{type:"handwriting-text",icon:wE,label:"Hand Writing Text",category:"Text Effects"},{type:"gallery",icon:TE,label:"Image Gallery",category:"Media"},{type:"form",icon:yw,label:"Embed Form",category:"Featured"},{type:"ticker",icon:LE,label:"Ticker Tape / Logo Carousel",category:"Featured"},{type:"article-feed",icon:yw,label:"Article Feed / Blog",category:"Featured"},{type:"events-calendar",icon:Kg,label:"Events Calendar",category:"Featured"},{type:"search",icon:fj,label:"Site Search",category:"Featured"},{type:"pricing",icon:bw,label:"Pricing Table",category:"Featured"},{type:"feature-comparison",icon:AE,label:"Feature Comparison",category:"Featured"},{type:"plan-comparison",icon:_E,label:"Plan Comparison Table",category:"Featured"},{type:"testimonials",icon:RE,label:"Testimonials",category:"Featured"},{type:"faq",icon:Aw,label:"FAQ",category:"Featured"},{type:"cta",icon:NE,label:"Call to Action",category:"Featured"},{type:"team",icon:Bj,label:"Team Members",category:"Featured"},{type:"stats",icon:$l,label:"Statistics",category:"Featured"},{type:"quote",icon:Zl,label:"Quote"},{type:"list",icon:IE,label:"List"},{type:"code",icon:kE,label:"Code"},{type:"newsletter-header",icon:ME,label:"Newsletter Header",category:"Newsletter"},{type:"article-card",icon:qN,label:"Insert Article",category:"Newsletter"},{type:"unsubscribe",icon:DE,label:"Unsubscribe Link",category:"Newsletter"},{type:"custom-html",icon:OE,label:"Custom HTML",category:"Advanced"},{type:"columns",icon:AE,label:"Columns (2-5)",category:"Layout"},{type:"card-grid",icon:AE,label:"Card Grid (ordered, unlimited)",category:"Layout"},{type:"image-text-row",icon:FE,label:"Image + Text (Row)",category:"Layout"},{type:"image-text-stack",icon:FE,label:"Image + Text (Stack)",category:"Layout"}],je=be.filter(e=>!e.category),ye=be.filter(e=>"Media"===e.category),Ne=be.filter(e=>"Hero"===e.category),we=be.filter(e=>"Featured"===e.category),Ce=be.filter(e=>"Text Effects"===e.category),ke=be.filter(e=>"Testimonials"===e.category),De=be.filter(e=>"Interactive"===e.category),_e=be.filter(e=>"Layout"===e.category),Se=be.filter(e=>"Advanced"===e.category),Ee=be.filter(e=>"Newsletter"===e.category);return(0,ea.jsxs)("div",{className:"py-8 px-4","data-testid":"block-editor",children:[s.length>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-4 pb-3 border-b border-slate-200",children:[(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:[s.length," blocks"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{W(new Set(s.map(e=>e.id)))},className:"text-xs h-7 px-2",title:"Collapse all blocks",children:[(0,ea.jsx)(er,{size:12,className:"mr-1"}),"Collapse All"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{W(new Set)},className:"text-xs h-7 px-2",title:"Expand all blocks",children:[(0,ea.jsx)(tr,{size:12,className:"mr-1"}),"Expand All"]})]})]}),(0,ea.jsx)(YS,{sensors:re,collisionDetection:A_,onDragEnd:e=>{const{active:t,over:n}=e;
2if(t.id!==n.id){const e=s.findIndex(e=>e.id===t.id),l=s.findIndex(e=>e.id===n.id),r=tE(s,e,l).map((e,t)=>d(d({},e),{},{order:t}));a(r)}},children:(0,ea.jsx)(cE,{items:s.map(e=>e.id),strategy:rE,children:s.map((e,t)=>{var a;return(0,ea.jsx)(aY,{block:e,index:t,onDuplicate:xe,onDelete:he,onStyleClick:e=>b(v===e?null:e),onMoveUp:()=>ne(t),onMoveDown:()=>le(t),isFirst:0===t,isLast:t===s.length-1,isCollapsed:H.has(e.id),onToggleCollapse:()=>{return t=e.id,void W(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},onAnchorChange:te,isDuplicateAnchor:se(e),allAnchorIds:Q(),onApplyPreset:pe,onApplyColumnPreset:ge,onTogglePublished:ae,onSaveBlock:F,children:ve(e,t,{onMoveUp:()=>ne(t),onMoveDown:()=>le(t),onDuplicate:()=>xe(e),onDelete:()=>he(e.id),onTogglePublished:()=>ae(e.id),isFirst:0===t,isLast:t===s.length-1,isPublished:!1!==(null===(a=e.content)||void 0===a?void 0:a.isPublished)})},e.id)})})}),(0,ea.jsxs)("div",{className:"relative mt-4 mb-2",children:[(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(UE,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)("input",{ref:J,type:"text",placeholder:'Type "/" to add a block quickly...',onChange:ce,onKeyDown:ue,className:"w-full pl-10 pr-4 py-3 border border-slate-200 rounded-lg text-sm placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all","data-testid":"slash-command-input"})]}),(0,ea.jsx)(iG,{isOpen:V,onClose:()=>{q(!1),G(""),J.current&&(J.current.value="")},onSelect:de,position:K,searchQuery:$})]}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsxs)(sg,{onClick:()=>{h(!m),m||A()},variant:"outline",className:"w-full justify-center border-dashed hover:border-indigo-400 hover:text-indigo-600","data-testid":"add-block-button",children:[(0,ea.jsx)(Vj,{size:20,className:"mr-2"}),"Add Block"]}),m&&(0,ea.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/20",onClick:()=>h(!1),children:(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg shadow-2xl p-4 w-[500px] max-h-[70vh] overflow-auto","data-testid":"block-type-menu",onClick:e=>e.stopPropagation(),children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-800",children:"Add Block"}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsxs)("a",{href:"https://eu.nexuscms.ai/site/nexusone/page/home",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-semibold text-indigo-600 hover:text-indigo-800 bg-indigo-50 hover:bg-indigo-100 px-2.5 py-1.5 rounded-md transition-colors","data-testid":"block-examples-link",title:"See live examples of every block, with the settings used",children:[(0,ea.jsx)(bj,{size:13}),"Block Examples"]}),(0,ea.jsx)("button",{onClick:()=>h(!1),className:"text-slate-400 hover:text-slate-600",children:"\u2715"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-indigo-500 px-2 py-1 flex items-center gap-1",children:[(0,ea.jsx)(CE,{size:12}),"My Saved Blocks"]}),S?(0,ea.jsx)("div",{className:"col-span-2 px-2 py-2 text-xs text-slate-400",children:"Loading\u2026"}):0===D.length?(0,ea.jsx)("div",{className:"col-span-2 px-2 py-2 text-xs text-slate-400",children:"No saved blocks yet. Click the bookmark icon on any block to save it for reuse."}):D.map(e=>(0,ea.jsxs)("div",{className:"col-span-2 group flex items-center justify-between gap-2 px-3 py-2 hover:bg-indigo-50 rounded-lg transition-colors text-sm cursor-pointer",onClick:()=>T(e),"data-testid":"saved-block-".concat(e.template_id),children:[(0,ea.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,ea.jsx)(CE,{size:16,className:"text-indigo-600 shrink-0"}),(0,ea.jsx)("span",{className:"text-indigo-700 font-medium truncate",children:e.name})]}),(0,ea.jsx)("button",{onClick:t=>z(e.template_id,t),className:"opacity-0 group-hover:opacity-100 text-slate-400 hover:text-red-600 transition-opacity shrink-0",title:"Remove saved block","data-testid":"delete-saved-block-".concat(e.template_id),children:(0,ea.jsx)(HE,{size:14})})]},e.template_id)),(0,ea.jsx)("div",{className:"col-span-2 text-xs font-semibold text-slate-500 px-2 py-1 mt-2 border-t",children:"Basic Blocks"}),je.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-slate-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-slate-600"}),(0,ea.jsx)("span",{children:a})]},t)}),(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-teal-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)(SE,{size:12}),"Media"]}),ye.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-teal-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-teal-600"}),(0,ea.jsx)("span",{className:"text-teal-700 font-medium",children:a})]},t)}),(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-amber-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)(SE,{size:12}),"Hero Section"]}),Ne.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-amber-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-amber-600"}),(0,ea.jsx)("span",{className:"text-amber-700 font-medium",children:a})]},t)}),we.length>0&&(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-purple-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)($g,{size:12}),"Featured Blocks"]}),we.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-purple-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-purple-600"}),(0,ea.jsx)("span",{className:"text-purple-700 font-medium",children:a})]},t)}),De.length>0&&(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-fuchsia-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)(EE,{size:12}),"Interactive & Media"]}),De.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-fuchsia-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-fuchsia-600"}),(0,ea.jsx)("span",{className:"text-fuchsia-700 font-medium",children:a})]},t)}),Ce.length>0&&(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-blue-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)(wE,{size:12}
2),"Text Effects"]}),Ce.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-blue-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-blue-600"}),(0,ea.jsx)("span",{className:"text-blue-700 font-medium",children:a})]},t)}),ke.length>0&&(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-teal-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)(RE,{size:12}),"Testimonials"]}),ke.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-teal-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-teal-600"}),(0,ea.jsx)("span",{className:"text-teal-700 font-medium",children:a})]},t)}),(0,ea.jsx)("div",{className:"col-span-2 text-xs font-semibold text-slate-500 px-2 py-1 mt-2 border-t",children:"Layout Blocks"}),_e.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-slate-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-indigo-600"}),(0,ea.jsx)("span",{children:a})]},t)}),(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-red-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)(OE,{size:12}),"Advanced"]}),Se.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-red-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-red-600"}),(0,ea.jsx)("span",{className:"text-red-700 font-medium",children:a})]},t)}),Ee.length>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"col-span-2 text-xs font-semibold text-rose-500 px-2 py-1 mt-2 border-t flex items-center gap-1",children:[(0,ea.jsx)(DE,{size:12}),"Newsletter"]}),Ee.map(e=>{let{type:t,icon:s,label:a}=e;return(0,ea.jsxs)("button",{onClick:()=>oe(t),"data-testid":"add-block-".concat(t),className:"flex items-center gap-2 px-3 py-2 hover:bg-rose-50 rounded-lg transition-colors text-left text-sm",children:[(0,ea.jsx)(s,{size:18,className:"text-rose-600"}),(0,ea.jsx)("span",{className:"text-rose-700 font-medium",children:a})]},t)})]})]})]})})]}),(0,ea.jsx)(Dq,{open:x,onClose:()=>p(!1),onSelect:e=>{if(g)if(g.includes(":ticker:")){const t=g.split(":"),a=t[0],n=parseInt(t[2]),l=s.find(e=>e.id===a);if(l&&"ticker"===l.type){const t=[...l.content.items||[]];t[n]&&(t[n]=d(d({},t[n]),{},{imageUrl:e.url,imageAlt:e.alt_text||e.filename}),me(a,d(d({},l.content),{},{items:t})))}}else if(g.includes(":heroimg:")){const t=g.split(":"),a=t[0],n=t[2],l=t[3],r=s.find(e=>e.id===a);if(r){const t=d({},r.content);if(void 0===l||""===l)t[n]=e.url;else{const s=[...t[n]||[]],a=parseInt(l);s[a]&&(s[a]=d(d({},s[a]),{},{imageUrl:e.url}),t[n]=s)}me(a,t)}}else if(g.includes(":testiavatar:")){const t=g.split(":"),a=t[0],n=parseInt(t[2]),l=s.find(e=>e.id===a);if(l&&"testimonials"===l.type){const t=[...l.content.items||[]];t[n]&&(t[n]=d(d({},t[n]),{},{avatar:e.url}),me(a,d(d({},l.content),{},{items:t})))}}else if(g.includes(":tavatar:")){const t=g.split(":"),a=t[0],n=parseInt(t[2]),l=s.find(e=>e.id===a);if(l){const t=[...l.content.items||[]];t[n]&&(t[n]=d(d({},t[n]),{},{avatarUrl:e.url}),me(a,d(d({},l.content),{},{items:t})))}}else if(g.includes(":beforeafter:")){const t=g.split(":"),a=t[0],n=t[2],l=s.find(e=>e.id===a);if(l&&"before-after"===l.type){const t="after"===n?"afterImage":"beforeImage";me(a,d(d({},l.content),{},{[t]:e.url}))}}else if(g.includes(":teammember:")){const t=g.split(":"),a=t[0],n=parseInt(t[2]),l=s.find(e=>e.id===a);if(l&&"team"===l.type){const t=[...l.content.members||[]];t[n]&&(t[n]=d(d({},t[n]),{},{image:e.url}),me(a,d(d({},l.content),{},{members:t})))}}else if(g.includes(":logocloud:")){const t=g.split(":"),a=t[0],n=parseInt(t[2]),l=s.find(e=>e.id===a);if(l&&"logo-cloud"===l.type){const t=[...l.content.logos||[]];t[n]&&(t[n]=d(d({},t[n]),{},{imageUrl:e.url,name:t[n].name||e.alt_text||""}),me(a,d(d({},l.content),{},{logos:t})))}}
2else if(g.includes(":carousel:")){const t=g.split(":"),a=t[0],n=parseInt(t[2]),l=s.find(e=>e.id===a);if(l&&"image-text-row"===l.type){const t=l.content.slides||[],s=t.length>0?[...t]:[{imageUrl:l.content.imageUrl||"",imageAlt:l.content.imageAlt||"",textHtml:l.content.textHtml||"<p>Text content</p>",imagePosition:l.content.imagePosition||"left"}];s[n]=d(d({},s[n]),{},{imageUrl:e.url,imageAlt:e.alt_text||e.filename}),me(a,d(d({},l.content),{},{slides:s}))}}else if(g.includes(":")){const[t,a]=g.split(":"),n=parseInt(a),l=s.find(e=>e.id===t);if(l&&("columns"===l.type||"card-grid"===l.type)){const s=[...l.content.columns];s[n]=d(d({},s[n]),{},{imageUrl:e.url,imageAlt:e.alt_text||e.filename}),me(t,d(d({},l.content),{},{columns:s}))}}else{const t=s.find(e=>e.id===g);t&&("image"===t.type?me(g,d(d({},t.content),{},{url:e.url,alt:e.alt_text||e.filename})):"image-text-row"===t.type||"image-text-stack"===t.type?me(g,d(d({},t.content),{},{imageUrl:e.url,imageAlt:e.alt_text||e.filename})):"newsletter-header"===t.type&&me(g,d(d({},t.content),{},{logoUrl:e.url,logoAlt:e.alt_text||e.filename||t.content.logoAlt})))}f(null)}}),(0,ea.jsx)(L$,{open:j,onClose:()=>{y(!1),w(null)},onSelect:e=>{if(N){const t=s.map(t=>t.id===N?d(d({},t),{},{content:d(d({},t.content),{},{code:e.code,language:e.language})}):t);a(t)}y(!1),w(null)}}),(0,ea.jsx)(mG,{open:!!C,block:C,onClose:()=>k(null),onSaved:()=>A()})]})},lY=e=>{var s;let{open:a,onOpenChange:n,onBlocksGenerated:l}=e;const[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)("openai"),[d,u]=(0,t.useState)(""),[m,h]=(0,t.useState)(""),[x,p]=(0,t.useState)(""),[g,f]=(0,t.useState)(!1),[v,b]=(0,t.useState)(0),[j,y]=(0,t.useState)(!1),[N,w]=(0,t.useState)(!0),[C,k]=(0,t.useState)({}),[D,_]=(0,t.useState)([]),[S,E]=(0,t.useState)(!1);(0,t.useEffect)(()=>{a&&(A(),F(),T())},[a]),(0,t.useEffect)(()=>{C[o]&&u(C[o].default)},[o,C]);const A=async()=>{try{const e=await _l.get("/ai/credits");b(e.data.credits)}catch(e){console.error("Failed to fetch credits",e)}finally{w(!1)}},F=async()=>{try{const e=await _l.get("/ai/models");k(e.data)}catch(e){console.error("Failed to fetch models",e)}},T=async()=>{try{const e=await _l.get("/ai/packages");_(e.data.packages)}catch(e){console.error("Failed to fetch packages",e)}};return(0,ea.jsx)(Ok,{open:a,onOpenChange:n,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)($g,{className:"text-purple-500",size:24}),"AI Page Designer"]})}),S?(0,ea.jsxs)("div",{className:"py-6",children:[(0,ea.jsxs)("div",{className:"text-center mb-6",children:[(0,ea.jsx)(Aj,{size:48,className:"mx-auto text-slate-300 mb-3"}),(0,ea.jsx)("h3",{className:"text-lg font-semibold",children:"Purchase AI Credits"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm",children:"Each AI design generation uses 1 credit"})]}),(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-4 mb-6",children:D.map(e=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-4 text-center hover:border-purple-400 hover:shadow-md transition-all cursor-pointer",onClick:()=>(async e=>{try{const t=await _l.post("/ai/purchase-credits?package=".concat(e));window.open(t.data.url,"_blank"),qs.success("Redirecting to checkout...")}catch(t){qs.error("Failed to initiate purchase")}})(e.id),children:[(0,ea.jsx)("div",{className:"text-2xl font-bold text-purple-600",children:e.credits}),(0,ea.jsx)("div",{className:"text-sm text-slate-500 mb-2",children:"credits"}),(0,ea.jsxs)("div",{className:"text-xl font-semibold",children:["$",e.price]}),(0,ea.jsx)("div",{className:"text-xs text-slate-400 mt-1",children:e.description})]},e.id))}),(0,ea.jsx)(sg,{variant:"outline",className:"w-full",onClick:()=>E(!1),children:"Back to Designer"})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between bg-slate-50 rounded-lg p-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)($g,{size:18,className:"text-purple-500"}),(0,ea.jsx)("span",{className:"font-medium",children:"Available Credits:"}),N?(0,ea.jsx)(ql,{size:16,className:"animate-spin"}):(0,ea.jsx)("span",{className:"text-lg font-bold text-purple-600",children:v})]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[(0,ea.jsx)(Aj,{size:14,className:"mr-1"}),"Buy Credits"]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"AI Provider"}),(0,ea.jsxs)(eb,{value:o,onValueChange:c,children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"openai",children:"OpenAI (GPT)"}),(0,ea.jsx)(rb,{value:"anthropic",children:"Anthropic (Claude)"}),(0,ea.jsx)(rb,{value:"gemini",children:"Google (Gemini)"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Model"}),(0,ea.jsxs)(eb,{value:d,onValueChange:u,children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select model"})}),(0,ea.jsx)(lb,{children:null===(s=C[o])||void 0===s?void 0:s.options.map(e=>(0,ea.jsx)(rb,{value:e,children:e},e))})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("label",{className:"text-sm font-medium mb-1 block",children:["Business Type ",(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"(optional)"})]}),(0,ea.jsxs)(eb,{value:m||"none",onValueChange:e=>h("none"===e?"":e),children:[(0,ea.jsx)(sb,{"data-testid":"ai-business-type",children:(0,ea.jsx)(tb,{placeholder:"Any"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"Any"}),(0,ea.jsx)(rb,{value:"saas",children:"SaaS / Software"}),(0,ea.jsx)(rb,{value:"agency",children:"Agency / Services"}),(0,ea.jsx)(rb,{value:"ecommerce",children:"E-commerce"}),(0,ea.jsx)(rb,{value:"restaurant",children:"Restaurant / Hospital
2ity"}),(0,ea.jsx)(rb,{value:"portfolio",children:"Portfolio / Creative"}),(0,ea.jsx)(rb,{value:"blog",children:"Blog / Publication"}),(0,ea.jsx)(rb,{value:"nonprofit",children:"Nonprofit / Charity"}),(0,ea.jsx)(rb,{value:"fitness",children:"Fitness / Wellness"}),(0,ea.jsx)(rb,{value:"education",children:"Education / Training"}),(0,ea.jsx)(rb,{value:"other",children:"Other"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("label",{className:"text-sm font-medium mb-1 block",children:["Tone ",(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"(optional)"})]}),(0,ea.jsxs)(eb,{value:x||"none",onValueChange:e=>p("none"===e?"":e),children:[(0,ea.jsx)(sb,{"data-testid":"ai-tone",children:(0,ea.jsx)(tb,{placeholder:"Default"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"Default"}),(0,ea.jsx)(rb,{value:"professional",children:"Professional"}),(0,ea.jsx)(rb,{value:"playful",children:"Playful"}),(0,ea.jsx)(rb,{value:"bold",children:"Bold"}),(0,ea.jsx)(rb,{value:"minimal",children:"Minimal"}),(0,ea.jsx)(rb,{value:"warm",children:"Warm / Friendly"}),(0,ea.jsx)(rb,{value:"technical",children:"Technical"}),(0,ea.jsx)(rb,{value:"luxurious",children:"Luxurious"})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Describe Your Page"}),(0,ea.jsx)(YN,{value:r,onChange:e=>i(e.target.value),placeholder:"E.g., Create a landing page for a fitness app with hero section, 3 feature columns with icons, testimonial slider, and call-to-action...",rows:4,className:"resize-none"})]}),(0,ea.jsxs)("label",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer hover:bg-slate-50 transition-colors","data-testid":"ai-generate-images-toggle",children:[(0,ea.jsx)("input",{type:"checkbox",checked:g,onChange:e=>f(e.target.checked),className:"mt-1 w-4 h-4 accent-purple-600"}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsxs)("div",{className:"text-sm font-medium flex items-center gap-2",children:["Generate real images",(0,ea.jsx)("span",{className:"text-[10px] uppercase tracking-wide bg-purple-100 text-purple-700 px-1.5 py-0.5 rounded",children:"Nano Banana"})]}),(0,ea.jsx)("div",{className:"text-xs text-slate-500 mt-0.5",children:"Replace placeholder images with AI-generated photos (saves to your Media Library). Adds ~5-10 seconds per image. Same 1 credit cost."})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-2 block",children:"Example prompts:"}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2",children:["Landing page for a coffee shop with hero, features, menu highlights, and contact","Portfolio page with hero introduction, 3-column project gallery, about section","SaaS product page with features grid, pricing comparison, testimonials","Restaurant menu page with food categories, specials, and reservation info","Blog homepage with featured post, recent articles grid, newsletter signup"].slice(0,3).map((e,t)=>(0,ea.jsxs)("button",{onClick:()=>i(e),className:"text-xs bg-slate-100 hover:bg-slate-200 text-slate-600 px-2 py-1 rounded transition-colors truncate max-w-[200px]",title:e,children:[e.slice(0,40),"..."]},t))})]}),(0,ea.jsx)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 text-sm",children:(0,ea.jsxs)("p",{className:"text-amber-800",children:[(0,ea.jsx)("strong",{children:"Tip:"})," The AI now knows your brand colors and fonts and can use Pricing, Testimonials, FAQ, CTA, Team and Stats blocks. Picking a Business Type and Tone above significantly improves output quality."]})})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(r.trim()){if(v<1)return qs.error("Insufficient credits. Please purchase more credits."),void E(!0);y(!0);try{const e=await _l.post("/ai/design",{prompt:r.trim(),ai_provider:o,ai_model:d||void 0,business_type:m||void 0,tone:x||void 0,generate_images:g}),{blocks:t,credits_remaining:s,images_generated:a}=e.data;b(s);const c=a>0?" Generated ".concat(a," image").concat(1===a?"":"s","."):"";qs.success("Page design generated!".concat(c," ").concat(s," credits remaining.")),l(t),n(!1),i("")}catch(a){var e,t,s;const n=(null===(e=a.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to generate design";qs.error(n),402===(null===(s=a.response)||void 0===s?void 0:s.status)&&E(!0)}finally{y(!1)}}else qs.error("Please enter a description for your page")},disabled:j||!r.trim()||v<1,className:"bg-purple-600 hover:bg-purple-700",children:j?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:16,className:"mr-2 animate-spin"}),"Generating..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(pq,{size:16,className:"mr-2"}),"Generate Design (1 credit)"]})})]})]})]})})},rY=["__scopeCollapsible","open","defaultOpen","disabled","onOpenChange"],iY=["__scopeCollapsible"],oY=["forceMount"],cY=["__scopeCollapsible","present","children"];
2var dY="Collapsible",[uY,mY]=jr(dY),[hY,xY]=uY(dY),pY=t.forwardRef((e,s)=>{const{__scopeCollapsible:a,open:n,defaultOpen:r,disabled:i,onOpenChange:o}=e,c=l(e,rY),[u,m]=Cr({prop:n,defaultProp:null!==r&&void 0!==r&&r,onChange:o,caller:dY});return(0,ea.jsx)(hY,{scope:a,disabled:i,contentId:ki(),open:u,onOpenToggle:t.useCallback(()=>m(e=>!e),[m]),children:(0,ea.jsx)(Tr.div,d(d({"data-state":yY(u),"data-disabled":i?"":void 0},c),{},{ref:s}))})});pY.displayName=dY;var gY="CollapsibleTrigger",fY=t.forwardRef((e,t)=>{const{__scopeCollapsible:s}=e,a=l(e,iY),n=xY(gY,s);return(0,ea.jsx)(Tr.button,d(d({type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":yY(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled},a),{},{ref:t,onClick:xr(e.onClick,n.onOpenToggle)}))});fY.displayName=gY;var vY="CollapsibleContent",bY=t.forwardRef((e,t)=>{const{forceMount:s}=e,a=l(e,oY),n=xY(vY,e.__scopeCollapsible);return(0,ea.jsx)(Jc,{present:s||n.open,children:e=>{let{present:s}=e;return(0,ea.jsx)(jY,d(d({},a),{},{ref:t,present:s}))}})});bY.displayName=vY;var jY=t.forwardRef((e,s)=>{const{__scopeCollapsible:a,present:n,children:r}=e,i=l(e,cY),o=xY(vY,a),[c,u]=t.useState(n),m=t.useRef(null),h=fr(s,m),x=t.useRef(0),p=x.current,g=t.useRef(0),f=g.current,v=o.open||c,b=t.useRef(v),j=t.useRef(void 0);return t.useEffect(()=>{const e=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(e)},[]),Nr(()=>{const e=m.current;if(e){j.current=j.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();x.current=t.height,g.current=t.width,b.current||(e.style.transitionDuration=j.current.transitionDuration,e.style.animationName=j.current.animationName),u(n)}},[o.open,n]),(0,ea.jsx)(Tr.div,d(d({"data-state":yY(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!v},i),{},{ref:h,style:d({"--radix-collapsible-content-height":p?"".concat(p,"px"):void 0,"--radix-collapsible-content-width":f?"".concat(f,"px"):void 0},e.style),children:v&&r}))});function yY(e){return e?"open":"closed"}var NY=pY,wY=fY,CY=bY;
2const kY=NY,DY=fY,_Y=bY,SY=e=>{var s,a;let{theme:n,onChange:l}=e;const[r,i]=(0,t.useState)(null),[o,c]=(0,t.useState)(!1);(0,t.useEffect)(()=>{u()},[]);const u=async()=>{try{const e=await _l.get("/theme");i(e.data)}catch(e){console.error("Failed to fetch site theme")}},m=n||{use_site_theme:!0},h=(e,t)=>{l(d(d({},m),{},{[e]:t}))},x=e=>!1===m.use_site_theme&&m[e]?m[e]:(null===r||void 0===r?void 0:r[e])||"";return(0,ea.jsxs)(kY,{open:o,onOpenChange:c,className:"border border-slate-200 rounded-lg",children:[(0,ea.jsx)(DY,{asChild:!0,children:(0,ea.jsxs)(sg,{variant:"ghost",className:"w-full justify-between p-4 h-auto","data-testid":"page-theme-panel-toggle",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Dw,{size:18,className:"text-purple-500"}),(0,ea.jsx)("span",{className:"font-medium",children:"Page Theme"})]}),o?(0,ea.jsx)(er,{size:18}):(0,ea.jsx)(tr,{size:18})]})}),(0,ea.jsx)(_Y,{className:"px-4 pb-4",children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-slate-100",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Use Site Theme"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Inherit settings from site-wide theme"})]}),(0,ea.jsx)(wb,{checked:!1!==m.use_site_theme,onCheckedChange:e=>h("use_site_theme",e),"data-testid":"page-theme-use-site-toggle"})]}),!1===m.use_site_theme&&(0,ea.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Backgroun
2d Type"}),(0,ea.jsxs)(eb,{value:m.background_type||"solid",onValueChange:e=>h("background_type",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid Color"}),(0,ea.jsx)(rb,{value:"linear-gradient",children:"Linear Gradient"}),(0,ea.jsx)(rb,{value:"radial-gradient",children:"Radial Gradient"})]})]})]}),(!m.background_type||"solid"===m.background_type)&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Background Color"}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:m.background_color||"#ffffff",onChange:e=>h("background_color",e.target.value),className:"w-12 h-9 p-1 cursor-pointer","data-testid":"page-theme-bg-color-picker"}),(0,ea.jsx)(BN,{value:m.background_color||"#ffffff",onChange:e=>h("background_color",e.target.value),placeholder:"#ffffff",className:"flex-1","data-testid":"page-theme-bg-color-input"})]})]}),m.background_type&&"solid"!==m.background_type&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Gradient Direction"}),(0,ea.jsxs)(eb,{value:m.gradient_direction||"to bottom",onValueChange:e=>h("gradient_direction",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"to bottom",label:"Top to Bottom"},{value:"to right",label:"Left to Right"},{value:"to bottom right",label:"Diagonal \u2198"},{value:"to bottom left",label:"Diagonal \u2199"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Start Color"}),(0,ea.jsxs)("div",{className:"flex gap-1 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:m.gradient_start||"#6366f1",onChange:e=>h("gradient_start",e.target.value),className:"w-10 h-9 p-1 cursor-pointer"}),(0,ea.jsx)(BN,{value:m.gradient_start||"#6366f1",onChange:e=>h("gradient_start",e.target.value),className:"flex-1 text-xs"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"End Color"}),(0,ea.jsxs)("div",{className:"flex gap-1 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:m.gradient_end||"#8b5cf6",onChange:e=>h("gradient_end",e.target.value),className:"w-10 h-9 p-1 cursor-pointer"}),(0,ea.jsx)(BN,{value:m.gradient_end||"#8b5cf6",onChange:e=>h("gradient_end",e.target.value),className:"flex-1 text-xs"})]})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Heading Color"}),(0,ea.jsxs)("div",{className:"flex gap-1 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:m.heading_color||"#1e293b",onChange:e=>h("heading_color",e.target.value),className:"w-10 h-9 p-1 cursor-pointer"}),(0,ea.jsx)(BN,{value:m.heading_color||"#1e293b",onChange:e=>h("heading_color",e.target.value),className:"flex-1 text-xs"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Body Color"}),(0,ea.jsxs)("div",{className:"flex gap-1 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:m.body_color||"#475569",onChange:e=>h("body_color",e.target.value),className:"w-10 h-9 p-1 cursor-pointer"}),(0,ea.jsx)(BN,{value:m.body_color||"#475569",onChange:e=>h("body_color",e.target.value),className:"flex-1 text-xs"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Primary/Accent Color"}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:m.primary_color||"#4f46e5",onChange:e=>h("primary_color",e.target.value),className:"w-12 h-9 p-1 cursor-pointer","data-testid":"page-theme-primary-color-picker"}),(0,ea.jsx)(BN,{value:m.primary_color||"#4f46e5",onChange:e=>h("primary_color",e.target.value),className:"flex-1","data-testid":"page-theme-primary-color-input"})]})]})]}),(0,ea.jsxs)("div",{className:"mt-4 p-4 rounded-lg border border-slate-200",style:{background:!1!==m.use_site_theme?null!==r&&void 0!==r&&null!==(s=r.background_type)&&void 0!==s&&s.includes("gradient")?"linear-gradient(".concat((null===r||void 0===r?void 0:r.gradient_direction)||"to bottom",", ").concat((null===r||void 0===r?void 0:r.gradient_start)||"#6366f1",", ").concat((null===r||void 0===r?void 0:r.gradient_end)||"#8b5cf6",")"):(null===r||void 0===r?void 0:r.background_color)||"#ffffff"
2:null!==(a=m.background_type)&&void 0!==a&&a.includes("gradient")?"linear-gradient(".concat(m.gradient_direction||"to bottom",", ").concat(m.gradient_start||"#6366f1",", ").concat(m.gradient_end||"#8b5cf6",")"):m.background_color||"#ffffff"},children:[(0,ea.jsx)("p",{className:"text-xs font-medium mb-1",style:{color:x("heading_color")||"#1e293b"},children:"Preview Heading"}),(0,ea.jsx)("p",{className:"text-xs",style:{color:x("body_color")||"#475569"},children:"This is how text will appear on this page."})]})]})})]})},EY=[{value:"landing",label:"Landing Page"},{value:"about",label:"About Us"},{value:"contact",label:"Contact"},{value:"blog",label:"Blog Post"},{value:"product",label:"Product/Service"},{value:"portfolio",label:"Portfolio"},{value:"other",label:"Other"}],AY=e=>{var s;let{open:a,onClose:n,pageData:l,onSaved:r}=e;const{user:i}=Al(),o="master_admin"===(null===i||void 0===i?void 0:i.role),c="master_admin"===(null===i||void 0===i?void 0:i.impersonator_role)&&!o,u=o||c,[m,h]=(0,t.useState)(!1),[x,p]=(0,t.useState)({name:null!==l&&void 0!==l&&l.t
2itle?"".concat(l.title," Template"):"My Template",description:"",category:"other",is_system:!1,thumbnail_url:""});return(0,ea.jsx)(Ok,{open:a,onOpenChange:n,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{className:"flex items-center gap-2",children:x.is_system?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(hr,{size:20,className:"text-emerald-600"}),"Save as System Template"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(NE,{size:20}),"Save as Template"]})})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[u&&(0,ea.jsxs)("div",{className:"p-3 bg-emerald-50 rounded-lg border border-emerald-200 space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(Kl,{className:"text-emerald-600",size:20}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-emerald-900",children:"System Template"}),(0,ea.jsx)("p",{className:"text-xs text-emerald-700",children:"Available to all accounts"})]})]}),(0,ea.jsx)(wb,{checked:x.is_system,onCheckedChange:e=>p(d(d({},x),{},{is_system:e})),"data-testid":"system-template-toggle"})]}),x.is_system&&c&&(0,ea.jsxs)("p",{className:"text-xs text-amber-700 bg-amber-50 border border-amber-200 rounded px-2 py-1.5","data-testid":"design-only-note",children:[(0,ea.jsx)("strong",{children:"Design only:"})," you're impersonating this account, so its text, images and links will be replaced with placeholders. Only the layout, theme and styling are saved."]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"template-name",children:"Template Name *"}),(0,ea.jsx)(BN,{id:"template-name",value:x.name,onChange:e=>p(d(d({},x),{},{name:e.target.value})),placeholder:"My Awesome Template"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"template-description",children:"Description"}),(0,ea.jsx)(YN,{id:"template-description",value:x.description,onChange:e=>p(d(d({},x),{},{description:e.target.value})),placeholder:"Describe what this template is for...",rows:3})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Category"}),(0,ea.jsxs)(eb,{value:x.category,onValueChange:e=>p(d(d({},x),{},{category:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:EY.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),x.is_system&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"thumbnail-url",children:"Thumbnail URL (optional)"}),(0,ea.jsx)(BN,{id:"thumbnail-url",value:x.thumbnail_url,onChange:e=>p(d(d({},x),{},{thumbnail_url:e.target.value})),placeholder:"https://example.com/thumbnail.jpg"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Preview image shown in template gallery"})]}),(0,ea.jsxs)("div",{className:"rounded-lg p-3 text-sm ".concat(x.is_system?"bg-emerald-50 text-emerald-700":"bg-slate-50 text-slate-600"),children:[(0,ea.jsx)("p",{className:"font-medium mb-1",children:"This will save:"}),(0,ea.jsxs)("ul",{className:"list-disc list-inside space-y-1 opacity-80",children:[(0,ea.jsxs)("li",{children:[(null===l||void 0===l||null===(s=l.blocks)||void 0===s?void 0:s.length)||0," content blocks"]}),(0,ea.jsxs)("li",{children:["Page width: ",(null===l||void 0===l?void 0:l.pageWidth)||"standard"]}),(null===l||void 0===l?void 0:l.theme)&&(0,ea.jsx)("li",{children:"Custom theme settings"}),x.is_system&&(0,ea.jsx)("li",{className:"font-medium",children:"\ud83c\udf10 Globally available to all accounts"})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:n,disabled:m,children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:async()=>{if(x.name.trim()){h(!0);try{const e={name:x.name,description:x.description,category:x.category,blocks:l.blocks||[],page_width:l.pageWidth||"standard",theme:l.theme,is_system:x.is_system,thumbnail_url:x.thumbnail_url||void 0},t=await _l.post("/templates",e);x.is_system?qs.success("Saved as System Template! Available to all accounts."):qs.success("Page saved as template!"),null===r||void 0===r||r(t.data),n()}catch(s){var e,t;console.error("Failed to save template:",s),qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save template")}finally{h(!1)}}else qs.error("Please enter a template name")},disabled:m,className:x.is_system?"bg-emerald-600 hover:bg-emerald-700":"",children:[(0,ea.jsx)(BD,{size:16,className:"mr-2"}),m?"Saving...":x.is_system?"Save System Template":"Save Template"]})]})]})})},FY=Vl("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"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),TY=Vl("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"}]]),zY=["__scopeTabs","value","onValueChange","defaultValue","orientation","dir","activationMode"],MY=["__scopeTabs","loop"],PY=["__scopeTabs","value","disabled"],BY=["__scopeTabs","value","forceMount","children"];var RY="Tabs",[LY,IY]=jr(RY,[id]),OY=id(),[UY,HY]=LY(RY),WY=t.forwardRef((e,t)=>
2{const{__scopeTabs:s,value:a,onValueChange:n,defaultValue:r,orientation:i="horizontal",dir:o,activationMode:c="automatic"}=e,u=l(e,zY),m=Qr(o),[h,x]=Cr({prop:a,onChange:n,defaultProp:null!==r&&void 0!==r?r:"",caller:RY});return(0,ea.jsx)(UY,{scope:s,baseId:ki(),value:h,onValueChange:x,orientation:i,dir:m,activationMode:c,children:(0,ea.jsx)(Tr.div,d(d({dir:m,"data-orientation":i},u),{},{ref:t}))})});WY.displayName=RY;var VY="TabsList",qY=t.forwardRef((e,t)=>{const{__scopeTabs:s,loop:a=!0}=e,n=l(e,MY),r=HY(VY,s),i=OY(s);return(0,ea.jsx)(gd,d(d({asChild:!0},i),{},{orientation:r.orientation,dir:r.dir,loop:a,children:(0,ea.jsx)(Tr.div,d(d({role:"tablist","aria-orientation":r.orientation},n),{},{ref:t}))}))});qY.displayName=VY;var $Y="TabsTrigger",GY=t.forwardRef((e,t)=>{const{__scopeTabs:s,value:a,disabled:n=!1}=e,r=l(e,PY),i=HY($Y,s),o=OY(s),c=JY(i.baseId,a),u=QY(i.baseId,a),m=a===i.value;return(0,ea.jsx)(fd,d(d({asChild:!0},o),{},{focusable:!n,active:m,children:(0,ea.jsx)(Tr.button,d(d({type:"button",role:"tab","aria-selected":m,"aria-controls":u,"data-state":m?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:c},r),{},{ref:t,onMouseDown:xr(e.onMouseDown,e=>{n||0!==e.button||!1!==e.ctrlKey?e.preventDefault():i.onValueChange(a)}),onKeyDown:xr(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&i.onValueChange(a)}),onFocus:xr(e.onFocus,()=>{const e="manual"!==i.activationMode;m||n||!e||i.onValueChange(a)})}))}))});GY.displayName=$Y;var KY="TabsContent",YY=t.forwardRef((e,s)=>{const{__scopeTabs:a,value:n,forceMount:r,children:i}=e,o=l(e,BY),c=HY(KY,a),u=JY(c.baseId,n),m=QY(c.baseId,n),h=n===c.value,x=t.useRef(h);return t.useEffect(()=>{const e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,ea.jsx)(Jc,{present:r||h,children:t=>{let{present:a}=t;return(0,ea.jsx)(Tr.div,d(d({"data-state":h?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!a,id:m,tabIndex:0},o),{},{ref:s,style:d(d({},e.style),{},{animationDuration:x.current?"0s":void 0}),children:a&&i}))}})});function JY(e,t){return"".concat(e,"-trigger-").concat(t)}function QY(e,t){return"".concat(e,"-content-").concat(t)}YY.displayName=KY;var XY=qY,ZY=GY,eJ=YY;const tJ=["className"],sJ=["className"],aJ=["className"],nJ=WY,lJ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,tJ);return(0,ea.jsx)(XY,d({ref:t,className:Np("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s)},a))});lJ.displayName=XY.displayName;const rJ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,sJ);return(0,ea.jsx)(ZY,d({ref:t,className:Np("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s)},a))});rJ.displayName=ZY.displayName;const iJ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,aJ);return(0,ea.jsx)(eJ,d({ref:t,className:Np("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s)},a))});iJ.displayName=eJ.displayName;const oJ={landing:NE,about:qN,contact:Jl,blog:Uj,product:FY,portfolio:TY,other:AE},cJ={landing:"Landing Page",about:"About Us",contact:"Contact",blog:"Blog Post",product:"Product/Service",portfolio:"Portfolio",other:"Other"},dJ=e=>{let{open:s,onClose:a,onSelectTemplate:n,onStartBlank:l}=e;const[r,i]=(0,t.useState)({system:[],custom:[]}),[o,c]=(0,t.useState)(!0),[d,u]=(0,t.useState)(""),[m,h]=(0,t.useState)(null);(0,t.useEffect)(()=>{s&&x()},[s]);const x=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{c(!0);let a=(await _l.get("/templates")).data;if(e||Array.isArray(a.system)&&0===a.system.length)try{const e=await _l.post("/templates/seed-defaults");console.log("[Templates] seed-defaults response:",e.data);a=(await _l.get("/templates")).data}catch(l){var t,s;console.error("[Templates] seed-defaults failed:",null===l||void 0===l||null===(t=l.response)||void 0===t?void 0:t.status,null===l||void 0===l||null===(s=l.response)||void 0===s?void 0:s.data)}i(a)}catch(r){var a,n;console.error("[Templates] Failed to fetch templates:",null===r||void 0===r||null===(a=r.response)||void 0===a?void 0:a.status,null===r||void 0===r||null===(n=r.response)||void 0===n?void 0:n.data),qs.error("Could not load templates. Check your connection and try again.")}finally{c(!1)}},p=e=>d?e.filter(e=>e.name.toLowerCase().includes(d.toLowerCase())||e.description&&e.description.toLowerCase().includes(d.toLowerCase())):e,g=e=>{let{template:t,isSystem:s}=e;const a=oJ[t.category]||AE,n=(null===m||void 0===m?void 0:m.template_id)===t.template_id;return(0,ea.jsxs)("div",{onClick:()=>h(t),className:"cursor-pointer rounded-lg border-2 overflow-hidden transition-all ".concat(n?"border-indigo-500 ring-2 ring-indigo-200":"border-slate-200 hover:border-slate-300"),children:[(0,ea.jsxs)("div",{className:"relative aspect-video bg-slate-100 overflow-hidden",children:[t.thumbnail_url?(0,ea.jsx)("img",{src:t.thumbnail_url,alt:t.name,className:"w-full h-full object-cover"}):(0,ea.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-slate-100 to-slate-200",children:(0,ea.jsx)(a,{size:32,className:"text-slate-300"})}),s&&(0,ea.jsx)("span",{className:"absolute top-2 left-2 px-2 py-0.5 bg-indigo-600 text-white text-xs rounded-full",children:"System"}),n&&(0,ea.jsx)("div",{className:"absolute inset-0 bg-indigo-500/10 flex items-center justify-center",children:(0,ea.jsx)("div",{className:"w-6 h-6 bg-indigo-500 rounded-full flex items-center justify-center",children:(0,ea.jsx)("svg",{className:"w-4 h-4 text-white",f
2ill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,ea.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),(0,ea.jsxs)("div",{className:"p-3",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm text-slate-900 truncate",children:t.name}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 truncate mt-0.5",children:cJ[t.category]||t.category})]})]})},f=[...p(r.system),...p(r.custom)],v=p(r.system),b=p(r.custom);return(0,ea.jsx)(Ok,{open:s,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{className:"text-xl",children:"Create New Page"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Start from scratch or choose a template"})]}),(0,ea.jsx)("div",{className:"flex gap-4 py-4 border-b",children:(0,ea.jsxs)(sg,{variant:"outline","data-testid":"create-page-blank",className:"flex-1 h-20 flex flex-col items-center justify-center gap-2 border-2 border-dashed hover:border-indigo-300 hover:bg-indigo-50",onClick:()=>{l(),a()},children:[(0,ea.jsx)(Vj,{size:24,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"font-medium",children:"Start from Scratch"})]})}),(0,ea.jsxs)("div",{className:"relative py-4",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search templates...",value:d,onChange:e=>u(e.target.value),className:"pl-10"})]}),(0,ea.jsx)("div",{className:"flex-1 overflow-auto",children:o?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})}):(0,ea.jsxs)(nJ,{defaultValue:"all",children:[(0,ea.jsxs)(lJ,{className:"mb-4",children:[(0,ea.jsxs)(rJ,{value:"all",children:["All (",f.length,")"]}),(0,ea.jsxs)(rJ,{value:"system",children:["System (",v.length,")"]}),(0,ea.jsxs)(rJ,{value:"custom",children:["My Templates (",b.length,")"]})]}),(0,ea.jsx)(iJ,{value:"all",children:0===f.length?(0,ea.jsxs)("div",{className:"text-center py-8 text-slate-500 space-y-3",children:[(0,ea.jsx)("p",{children:"No templates found"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>x(!0),"data-testid":"templates-reseed-btn",children:"Reseed default templates"})]}):(0,ea.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:[r.system.map(e=>(0,ea.jsx)(g,{template:e,isSystem:!0},e.template_id)),r.custom.map(e=>(0,ea.jsx)(g,{template:e,isSystem:!1},e.template_id))]})}),(0,ea.jsx)(iJ,{value:"system",children:0===v.length?(0,ea.jsx)("div",{className:"text-center py-8 text-slate-500",children:"No system templates found"}):(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:v.map(e=>(0,ea.jsx)(g,{template:e,isSystem:!0},e.template_id))})}),(0,ea.jsx)(iJ,{value:"custom",children:0===b.length?(0,ea.jsxs)("div",{className:"text-center py-8 text-slate-500",children:[(0,ea.jsx)("p",{children:"No custom templates yet"}),(0,ea.jsx)("p",{className:"text-sm mt-1",children:"Save your pages as templates to see them here"})]}):(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:b.map(e=>(0,ea.jsx)(g,{template:e,isSystem:!1},e.template_id))})})]})}),(0,ea.jsxs)("div",{className:"flex justify-between items-center pt-4 border-t mt-4",children:[(0,ea.jsx)("div",{className:"text-sm text-slate-500",children:m&&(0,ea.jsxs)("span",{children:["Selected: ",(0,ea.jsx)("strong",{children:m.name})]})}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:a,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(m)try{const e=await _l.get("/templates/".concat(m.template_id));n(e.data),a()}catch(e){console.error("Failed to load template:",e),qs.error("Failed to load template")}},disabled:!m,children:"Use Selected Template"})]})]})]})})},uJ=e=>{let{title:t,description:s,image:a,url:n,siteName:l}=e;const r=(t||l||"Untitled page").trim(),i=(s||"").trim();let o=(l||"").toLowerCase();try{n&&(o=new URL(n).hostname.replace(/^www\./,""))}catch(G2){}const c=(e,t,s)=>(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg overflow-hidden shadow-sm","data-testid":"social-preview-".concat(t.toLowerCase().replace(/[^a-z0-9]+/g,"-")),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-slate-50 border-b border-slate-200",children:[(0,ea.jsx)(e,{size:14,className:"text-slate-500"}),(0,ea.jsx)("span",{className:"text-xs font-medium text-slate-600",children:t})]}),s]},t),d=(0,ea.jsxs)(ea.Fragment,{children:[a?(0,ea.jsx)("div",{className:"aspect-[1.91/1] bg-slate-100 overflow-hidden",children:(0,ea.jsx)("img",{src:a,alt:"",className:"w-full h-full object-cover"})}):(0,ea.jsx)("div",{className:"aspect-[1.91/1] bg-gradient-to-br from-slate-100 to-slate-200 flex items-center justify-center text-slate-400 text-xs",children:"No image"}),(0,ea.jsxs)("div",{className:"px-3 py-2",children:[(0,ea.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 truncate",children:o}),(0,ea.jsx)("div",{className:"text-sm font-semibold text-slate-900 leading-snug line-clamp-2 mt-0.5",children:r}),i&&(0,ea.jsx)("div",{className:"text-xs text-slate-500 line-clamp-2 mt-1",children:i})]})]}),u=(0,ea.jsxs)(ea.Fragment,{children:[a?(0,ea.jsx)("div",{className:"aspect-[1.91/1] bg-slate-100 overflow-hidden",children:(0,ea.jsx)("img",{src:a,alt:"",className:"w-full h-full object-cover"})}):(0,ea.jsx)("div",{className:"aspect-[1.91/1] bg-gradient-to-br from-blue-50 to-blue-100 flex items-center justify-center text-blue-400 text-xs",children:"No image"}),(0,ea.jsxs)("div",{className:"px-3 py-2",children:[(0,ea.jsx)("div",{className:"text-sm font-semibold text-slate-900 leading-snug line-clamp-2",children:r}),(0,ea.jsx)("div",{className:"text-[10px] text-slate-500 mt-1 truncate",children:o})]})]}),m=(0,ea.jsxs)(ea.Fragment,{children:[a?(0,ea.jsxs)("div",{className:"relative aspect-[1.91/1] bg-slate-100 overflow-hidden",children:[(0,ea.jsx)("img",{src:a,alt:"",className:"w-full h-full object-cover"}),(0,ea.jsx)("div",{className:"absolute left-2 bottom-2 right-2 bg-black/55 text-white text-xs px-2 py-1 rounded",children:(0,ea.jsx)("div",{className:"font-semibold leading-tight line-clamp-1",children:r})})]}):(0,ea.jsxs)("div",{className:"aspect-[1.91/1] bg-gradient-to-br from-slate-900 to-slate-700 flex flex-col items-start justify-end p-3",children:[(0,ea.jsx)("div",{className:"text-sm font-semibold text-white line-clamp-2 leading-tight",children:r}),(0,ea.jsx)("div",{className:"text-[10px] text-slate-300 mt-1 truncate",children:o})]}),(0,ea.jsx)("div",{className:"px-3 py-1.5 text-[10px] text-slate-500 truncate",children:o})]});return(0,ea.jsxs)("div",{className:"space-y-3","data-testid":"social-preview-panel",children:[c(nr,"Facebook",d),c(ir,"LinkedIn",u),c(lr,"Twitter / X",m),(0,ea.jsx)("p",{className:"text-[10px] text-slate-400 leading-tight",children:"Preview only \u2014 actual rendering may differ slightly between platforms. Re-share via the official debuggers to refresh their image caches after major changes."})]})},mJ=e=>"string"===typeof e&&/^(https?:\/\/|\/)/.test(e)&&/(\.jpg|\.jpeg|\.png|\.webp|\.gif|\.svg|\.avif|\/uploads\/|\/api\/uploads)/i.test(e),hJ=e=>{if(!Array.isArray(e))return"";const t=["imageUrl","image_url","backgroundImage","imageSrc","src","url"],s=e=>{if(e&&"object"===typeof e&&!Array.isArray(e)){for(const s of t)if(mJ(e[s]))return e[s];for(const t of Object.values(e)){const e=s(t);if(e)return e}}else if(Array.isArray(e))for(const t of e){const e=s(t);if(e)return e}return""};for(const a of e){const e=(null===a||void 0===a?void 0:a.content)||a;if(!1===(null===e||void 0===e?void 0:e.isPublished))continue;const t=s(e);if(t)return t}return""},xJ=()=>{var e,s,a,n;const{id:l}=je(),r=be(),[i]=_t(),o="new"===l,c=i.get("template"),[u,m]=(0,t.useState)({title:"",slug:"",blocks:[],status:"draft",pageWidth:"standard",theme:{use_site_theme:!0},parent_id:null,meta_description:"",og_image:"",og_title:"",og_description:"",noindex:!1,canonical_url:""}),[h,x]=(0,t.useState)(!o),[p,g]=(0,t.useState)(!1),[f,v]=(0,t.useState)(!1),[b,j]=(0,t.useState)("desktop"),[y,N]=(0,t.useState)(null),[w,C]=(0,t.useState)(!1),[k,D]=(0,t.useState)(!1),{user:_,logout:S}=Al(),E="super_admin"===(null===_||void 0===_?void 0:_.role),[A,F]=(0,t.useState)(!1),[T,z]=(0,t.useState)(!1),[M,P]=(0,t.useState)(null),[B,R]=(0,t.useState)(null),[L,I]=(0,t.useState)(0),[O,U]=(0,t.useState)([]),[H,W]=(0,t.useState)([]),[V,q]=(0,t.useState)([]),[$,G]=(0,t.useState)(!1),[K,Y]=(0,t.useState)(!1),[J,Q]=(0,t.useState)(!1),[X,Z]=(0,t.useState)(!1),ee=(0,t.useRef)(!1),te=(0,t.useRef)(null),se=(0,t.useRef)(!1);(0,t.useEffect)(()=>{se.current=J},[J]),(0,t.useEffect)(()=>{const e=e=>{if(se.current)return e.preventDefault(),e.returnValue="",""};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[]),(0,t.useEffect)(()=>{const e=e=>{if(!se.current)return;const t=e.target.closest("a[href]");if(!t)return;const s=t.getAttribute("href");!s||s.startsWith("http")||s.startsWith("mailto:")||s.startsWith("#")||(e.preventDefault(),e.stopPropagation(),te.current=s,Z(!0))};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[]),(0,t.useEffect)(()=>{re(),ae(),o?c?le(c):z(!0):ie()},[l,c]);const ae=async()=>
2{try{const e=(await _l.get("/pages")).data;U(e.map(e=>({page_id:e.page_id,slug:e.slug,title:e.title,full_path:e.full_path})));const t="new"!==l?l:null;W(e.filter(e=>(!t||e.page_id!==t)&&!e.isPopup).map(e=>({page_id:e.page_id,slug:e.slug,title:e.title||e.slug,full_path:e.full_path,parent_id:e.parent_id})));const s=[];e.forEach(e=>{(e.blocks||[]).forEach(t=>{var a;if(null!==(a=t.content)&&void 0!==a&&a.anchor_id||["heading","hero","form","gallery","article-feed"].includes(t.type)){var n,l,r,i;let a=t.type.charAt(0).toUpperCase()+t.type.slice(1);"heading"===t.type&&null!==(n=t.content)&&void 0!==n&&n.text?a=t.content.text.substring(0,30):"heading"===t.type&&null!==(l=t.content)&&void 0!==l&&l.html&&(a=t.content.html.replace(/<[^>]*>/g,"").substring(0,30));const o=(null===(r=t.content)||void 0===r?void 0:r.anchor_id)||"".concat(t.type,"-").concat((null===(i=t.id)||void 0===i?void 0:i.substring(0,8))||Math.random().toString(36).substr(2,8));s.push({id:o,name:a,pageSlug:e.slug,pageTitle:e.title})}})}),q(s)}catch(K2){console.error("Failed to fetch pages for linking:",K2)}},ne=e=>e&&!0===e.locks_theme?d(d({},e.theme||{}),{},{use_site_theme:!1}):{use_site_theme:!0},le=async e=>{try{const t=(await _l.get("/templates/".concat(e))).data;m(d(d({},u),{},{blocks:t.blocks||[],pageWidth:t.page_width||"standard",theme:ne(t)})),qs.success("Loaded template: ".concat(t.name)),setTimeout(()=>{ee.current=!0},100)}catch(t){console.error("Failed to load template:",t),qs.error("Failed to load template")}},re=async()=>{try{const e=await _l.get("/theme");P(e.data)}catch(e){console.error("Failed to fetch site theme")}try{const e=await _l.get("/tenant/branding");R(e.data||null)}catch(G2){}},ie=async()=>
2{try{const e=await _l.get("/pages/".concat(l));m(e.data),setTimeout(()=>{ee.current=!0},100)}catch(e){qs.error("Failed to load page"),r("/pages")}finally{x(!1)}},oe=(0,t.useCallback)(e=>{m(t=>{const s="function"===typeof e?e(t):e;return ee.current&&Q(!0),s})},[]),ce=async()=>{if(u.slug){g(!0);try{let e=u;const{blocks:t,uploaded:s}=await ID(u.blocks);if(s>0&&(e=d(d({},u),{},{blocks:t}),m(e),qs.info("Optimized ".concat(s," embedded image").concat(s>1?"s":""," to the Media Library"))),o){const t=await _l.post("/pages",e);qs.success("Page created successfully"),Q(!1),r("/pages/".concat(t.data.page_id))}else await _l.put("/pages/".concat(l),e),qs.success("Page updated successfully"),Q(!1)}catch(s){var e,t;const a=null===s||void 0===s||null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail;qs.error("string"===typeof a?a:"Failed to save page")}finally{g(!1)}}else qs.error("Please enter a page slug")},de=e=>e.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-"),ue=async e=>{if(j(e),"desktop"!==e&&!y)if(o)qs.error("Please save the page first to use mobile preview");else{C(!0);try{u.blocks&&u.blocks.length>0&&await ce();
2const e=await _l.get("/pages/".concat(l,"/preview-token")),{preview_token:t}=e.data;N("".concat(window.location.origin,"/preview/").concat(t,"?t=").concat(Date.now()))}catch(K2){console.error("Failed to build iframe preview URL:",K2),qs.error("Could not load mobile preview. Try saving the page first.")}finally{C(!1)}}},me=async()=>{if(o)qs.error("Please save the page first to use mobile preview");else{N(null),C(!0);try{u.blocks&&u.blocks.length>0&&await ce();const e=await _l.get("/pages/".concat(l,"/preview-token"));N("".concat(window.location.origin,"/preview/").concat(e.data.preview_token,"?t=").concat(Date.now()))}catch(K2){console.error("Failed to refresh preview:",K2),qs.error("Could not refresh preview.")}finally{C(!1)}}};return h?(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 bg-white p-8 flex items-center justify-center",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading page..."})})]}):(0,ea.jsxs)("div",{className:"flex","data-testid":"page-editor",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 bg-white",children:[(0,ea.jsx)("div",{className:"border-b border-slate-200 px-8 py-4 bg-white sticky top-0 z-10",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto flex justify-between items-center",children:[(0,ea.jsx)("div",{className:"flex items-center gap-4",children:(0,ea.jsx)(sg,{variant:"ghost",onClick:()=>r("/pages"),"data-testid":"back-button",children:(0,ea.jsx)(_j,{size:20})})}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[E&&(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>D(!0),className:"border-purple-300 text-purple-600 hover:bg-purple-50","data-testid":"ai-designer-button",children:[(0,ea.jsx)($g,{size:18,className:"mr-2"}),"AI Design"]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>F(!0),disabled:0===u.blocks.length,title:"Save this page as a reusable template","data-testid":"save-template-button",children:[(0,ea.jsx)(_w,{size:18,className:"mr-2"}),"Save as Template"]}),(0,ea.jsx)(sg,{variant:f?"default":"outline",onClick:()=>{f||(I(e=>e+1),N(null)),v(!f)},"data-testid":"preview-toggle",children:f?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(zD,{size:18,className:"mr-2"}),"Edit"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(IN,{size:18,className:"mr-2"}),"Quick Preview"]})}),f&&(0,ea.jsxs)("div",{className:"inline-flex items-center rounded-md border border-slate-300 bg-white p-1","data-testid":"viewport-switcher",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>ue("mobile"),title:"Mobile (375 px)","data-testid":"viewport-mobile",className:"p-1.5 rounded transition-colors ".concat("mobile"===b?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(RN,{size:16})}),(0,ea.jsx)("button",{type:"button",onClick:()=>ue("tablet"),title:"Tablet (768 px)","data-testid":"viewport-tablet",className:"p-1.5 rounded transition-colors ".concat("tablet"===b?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(MD,{size:16})}),(0,ea.jsx)("button",{type:"button",onClick:()=>ue("desktop"),title:"Desktop (full width)","data-testid":"viewport-desktop",className:"p-1.5 rounded transition-colors ".concat("desktop"===b?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(PD,{size:16})})]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>{if(o)qs.error("Please save the page first to enable Full Preview");else try{u.blocks.length>0&&await ce();
2const e=await _l.get("/pages/".concat(l,"/preview-token")),{preview_token:t}=e.data,s="".concat(window.location.origin,"/preview/").concat(t);window.open(s,"_blank"),qs.success("Preview opened in new tab")}catch(e){console.error("Failed to open preview:",e),qs.error("Failed to open preview. Please try saving the page first.")}},"data-testid":"full-preview-button",title:"Open full preview in new tab",children:[(0,ea.jsx)(bj,{size:18,className:"mr-2"}),"Full Preview"]}),(0,ea.jsxs)(eb,{value:u.status,onValueChange:e=>oe(d(d({},u),{},{status:e})),children:[(0,ea.jsx)(sb,{className:"w-32","data-testid":"status-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"draft",children:"Draft"}),(0,ea.jsx)(rb,{value:"published",children:"Published"})]})]}),(0,ea.jsxs)(sg,{onClick:ce,disabled:p,className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"save-button",children:[(0,ea.jsx)(BD,{size:18,className:"mr-2"}),p?"Saving...":"Save"]}),(0,ea.jsx)("div",{className:"w-px h-6 bg-slate-200 mx-1"}),(0,ea.jsxs)(sg,{onClick:S,variant:"ghost",className:"text-slate-500 hover:text-red-600 hover:bg-red-50","data-testid":"editor-logout-button",title:"Logout",children:[(0,ea.jsx)(zw,{size:18,className:"mr-2"}),"Logout"]})]})]})}),(0,ea.jsx)("div",{className:"border-b border-slate-100 px-6 py-6 bg-slate-50",children:(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{htmlFor:"page-title",className:"text-sm font-medium text-slate-600",children:["Page Title ",(0,ea.jsx)("span",{className:"text-slate-400",children:"(optional)"})]}),(0,ea.jsx)(BN,{id:"page-title",value:u.title,onChange:e=>oe(d(d({},u),{},{title:e.target.value})),placeholder:"Enter page title...",className:"mt-1 text-xl font-semibold","data-testid":"page-title-input",style:{fontFamily:"Manrope, sans-serif"}})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"page-width",className:"text-sm font-medium text-slate-600",children:"Page Width"}),(0,ea.jsxs)(eb,{value:u.pageWidth||"standard",onValueChange:e=>oe(d(d({},u),{},{pageWidth:e})),children:[(0,ea.jsx)(sb,{className:"mt-1","data-testid":"page-width-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"narrow",children:"Narrow (720px) - Best for reading"}),(0,ea.jsx)(rb,{value:"standard",children:"Standard (1024px) - Default"}),(0,ea.jsx)(rb,{value:"wide",children:"Wide (1280px) - More visual"}),(0,ea.jsx)(rb,{value:"full",children:"Full Width - Edge to edge"})]})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-white border border-slate-200 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-600",children:"Popup Page"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Opens in a modal overlay without header/footer navigation"})]}),(0,ea.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:u.isPopup||!1,onChange:e=>oe(d(d({},u),{},{isPopup:e.target.checked})),className:"sr-only peer","data-testid":"popup-page-toggle"}),(0,ea.jsx)("div",{className:"w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-green-50 border border-green-200 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-green-800",children:"Set as Homepage"}),(0,ea.jsx)("p",{className:"text-xs text-green-600 mt-1",children:"This page will show at the root URL (/) of your site"})]}),(0,ea.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:u.isHomepage||!1,onChange:e=>oe(d(d({},u),{},{isHomepage:e.target.checked})),className:"sr-only peer","data-testid":"homepage-toggle"}),(0,ea.jsx)("div",{className:"w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-green-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-green-600"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{htmlFor:"page-slug",className:"text-sm font-medium text-slate-600",children:["URL Slug ",(0,ea.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"/"}),(0,ea.jsx)(BN,{id:"page-slug",value:u.slug,onChange:e=>oe(d(d({},u),{},{slug:de(e.target.value)})),placeholder:"page-url-slug",className:"flex-1","data-testid":"page-slug-input"}),u.title&&!u.slug&&(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>oe(d(d({},u),{},{slug:de(u.title)})),children:"Generate from title"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"This will be the URL path for your page"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{htmlFor:"parent-page",className:"text-sm font-medium text-slate-600",children:["Parent Page ",(0,ea.jsx)("span",{className:"text-slate-400",children:"(optional)"})]}),(0,ea.jsxs)(eb,{value:u.parent_id||"none",onValueChange:e=>oe(d(d({},u),{},{parent_id:"none"===e?null:e})),children:[(0,ea.jsx)(sb,{className:"mt-1","data-testid":"parent-page-select",children:(0,ea.jsx)(tb,{placeholder:"No parent (root level page)"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"No parent (root level page)"}),H.map(e=>(0,ea.jsxs)(rb,{value:e.page_id,children:[e.full_path?"/".concat(e.full_path):"/".concat(e.slug)," - ",e.title]},e.page_id))]})]}),u.parent_id&&u.slug&&(0,ea.jsxs)("p",{className:"text-xs text-emerald-600 mt-1",children:["Full URL: /",(null===(e=H.find(e=>e.page_id===u.parent_id))||void 0===e?void 0:e.full_path)||"","/",u.slug]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Select a parent to create hierarchical URLs (e.g., /about/team)"})]}),(0,ea.jsx)(SY,{theme:u.theme,onChange:e=>oe(d(d({},u),{},{theme:e}))}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg overflow-hidden",children:[(0,ea.jsxs)("button",{type:"button",onClick:()=>G(!$),className:"w-full flex items-center justify-between p-4 bg-slate-50 hover:bg-slate-100 transition-colors",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(fj,{size:18,className:"text-slate-600"}),(0,ea.jsx)("span",{className:"font-medium text-slate-700",children:"SEO & Social Sharing"}),(u.meta_description||u.og_image||u.noindex)&&(0,ea.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-700 text-xs rounded-full",children:"Configured"})]}),$?(0,ea.jsx)(er,{size:18,className:"text-slate-400"}):(0,ea.jsx)(tr,{size:18,className:"text-slate-400"})]}),$&&(0,ea.jsxs)("div",{className:"p-4 space-y-4 bg-white",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"meta-description",className:"text-sm font-medium text-slate-700",children:"Meta Description"}),(0,ea.jsx)(YN,{id:"meta-description",value:u.meta_description||"",onChange:e=>oe(d(d({},u),{},{meta_description:e.target.value})),placeholder:"Brief description for search results (150-160 characters recommended)",className:"mt-1 h-20 resize-none",maxLength:320,"data-testid":"meta-description-input"}),(0,ea.jsxs)("p",{className:"text-xs mt-1 ".concat(((null===(s=u.meta_description)||void 0===s?void 0:s.length)||0)>160?"text-amber-600":"text-slate-500"),children:[(null===(a=u.meta_description)||void 0===a?void 0:a.length)||0,"/160 characters",((null===(n=u.meta_description)||void 0===n?void 0:n.length)||0)>160&&" (may be truncated in search results)"]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700",children:"Social Preview Image"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"Image shown when page is shared on Facebook, Twitter, LinkedIn"}),u.og_image?(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)("img",{src:u.og_image,alt:"Social preview",className:"w-full max-w-md h-40 object-cover rounded-lg border border-slate-200"}),(0,ea.jsxs)("div",{className:"absolute top-2 right-2 flex gap-1",children:[(0,ea.jsx)(sg,{type:"button",variant:"secondary",size:"sm",onClick:()=>Y(!0),className:"h-7 px-2 bg-white/90 hover:bg-white text-xs","data-testid":"og-image-change-btn",children:"Change"}),(0,ea.jsx)(sg,{type:"button",variant:"secondary",size:"sm",onClick:()=>oe(d(d({},u),{},{og_image:""})),className:"h-7 w-7 p-0 bg-white/90 hover:bg-white text-red-500",title:"Remove image",children:(0,ea.jsx)(sr,{size:14})})]})]}):(0,ea.jsxs)("button",{type:"button",onClick:()=>Y(!0),className:"w-full max-w-md h-32 border-2 border-dashed border-slate-300 rounded-lg flex flex-col items-center justify-center gap-2 hover:border-indigo-400 hover:bg-indigo-50/50 transition-colors","data-testid":"og-image-picker-btn",children:[(0,ea.jsx)($N,{size:24,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Choose from Media Library"}),(0,ea.jsx)("span",{className:"text-[11px] text-slate-400",children:"Recommended: 1200\xd7630 pixels"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700",children:"Hide from Search Engines"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:'Adds "noindex" tag to prevent Google from indexing this page'})]}),(0,ea.jsxs)("label",{className:"relative inline-flex cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:u.noindex||!1,onChange:e=>oe(d(d({},u),{},{noindex:e.target.checked})),className:"sr-only peer","data-testid":"noindex-toggle"}),(0,ea.jsx)("div",{className:"w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-amber-500"})]})]}),(0,ea.jsxs)("details",{className:"group",children:[(0,ea.jsxs)("summary",{className:"cursor-pointer text-sm text-slate-600 hover:text-slate-800 list-none flex items-center gap-1",children:[(0,ea.jsx)(tr,{size:14,className:"group-open:rotate-180 transition-transform"}),"Advanced Settings"]}),(0,ea.jsxs)("div",{className:"mt-3 space-y-3 pl-5 border-l-2 border-slate-200",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"og-title",className:"text-sm text-slate-600",children:"Social Title Override"}),(0,ea.jsx)(BN,{id:"og-title",value:u.og_title||"",onChange:e=>oe(d(d({},u),{},{og_title:e.target.value})),placeholder:u.title||"Uses page title by default",className:"mt-1 text-sm","data-testid":"og-title-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"og-description",className:"text-sm text-slate-600",children:"Social Description Override"}),(0,ea.jsx)(YN,{id:"og-description",value:u.og_description||"",onChange:e=>oe(d(d({},u),{},{og_description:e.target.value}
2)),placeholder:u.meta_description||"Uses meta description by default",className:"mt-1 h-16 text-sm resize-none","data-testid":"og-description-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"canonical-url",className:"text-sm text-slate-600",children:"Canonical URL"}),(0,ea.jsx)(BN,{id:"canonical-url",value:u.canonical_url||"",onChange:e=>oe(d(d({},u),{},{canonical_url:e.target.value})),placeholder:"Leave empty to use default page URL",className:"mt-1 text-sm","data-testid":"canonical-url-input"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Use if this content exists on another URL"})]})]})]}),(0,ea.jsxs)("div",{className:"pt-4 border-t border-slate-200",children:[(0,ea.jsx)("h4",{className:"text-sm font-medium text-slate-700 mb-3",children:"Social preview"}),(0,ea.jsx)(uJ,{title:u.og_title||u.title,description:u.og_description||u.meta_description,image:u.og_image||hJ(u.blocks)||(null===B||void 0===B?void 0:B.logo_url)||(null===B||void 0===B?void 0:B.favicon_url)||"",url:u.canonical_url||"https://".concat("undefined"!==typeof window?window.location.host:"","/").concat(u.slug||""),siteName:(null===_||void 0===_?void 0:_.tenant_name)||""})]})]})]})]})}),(0,ea.jsx)("div",{className:"px-6 pb-20",children:f?(()=>{if("desktop"===b)return(0,ea.jsx)(cN,{blocks:u.blocks,title:u.title,pageWidth:u.pageWidth,theme:u.theme,siteTheme:M,pageId:l,tenantId:null===_||void 0===_?void 0:_.tenant_id,showNavigation:!o,refreshKey:L,isQuickPreview:!0});const e="mobile"===b?375:768,t="mobile"===b?812:1024;return(0,ea.jsxs)("div",{className:"flex flex-col items-center","data-testid":"preview-frame-".concat(b),children:[(0,ea.jsxs)("div",{className:"text-xs text-slate-500 mb-3 flex items-center gap-2",children:[(0,ea.jsxs)("span",{children:["mobile"===b?"iPhone":"iPad"," preview \xb7 ",e," \xd7 ",t]}),(0,ea.jsx)("button",{type:"button",onClick:me,className:"underline hover:text-indigo-600","data-testid":"preview-iframe-refresh",children:"refresh"})]}),(0,ea.jsx)("div",{className:"bg-white shadow-xl border-[10px] border-slate-800 rounded-[36px] overflow-hidden",style:{width:"".concat(e+20,"px"),maxWidth:"100%"},children:w||!y?(0,ea.jsxs)("div",{className:"flex items-center justify-center text-slate-400 text-sm",style:{width:"".concat(e,"px"),height:"".concat(t,"px"),maxWidth:"100%"},children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-indigo-600 mr-2"}),"Loading preview\u2026"]}):(0,ea.jsx)("iframe",{title:"Mobile preview",src:y,style:{width:"".concat(e,"px"),height:"".concat(t,"px"),maxWidth:"100%",border:0,display:"block"},"data-testid":"preview-iframe"})})]})})():(0,ea.jsx)(nY,{blocks:u.blocks,onChange:e=>oe(d(d({},u),{},{blocks:e})),pages:O,allPagesAnchors:V,siteTheme:M})})]}),(0,ea.jsx)(lY,{open:k,onOpenChange:D,onBlocksGenerated:async e=>{const t=[...u.blocks,...e];oe(e=>d(d({},e),{},{blocks:t})),qs.info("AI blocks added. Saving...");try{if(o){if(!u.slug)return void qs.warning("Please add a URL slug and save the page");const e=await _l.post("/pages",d(d({},u),{},{blocks:t}));qs.success("Page created with AI design!"),r("/pages/".concat(e.data.page_id))}else await _l.put("/pages/".concat(l),d(d({},u),{},{blocks:t})),qs.success("AI design saved!")}catch(s){qs.error("Auto-save failed. Please click Save manually.")}}}),(0,ea.jsx)(AY,{open:A,onClose:()=>F(!1),pageData:u,onSaved:()=>{}}),(0,ea.jsx)(dJ,{open:T,onClose:()=>{z(!1),setTimeout(()=>{ee.current=!0},100)},onSelectTemplate:e=>{m(d(d({},u),{},{blocks:e.blocks||[],pageWidth:e.page_width||"standard",theme:ne(e)})),qs.success("Loaded template: ".concat(e.name)),setTimeout(()=>{ee.current=!0},100)},onStartBlank:()=>{setTimeout(()=>{ee.current=!0},100)}}),(0,ea.jsx)(Ok,{open:X,onOpenChange:Z,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2 text-amber-600",children:[(0,ea.jsx)(AN,{size:20}),"Unsaved Changes"]}),(0,ea.jsx)(Gk,{children:"You have unsaved changes on this page. What would you like to do?"})]}),(0,ea.jsx)("div",{className:"py-4",children:(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"If you leave without saving, your changes will be lost."})}),(0,ea.jsxs)(qk,{className:"flex flex-col sm:flex-row gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>{Z(!1),te.current=null},className:"w-full sm:w-auto",children:"Stay on Page"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:()=>{Q(!1),Z(!1),te.current&&(r(te.current),te.current=null)},className:"w-full sm:w-auto",children:"Discard Changes"}),(0,ea.jsxs)(sg,{onClick:async()=>{await ce(),Z(!1),te.current&&(r(te.current),te.current=null)},className:"bg-indigo-600 hover:bg-indigo-700 w-full sm:w-auto",children:[(0,ea.jsx)(BD,{size:16,className:"mr-2"}),"Save & Leave"]})]})]})}),(0,ea.jsx)(Dq,{open:K,onClose:()=>Y(!1),onSelect:e=>{oe(d(d({},u),{},{og_image:e.url})),Y(!1)}})]})},pJ=Vl("mail-check",[["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"}
2]]),gJ=Vl("link-2",[["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"}]]),fJ=Vl("circle-x",[["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"}]]),vJ=Vl("file-spreadsheet",[["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"}]]),bJ=Vl("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"}]]),jJ=Vl("user-minus",[["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"}]]),yJ=Vl("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"}]]),NJ=Vl("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"}]]),wJ=Vl("link-2-off",[["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"}]]),CJ=e=>{if(!e)return"never";const t=new Date(e).getTime();if(isNaN(t))return"never";const s=Math.floor((Date.now()-t)/1e3);if(s<60)return"just now";const a=Math.floor(s/60);if(a<60)return"".concat(a," minute").concat(1===a?"":"s"," ago");const n=Math.floor(a/60);if(n<24)return"".concat(n," hour").concat(1===n?"":"s"," ago");const l=Math.floor(n/24);return"".concat(l," day").concat(1===l?"":"s"," ago")},kJ=()=>{var e,s,a,n,l,r,i;const[o,c]=(0,t.useState)(null),[d,u]=(0,t.useState)(!0),[m,h]=(0,t.useState)(!1),[x,p]=(0,t.useState)(!1),[g,f]=(0,t.useState)(null),v=t.useRef(null),[b,j]=(0,t.useState)(!1),[y,N]=(0,t.useState)(1),[w,C]=(0,t.useState)(""),[k,D]=(0,t.useState)([]),[_,S]=(0,t.useState)(!1),[E,A]=(0,t.useState)(""),[F,T]=(0,t.useState)(!1),[z,M]=(0,t.useState)(!1),[P,B]=(0,t.useState)(""),R=(0,t.useCallback)(async()=>{try{const e=await _l.get("/wonde/status");c(e.data),"running"!==e.data.sync_status&&(h(!1),v.current&&(clearInterval(v.current),v.current=null))}catch(K2){var e;403!==(null===(e=K2.response)||void 0===e?void 0:e.status)&&console.error("Failed to fetch Wonde status:",K2),c({wonde_enabled:!1,connected:!1})}finally{u(!1)}},[]);(0,t.useEffect)(()=>{R().then(()=>{})},[R]),(0,t.useEffect)(()=>("running"!==(null===o||void 0===o?void 0:o.sync_status)||v.current||(v.current=setInterval(R,4e3)),()=>{v.current&&"running"!==(null===o||void 0===o?void 0:o.sync_status)&&(clearInterval(v.current),v.current=null)}),[null===o||void 0===o?void 0:o.sync_status,R]);const L=async()=>{if(w.trim()){S(!0);try{const e=(await _l.get("/wonde/schools",{params:{token:w.trim()}})).data.schools||[];if(!e.length)return void qs.error("No schools found for this token");D(e),A(e[0].id),N(2)}catch(K2){var e,t,s;const n=(null===(e=K2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"";400===(null===(s=K2.response)||void 0===s?void 0:s.status)&&n.toLowerCase().includes("permission")?(M(!0),N(2)):qs.error(n||"Failed to fetch schools. Check your token.")}finally{S(!1)}}else qs.error("Please enter your Wonde API token")},I=async()=>{const e=z?P.trim():E;if(e){T(!0);try{const t=z?{token:w.trim(),school_id:e}:{token:w.trim(),school_id:e,school_name:(k.find(t=>t.id===e)||{}).name},s=await _l.post("/wonde/connect",t);qs.success(s.data.message||"School connected"),j(!1),N(1),C(""),D([]),M(!1),B(""),R()}catch(K2){var t,s;qs.error((null===(t=K2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to connect. Please try again.")}finally{T(!1)}}else qs.error("Please enter your School ID")};if(d)return(0,ea.jsxs)("div",{className:"flex items-center gap-2 py-4 text-slate-400",children:[(0,ea.jsx)(ql,{size:16,className:"animate-spin"}),(0,ea.jsx)("span",{className:"text-sm",children:"Loading Wonde status..."})]});if(null===o||void 0===o||!o.wonde_enabled)return(0,ea.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-5","data-testid":"wonde-not-enabled",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,ea.jsx)(NJ,{size:20,className:"text-amber-600"}),(0,ea.jsx)("span",{className:"font-semibold text-slate-800",children:"Wonde MIS Integration"})]}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Sync parent and guardian contacts from your school MIS system directly into your subscriber lists."}),(0,ea.jsx)("p",{className:"text-sm text-amber-700 mt-2",children:"This feature is not yet enabled for your account. Contact your NexusCMS administrator to enable Wonde sync."})]});if(null===o||void 0===o||!o.connected)return(0,ea.jsxs)("div",{className:"rounded-lg border border-green-200 bg-green-50 p-5","data-testid":"wonde-setup",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,ea.jsx)(NJ,{size:20,className:"text-green-700"}),(0,ea.jsx)("span",{className:"font-semibold text-slate-800",children:"Wonde MIS Integration"})]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-4",children:"Connect your Wonde account to automatically sync parent/guardian contacts into subscriber groups by year."}),b?(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4 space-y-4 shadow-sm",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full ".concat(1===y?"bg-green-100 text-green-700 font-medium":"bg-slate-100"),children:"1 Enter Token"}),(0,ea.jsx)("span",{className:"text-slate-300",children:"\u2192"}),(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full ".concat(2===y?"bg-green-100 text-green-700 font-medium":"bg-slate-100"),children:"2 Select School"}),(0,ea.jsx)("span",{className:"text-slate-300",children:"\u2192"}),(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-slate-100",children:"3 Connect"})]}),1===y&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Wonde API Token"}),(0,ea.jsx)(BN,{type:"password",placeholder:"Paste your Wonde school token",value:w,onChange:e=>C(e.target.value),"data-testid":"wonde-token-input"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Find this in your Wonde dashboard under Settings \u2192 API Tokens."})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{onClick:L,disabled:_||!w.trim(),"data-testid":"wonde-fetch-sch
2ools-btn",children:_?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-2"}),"Fetching Schools..."]}):"Fetch Schools"}),(0,ea.jsx)(sg,{variant:"ghost",onClick:()=>{j(!1),C("")},children:"Cancel"})]})]}),2===y&&(0,ea.jsxs)(ea.Fragment,{children:[z?(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-start gap-2 bg-amber-50 border border-amber-200 rounded-md p-3 mb-3 text-xs text-amber-800",children:[(0,ea.jsx)(AN,{size:14,className:"mt-0.5 flex-shrink-0"}),(0,ea.jsxs)("span",{children:["Your token doesn't have permission to list schools automatically. Enter your School ID manually instead. Find it in your ",(0,ea.jsx)("strong",{children:"Wonde dashboard \u2192 Settings \u2192 School Details"})," (looks like ",(0,ea.jsx)("code",{className:"font-mono bg-amber-100 px-1 rounded",children:"A1234567890"}),")."]})]}),(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"School ID"}),(0,ea.jsx)(BN,{placeholder:"e.g. A1234567890",value:P,onChange:e=>B(e.target.value),"data-testid":"wonde-manual-school-id-input"})]}):(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Select School"}),(0,ea.jsxs)(eb,{value:E,onValueChange:A,children:[(0,ea.jsx)(sb,{"data-testid":"wonde-school-select",children:(0,ea.jsx)(tb,{placeholder:"Choose a school"})}),(0,ea.jsx)(lb,{children:k.map(e=>(0,ea.jsxs)(rb,{value:e.id,children:[e.name,e.town?" \u2014 ".concat(e.town):""]},e.id))})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:[k.length," school",1!==k.length?"s":""," found for your token."]})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{onClick:I,disabled:F||(z?!P.trim():!E),"data-testid":"wonde-connect-btn",children:F?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-2"}),"Connecting..."]}):"Connect School"}),(0,ea.jsx)(sg,{variant:"ghost",onClick:()=>{N(1),M(!1),B("")},children:"Back"})]})]})]}):(0,ea.jsx)(sg,{onClick:()=>j(!0),variant:"outline","data-testid":"wonde-setup-btn",children:"Set Up Wonde"})]});const O=o.last_sync_result,U=O&&(O.errors>0||O.error),H=!o.last_sync_at;return(0,ea.jsxs)("div",{className:"rounded-lg border border-green-200 bg-green-50 p-5","data-testid":"wonde-connected",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(cr,{size:18,className:"text-green-600"}),(0,ea.jsx)("span",{className:"font-semibold text-slate-800",children:"Wonde MIS Integration"})]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-0.5",children:o.school_name})]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:async()=>{if(window.confirm("Disconnect Wonde? Existing synced subscribers will not be removed.")){p(!0);try{await _l.delete("/wonde/disconnect"),qs.success("Wonde disconnected"),f(null),R()}catch(K2){qs.error("Failed to disconnect Wonde")}finally{p(!1)}}},disabled:x,className:"text-red-600 hover:text-red-700 hover:bg-red-50","data-testid":"wonde-disconnect-btn",children:[x?(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-1"}):(0,ea.jsx)(wJ,{size:14,className:"mr-1"}),"Disconnect"]})]}),(0,ea.jsxs)("div",{className:"bg-white/70 rounded-lg border border-slate-200 p-4 mb-3","data-testid":"wonde-sync-health",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(yJ,{size:16,className:"text-green-600"}),(0,ea.jsx)("span",{className:"text-sm font-semibold text-slate-800",children:"Sync Health"})]}),(0,ea.jsx)("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full inline-flex items-center gap-1 ".concat("running"===(null===o||void 0===o?void 0:o.sync_status)?"bg-blue-100 text-blue-700":H?"bg-slate-100 text-slate-600":U?"bg-red-100 text-red-700":"bg-green-100 text-green-700"),"data-testid":"wonde-sync-status",children:"running"===(null===o||void 0===o?void 0:o.sync_status)?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:12,className:"animate-spin"})," Syncing..."]}):H?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Kg,{size:12})," Never synced"]}):U?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(AN,{size:12})," Needs attention"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(cr,{size:12})," Healthy"]})})]}),H?(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:'No sync has run yet. Click "Sync Now" to import parent contacts from Wonde.'}):(0,ea.jsxs)("div",{className:"text-sm text-slate-600 mb-2",children:["Last sync ",(0,ea.jsx)("span",{className:"font-medium text-slate-800",children:CJ(o.last_sync_at)}),(0,ea.jsx)("span",{className:"block text-xs text-slate-400 mt-0.5",children:new Date(o.last_sync_at).toLocaleStr
2ing()})]}),O&&!O.note&&(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-2 mt-2",children:[(0,ea.jsxs)("div",{className:"rounded-md bg-green-50 border border-green-100 px-2 py-2 text-center","data-testid":"wonde-stat-created",children:[(0,ea.jsx)("div",{className:"text-lg font-semibold text-green-700",children:null!==(e=O.created)&&void 0!==e?e:0}),(0,ea.jsx)("div",{className:"text-xs text-slate-500",children:"New"})]}),(0,ea.jsxs)("div",{className:"rounded-md bg-blue-50 border border-blue-100 px-2 py-2 text-center","data-testid":"wonde-stat-updated",children:[(0,ea.jsx)("div",{className:"text-lg font-semibold text-blue-700",children:null!==(s=O.updated)&&void 0!==s?s:0}),(0,ea.jsx)("div",{className:"text-xs text-slate-500",children:"Updated"})]}),(0,ea.jsxs)("div",{className:"rounded-md bg-indigo-50 border border-indigo-100 px-2 py-2 text-center","data-testid":"wonde-stat-groups",children:[(0,ea.jsx)("div",{className:"text-lg font-semibold text-indigo-700",children:null!==(a=O.year_groups_created)&&void 0!==a?a:0}),(0,ea.jsx)("div",{className:"text-xs text-slate-500",children:"New Groups"})]}),(0,ea.jsxs)("div",{className:"rounded-md px-2 py-2 text-center border ".concat((null!==(n=O.errors)&&void 0!==n?n:0)>0?"bg-red-50 border-red-100":"bg-slate-50 border-slate-100"),"data-testid":"wonde-stat-errors",children:[(0,ea.jsx)("div",{className:"text-lg font-semibold ".concat((null!==(l=O.errors)&&void 0!==l?l:0)>0?"text-red-700":"text-slate-400"),children:null!==(r=O.errors)&&void 0!==r?r:0}),(0,ea.jsx)("div",{className:"text-xs text-slate-500",children:"Errors"})]})]}),(null===O||void 0===O?void 0:O.note)&&(0,ea.jsxs)("div",{className:"flex items-start gap-2 text-xs text-amber-700 bg-amber-50 border border-amber-100 rounded-md p-2 mt-2",children:[(0,ea.jsx)(AN,{size:14,className:"mt-0.5 flex-shrink-0"}),(0,ea.jsx)("span",{children:O.note})]}),(null===O||void 0===O?void 0:O.year_groups)&&O.year_groups.length>0&&(0,ea.jsxs)("div",{className:"flex items-start gap-2 mt-2 pt-2 border-t border-slate-100",children:[(0,ea.jsx)(Bj,{size:13,className:"text-indigo-500 mt-0.5 flex-shrink-0"}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-1",children:O.year_groups.map(e=>(0,ea.jsx)("span",{className:"text-xs bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-full border border-indigo-100",children:e},e))})]})]}),(0,ea.jsx)(sg,{onClick:async()=>{h(!0),f(null);try{await _l.post("/wonde/sync"),qs.success("Sync started \u2014 results will appear here shortly"),v.current&&clearInterval(v.current),v.current=setInterval(R,4e3),R()}catch(K2){var e,t;h(!1),qs.error((null===(e=K2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Sync failed. Please try again.")}},disabled:m||"running"===(null===o||void 0===o?void 0:o.sync_status),"data-testid":"wonde-sync-btn",children:m||"running"===(null===o||void 0===o?void 0:o.sync_status)?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-2"}),"Syncing \u2014 please wait..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(gq,{size:14,className:"mr-2"}),"Sync Now"]})}),(null===g||void 0===g||null===(i=g.result)||void 0===i?void 0:i.note)&&(0,ea.jsxs)("div",{className:"mt-3 flex items-start gap-2 text-xs text-amber-700 bg-amber-50 border border-amber-100 rounded-md p-3","data-testid":"wonde-sync-result",children:[(0,ea.jsx)(AN,{size:14,className:"mt-0.5 flex-shrink-0"}),(0,ea.jsx)("span",{children:g.result.note})]})]})},DJ={taptile:{name:"Taptile",color:"purple",defaultUrl:"https://taptile.app"},ubots:{name:"ubots",color:"blue",defaultUrl:""},wonde:{name:"Wonde",color:"green",defaultUrl:"https://api.wonde.com"},generic:{name:"Custom API",color:"slate",defaultUrl:""}},_J=e=>{if(!e)return"never";const t=new Date(e).getTime();if(isNaN(t))return"never";const s=Math.floor((Date.now()-t)/1e3);if(s<60)return"just now";const a=Math.floor(s/60);if(a<60)return"".concat(a," minute").concat(1===a?"":"s"," ago");const n=Math.floor(a/60);if(n<24)return"".concat(n," hour").concat(1===n?"":"s"," ago");const l=Math.floor(n/24);return"".concat(l," day").concat(1===l?"":"s"," ago")},SJ=e=>{const t=Number(e)||60;return t<60?"every ".concat(t," minutes"):60===t?"every hour":t<1440?"every ".concat(t/60," hours"):"every 24 hours"},EJ=(e,t)=>{if(!e)return"on next check (within a minute)";const s=new Date(e).getTime();if(isNaN(s))return"on next check";const a=s+60*(Number(t)||60)*1e3-Date.now();if(a<=0)return"due now";const n=Math.ceil(a/6e4);if(n<60)return"in about ".concat(n," minute").concat(1===n?"":"s");const l=Math.round(n/60);return"in about ".concat(l," hour").concat(1===l?"":"s")},AJ=()=>{var e;const[s,a]=(0,t.useState)(null),[n,l]=(0,t.useState)(!0),[r,i]=(0,t.useState)(!1),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)(null),[h,x]=(0,t.useState)(null),[p,g]=(0,t.useState)(null),[f,v]=(0,t.useState)(!1),[b,j]=(0,t.useState)(null),[y,N]=(0,t.useState)({platform:"taptile",api_url:"",api_key:"",auto_sync_enabled:!1,sync_interval_minutes:60}),w=(0,t.useCallback)(async()=>{try{const e=await _l.get("/contact-sync/settings");a(e.data)}catch(e){console.error("Failed to fetch settings:",e)}finally{l(!1)}},[]);(0,t.useEffect)(()=>{w()},[w]);const C=async(e,t)=>{m(t),g(null);const s="push"===t?"/contact-sync/push/".concat(e):"/contact-sync/import/".concat(e);try{const e=await _l.post(s);g(e.data),qs.success(e.data.message),w()}catch(l){var a,n;const e=(null===(a=l.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.detail)||"".concat(t," failed");qs.error(e),g({status:"error",message:e})}finally{m(null)}};if(n)return(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"animate-spin h-8 w-8 text-indigo-600"})});const k=(null===s||void 0===s?void 0:s.integrations)||[];if(!(null===s||void 0===s?void 0:s.contact_sync_enabled))return(0,ea.jsxs)("div",{className:"space-y-6","data-testid":"contact-sync-not-enabled",children:[(0,ea.jsxs)("div",{className:"text-center py-8 bg-slate-50 rounded-lg border-2 border-dashed border-slate-200","data-testid":"contact-sync-disabled",children:[(0,ea.jsx)(gJ,{size:48,className:"mx-auto text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-700 mb-2",children:"Contact Sync Not Enabled"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"Contact your NexusCMS administrator to enable integrations for your account."})]}),(0,ea.jsx)(kJ,{})]});const D=k.map(e=>e.platform),_=Object.keys(DJ).filter(e=>!D.includes(e));return(0,ea.jsxs)("div",{className:"space-y-6","data-testid":"contact-sync-settings",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,ea.jsx)(gJ,{size:20,className:"text-indigo-600"}),(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-800",children:"Integrations"})]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Connect external platforms to sync contacts."})]}),_.length>0&&!f&&(0,ea.jsxs)(eb,{onValueChange:e=>(e=>{N({platform:e||"taptile",api_url:(DJ[e]||DJ.generic).defaultUrl||"",api_key:"",auto_sync_enabled:!1,sync_interval_minutes:60}),v(!0),j(null),x(null)})(e),children:[(0,ea.jsxs)(sb,{className:"w-48","data-testid":"add-integration-btn",children:[(0,ea.jsx)(Vj,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Add Integration"})]}),(0,ea.jsx)(lb,{children:_.map(e=>(0,ea.jsx)(rb,{value:e,children:DJ[e].name},e))})]})]}),k.map(e=>{const t=DJ[e.platform]||DJ.generic,s={purple:"border-purple-200 bg-purple-50",blue:"border-blue-200 bg-blue-50",green:"border-green-200 bg-green-50",slate:"border-slate-200 bg-slate-50"}[t.color]||"border-slate-200 bg-slate-50";return(0,ea.jsxs)("div",{className:"rounded-lg border p-5 ".concat(s),"data-testid":"integration-".concat(e.platform),children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(cr,{size:18,className:"text-green-600"}),(0,ea.jsx)("span",{className:"font-semibold text-slate-800",children:t.name}),e.auto_sync_enabled&&(0,ea.jsx)("span",{className:"text-xs bg-indigo-100 text-indigo-700 px-2 py-0.5 rounded-full",children:"Auto-sync"})]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-0.5",children:e.api_url}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-0.5",children:["Key: ",e.api_key_masked]})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{return N({platform:(t=e).platform,api_url:t.api_url||"",api_key:"",auto_sync_enabled:t.auto_sync_enabled||!1,sync_
2interval_minutes:t.sync_interval_minutes||60}),j(t.platform),v(!0),void x(null);var t},"data-testid":"edit-".concat(e.platform),children:[(0,ea.jsx)(Oj,{size:14,className:"mr-1"})," Edit"]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>(async e=>{var t;const s=(null===(t=DJ[e])||void 0===t?void 0:t.name)||e;if(window.confirm("Remove ".concat(s," integration? This will not delete any synced contacts.")))try{await _l.delete("/contact-sync/settings/".concat(e)),qs.success("".concat(s," integration removed")),g(null),w()}catch(a){qs.error("Failed to remove integration")}})(e.platform),className:"text-red-600 hover:text-red-700 hover:bg-red-50","data-testid":"remove-".concat(e.platform),children:(0,ea.jsx)(wD,{size:14})})]})]}),((s,a,n)=>{const l=e.last_sync_result||null,r=!!l&&(l.errors>0||l.error),i=!e.last_sync_at,o=i?"Never synced":r?"Needs attention":"Healthy",c=i?"bg-slate-100 text-slate-600":r?"bg-red-100 text-red-700":"bg-green-100 text-green-700",d=i?Kg:r?AN:cr;return(0,ea.jsxs)("div",{className:"bg-white/70 rounded-lg border border-slate-200 p-4 mb-3","data-testid":"sync-health-".concat(e.platform),children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(yJ,{size:16,className:"text-indigo-600"}),(0,ea.jsx)("span",{className:"text-sm font-semibold text-slate-800",children:"Sync Health"})]}),(0,ea.jsxs)("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full inline-flex items-center gap-1 ".concat(c),"data-testid":"sync-status-".concat(e.platform),children:[(0,ea.jsx)(d,{size:12})," ",o]})]}),(0,ea.jsx)("div",{className:"text-sm text-slate-600 mb-3",children:i?(0,ea.jsxs)("span",{children:["No sync has run yet. Use \u201cPush to ",t.name,"\u201d below or wait for the scheduled sync."]}):(0,ea.jsxs)("span",{children:["Last sync ",(0,ea.jsx)("span",{className:"font-medium text-slate-800",children:_J(e.last_sync_at)}),null!==l&&void 0!==l&&l.auto?(0,ea.jsx)("span",{className:"ml-1 text-xs bg-indigo-100 text-indigo-700 px-1.5 py-0.5 rounded",children:"automatic"}):(0,ea.jsx)("span",{className:"ml-1 text-xs bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded",children:"manual"}),(0,ea.jsx)("span",{className:"block text-xs text-slate-400 mt-0.5",children:new Date(e.last_sync_at).toLocaleString()})]})}),l&&(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-2",children:[(0,ea.jsxs)("div",{className:"rounded-md bg-green-50 border border-green-100 px-3 py-2 text-center","data-testid":"stat-created-".concat(e.platform),children:[(0,ea.jsx)("div",{className:"text-lg font-semibold text-green-700",children:null!==(s=l.created)&&void 0!==s?s:0}),(0,ea.jsx)("div",{className:"text-xs text-slate-500",children:"New"})]}),(0,ea.jsxs)("div",{className:"rounded-md bg-blue-50 border border-blue-100 px-3 py-2 text-center","data-testid":"stat-updated-".concat(e.platform),children:[(0,ea.jsx)("div",{className:"text-lg font-semibold text-blue-700",children:null!==(a=l.updated)&&void 0!==a?a:0}),(0,ea.jsx)("div",{className:"text-xs text-slate-500",children:"Updated"})]}),(0,ea.jsxs)("div",{className:"rounded-md px-3 py-2 text-center border ".concat(l.errors>0?"bg-red-50 border-red-100":"bg-slate-50 border-slate-100"),"data-testid":"stat-errors-".concat(e.platform),children:[(0,ea.jsx)("div",{className:"text-lg font-semibold ".concat(l.errors>0?"text-red-700":"text-slate-400"),children:null!==(n=l.errors)&&void 0!==n?n:0}),(0,ea.jsx)("div",{className:"text-xs text-slate-500",children:"Errors"})]})]}),(null===l||void 0===l?void 0:l.error)&&(0,ea.jsxs)("div",{className:"flex items-start gap-2 text-xs text-red-700 bg-red-50 border border-red-100 rounded-md p-2 mb-2","data-testid":"sync-error-".concat(e.platform),children:[(0,ea.jsx)(AN,{size:14,className:"mt-0.5 flex-shrink-0"}),(0,ea.jsx)("span",{children:l.error})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500 pt-1 border-t border-slate-100 mt-2",children:[(0,ea.jsx)(Kg,{size:13}),e.auto_sync_enabled?(0,ea.jsxs)("span",{"data-testid":"next-sync-".concat(e.platform),children:["Auto-sync is ",(0,ea.jsx)("span",{className:"font-medium text-slate-700",children:"on"})," (",SJ(e.sync_interval_minutes),"). Next sync ",EJ(e.last_auto_
2sync_at||e.last_sync_at,e.sync_interval_minutes),"."]}):(0,ea.jsx)("span",{children:"Auto-sync is off \u2014 contacts sync only when you press \u201cPush\u201d."})]})]})})(),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>C(e.platform,"push"),disabled:null!==u,"data-testid":"push-".concat(e.platform),children:["push"===u?(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-1"}):(0,ea.jsx)(kq,{size:14,className:"mr-1"}),"Push to ",t.name]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>C(e.platform,"import"),disabled:null!==u,"data-testid":"import-".concat(e.platform),children:["import"===u?(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-1"}):(0,ea.jsx)(jj,{size:14,className:"mr-1"}),"Import from ",t.name]})]})]},e.platform)}),p&&(0,ea.jsxs)("div",{className:"rounded-lg p-4 border ".concat("ok"===p.status?"bg-blue-50 border-blue-200":"bg-red-50 border-red-200"),"data-testid":"sync-result",children:[(0,ea.jsx)("p",{className:"font-medium text-sm mb-1",children:"ok"===p.status?"Sync Complete":"Sync Failed"}),(0,ea.jsx)("p",{className:"text-sm",children:p.message}),p.result&&(0,ea.jsxs)("div",{className:"flex gap-4 mt-2 text-xs",children:[(0,ea.jsxs)("span",{className:"text-green-700",children:["Created: ",p.result.created]}),(0,ea.jsxs)("span",{className:"text-blue-700",children:["Updated: ",p.result.updated]}),p.result.skipped>0&&(0,ea.jsxs)("span",{className:"text-slate-500",children:["Skipped: ",p.result.skipped]}),p.result.errors>0&&(0,ea.jsxs)("span",{className:"text-red-600",children:["Errors: ",p.result.errors]}),p.result.total_sent&&(0,ea.jsxs)("span",{className:"text-slate-500",children:["Total sent: ",p.result.total_sent]})]})]}),f&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-5 space-y-4 shadow-sm",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("span",{className:"font-medium text-sm text-slate-700",children:b?"Edit ".concat((null===(e=DJ[b])||void 0===e?void 0:e.name)||b):"New Connection"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{v(!1),j(null),x(null)},children:"Cancel"})]}),!b&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Platform"}),(0,ea.jsxs)(eb,{value:y.platform,onValueChange:e=>{const t=DJ[e]||{};N(d(d({},y),{},{platform:e,api_url:t.defaultUrl||y.api_url}))},children:[(0,ea.jsx)(sb,{"data-testid":"platform-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:_.map(e=>(0,ea.jsx)(rb,{value:e,children:DJ[e].name},e))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"API Base URL"}),(0,ea.jsx)(BN,{placeholder:"https://taptile.app",value:y.api_url,onChange:e=>N(d(d({},y),{},{api_url:e.target.value})),"data-testid":"api-url-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-500 mb-1 block",children:["API Key ",b&&(0,ea.jsx)("span",{className:"text-slate-400",children:"(leave blank to keep existing)"})]}),(0,ea.jsx)(BN,{type:"password",placeholder:b?"Leave blank to keep existing key":"Paste your API key",value:y.api_key,onChange:e=>N(d(d({},y),{},{api_key:e.target.value})),"data-testid":"api-key-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between py-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700",children:"Auto-Sync"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Push subscribers on a schedule"})]}),(0,ea.jsx)(wb,{checked:y.auto_sync_enabled,onCheckedChange:e=>N(d(d({},y),{},{auto_sync_enabled:e})),"data-testid":"auto-sync-toggle"})]}),y.auto_sync_enabled&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Interval"}),(0,ea.jsxs)(eb,{value:String(y.sync_interval_minutes),onValueChange:e=>N(d(d({},y),{},{sync_interval_minutes:parseInt(e)})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"30",children:"Every 30 min"}),(0,ea.jsx)(rb,{value:"60",children:"Every hour"}),(0,ea.jsx)(rb,{value:"360",children:"Every 6 hours"}),(0,ea.jsx)(rb,{value:"1440",children:"Every 24 hours"})]})]})]})]}),h&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-3 rounded-lg text-sm ".concat("ok"===h.status?"bg-green-50 text-green-700":"bg-red-50 text-red-700"),children:["ok"===h.status?(0,ea.jsx)(cr,{size:16}):(0,ea.jsx)(fJ,{size:16}),h.message]}),(0,ea.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>
2{if(y.api_url&&y.api_key){c(!0),x(null);try{const e=await _l.post("/contact-sync/test-connection",y);x(e.data),"ok"===e.data.status?qs.success(e.data.message):qs.error(e.data.message)}catch(e){x({status:"error",message:"Connection test failed"}),qs.error("Connection test failed")}finally{c(!1)}}else qs.error("API URL and Key are required to test")},disabled:o||!y.api_url||!y.api_key,"data-testid":"test-connection-btn",children:[o?(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-2"}):(0,ea.jsx)(gq,{size:14,className:"mr-2"}),"Test Connection"]}),(0,ea.jsxs)(sg,{onClick:async()=>{if(y.api_url)if(y.api_key||b){i(!0);try{var e;const t=d({},y);if(!t.api_key&&b){const e=((null===s||void 0===s?void 0:s.integrations)||[]).find(e=>e.platform===b);null!==e&&void 0!==e&&e.api_key&&(t.api_key=e.api_key)}await _l.post("/contact-sync/settings",t),qs.success("".concat((null===(e=DJ[y.platform])||void 0===e?void 0:e.name)||y.platform," integration saved")),v(!1),j(null),x(null),w()}catch(n){var t,a;qs.error((null===(t=n.response)||void 0===t||null===(a=t.data)||void 0===a?void 0:a.detail)||"Failed to save settings")}finally{i(!1)}}else qs.error("API Key is required");else qs.error("API URL is required")},disabled:r||!y.api_url,"data-testid":"save-integration-btn",children:[r?(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-2"}):null,b?"Update":"Connect"]})]})]}),(0,ea.jsx)("div",{className:"pt-2 border-t border-slate-200",children:(0,ea.jsx)(kJ,{})})]})},FJ=()=>{var e,s,a,n,l,r,i,o,c,u,m;const[h,x]=(0,t.useState)([]),[p,g]=(0,t.useState)(!0),[f,v]=(0,t.useState)(""),[b,j]=(0,t.useState)("newsletters"),[y,N]=(0,t.useState)([]),[w,C]=(0,t.useState)(!1),[k,D]=(0,t.useState)(""),[_,S]=(0,t.useState)(!1),[E,A]=(0,t.useState)({email:"",name:"",phone:"",company:"",role:"",preferred_language:"en",group_ids:[]}),[F,T]=(0,t.useState)(null),[z,M]=(0,t.useState)(!1),[P,B]=(0,t.useState)(1),[R,L]=(0,t.useState)(0),[I,O]=(0,t.useState)(1),[U,H]=(0,t.useState)([]),[W,V]=(0,t.useState)(!1),[q,$]=(0,t.useState)({name:"",description:""}),[G,K]=(0,t.useState)(null),[Y,J]=(0,t.useState)(null),[Q,X]=(0,t.useState)(!1),[Z,ee]=(0,t.useState)(""),[te,se]=(0,t.useState)([]),[ae,ne]=(0,t.useState)(!1),[le,re]=(0,t.useState)(""),[ie,oe]=(0,t.useState)(!1),[ce,de]=(0,t.useState)(null),[ue,me]=(0,t.useState)(null),[he,xe]=(0,t.useState)(!1),[pe,ge]=(0,t.useState)("all"),[fe,ve]=(0,t.useState)(""),[be,je]=(0,t.useState)([]),[ye,Ne]=(0,t.useState)(!1),[we,Ce]=(0,t.useState)({total_newsletters:0,total_sent:0,total_opened:0,total_bounced:0,open_rate:0,bounce_rate:0}),[ke,De]=(0,t.useState)({total_subscribers:0,active_subscribers:0,emails_sent_30d:0,newsletters_sent:0}),[_e,Se]=(0,t.useState)(!1),[Ee,Ae]=(0,t.useState)(""),[Fe,Te]=(0,t.useState)(!1),[ze,Me]=(0,t.useState)(!1),[Pe,Be]=(0,t.useState)(null),[Re,Le]=(0,t.useState)([]),[Ie,Oe]=(0,t.useState)(""),[Ue,He]=(0,t.useState)([]),[We,Ve]=(0,t.useState)(""),[qe,$e]=(0,t.useState)(!1),[Ge,Ke]=(0,t.useState)("now"),[Ye,Je]=(0,t.useState)(""),[Qe,Xe]=(0,t.useState)(""),[Ze,et]=(0,t.useState)(!1),[tt,st]=(0,t.useState)(null),[at,nt]=(0,t.useState)([]),[lt,rt]=(0,t.useState)([]),[it,ot]=(0,t.useState)({email_column:0,name_column:null,group_column:null,role_column:null,language_column:null,has_header:!0,default_group_ids:[],override_existing:!1}),[ct,dt]=(0,t.useState)(!1),ut=(0,t.useRef)(null),[mt,ht]=(0,t.useState)("list"),[xt,pt]=(0,t.useState)(1),[gt]=(0,t.useState)(10),[ft,vt]=(0,t.useState)("all"),[bt,jt]=(0,t.useState)("all"),[yt,wt]=(0,t.useState)(!1),[Ct,kt]=(0,t.useState)(""),[Dt,_t]=(0,t.useState)(null),[St,Et]=(0,t.useState)([]),[At,Ft]=(0,t.useState)(!1),[Tt,zt]=(0,t.useState)(1),[Mt,Pt]=(0,t.useState)(0),[Bt,Rt]=(0,t.useState)("all");(0,t.useEffect)(()=>{Wt(),Kt(),qt(),$t(),Lt()},[]),(0,t.useEffect)(()=>{"subscribers"===b?Vt():"analytics"===b?Gt():"groups"===b&&qt()},[b]);const Lt=async()=>{try{const e=await _l.get("/newsletters/campaigns");je(e.data)}catch(e){console.error("Failed to load campaigns:",e)}},[It,Ot]=(0,t.useState)(null),[Ut,Ht]=(0,t.useState)(!0),Wt=async()=>{try{const e=await _l.get("/newsletters");x(e.data)}catch(e){qs.error("Failed to load newsletters")}finally{g(!1)}},Vt=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;C(!0);try{const t=await _l.get("/subscribers?page=".concat(e,"&per_page=50"));N(t.data.subscribers||[]),L(t.data.total||0),O(t.data.total_pages||1),B(e)}catch(t){console.error("Failed to load subscribers:",t)}finally{C(!1)}},qt=async()=>{try{const e=await _l.get("/subscriber-groups");H(e.data)}catch(e){console.error("Failed to load groups:",e)}},$t=async()=>{try{const e=await _l.get("/newsletters/analytics/summary");Ce(e.data)}
2catch(e){console.error("Failed to load analytics summary:",e)}},Gt=async()=>{Ne(!0);try{const[e,t]=await Promise.all([_l.get("/newsletters/analytics/summary"),_l.get("/newsletters/campaigns")]);Ce(e.data),je(t.data)}catch(e){console.error("Failed to load analytics:",e)}finally{Ne(!1)}},Kt=async()=>{try{const e=await _l.get("/newsletters/analytics/summary");De({total_subscribers:e.data.total_subscribers||0,active_subscribers:e.data.total_subscribers||0,emails_sent_30d:e.data.total_sent||0,newsletters_sent:e.data.total_newsletters||0})}catch(e){console.error("Failed to load email stats")}},Yt=e=>e&&0!==e.length?e.map(e=>{const t=U.find(t=>t.group_id===e);return t?t.name:null}).filter(Boolean):[],Jt=e=>{J(e),ee(""),X(!0),0===y.length&&Vt()},Qt=e=>y.filter(t=>t.group_ids&&t.group_ids.includes(e)&&"active"===t.status),Xt=()=>{if(null===ue||void 0===ue||!ue.recipients)return[];let e=ue.recipients;return"all"!==pe&&(e=e.filter(e=>{var t;return"opened"===pe?e.opened_at:"clicked"===pe?e.clicked_at:"bounced"===pe?(null===(t=e.status)||void 0===t?void 0:t.includes("bounce"))||e.bounced_at:"delivered"!==pe||("delivered"===e.status||"sent"===e.status)})),fe&&(e=e.filter(e=>e.email.toLowerCase().includes(fe.toLowerCase())||(e.name||"").toLowerCase().includes(fe.toLowerCase()))),e},Zt=async function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;Ft(!0),_t(e),kt(t),zt(a),Rt(s),wt(!0);try{let n="/campaigns/".concat(e.campaign_id,"/recipients?status=").concat(t,"&page=").concat(a,"&per_page=50");"bounced"===t&&"all"!==s&&(n+="&bounce_type=".concat(s));const l=await _l.get(n);Et(l.data.recipients||[]),Pt(l.data.total||0)}catch(n){qs.error("Failed to load recipient details"),console.error("Recipient details error:",n),Et([])}finally{Ft(!1)}},es=()=>{st(null),nt([]),ot({email_column:0,name_column:null,group_column:null,role_column:null,language_column:null,has_header:!0,default_group_ids:[],override_existing:!1}),ut.current&&(ut.current.value="")},ts=(()=>{let e=h.filter(e=>e.title.toLowerCase().includes(f.toLowerCase()));if("all"!==ft&&(e=e.filter(e=>"sent"===ft?e.sent_at&&"scheduled"!==e.status:"scheduled"===ft?"scheduled"===e.status||e.scheduled_at:"draft"!==ft||!e.sent_at&&"scheduled"!==e.status&&!e.scheduled_at)),"all"!==bt){const t=new Date;e=e.filter(e=>{const s=new Date(e.created_at);return"7days"===bt?(t-s)/864e5<=7:"30days"===bt?(t-s)/864e5<=30:"90days"!==bt||(t-s)/864e5<=90})}return e})(),ss=Math.ceil(ts.length/gt),as=ts.slice((xt-1)*gt,xt*gt),ns=y.filter(e=>e.email.toLowerCase().includes(k.toLowerCase())||(e.name||"").toLowerCase().includes(k.toLowerCase())),ls=ns.length>0&&ns.every(e=>te.includes(e.subscriber_id)),rs=te.length>0&&!ls,is=te.length===R&&R>0;return(0,ea.jsxs)("div",{className:"flex","data-testid":"newsletters-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold",style:{fontFamily:"Manrope, sans-serif"},children:"Email & Newsletters"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Manage newsletters, subscribers, and analytics"})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsx)(DC,{content:"Send a test email to verify your setup",children:(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>Se(!0),children:[(0,ea.jsx)(pJ,{size:18,className:"mr-2"}),"Test Email"]})}),(0,ea.jsx)(DC,{content:"Create a new email newsletter campaign",children:(0,ea.jsx)(Nt,{to:"/newsletters/new",children:(0,ea.jsxs)(sg,{className:"bg-emerald-600 hover:bg-emerald-700","data-testid":"create-newsletter-button",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Create Newsletter"]})})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[(0,ea.jsx)(DC,{content:"Active email subscribers in your list",children:(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Bj,{className:"text-indigo-600",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:ke.active_subscribers}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Subscribers"})]})]})})}),(0,ea.jsx)(DC,{content:"Total emails sent in the last 30 days",children:(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-emerald-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Yl,{className:"text-emerald-600",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:ke.emails_sent_30d}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Emails Sent"})]})]})})}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-amber-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(IN,{className:"text-amber-600",
2size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:[we.open_rate,"%"]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Open Rate"})]})]})}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(dr,{className:"text-purple-600",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:ke.newsletters_sent}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Campaigns"})]})]})})]}),(0,ea.jsxs)(nJ,{value:b,onValueChange:j,className:"w-full",children:[(0,ea.jsxs)(lJ,{className:"mb-4",children:[(0,ea.jsxs)(rJ,{value:"newsletters",className:"gap-2",children:[(0,ea.jsx)(Yl,{size:16}),"Newsletters"]}),(0,ea.jsxs)(rJ,{value:"subscribers",className:"gap-2",children:[(0,ea.jsx)(Bj,{size:16}),"Subscribers"]}),(0,ea.jsxs)(rJ,{value:"groups",className:"gap-2",children:[(0,ea.jsx)(Wj,{size:16}),"Groups"]}),(0,ea.jsxs)(rJ,{value:"analytics",className:"gap-2",children:[(0,ea.jsx)(Cw,{size:16}),"Analytics"]}),(0,ea.jsxs)(rJ,{value:"contact-sync",className:"gap-2","data-testid":"contact-sync-tab",children:[(0,ea.jsx)(gJ,{size:16}),"Contact Sync"]})]}),(0,ea.jsxs)(iJ,{value:"newsletters",children:[(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 mb-6",children:(0,ea.jsxs)("div",{className:"flex gap-4 items-center",children:[(0,ea.jsxs)("div",{className:"relative flex-1",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:20}),(0,ea.jsx)(BN,{placeholder:"Search newsletters...",value:f,onChange:e=>{v(e.target.value),pt(1)},className:"pl-10","data-testid":"search-input"})]}),(0,ea.jsxs)(eb,{value:ft,onValueChange:e=>{vt(e),pt(1)},children:[(0,ea.jsxs)(sb,{className:"w-[140px]",children:[(0,ea.jsx)(kD,{size:16,className:"mr-2 text-slate-400"}),(0,ea.jsx)(tb,{placeholder:"Status"})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Status"}),(0,ea.jsx)(rb,{value:"sent",children:"Sent"}),(0,ea.jsx)(rb,{value:"scheduled",children:"Scheduled"}),(0,ea.jsx)(rb,{value:"draft",children:"Draft"})]})]}),(0,ea.jsxs)(eb,{value:bt,onValueChange:e=>{jt(e),pt(1)},children:[(0,ea.jsxs)(sb,{className:"w-[140px]",children:[(0,ea.jsx)(yj,{size:16,className:"mr-2 text-slate-400"}),(0,ea.jsx)(tb,{placeholder:"Date"})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Time"}),(0,ea.jsx)(rb,{value:"7days",children:"Last 7 Days"}),(0,ea.jsx)(rb,{value:"30days",children:"Last 30 Days"}),(0,ea.jsx)(rb,{value:"90days",children:"Last 90 Days"})]})]})]})}),p?(0,ea.jsx)("div",{className:"text-center py-12",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading newsletters..."})}):0===ts.length?(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-12 text-center",children:[(0,ea.jsx)(dr,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"No newsletters found"}),(0,ea.jsx)(Nt,{to:"/newsletters/new",children:(0,ea.jsxs)(sg,{"data-testid":"empty-create-button",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Create Your First Newsletter"]})})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Title"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Recipients"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Open Rate"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Click Rate"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Date"}),(0,ea.jsx)("th",{className:"text-right px-6 py-3 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-200",children:as.map(e=>{const t=(s=e.newsletter_id,be.find(e=>e.newsletter_id===s)||null);var s;const a=(null===t||void 0===t?void 0:t.open_rate)||0,n=(null===t||void 0===t?void 0:t.click_rate)||0;return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50 group",children:[(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsxs)(Nt,{to:"/newsletters/".concat(e.newsletter_id),className:"block","data-testid":"newsletter-row-".concat(e.newsletter_id),children:[(0,ea.jsx)("p",{className:"font-medium text-slate-900 group-hover:text-indigo-600 transition-colors",children:e.title}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 truncate max-w-xs",children:e.subject})]})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:e.sent_at&&"scheduled"!==e.status?(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs bg-emerald-100 text-emerald-700",children:[(0,ea.jsx)(uD,{size:12}),"Sent"]}):"scheduled"===e.status||e.scheduled_at?(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs bg-indigo-100 text-indigo-700",children:[(0,ea.jsx)(yj,{size:12}),"Scheduled"]}),e.scheduled_at&&(0,ea.jsx)("p",{className:"text-xs text-indigo-600 mt-1",children:new Date(e.scheduled_at).toLocaleStr
2ing()})]}):(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs bg-slate-100 text-slate-600",children:[(0,ea.jsx)(Kg,{size:12}),"Draft"]})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:e.sent_at||e.scheduled_at?e.recipients_count||0:"-"})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:e.sent_at&&"scheduled"!==e.status?(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("div",{className:"w-16 h-2 bg-slate-200 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full rounded-full ".concat(a>30?"bg-emerald-500":a>15?"bg-amber-500":"bg-red-400"),style:{width:"".concat(Math.min(a,100),"%")}})}),(0,ea.jsxs)("span",{className:"text-sm text-slate-600",children:[a,"%"]})]}):(0,ea.jsx)("span",{className:"text-sm text-slate-400",children:"-"})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:e.sent_at&&"scheduled"!==e.status?(0,ea.jsxs)("span",{className:"text-sm text-slate-600",children:[n,"%"]}):(0,ea.jsx)("span",{className:"text-sm text-slate-400",children:"-"})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:e.sent_at?new Date(e.sent_at).toLocaleDateString():e.scheduled_at?new Date(e.scheduled_at).toLocaleDateString():new Date(e.created_at).toLocaleDateString()})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-right",children:(0,ea.jsxs)("div",{className:"flex gap-1 justify-end opacity-0 group-hover:opacity-100 transition-opacity",children:[e.sent_at&&"scheduled"!==e.status&&(0,ea.jsx)(sg,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50",onClick:t=>(async(e,t)=>{e.preventDefault(),e.stopPropagation(),de(t),oe(!0),xe(!0),ge("all"),ve("");try{const e=await _l.get("/newsletters/".concat(t.newsletter_id,"/analytics"));me(e.data)}catch(s){qs.error("Failed to load analytics"),console.error("Analytics error:",s)}finally{xe(!1)}})(t,e),title:"Analytics","data-testid":"analytics-btn-".concat(e.newsletter_id),children:(0,ea.jsx)(Cw,{size:14})}),"scheduled"!==e.status&&!e.scheduled_at||e.sent_at?(0,ea.jsx)(sg,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:t=>((e,t)=>{e.preventDefault(),e.stopPropagation(),Be(t),Le([]),Oe(""),He([]),Ve(""),Ke("now"),Je(""),Xe(""),Me(!0),0===y.length&&Vt()})(t,e),title:"Send",children:(0,ea.jsx)(dr,{size:14})}):(0,ea.jsx)(sg,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-amber-600 hover:text-amber-700 hover:bg-amber-50",onClick:t=>(async(e,t)=>{if(e.preventDefault(),e.stopPropagation(),confirm("Are you sure you want to cancel this scheduled newsletter?"))try{await _l.delete("/newsletters/".concat(t.newsletter_id,"/schedule")),qs.success("Scheduled newsletter cancelled"),Wt()}catch(n){var s,a;qs.error((null===(s=n.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Failed to cancel scheduled newsletter")}})(t,e),title:"Cancel Schedule",children:(0,ea.jsx)(fJ,{size:14})}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:t=>(async(e,t)=>{e.preventDefault(),e.stopPropagation();try{await _l.post("/newsletters/".concat(t,"/clone")),qs.success("Newsletter cloned successfully"),Wt()}catch(s){qs.error("Failed to clone newsletter")}})(t,e.newsletter_id),title:"Clone",children:(0,ea.jsx)(DD,{size:14})}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-red-600 hover:text-red-700 hover:bg-red-50",onClick:t=>(async(e,t)=>{if(e.preventDefault(),e.stopPropagation(),window.confirm("Are you sure you want to delete this newsletter?"))try{await _l.delete("/newsletters/".concat(t)),qs.success("Newsletter deleted"),Wt()}catch(s){qs.error("Failed to delete newsletter")}})(t,e.newsletter_id),title:"Delete",children:(0,ea.jsx)(wD,{size:14})})]})})]},e.newsletter_id)})})]})}),ss>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-between mt-4 px-2",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Showing ",(xt-1)*gt+1," to ",Math.min(xt*gt,ts.length)," of ",ts.length," newsletters"]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>pt(e=>Math.max(1,e-1)),disabled:1===xt,children:[(0,ea.jsx)(vj,{size:16,className:"mr-1"}),"Previous"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>pt(e=>Math.min(ss,e+1)),disabled:xt===ss,children:["Next",(0,ea.jsx)(ax,{size:16,className:"ml-1"})]})]})]})]})]}),(0,ea.jsxs)(iJ,{value:"subscribers",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 mb-6 flex flex-wrap gap-4",children:[(0,ea.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:20}),(0,ea.jsx)(BN,{placeholder:"Search subscribers...",value:k,onChange:e=>D(e.target.value),className:"pl-10"})]}),(0,ea.jsxs)(sg,{onClick:()=>Vt(),variant:"outline",children:[(0,ea.jsx)(gq,{size:16,className:"mr-2"}),"Refresh"]}),(0,ea.jsxs)(sg,{onClick:async()=>{let e;if(te.length>0)if(te.length>y.length)try{const t=await _l.get("/subscribers?page=1&per_page=10000");e=(t.data.subscribers||[]).filter(e=>te.includes(e.subscriber_id))}catch(r){return void qs.error("Failed to fetch subscribers for export")}else e=y.filter(e=>te.includes(e.subscriber_id));else try{e=(await _l.get("/subscribers?page=1&per_page=10000")).data.subscribers||[]}catch(r){return void qs.error("Failed to fetch subscribers for export")}if(0===e.length)return void qs.error("No subscribers to export");const t=e.map(e=>{const t=Yt(e.group_ids).join("; ");return[e.email,e.name||"",e.status||"active",e.preferred_language||e.language||"",t,e.created_at?new Date(e.created_at).toISOString().split("T")[0]:""].map(e=>'"'.concat((e||"").replace(/"/g,'""'),'"')).join(",")}),s=[["email","name","status","language","groups","subscribed_date"].join(","),...t].join("\n"),a=new Blob([s],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(a),l=document.createElement("a");l.href=n,l.download="subscribers_".concat((new Date).toISOString().split("T")[0],".csv"),document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(n),qs.success("Exported ".concat(e.length," subscriber(s) to CSV"))},variant:"outline","data-testid":"export-csv-button",children:[(0,ea.jsx)(vJ,{size:16,className:"mr-2"}),te.length>0?"Export Selected (".concat(te.length,")"):"Export All"]}),(0,ea.jsxs)(sg,{onClick:()=>{es(),et(!0)},variant:"outline","data-testid":"import-csv-button",children:[(0,ea.jsx)(kq,{size:16,className:"mr-2"}),"Import CSV"]}),(0,ea.jsxs)(sg,{onClick:()=>S(!0),"data-testid":"add-subscriber-button",children:[(0,ea.jsx)(Vj,{size:16,className:"mr-2"}),"Add Subscriber"]})]}),te.length>0&&(0,ea.jsxs)("div",{className:"bg-indigo-50 border border-indigo-200 rounded-xl p-4 mb-4 flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4 flex-wrap",children:[(0,ea.jsxs)("span",{className:"text-sm font-medium text-indigo-700",children:[te.length," of ",R," subscriber(s) selected"]}),!is&&R>te.length&&(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",onClick:async()=>{C(!0);try{const e=await(async()=>{try{return((await _l.get("/subscribers?page=1&per_page=10000")).data.subscribers||[]).map(e=>e.subscriber_id)}catch(e){return console.error("Failed to fetch all subscriber IDs:",e),[]}})();se(e),qs.success("Selected all ".concat(e.length," subscribers"))}catch(e){qs.error("Failed to select all subscribers")}finally{C(!1)}},className:"text-indigo-600 hover:text-indigo-700 font-medium",children:["Select all ",R," subscribers"]}
2),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{se([])},className:"text-indigo-600 hover:text-indigo-700",children:"Clear selection"})]}),(0,ea.jsx)("div",{className:"flex gap-2",children:(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>ne(!0),className:"border-indigo-300 text-indigo-700 hover:bg-indigo-100",children:[(0,ea.jsx)(vD,{size:16,className:"mr-2"}),"Add to Group"]})})]}),w?(0,ea.jsx)("div",{className:"text-center py-12",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading subscribers..."})}):0===ns.length?(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-12 text-center",children:[(0,ea.jsx)(Bj,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"No subscribers yet"}),(0,ea.jsxs)("div",{className:"flex gap-3 justify-center",children:[(0,ea.jsxs)(sg,{onClick:()=>{es(),et(!0)},variant:"outline",children:[(0,ea.jsx)(kq,{size:18,className:"mr-2"}),"Import from CSV"]}),(0,ea.jsxs)(sg,{onClick:()=>S(!0),children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Add Subscriber"]})]})]}):(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"px-4 py-3 w-12",children:(0,ea.jsx)(fw,{checked:ls,onCheckedChange:e=>{se(e?ns.map(e=>e.subscriber_id):[])},className:rs?"data-[state=checked]:bg-indigo-400":"","data-testid":"select-all-subscribers"})}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Email"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Name"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Source"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Groups"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Subscribed"}),(0,ea.jsx)("th",{className:"text-right px-4 py-3 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-200",children:ns.map(e=>{const t=Yt(e.group_ids),s=te.includes(e.subscriber_id);return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50 group ".concat(s?"bg-indigo-50":""),children:[(0,ea.jsx)("td",{className:"px-4 py-4 w-12",children:(0,ea.jsx)(fw,{checked:s,onCheckedChange:t=>((e,t)=>{se(t?t=>[...t,e]:t=>t.filter(t=>t!==e))})(e.subscriber_id,t),"data-testid":"select-subscriber-".concat(e.subscriber_id)})}),(0,ea.jsx)("td",{className:"px-4 py-4 text-sm font-medium",children:e.email}),(0,ea.jsx)("td",{className:"px-4 py-4 text-sm text-slate-600",children:e.name||"-"}),(0,ea.jsx)("td",{className:"px-4 py-4",children:(0,ea.jsx)("span",{className:"px-2 py-1 rounded-full text-xs ".concat("active"===e.status?"bg-emerald-100 text-emerald-700":"bg-slate-100 text-slate-600"),children:e.status})}),(0,ea.jsx)("td",{className:"px-4 py-4",children:(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs ".concat("taptile"===e.source?"bg-purple-100 text-purple-700":"website-form"===e.source?"bg-blue-100 text-blue-700":"csv-import"===e.source?"bg-amber-100 text-amber-700":"bg-slate-100 text-slate-600"),children:e.source||"manual"})}),(0,ea.jsx)("td",{className:"px-4 py-4",children:t.length>0?(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,2).map((e,t)=>(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs bg-indigo-100 text-indigo-700",children:e},t)),t.length>2&&(0,ea.jsxs)("span",{className:"px-2 py-0.5 rounded-full text-xs bg-slate-100 text-slate-600",children:["+",t.length-2," more"]})]}):(0,ea.jsx)("span",{className:"text-sm text-slate-400",children:"No groups"})}),(0,ea.jsx)("td",{className:"px-4 py-4 text-sm text-slate-600",children:e.created_at?new Date(e.created_at).toLocaleDateString():"-"}),(0,ea.jsx)("td",{className:"px-4 py-4 text-right",children:(0,ea.jsxs)("div",{className:"flex gap-1 justify-end opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{T(d(d({},e),{},{group_ids:e.group_ids||[]})),M(!0)})(e),className:"h-8 w-8 p-0",title:"Edit",children:(0,ea.jsx)(bJ,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this subscriber?"))try{await _l.delete("/subscribers/".concat(e)),qs.success("Subscriber deleted"),Vt(),Kt()}catch(t){qs.error("Failed to delete subscriber")}})(e.subscriber_id),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700 hover:bg-red-50",title:"Delete",children:(0,ea.jsx)(wD,{size:14})})]})})]},e.subscriber_id)})})]})}),R>50&&(0,ea.jsxs)("div",{className:"mt-4 flex items-center justify-between bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"text-sm text-slate-600",children:["Showing ",50*(P-1)+1," - ",Math.min(50*P,R)," of ",R," subscribers"]}
2),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>Vt(P-1),disabled:P<=1,children:"Previous"}),(0,ea.jsxs)("span",{className:"text-sm text-slate-600 px-3",children:["Page ",P," of ",I]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>Vt(P+1),disabled:P>=I,children:"Next"})]})]})]}),(0,ea.jsxs)(iJ,{value:"groups",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 mb-6 flex justify-between items-center",children:[(0,ea.jsx)("p",{className:"text-slate-600",children:"Organize your subscribers into groups for targeted campaigns"}),(0,ea.jsxs)(sg,{onClick:()=>{K(null),$({name:"",description:""}),V(!0)},children:[(0,ea.jsx)(vD,{size:16,className:"mr-2"}),"Create Group"]})]}),0===U.length?(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-12 text-center",children:[(0,ea.jsx)(Wj,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"No groups yet"}),(0,ea.jsxs)(sg,{onClick:()=>V(!0),children:[(0,ea.jsx)(vD,{size:18,className:"mr-2"}),"Create Your First Group"]})]}):(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:U.map(e=>(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>Jt(e),children:[(0,ea.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-lg font-semibold",children:e.name}),e.description&&(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:e.description})]}),(0,ea.jsxs)("div",{className:"flex gap-1",onClick:e=>e.stopPropagation(),children:[(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>{K(e),$({name:e.name,description:e.description||""}),V(!0)},children:(0,ea.jsx)(bJ,{size:14})}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",className:"text-red-600 hover:bg-red-50",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this group?"))try{await _l.delete("/subscriber-groups/".concat(e)),qs.success("Group deleted"),qt()}catch(t){qs.error("Failed to delete group")}})(e.group_id),children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-600",children:[(0,ea.jsx)(Bj,{size:16}),(0,ea.jsxs)("span",{className:"text-sm",children:[e.subscriber_count||0," subscribers"]}
2)]}),(0,ea.jsxs)(sg,{size:"sm",variant:"outline",onClick:t=>{t.stopPropagation(),Jt(e)},children:[(0,ea.jsx)(IN,{size:14,className:"mr-1"}),"View"]})]})]},e.group_id))})]}),(0,ea.jsx)(iJ,{value:"analytics",children:ye?(0,ea.jsx)("div",{className:"text-center py-12",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading analytics..."})}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(dr,{size:18,className:"text-indigo-600"}),(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:"Total Sent"})]}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:we.total_sent})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(IN,{size:18,className:"text-emerald-600"}),(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:"Opened"})]}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:we.total_opened})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(GN,{size:18,className:"text-amber-600"}),(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:"Open Rate"})]}),(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:[we.open_rate,"%"]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(AN,{size:18,className:"text-red-500"}),(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:"Bounced"})]}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:we.total_bounced})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(jJ,{size:18,className:"text-slate-500"}),(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:"Unsubscribed"})]}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:we.total_unsubscribed||0})]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsxs)("div",{className:"px-6 py-4 border-b border-slate-200 flex items-center justify-between",children:[(0,ea.jsx)("h3",{className:"font-semibold",children:"Campaign History"}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm text-slate-600 cursor-pointer select-none","data-testid":"hide-test-sends-toggle",children:[(0,ea.jsx)("input",{type:"checkbox",checked:Ut,onChange:e=>Ht(e.target.checked),className:"w-4 h-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"}),(0,ea.jsx)("span",{children:"Hide test sends (< 10 recipients)"})]})]}),0===be.length?(0,ea.jsxs)("div",{className:"p-12 text-center",children:[(0,ea.jsx)(Cw,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No campaigns sent yet"})]}):(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Newsletter"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Sent"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Opened"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Open Rate"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Bounced"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Unsubscribed"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Date"}),(0,ea.jsx)("th",{className:"text-right px-6 py-3 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-200",children:be.filter(e=>!Ut||(e.sent_count||0)>=10).map(e=>(0,ea.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"px-6 py-4 text-sm font-medium",children:e.title}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm",children:e.sent_count}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm",children:(0,ea.jsx)("button",{onClick:()=>Zt(e,"opened"),className:"text-emerald-600 hover:text-emerald-800 hover:underline font-medium",title:"Click to see who opened",children:e.opened_count||0})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm",children:(0,ea.jsxs)("span",{className:"font-medium ".concat(e.open_rate>20?"text-emerald-600":"text-slate-600"),children:[e.open_rate,"%"]})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm",children:(0,ea.jsx)("button",{onClick:()=>Zt(e,"bounced"),className:"text-red-600 hover:text-red-800 hover:underline font-medium",title:"Click to see bounced emails",children:e.bounced_count||(e.hard_bounced_count||0)+(e.soft_bounced_count||0)})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm",children:(0,ea.jsx)("button",{onClick:()=>Zt(e,"unsubscribed"),className:"text-amber-600 hover:text-amber-800 hover:underline font-medium",title:"Click to see unsubscribes",children:e.unsubscribed_count||0})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)("span",{className:"px-2 py-1 rounded-full text-xs ".concat("completed"===e.status?"bg-emerald-100 text-emerald-700":"sending"===e.status?"bg-amber-100 text-amber-700":"bg-slate-100 text-slate-600"),children:e.status})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm text-slate-600",children:e.created_at?new Date(e.created_at).toLocaleDateString():"-"}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm text-right",children:(0,ea.jsx)(DC,{content:"Pull the latest delivered / opened / clicked numbers from the email provider. Useful if a webhook event was missed.",children:(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",disabled:It===e.campaign_id,onClick:()=>(async e=>{if(null!==e&&void 0!==e&&e.campaign_id){Ot(e.campaign_id);try{const t=(await _l.post("/newsletters/campaigns/".concat(e.campaign_id,"/resync"))).data||{},s=t.applied_updates||{},a=Object.keys(s).filter(e=>"last_resync_at"!==e);t.note?qs.info(t.note,{duration:8e3}):0===a.length?qs.info("Analytics already up to date \u2014 no new events from the email provider."):qs.success("Analytics re-synced (".concat(a.length," counter").concat(1===a.length?"":"s"," updated).")),await Lt()}catch(a){var t,s;const e=(null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Re-sync failed";qs.error(e)}finally{Ot(null)}}})(e),"data-testid":"resync-analytics-btn-".concat(e.campaign_id),className:"text-slate-600 hover:text-slate-900",children:[(0,ea.jsx)(gq,{size:14,className:It===e.campaign_id?"animate-spin mr-1.5":"mr-1.5"}),It===e.campaign_id?"Syncing\u2026":"Re-sync"]})})})]},e.campaign_id))})]})]})]})}),(0,ea.jsx)(iJ,{value:"contact-sync",children:(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:(0,ea.jsx)(AJ,{})})})]})]})}),(0,ea.jsx)(Ok,{open:_,onOpenChange:S,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Add Subscriber"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email(s) *"}),(0,ea.jsx)("textarea",{className:"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
2ing-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",placeholder:"[email protected]\nOr add multiple emails separated by commas or new lines:\[email protected], [email protected]",value:E.email,onChange:e=>A(d(d({},E),{},{email:e.target.value}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Add multiple emails by separating with commas or new lines"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Name (optional, for single subscriber)"}),(0,ea.jsx)(BN,{placeholder:"John Doe",value:E.name,onChange:e=>A(d(d({},E),{},{name:e.target.value})),disabled:E.email.includes(",")||E.email.includes("\n")})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Phone (optional)"}),(0,ea.jsx)(BN,{placeholder:"+1 555 123 4567",value:E.phone,onChange:e=>A(d(d({},E),{},{phone:e.target.value})),disabled:E.email.includes(",")||E.email.includes("\n")})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Company (optional)"}),(0,ea.jsx)(BN,{placeholder:"Company name",value:E.company,onChange:e=>A(d(d({},E),{},{company:e.target.value})),disabled:E.email.includes(",")||E.email.includes("\n")})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Role / Segment (optional)"}),(0,ea.jsx)(BN,{list:"subscriber-role-suggestions",placeholder:"e.g. parent, teacher, member, customer",value:E.role,onChange:e=>A(d(d({},E),{},{role:e.target.value})),disabled:E.email.includes(",")||E.email.includes("\n"),"data-testid":"subscriber-role-input"}),(0,ea.jsxs)("datalist",{id:"subscriber-role-suggestions",children:[(0,ea.jsx)("option",{value:"parent"}),(0,ea.jsx)("option",{value:"teacher"}),(0,ea.jsx)("option",{value:"student"}),(0,ea.jsx)("option",{value:"staff"}),(0,ea.jsx)("option",{value:"member"}),(0,ea.jsx)("option",{value:"customer"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Used for notification targeting in connected apps (e.g. Taptile)"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Preferred Language"}),(0,ea.jsxs)(eb,{value:E.preferred_language||"en",onValueChange:e=>A(d(d({},E),{},{preferred_language:e})),children:[(0,ea.jsx)(sb,{"data-testid":"add-subscriber-language-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"en",children:"English"}),(0,ea.jsx)(rb,{value:"fr",children:"French (Fran\xe7ais)"}),(0,ea.jsx)(rb,{value:"de",children:"German (Deutsch)"}),(0,ea.jsx)(rb,{value:"es",children:"Spanish (Espa\xf1ol)"}),(0,ea.jsx)(rb,{value:"it",children:"Italian (Italiano)"}),(0,ea.jsx)(rb,{value:"pt",children:"Portuguese (Portugu\xeas)"}),(0,ea.jsx)(rb,{value:"nl",children:"Dutch (Nederlands)"}),(0,ea.jsx)(rb,{value:"pl",children:"Polish (Polski)"}),(0,ea.jsx)(rb,{value:"ro",children:"Romanian (Rom\xe2n\u0103)"}),(0,ea.jsx)(rb,{value:"cs",children:"Czech (\u010ce\u0161tina)"}),(0,ea.jsx)(rb,{value:"el",children:"Greek (\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac)"}),(0,ea.jsx)(rb,{value:"zh",children:"Chinese (\u4e2d\u6587)"}),(0,ea.jsx)(rb,{value:"ja",children:"Japanese (\u65e5\u672c\u8a9e)"}),(0,ea.jsx)(rb,{value:"ko",children:"Korean (\ud55c\uad6d\uc5b4)"}),(0,ea.jsx)(rb,{value:"ar",children:"Arabic (\u0627\u0644\u0639\u0631\u0628\u064a\u0629)"}),(0,ea.jsx)(rb,{value:"hi",children:"Hindi (\u0939\u093f\u0928\u094d\u0926\u0940)"}),(0,ea.jsx)(rb,{value:"ru",children:"Russian (\u0420\u0443\u0441\u0441\u043a\u0438\u0439)"}),(0,ea.jsx)(rb,{value:"tr",children:"Turkish (T\xfcrk\xe7e)"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Newsletters will be translated to this language when sent. Applies to all emails added above."})]}),U.length>0&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Groups (optional)"}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2",children:U.map(e=>(0,ea.jsx)("button",{type:"button",className:"px-3 py-1 rounded-full text-sm border transition-colors ".concat(E.group_ids.includes(e.group_id)?"bg-indigo-100 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:bg-slate-100"),onClick:()=>{const t=E.group_ids.includes(e.group_id)?E.group_ids.filter(t=>t!==e.group_id):[...E.group_ids,e.group_id];A(d(d({},E),{},{group_ids:t}))},children:e.name},e.group_id))})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(!E.email)return void qs.error("Email is required");const e=E.email.split(/[,\n]/).map(e=>e.trim()).filter(e=>e&&e.includes("@"));if(0!==e.length)try{if(1===e.length)await _l.post("/subscribers",{email:e[0],name:E.name||null,phone:E.phone||null,company:E.company||null,role:E.role||null,preferred_language:E.preferred_language||"en",group_ids:E.group_ids,source:"manual"}),qs.success("Subscriber added successfully");else{const t=(await _l.post("/subscribers/bulk",{emails:e,group_ids:E.group_ids,preferred_language:E.preferred_language||"en"})).data;qs.success("Added ".concat(t.created," subscriber(s)").concat(t.duplicates>0?", ".concat(t.duplicates," duplicate(s) skipped"):""))}S(!1),A({email:"",name:"",phone:"",company:"",role:"",preferred_language:"en",group_ids:[]}),Vt(),Kt()}catch(a){var t,s;const e=null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail;if(Array.isArray(e)){const t=e.map(e=>e.msg||e.message||"Validation error").join(", ");qs.error(t)}else"object"===typeof e&&null!==e?qs.error(e.msg||e.message||"Failed to add subscriber"):qs.error(e||"Failed to add subscriber")}else qs.error("Please enter a valid email address")},children:"Add Subscriber"})]})]})}),(0,ea.jsx)(Ok,{open:z,onOpenChange:M,children:(0,ea.jsxs)(Wk,{className:"max-w-lg","data-testid":"edit-subscriber-dialog",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Edit Subscriber"})}),F&&(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email"}),(0,ea.jsx)(BN,{type:"email",value:F.email,disabled:!0,className:"bg-slate-50"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Email cannot be changed"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Name"}),(0,ea.jsx)(BN,{placeholder:"John Doe",value:F.name||"",onChange:e=>T(d(d({},F),{},{name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Role / Segment"}),(0,ea.jsx)(BN,{list:"subscriber-role-suggestions",placeholder:"e.g. parent, teacher, member, customer",value:F.role||"",onChange:e=>T(d(d({},F),{},{role:e.target.value})),"data-testid":"edit-subscriber-role-input"}),(0,ea.jsxs)("datalist",{id:"subscriber-role-suggestions",children:[(0,ea.jsx)("option",{value:"parent"}),(0,ea.jsx)("option",{value:"teacher"}),(0,ea.jsx)("option",{value:"student"}),(0,ea.jsx)("option",{value:"staff"}),(0,ea.jsx)("option",{value:"member"}),(0,ea.jsx)("option",{value:"customer"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Used for notification targeting in connected apps (e.g. Taptile)"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Status"}),(0,ea.jsxs)(eb,{value:F.status,onValueChange:e=>T(d(d({},F),{},{status:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"active",children:"Active"}),(0,ea.jsx)(rb,{value:"unsubscribed",children:"Unsubscribed"}),(0,ea.jsx)(rb,{value:"bounced",children:"Bounced"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Preferred Language"}),(0,ea.jsxs)(eb,{value:F.preferred_language||"en",onValueChange:e=>T(d(d({},F),{},{preferred_language:e})),children:[(0,ea.jsx)(sb,{"data-testid":"subscriber-language-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"en",children:"English"}),(0,ea.jsx)(rb,{value:"fr",children:"French (Fran\xe7ais)"}),(0,ea.jsx)(rb,{value:"de",children:"German (Deutsch)"}),(0,ea.jsx)(rb,{value:"es",children:"Spanish (Espa\xf1ol)"}),(0,ea.jsx)(rb,{value:"it",children:"Italian (Italiano)"}),(0,ea.jsx)(rb,{value:"pt",children:"Portuguese (Portugu\xeas)"}),(0,ea.jsx)(rb,{value:"nl",children:"Dutch (Nederlands)"}),(0,ea.jsx)(rb,{value:"pl",children:"Polish (Polski)"}),(0,ea.jsx)(rb,{value:"ro",children:"Romanian (Rom\xe2n\u0103)"}),(0,ea.jsx)(rb,{value:"cs",children:"Czech (\u010ce\u0161tina)"}),(0,ea.jsx)(rb,{value:"el",children:"Greek (\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac)"}),(0,ea.jsx)(rb,{value:"zh",children:"Chinese (\u4e2d\u6587)"}),(0,ea.jsx)(rb,{value:"ja",children:"Japanese (\u65e5\u672c\u8a9e)"}),(0,ea.jsx)(rb,{value:"ko",children:"Korean (\ud55c\uad6d\uc5b4)"}),(0,ea.jsx)(rb,{value:"ar",children:"Arabic (\u0627\u0644\u0639\u0631\u0628\u064a\u0629)"}),(0,ea.jsx)(rb,{value:"hi",children:"Hindi (\u0939\u093f\u0928\u094d\u0926\u0940)"}),(0,ea.jsx)(rb,{value:"ru",children:"Russian (\u0420\u0443\u0441\u0441\u043a\u0438\u0439)"}),(0,ea.jsx)(rb,{value:"tr",children:"Turkish (T\xfcrk\xe7e)"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Newsletters will be translated to this language when sent"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Groups"}),U.length>0?(0,ea.jsx)("div",{className:"flex flex-wrap gap-2",children:U.map(e=>(0,ea.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-full text-sm border transition-colors ".concat(F.group_ids.includes(e.group_id)?"bg-indigo-100 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:bg-slate-100"),onClick:()=>{const t=F.group_ids.includes(e.group_id)?F.group_ids.filter(t=>t!==e.group_id):[...F.group_ids,e.group_id];
2T(d(d({},F),{},{group_ids:t}))},children:e.name},e.group_id))}):(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"No groups available. Create groups in the Groups tab."})]}),F.created_at&&(0,ea.jsxs)("div",{className:"pt-2 border-t text-sm text-slate-500",children:[(0,ea.jsxs)("p",{children:["Subscribed: ",new Date(F.created_at).toLocaleString()]}),F.source&&(0,ea.jsxs)("p",{children:["Source: ",F.source]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(F)try{await _l.put("/subscribers/".concat(F.subscriber_id),{name:F.name||null,role:F.role||null,group_ids:F.group_ids,status:F.status,preferred_language:F.preferred_language||"en"}),qs.success("Subscriber updated successfully"),M(!1),T(null),Vt(),qt()}catch(s){var e,t;const a=null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail;Array.isArray(a)?qs.error(a.map(e=>e.msg||"Error").join(", ")):qs.error(a||"Failed to update subscriber")}},children:"Save Changes"})]})]})}),(0,ea.jsx)(Ok,{open:W,onOpenChange:V,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:G?"Edit Group":"Create Group"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Group Name *"}),(0,ea.jsx)(BN,{placeholder:"e.g., VIP Customers",value:q.name,onChange:e=>$(d(d({},q),{},{name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Description (optional)"}),(0,ea.jsx)(BN,{placeholder:"Brief description of this group",value:q.description,onChange:e=>$(d(d({},q),{},{description:e.target.value}))})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(q.name)try{G?(await _l.put("/subscriber-groups/".concat(G.group_id),q),qs.success("Group updated successfully")):(await _l.post("/subscriber-groups",q),qs.success("Group created successfully")),V(!1),$({name:"",description:""}),K(null),qt()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save group")}else qs.error("Group name is required")},children:G?"Update Group":"Create Group"})]})]})}),(0,ea.jsx)(Ok,{open:ze,onOpenChange:Me,children:(0,ea.jsxs)(Wk,{className:"max-w-3xl max-h-[90vh] overflow-y-auto","data-testid":"send-newsletter-dialog",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{className:"text-lg",children:"Send Newsletter"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-2",children:[Pe&&(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg",children:[(0,ea.jsx)("p",{className:"font-medium",children:Pe.title}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:Pe.subject})]}),(Re.length>0||Ue.length>0||Ie.trim())&&(0,ea.jsxs)("div",{className:"bg-emerald-50 border border-emerald-200 rounded-lg p-3",children:[(0,ea.jsxs)("p",{className:"text-sm font-medium text-emerald-800 flex items-center gap-2 mb-2",children:[(0,ea.jsx)(Bj,{size:16}),"Selected: ",Re.length," group(s), ",Ue.length," subscriber(s)",Ie.split(/[,\n]/).filter(e=>e.trim()&&e.includes("@")).length>0&&", ".concat(Ie.split(/[,\n]/).filter(e=>e.trim()&&e.includes("@")).length," custom email(s)")]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1.5 max-h-20 overflow-y-auto",children:[Re.map(e=>{const t=U.find(t=>t.group_id===e);return t&&(0,ea.jsxs)("span",{className:"px-2 py-1 bg-indigo-100 text-indigo-700 rounded text-xs flex items-center gap-1",children:[t.name," (",t.subscriber_count||0,")",(0,ea.jsx)("button",{onClick:()=>Le(Re.filter(t=>t!==e)),className:"ml-1 hover:text-indigo-900",children:"\xd7"})]},e)}),Ue.slice(0,10).map(e=>{const t=y.find(t=>t.subscriber_id===e);return t&&(0,ea.jsxs)("span",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center gap-1",children:[t.email.length>25?t.email.substring(0,25)+"...":t.email,(0,ea.jsx)("button",{onClick:()=>He(Ue.filter(t=>t!==e)),className:"ml-1 hover:text-blue-900",children:"\xd7"})]},e)}),Ue.length>10&&(0,ea.jsxs)("span",{className:"px-2 py-1 bg-blue-50 text-blue-600 rounded text-xs",children:["+",Ue.length-10," more subscribers"]}
2)]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,ea.jsx)(Wj,{size:16,className:"text-indigo-600"}),"Send to Groups"]}),U.length>0?(0,ea.jsx)("div",{className:"flex flex-wrap gap-2",children:U.map(e=>(0,ea.jsxs)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-sm border-2 transition-all ".concat(Re.includes(e.group_id)?"bg-indigo-100 border-indigo-400 text-indigo-700 font-medium":"bg-white border-slate-200 text-slate-600 hover:border-indigo-300 hover:bg-indigo-50"),onClick:()=>{const t=Re.includes(e.group_id)?Re.filter(t=>t!==e.group_id):[...Re,e.group_id];Le(t)},children:[Re.includes(e.group_id)&&(0,ea.jsx)(uD,{size:14,className:"inline mr-1"}),e.name," ",(0,ea.jsxs)("span",{className:"text-slate-400 ml-1",children:["(",e.subscriber_count||0,")"]})]},e.group_id))}):(0,ea.jsx)("p",{className:"text-sm text-slate-500 italic",children:"No groups created yet."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("div",{className:"flex items-center justify-between",children:(0,ea.jsxs)(tf,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,ea.jsx)(Bj,{size:16,className:"text-blue-600"}),"Select Individual Subscribers",Ue.length>0&&(0,ea.jsxs)("span",{className:"text-xs bg-blue-100 text-blue-700 px-2 py-0.5 rounded-full ml-1",children:[Ue.length," selected"]})]})}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,ea.jsxs)(sg,{variant:"default",size:"sm",onClick:async()=>{try{const e=((await _l.get("/subscribers?page=1&per_page=10000")).data.subscribers||[]).filter(e=>"active"===e.status).map(e=>e.subscriber_id);He(e),qs.success("Selected all ".concat(e.length," active subscribers"))}catch(e){qs.error("Failed to select all subscribers")}},className:"bg-blue-600 hover:bg-blue-700","data-testid":"select-all-subscribers-send",children:[(0,ea.jsx)(uD,{size:16,className:"mr-2"}),"Select All Subscribers (",R," total)"]}),Ue.length>0&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>He([]),className:"text-slate-600",children:"Clear Selection"})]}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:16}),(0,ea.jsx)(BN,{placeholder:"Search subscribers...",value:We,onChange:e=>Ve(e.target.value),className:"pl-9"})]}),y.length>0?(0,ea.jsxs)("div",{className:"border rounded-lg max-h-48 overflow-y-auto",children:[y.filter(e=>"active"===e.status).filter(e=>!We||e.email.toLowerCase().includes(We.toLowerCase())||(e.name||"").toLowerCase().includes(We.toLowerCase())).map(e=>{var t;return(0,ea.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 hover:bg-slate-50 cursor-pointer border-b last:border-b-0 ".concat(Ue.includes(e.subscriber_id)?"bg-blue-50":""),onClick:()=>{const t=Ue.includes(e.subscriber_id)?Ue.filter(t=>t!==e.subscriber_id):[...Ue,e.subscriber_id];He(t)},children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(fw,{checked:Ue.includes(e.subscriber_id),className:"pointer-events-none"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium",children:e.email}),e.name&&(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:e.name})]})]}),(null===(t=e.group_ids)||void 0===t?void 0:t.length)>0&&(0,ea.jsxs)("span",{className:"text-xs text-slate-400",children:[e.group_ids.length," group(s)"]})]},e.subscriber_id)}),0===y.filter(e=>"active"===e.status).length&&(0,ea.jsx)("p",{className:"text-sm text-slate-500 p-3 text-center",children:"No active subscribers"})]}):(0,ea.jsx)("p",{className:"text-sm text-slate-500 italic",children:"No subscribers yet."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,ea.jsx)(Yl,{size:16,className:"text-amber-600"}),"Additional Email Addresses"]}),(0,ea.jsx)("textarea",{className:"flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
2ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",placeholder:"Enter emails (comma or newline separated)",value:Ie,onChange:e=>Oe(e.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"When to Send"}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsxs)("button",{type:"button",className:"flex-1 px-4 py-3 rounded-lg border-2 transition-all flex items-center justify-center gap-2 ".concat("now"===Ge?"border-emerald-500 bg-emerald-50 text-emerald-700":"border-slate-200 hover:border-slate-300"),onClick:()=>Ke("now"),"data-testid":"send-now-option",children:[(0,ea.jsx)(dr,{size:16}),(0,ea.jsx)("span",{className:"font-medium text-sm",children:"Send Now"})]}),(0,ea.jsxs)("button",{type:"button",className:"flex-1 px-3 py-2 rounded-lg border-2 transition-all flex items-center justify-center gap-2 ".concat("schedule"===Ge?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 hover:border-slate-300"),onClick:()=>Ke("schedule"),"data-testid":"schedule-option",children:[(0,ea.jsx)(yj,{size:16}),(0,ea.jsx)("span",{className:"font-medium text-sm",children:"Schedule"})]})]}),"schedule"===Ge&&(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Date"}),(0,ea.jsx)(BN,{type:"date",value:Ye,onChange:e=>Je(e.target.value),min:(new Date).toISOString().split("T")[0],"data-testid":"schedule-date",className:"h-9"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Time"}),(0,ea.jsx)(BN,{type:"time",value:Qe,onChange:e=>Xe(e.target.value),"data-testid":"schedule-time",className:"h-9"})]})]}),Ye&&Qe&&(0,ea.jsxs)("p",{className:"text-sm text-indigo-600 flex items-center gap-1",children:[(0,ea.jsx)(Kg,{size:14}),"Will be sent on ",new Date("".concat(Ye,"T").concat(Qe)).toLocaleString()]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>Me(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{const e=Ue.map(e=>{const t=y.find(t=>t.subscriber_id===e);return null===t||void 0===t?void 0:t.email}).filter(Boolean),t=Ie.split(/[,\n]/).map(e=>e.trim()).filter(e=>e&&e.includes("@")),s=[...new Set([...e,...t])];if(0===Re.length&&0===s.length)return void qs.error("Please select groups, subscribers, or enter email addresses");let a=null;if("schedule"===Ge){if(!Ye||!Qe)return void qs.error("Please select both date and time for scheduling");const e=new Date("".concat(Ye,"T").concat(Qe));if(e<=new Date)return void qs.error("Scheduled time must be in the future");a=e.toISOString()}$e(!0);try{const e={recipient_emails:s,group_ids:Re};a&&(e.scheduled_at=a);await _l.post("/newsletters/".concat(Pe.newsletter_id,"/send"),e);const t=Re.reduce((e,t)=>{const s=U.find(e=>e.group_id===t);return e+((null===s||void 0===s?void 0:s.subscriber_count)||0)},0)+s.length;a?qs.success("Newsletter scheduled for ".concat(new Date(a).toLocaleString()," (").concat(t," recipients)")):qs.success("Newsletter is being sent to ".concat(t," recipients!")),Me(!1),Wt(),Gt()}catch(r){var n,l;qs.error((null===(n=r.response)||void 0===n||null===(l=n.data)||void 0===l?void 0:l.detail)||"Failed to send newsletter")}finally{$e(!1)}},disabled:qe,className:"schedule"===Ge?"bg-indigo-600 hover:bg-indigo-700":"bg-emerald-600 hover:bg-emerald-700","data-testid":"send-newsletter-submit",children:qe?"Processing...":"schedule"===Ge?"Schedule Newsletter":"Send Newsletter"})]})]})}),(0,ea.jsx)(Ok,{open:_e,onOpenChange:Se,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Send Test Email"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Send a test email to verify your SendGrid configuration is working correctly."}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Recipient Email"}),(0,ea.jsx)(BN,{type:"email",placeholder:"[email protected]",value:Ee,onChange:e=>Ae(e.target.value)})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>Se(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(Ee){Te(!0);try{(await _l.post("/email/test",{to_email:Ee})).data.success?(qs.success("Test email sent successfully!"),Se(!1),Ae("")):qs.error("Failed to send test email")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to send test email")}finally{Te(!1)}}else qs.error("Please enter an email address")},disabled:Fe,children:Fe?"Sending...":"Send Test Email"})]})]})}),(0,ea.jsx)(Ok,{open:Ze,onOpenChange:et,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl","data-testid":"csv-import-dialog",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(vJ,{size:20,className:"text-indigo-600"}),"Import Subscribers from CSV"]})}),(0,ea.jsx)("div",{className:"space-y-6 py-4",children:tt?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(vJ,{size:24,className:"text-emerald-600"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:tt.name}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[at.length-(it.has_header?1:0)," data rows found"]})]})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:es,children:(0,ea.jsx)(fJ,{size:18,className:"text-slate-400"})})]}),at.length>0&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"mb-2 block",children:"Preview (first 5 rows)"}),(0,ea.jsx)("div",{className:"border rounded-lg overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full text-sm",children:[(0,ea.jsx)("thead",{className:"bg-slate-100",children:(0,ea.jsx)("tr",{children:null===(e=at[0])||void 0===e?void 0:e.map((e,t)=>(0,ea.jsxs)("th",{className:"px-3 py-2 text-left text-xs font-medium text-slate-500",children:["Column ",t+1]},t))})}),(0,ea.jsx)("tbody",{children:at.slice(0,5).map((e,t)=>(0,ea.jsx)("tr",{className:0===t&&it.has_header?"bg-amber-50":"hover:bg-slate-50",children:e.map((e,t)=>(0,ea.jsx)("td",{className:"px-3 py-2 border-t text-slate-600 truncate max-w-[150px]",children:e||(0,ea.jsx)("span",{className:"text-slate-300",children:"empty"})},t))},t))})]})}),it.has_header&&(0,ea.jsx)("p",{className:"text-xs text-amber-600 mt-1",children:"First row highlighted will be treated as header"})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)(tf,{children:"Column Mapping"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-600",children:"Email Column *"}),(0,ea.jsxs)(eb,{value:String(it.email_column),onValueChange:e=>ot(t=>d(d({},t),{},{email_column:parseInt(e)})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select column"})}),(0,ea.jsx)(lb,{children:lt.map(e=>{var t;return(0,ea.jsxs)(rb,{value:String(e),children:["Column ",e+1," ",null!==(t=at[0])&&void 0!==t&&t[e]&&it.has_header?"(".concat(at[0][e],")"):""]},e)})})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-600",children:"Name Column (optional)"}),(0,ea.jsxs)(eb,{value:null!==it.name_column?String(it.name_column):"none",onValueChange:e=>ot(t=>d(d({},t),{},{name_column:"none"===e?null:parseInt(e)})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select column"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"-- None --"}),lt.map(e=>{var t;return(0,ea.jsxs)(rb,{value:String(e),children:["Column ",e+1," ",null!==(t=at[0])&&void 0!==t&&t[e]&&it.has_header?"(".concat(at[0][e],")"):""]},e)})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-600",children:"Group Column (optional)"}),(0,ea.jsxs)(eb,{value:null!==it.group_column?String(it.group_column):"none",onValueChange:e=>ot(t=>d(d({},t),{},{group_column:"none"===e?null:parseInt(e)})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select column"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"-- None --"}),lt.map(e=>{var t;return(0,ea.jsxs)(rb,{value:String(e),children:["Column ",e+1," ",null!==(t=at[0])&&void 0!==t&&t[e]&&it.has_header?"(".concat(at[0][e],")"):""]},e)})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Groups will be auto-created if they don't exist"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-600",children:"Role Column (optional)"}),(0,ea.jsxs)(eb,{value:null!==it.role_column?String(it.role_column):"none",onValueChange:e=>ot(t=>d(d({},t),{}
2,{role_column:"none"===e?null:parseInt(e)})),children:[(0,ea.jsx)(sb,{"data-testid":"csv-role-column-select",children:(0,ea.jsx)(tb,{placeholder:"Select column"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"-- None --"}),lt.map(e=>{var t;return(0,ea.jsxs)(rb,{value:String(e),children:["Column ",e+1," ",null!==(t=at[0])&&void 0!==t&&t[e]&&it.has_header?"(".concat(at[0][e],")"):""]},e)})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Generic role/segment (parent, member, customer\u2026) for app targeting"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-600",children:"Language Column (optional)"}),(0,ea.jsxs)(eb,{value:null!==it.language_column?String(it.language_column):"none",onValueChange:e=>ot(t=>d(d({},t),{},{language_column:"none"===e?null:parseInt(e)})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select column"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"-- None --"}),lt.map(e=>{var t;return(0,ea.jsxs)(rb,{value:String(e),children:["Column ",e+1," ",null!==(t=at[0])&&void 0!==t&&t[e]&&it.has_header?"(".concat(at[0][e],")"):""]},e)})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Use 2-letter codes: en, fr, de, es, etc."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-600",children:"Options"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(fw,{id:"has-header",checked:it.has_header,onCheckedChange:e=>ot(t=>d(d({},t),{},{has_header:!!e}))}),(0,ea.jsx)("label",{htmlFor:"has-header",className:"text-sm text-slate-600 cursor-pointer",children:"First row is header"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,ea.jsx)(fw,{id:"override-existing",checked:it.override_existing,onCheckedChange:e=>ot(t=>d(d({},t),{},{override_existing:!!e}))}),(0,ea.jsx)("label",{htmlFor:"override-existing",className:"text-sm text-slate-600 cursor-pointer",children:"Update existing subscribers (match by email)"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"When enabled, existing subscribers will be updated with new data instead of being skipped"})]})]}),U.length>0&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-600",children:"Add all to groups (optional)"}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2",children:U.map(e=>(0,ea.jsx)("button",{type:"button",className:"px-3 py-1 rounded-full text-sm border transition-colors ".concat(it.default_group_ids.includes(e.group_id)?"bg-indigo-100 border-indigo-300 text-indigo-700":"bg-slate-50 border-slate-200 text-slate-600 hover:bg-slate-100"),onClick:()=>{const t=it.default_group_ids.includes(e.group_id)?it.default_group_ids.filter(t=>t!==e.group_id):[...it.default_group_ids,e.group_id];ot(e=>d(d({},e),{},{default_group_ids:t}))},children:e.name},e.group_id))})]})]})]}):(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"border-2 border-dashed border-slate-300 rounded-lg p-8 text-center hover:border-indigo-400 transition-colors cursor-pointer",onClick:()=>{var e;return null===(e=ut.current)||void 0===e?void 0:e.click()},children:[(0,ea.jsx)(kq,{size:40,className:"mx-auto mb-4 text-slate-400"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-2",children:"Click to upload a CSV file"}),(0,ea.jsx)("p",{className:"text-sm text-slate-400",children:"Supports .csv files with email addresses"}),(0,ea.jsx)("input",{ref:ut,type:"file",accept:".csv",className:"hidden",onChange:e=>{var t;const s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!s)return;if(!s.name.endsWith(".csv"))return void qs.error("Please select a CSV file");st(s);const a=new FileReader;a.onload=e=>{var t;const s=null===(t=e.target)||void 0===t?void 0:t.result;if("string"===typeof s){const e=s.split("\n").filter(e=>e.trim()).map(e=>{const t=[];let s="",a=!1;for(let n=0;n<e.length;n++){const l=e[n];'"'===l?a=!a:","!==l||a?s+=l:(t.push(s.trim()),s="")}return t.push(s.trim()),t});if(e.length>0){rt(e[0].map((e,t)=>t)),nt(e.slice(0,6));const t=e[0].map(e=>e.toLowerCase()),s=t.findIndex(e=>e.includes("email")),a=t.findIndex(e=>e.includes("name")&&!e.includes("email")),n=t.findIndex(e=>e.includes("group")||e.includes("category")||e.includes("list")),l=t.findIndex(e=>e.includes("role")||e.includes("type")||e.includes("segment"));ot(e=>d(d({},e),{},{email_column:s>=0?s:0,name_column:a>=0?a:null,group_column:n>=0?n:null,role_column:l>=0?l:null}))}}},a.readAsText(s)},"data-testid":"csv-file-input"})]}),(0,ea.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,ea.jsxs)("h4",{className:"font-medium text-blue-800 mb-2 flex items-center gap-2",children:[(0,ea.jsx)(vJ,{size:16}),"CSV Format Guide"]}),(0,ea.jsx)("p",{className:"text-sm text-blue-700 mb-3",children:"Your CSV can include any of these columns (only email is required):"}),(0,ea.jsxs)("div",{className:"bg-white rounded border border-blue-200 p-3 font-mono text-xs overflow-x-auto",children:[(0,ea.jsx)("div",{className:"text-slate-500",children:"email,name,group,language"}),(0,ea.jsx)("div",{className:"text-slate-700",children:"[email protected],John Doe,Members,en"}),(0,ea.jsx)("div",{className:"text-slate-700",children:"[email protected],Marie Dupont,Board,fr"}),(0,ea.jsx)("div",{className:"text-slate-700",children:"[email protected],Hans Mueller,Members,de"})]}),(0,ea.jsxs)("div",{className:"mt-3 space-y-1 text-xs text-blue-600",children:[(0,ea.jsxs)("p",{children:[(0,ea.jsx)("strong",{children:"Language codes:"})," en (English), fr (French), de (German), es (Spanish), it (Italian), pt (Portuguese), nl (Dutch), pl (Polish), da (Danish), sv (Swedish), etc."]}),(0,ea.jsxs)("p",{children:[(0,ea.jsx)("strong",{children:"Groups:"})," New groups are created automatically if they don't exist."]}),(0,ea.jsxs)("p",{children:[(0,ea.jsx)("strong",{children:"Duplicates:"})," Existing subscribers will have their group and language updated."]})]})]})]})}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>et(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(tt){dt(!0);try{const t=await tt.text(),s=(await _l.post("/subscribers/import-csv",{csv_data:t,mapping:it})).data;if(s.success){var e;let t="Imported ".concat(s.created," subscribers");s.updated>0&&(t+=", updated ".concat(s.updated," existing")),s.duplicates>0&&(t+=", ".concat(s.duplicates," duplicates skipped")),s.errors>0&&(t+=", ".concat(s.errors," errors")),(null===(e=s.groups_created)||void 0===e?void 0:e.length)>0&&(t+=". Created ".concat(s.groups_created.length," new group(s)")),qs.success(t),et(!1),st(null),nt([]),Vt(),qt(),Kt()}}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to import CSV")}finally{dt(!1)}}else qs.error("Please select a CSV file")},disabled:!tt||ct,className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"csv-import-submit",children:ct?"Importing...":"Import Subscribers"})]})]})}),(0,ea.jsx)(Ok,{open:ae,onOpenChange:ne,children:(0,ea.jsxs)(Wk,{className:"max-w-md","data-testid":"add-to-group-dialog",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(vD,{size:20,className:"text-indigo-600"}),"Add to Group"]})}),(0,ea.jsxs)("div",{className:"py-4 space-y-4",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-600",children:["Add ",te.length," selected subscriber(s) to a group:"]}),(0,ea.jsxs)(eb,{value:le,onValueChange:re,children:[(0,ea.jsx)(sb,{"data-testid":"select-group-dropdown",children:(0,ea.jsx)(tb,{placeholder:"Select a group..."})}),(0,ea.jsx)(lb,{children:U.map(e=>(0,ea.jsx)(rb,{value:e.group_id,children:e.name},e.group_id))})]}),0===U.length&&(0,ea.jsx)("p",{className:"text-sm text-amber-600",children:"No groups available. Create a group first in the Groups tab."})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>ne(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(le&&0!==te.length){qs.info("Adding ".concat(te.length," subscribers to group... Please wait."));try{const e=await _l.post("/subscribers/bulk-add-to-group",{subscriber_ids:te,group_id:le},{timeout:12e4});qs.success(e.data.message||"Added ".concat(e.data.updated_count," subscriber(s) to group")),ne(!1),re(""),se([]),Vt(P),qt()}catch(a){var e,t,s;if("ECONNABORTED"===a.code||null!==(e=a.message)&&void 0!==e&&e.includes("timeout"))qs.warning("Request timed out, but operation may have completed. Please check the group count."),ne(!1),qt();else qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to add subscribers to group")}}else qs.error("Please select a group and at least one subscriber")},disabled:!le||0===U.length,className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"confirm-ad
2d-to-group",children:"Add to Group"})]})]})}),(0,ea.jsx)(Ok,{open:Q,onOpenChange:X,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl max-h-[80vh]","data-testid":"group-members-dialog",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Wj,{size:20,className:"text-indigo-600"}),null===Y||void 0===Y?void 0:Y.name," - Members"]})}),Y&&(0,ea.jsxs)("div",{className:"py-4 space-y-4",children:[Y.description&&(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:Y.description}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:16}),(0,ea.jsx)(BN,{placeholder:"Search members...",value:Z,onChange:e=>ee(e.target.value),className:"pl-9"})]}),(0,ea.jsx)("div",{className:"border rounded-lg max-h-[50vh] overflow-y-auto",children:0===Qt(Y.group_id).filter(e=>!Z||e.email.toLowerCase().includes(Z.toLowerCase())||(e.name||"").toLowerCase().includes(Z.toLowerCase())).length?(0,ea.jsxs)("div",{className:"p-8 text-center",children:[(0,ea.jsx)(Bj,{size:32,className:"mx-auto mb-2 text-slate-300"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No members in this group"})]}):(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b sticky top-0",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-4 py-2 text-sm font-medium text-slate-600",children:"Email"}),(0,ea.jsx)("th",{className:"text-left px-4 py-2 text-sm font-medium text-slate-600",children:"Name"}),(0,ea.jsx)("th",{className:"text-left px-4 py-2 text-sm font-medium text-slate-600",children:"Other Groups"}),(0,ea.jsx)("th",{className:"text-right px-4 py-2 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y",children:Qt(Y.group_id).filter(e=>!Z||e.email.toLowerCase().includes(Z.toLowerCase())||(e.name||"").toLowerCase().includes(Z.toLowerCase())).map(e=>{var t;const s=Yt(null===(t=e.group_ids)||void 0===t?void 0:t.filter(e=>e!==Y.group_id));return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"px-4 py-3 text-sm font-medium",children:e.email}),(0,ea.jsx)("td",{className:"px-4 py-3 text-sm text-slate-600",children:e.name||"-"}),(0,ea.jsx)("td",{className:"px-4 py-3",children:s.length>0?(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1",children:[s.slice(0,2).map((e,t)=>(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs bg-slate-100 text-slate-600",children:e},t)),s.length>2&&(0,ea.jsxs)("span",{className:"text-xs text-slate-400",children:["+",s.length-2]})]}):(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"None"})}),(0,ea.jsx)("td",{className:"px-4 py-3 text-right",children:(0,ea.jsxs)(sg,{size:"sm",variant:"ghost",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8",onClick:()=>(async(e,t)=>{try{const s=y.find(t=>t.subscriber_id===e);if(!s)return;const a=(s.group_ids||[]).filter(e=>e!==t);await _l.put("/subscribers/".concat(e),{group_ids:a}),qs.success("Subscriber removed from group"),Vt(),qt()}catch(s){qs.error("Failed to remove subscriber from group")}})(e.subscriber_id,Y.group_id),children:[(0,ea.jsx)(jJ,{size:14,className:"mr-1"}),"Remove"]})})]},e.subscriber_id)})})]})}),(0,ea.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t text-sm text-slate-500",children:[(0,ea.jsxs)("span",{children:[Qt(Y.group_id).length," total members"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{X(!1),j("subscribers")},children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"}),"Add Subscribers"]}
2)]})]}),(0,ea.jsx)(qk,{children:(0,ea.jsx)(sg,{variant:"outline",onClick:()=>X(!1),children:"Close"})})]})}),(0,ea.jsx)(Ok,{open:ie,onOpenChange:oe,children:(0,ea.jsxs)(Wk,{className:"sm:max-w-[700px] max-h-[90vh] overflow-hidden flex flex-col",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Cw,{size:20,className:"text-emerald-600"}),"Campaign Analytics"]})}),he?(0,ea.jsxs)("div",{className:"py-12 text-center",children:[(0,ea.jsx)(gq,{className:"animate-spin mx-auto mb-2 text-slate-400",size:24}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading analytics..."})]}):ue?(0,ea.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4",children:[(0,ea.jsx)("h3",{className:"font-semibold text-lg",children:ue.title||"Untitled Newsletter"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mt-1",children:["Subject: ",ue.subject||"No subject"]}),ue.sent_at&&(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:["Sent: ",new Date(ue.sent_at).toLocaleString()]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2",children:[(0,ea.jsxs)("div",{className:"bg-blue-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-lg font-bold text-blue-700",children:(null===(s=ue.stats)||void 0===s?void 0:s.total_sent)||0}),(0,ea.jsx)("p",{className:"text-xs text-blue-600",children:"Sent"})]}),(0,ea.jsxs)("div",{className:"bg-green-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-lg font-bold text-green-700",children:(null===(a=ue.stats)||void 0===a?void 0:a.delivered)||0}),(0,ea.jsx)("p",{className:"text-xs text-green-600",children:"Delivered"})]}),(0,ea.jsxs)("div",{className:"bg-emerald-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-lg font-bold text-emerald-700",children:(null===(n=ue.stats)||void 0===n?void 0:n.opened)||0}),(0,ea.jsx)("p",{className:"text-xs text-emerald-600",children:"Opened"})]}),(0,ea.jsxs)("div",{className:"bg-indigo-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-lg font-bold text-indigo-700",children:(null===(l=ue.stats)||void 0===l?void 0:l.clicked)||0}),(0,ea.jsx)("p",{className:"text-xs text-indigo-600",children:"Clicked"})]}),(0,ea.jsxs)("div",{className:"bg-red-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-lg font-bold text-red-700",children:(null===(r=ue.stats)||void 0===r?void 0:r.bounced)||0}),(0,ea.jsx)("p",{className:"text-xs text-red-600",children:"Bounced"})]}),(0,ea.jsxs)("div",{className:"bg-amber-50 rounded-lg p-3 text-center",children:[(0,ea.jsxs)("p",{className:"text-lg font-bold text-amber-700",children:[(null===(i=ue.stats)||void 0===i?void 0:i.open_rate)||0,"%"]}),(0,ea.jsx)("p",{className:"text-xs text-amber-600",children:"Open Rate"})]})]}),(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,ea.jsxs)("div",{className:"relative flex-1",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:16}),(0,ea.jsx)(BN,{placeholder:"Search recipients...",value:fe,onChange:e=>ve(e.target.value),className:"pl-9","data-testid":"analytics-recipient-search"})]}),(0,ea.jsxs)(eb,{value:pe,onValueChange:ge,children:[(0,ea.jsx)(sb,{className:"w-full sm:w-[150px]","data-testid":"analytics-status-filter",children:(0,ea.jsx)(tb,{placeholder:"Filter by status"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Recipients"}),(0,ea.jsx)(rb,{value:"delivered",children:"Delivered"}),(0,ea.jsx)(rb,{value:"opened",children:"Opened"}),(0,ea.jsx)(rb,{value:"clicked",children:"Clicked"}),(0,ea.jsx)(rb,{value:"bounced",children:"Bounced"})]})]})]}),(0,ea.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,ea.jsx)("div",{className:"max-h-[300px] overflow-y-auto",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b sticky top-0",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-4 py-2 text-sm font-medium text-slate-600",children:"Email"}),(0,ea.jsx)("th",{className:"text-left px-4 py-2 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left px-4 py-2 text-sm font-medium text-slate-600 hidden sm:table-cell",children:"Last Updated"})]})}),(0,ea.jsx)("tbody",{className:"divide-y",children:0===Xt().length?(0,ea.jsx)("tr",{children:(0,ea.jsx)("td",{colSpan:"3",className:"px-4 py-8 text-center text-slate-500",children:0===(null===(o=ue.recipients)||void 0===o?void 0:o.length)?"No recipient tracking data available for this campaign":"No recipients match your filter"})}):Xt().map((e,t)=>{let s=e.status||"sent",a=Yl,n="bg-slate-100 text-slate-700";e.bounced_at||s.includes("bounce")?(s="Bounced",a=fJ,n="bg-red-100 text-red-700"):e.clicked_at?(s="Clicked",a=uD,n="bg-indigo-100 text-indigo-700"):e.opened_at?(s="Opened",a=IN,n="bg-emerald-100 text-emerald-700"):"delivered"===s?(s="Delivered",a=pJ,n="bg-green-100 text-green-700"):(s="Sent",a=Yl,n="bg-blue-100 text-blue-700");const l=e.clicked_at||e.opened_at||e.delivered_at||e.sent_at;return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50","data-testid":"recipient-row-".concat(t),children:[(0,ea.jsxs)("td",{className:"px-4 py-2 text-sm",children:[(0,ea.jsx)("span",{className:"font-medium",children:e.email}),e.name&&(0,ea.jsxs)("span",{className:"text-slate-500 ml-2",children:["(",e.name,")"]})]}),(0,ea.jsx)("td",{className:"px-4 py-2",children:(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ".concat(n),children:[(0,ea.jsx)(a,{size:12}),s]})}),(0,ea.jsx)("td",{className:"px-4 py-2 text-sm text-slate-500 hidden sm:table-cell",children:l?new Date(l).toLocaleStr
2ing():"-"})]},t)})})]})})}),(0,ea.jsxs)("div",{className:"flex items-center justify-between text-sm text-slate-500 border-t pt-3",children:[(0,ea.jsxs)("span",{children:["Showing ",Xt().length," of ",(null===(c=ue.recipients)||void 0===c?void 0:c.length)||0," recipients"]}),(0,ea.jsxs)("span",{children:["Click Rate: ",(null===(u=ue.stats)||void 0===u?void 0:u.click_rate)||0,"% | Bounce Rate: ",(null===(m=ue.stats)||void 0===m?void 0:m.bounce_rate)||0,"%"]})]})]}):(0,ea.jsxs)("div",{className:"py-8 text-center",children:[(0,ea.jsx)(AN,{size:32,className:"mx-auto mb-2 text-slate-300"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No analytics data available"})]}),(0,ea.jsx)(qk,{children:(0,ea.jsx)(sg,{variant:"outline",onClick:()=>oe(!1),children:"Close"})})]})}),(0,ea.jsx)(Ok,{open:yt,onOpenChange:wt,children:(0,ea.jsxs)(Wk,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:["opened"===Ct&&(0,ea.jsx)(IN,{className:"text-emerald-600",size:20}),"bounced"===Ct&&(0,ea.jsx)(AN,{className:"text-red-600",size:20}),"unsubscribed"===Ct&&(0,ea.jsx)(jJ,{className:"text-amber-600",size:20}),"opened"===Ct&&"Opened Emails","bounced"===Ct&&"Bounced Emails","unsubscribed"===Ct&&"Unsubscribed",Dt&&(0,ea.jsxs)("span",{className:"text-slate-400 font-normal text-sm ml-2",children:["- ",Dt.title]})]})}),(0,ea.jsxs)("div",{className:"flex-1 overflow-auto",children:[(()=>{if(!Dt)return null;const e="bounced"===Ct?Dt.bounced_count||(Dt.hard_bounced_count||0)+(Dt.soft_bounced_count||0):"opened"===Ct?Dt.opened_count||0:"unsubscribed"===Ct&&Dt.unsubscribed_count||0;if(!At&&e>0&&Mt<e){const t=e-Mt;return(0,ea.jsxs)("div",{className:"mb-4 p-3 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[(0,ea.jsx)("strong",{children:"Heads up:"})," the aggregate count for this campaign is ",(0,ea.jsx)("strong",{children:e}),", but only ",(0,ea.jsx)("strong",{children:Mt})," have per-recipient details available. ",t," record",1===t?"":"s"," predate detailed tracking \u2014 totals are correct, but the individual addresses are unavailable for those."]})}return null})(),"bounced"===Ct&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-4 p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-600",children:"Filter by bounce type:"}),(0,ea.jsxs)("button",{onClick:()=>Zt(Dt,"bounced","all",1),className:"px-3 py-1 rounded-full text-xs font-medium transition-colors ".concat("all"===Bt?"bg-slate-800 text-white":"bg-white text-slate-600 border hover:bg-slate-100"),children:["All (",Mt,")"]}),(0,ea.jsx)("button",{onClick:()=>Zt(Dt,"bounced","hard",1),className:"px-3 py-1 rounded-full text-xs font-medium transition-colors ".concat("hard"===Bt?"bg-red-600 text-white":"bg-white text-red-600 border border-red-200 hover:bg-red-50"),children:"Hard Bounce"}),(0,ea.jsx)("button",{onClick:()=>Zt(Dt,"bounced","soft",1),className:"px-3 py-1 rounded-full text-xs font-medium transition-colors ".concat("soft"===Bt?"bg-amber-600 text-white":"bg-white text-amber-600 border border-amber-200 hover:bg-amber-50"),children:"Soft Bounce"})]}),At?(0,ea.jsxs)("div",{className:"py-12 text-center",children:[(0,ea.jsx)(gq,{className:"animate-spin mx-auto mb-2 text-slate-400",size:24}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading recipients..."})]}):0===St.length?(0,ea.jsxs)("div",{className:"py-12 text-center",children:[(0,ea.jsx)(Yl,{className:"mx-auto mb-2 text-slate-300",size:32}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No recipients found"})]}):(0,ea.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,ea.jsxs)("table",{className:"w-full text-sm",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-4 py-3 font-medium text-slate-600",children:"Email"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 font-medium text-slate-600",children:"Name"}),"bounced"===Ct&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("th",{className:"text-left px-4 py-3 font-medium text-slate-600",children:"Type"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 font-medium text-slate-600",children:"Reason"})]}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 font-medium text-slate-600",children:"Date"})]})}),(0,ea.jsx)("tbody",{className:"divide-y",children:St.map((e,t)=>(0,ea.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"px-4 py-3 font-medium",children:e.email}),(0,ea.jsx)("td",{className:"px-4 py-3 text-slate-600",children:e.name||"-"}),"bounced"===Ct&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsx)("span",{className:"px-2 py-1 rounded-full text-xs font-medium ".concat("hard"===e.bounce_type?"bg-red-100 text-red-700":"bg-amber-100 text-amber-700"),children:"hard"===e.bounce_type?"Hard Bounce":"Soft Bounce"})}),(0,ea.jsx)("td",{className:"px-4 py-3 text-slate-500 text-xs max-w-[200px] truncate",title:e.bounce_reason,children:e.bounce_reason||"-"})]}),(0,ea.jsx)("td",{className:"px-4 py-3 text-slate-500",children:"opened"===Ct&&e.opened_at?new Date(e.opened_at).toLocaleStr
2ing():"bounced"===Ct&&e.bounced_at?new Date(e.bounced_at).toLocaleString():"unsubscribed"===Ct&&e.unsubscribed_at?new Date(e.unsubscribed_at).toLocaleString():"-"})]},t))})]})}),Mt>50&&(0,ea.jsxs)("div",{className:"flex items-center justify-between mt-4 text-sm",children:[(0,ea.jsxs)("span",{className:"text-slate-500",children:["Showing ",St.length," of ",Mt," recipients"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",disabled:1===Tt,onClick:()=>Zt(Dt,Ct,Bt,Tt-1),children:(0,ea.jsx)(vj,{size:16})}),(0,ea.jsxs)("span",{className:"text-slate-600",children:["Page ",Tt," of ",Math.ceil(Mt/50)]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",disabled:Tt>=Math.ceil(Mt/50),onClick:()=>Zt(Dt,Ct,Bt,Tt+1),children:(0,ea.jsx)(ax,{size:16})})]})]})]}),(0,ea.jsxs)(qk,{className:"border-t pt-4 mt-4",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>{if(Dt)try{let e="/campaigns/".concat(Dt.campaign_id,"/recipients/export?status=").concat(Ct);"bounced"===Ct&&"all"!==Bt&&(e+="&bounce_type=".concat(Bt));const t=await _l.get(e,{responseType:"blob"}),s=new Blob([t.data],{type:"text/csv"}),a=window.URL.createObjectURL(s),n=document.createElement("a");n.href=a,n.download="".concat(Dt.title||"campaign","_").concat(Ct,"_recipients.csv"),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(a),qs.success("CSV exported successfully")}catch(e){qs.error("Failed to export CSV"),console.error("Export error:",e)}},className:"mr-auto",children:[(0,ea.jsx)(vJ,{size:16,className:"mr-2"}),"Export CSV"]}),(0,ea.jsx)(sg,{variant:"outline",onClick:()=>wt(!1),children:"Close"})]})]})})]})},TJ=e=>{let{label:t,value:s}=e;return(0,ea.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:s}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:t})]})};function zJ(){var e,s,a,n,l,r,i,o;const[c,u]=(0,t.useState)(null),[m,h]=(0,t.useState)([]),[x,p]=(0,t.useState)(!0),[g,f]=(0,t.useState)(!1),[v,b]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),[N,w]=(0,t.useState)({question:"",answer:"",priority:1}),[C,k]=(0,t.useState)(null),[D,_]=(0,t.useState)({name:"",greeting_message:"",primary_color:"#4f46e5",fallback_message:"",fallback_cta_label:"",fallback_cta_url:"",footer_enabled:!1,footer_message:"",footer_cta_label:"",footer_cta_url:"",widget_scope:"all",widget_paths:[]}),[S,E]=(0,t.useState)(!1),[A,F]=(0,t.useState)(null),T=t.useRef(null),[z,M]=(0,t.useState)(null),[P,B]=(0,t.useState)(!1),[R,L]=(0,t.useState)([]),[I,O]=(0,t.useState)(null),[U,H]=(0,t.useState)(!1),[W,V]=(0,t.useState)([]),[q,$]=(0,t.useState)(""),[G,K]=(0,t.useState)(!1),[Y,J]=(0,t.useState)(null),Q=t.useRef(null),X=async e=>{try{const t=await _l.post("/tenant/faqs/import",{mode:e,items:A.rows});qs.success("Imported ".concat(t.data.imported,' FAQ(s). Click "Sync now" to push to your assistant.')),F(null),await re()}catch(G2){var t,s;qs.error((null===G2||void 0===G2||null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Import failed.")}},Z=async()=>{try{var e;const t=await _l.get("/tenant/ai-assistant/details");k(t.data),null!==(e=t.data)&&void 0!==e&&e.config&&_({name:t.data.config.name||"",greeting_message:t.data.config.greeting_message||"",primary_color:t.data.config.primary_color||"#4f46e5",fallback_message:t.data.config.fallback_message||"",fallback_cta_label:t.data.config.fallback_cta_label||"",fallback_cta_url:t.data.config.fallback_cta_url||"",footer_enabled:!!t.data.config.footer_enabled,footer_message:t.data.config.footer_message||"",footer_cta_label:t.data.config.footer_cta_label||"",footer_cta_url:t.data.config.footer_cta_url||"",widget_scope:t.data.config.widget_scope||"all",widget_paths:t.data.config.widget_paths||[]})}catch(G2){}},ee=async()=>{try{const e=await _l.get("/tenant/ai-assistant/pages");M(e.data)}catch(G2){}try{var e;const t=await _l.get("/tenant/ai-assistant/link-pages");L((null===(e=t.data)||void 0===e?void 0:e.pages)||[])}catch(G2){}},te=e=>{M(t=>t&&d(d({},t),{},{pages:t.pages.map(t=>d(d({},t),{},{included:e}))}))},se=async()=>{const e=q.trim();if(e&&!G){V(t=>[...t,{role:"user",text:e}]),$(""),K(!0);try{const t=await _l.post("/tenant/ai-assistant/test-chat",{message:e,session_id:Y});t.data.session_id&&J(t.data.session_id),V(e=>[...e,{role:"bot",text:t.data.response,cta:t.data.cta,footer:t.data.footer,sources:t.data.sources}])}catch(G2){V(t=>{var s,a;return[...t,{role:"bot",text:(null===G2||void 0===G2||null===(s=G2.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"The assistant could not answer right now.",error:!0}]})}finally{K(!1)}}};t.useEffect(()=>{Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},[W,G]);const ae=async()=>{try{const e=await _l.get("/tenant/ai-assistant/documents");O(e.data)}catch(G2){}},ne=e=>{O(t=>t&&d(d({},t),{},{documents:t.documents.map(t=>d(d({},t),{},{included:e}))}))},le=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Contact us";const s="".concat(e,"_cta_label"),a="".concat(e,"_cta_url");return(0,ea.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-1.5",children:[(0,ea.jsxs)(tf,{children:["CTA button label ",(0,ea.jsx)("span",{className:"text-slate-400 font-normal",children:"(optional)"})]}),(0,ea.jsx)(BN,{value:D[s],onChange:e=>_(d(d({},D),{},{[s]:e.target.value})),placeholder:t,"data-testid":"bot-".concat(e,"-cta-label-input")})]}),(0,ea.jsxs)("div",{className:"space-y-1.5",children:[(0,ea.jsx)(tf,{children:"CTA button URL"}),R.length>0&&(0,ea.jsxs)(eb,{value:R.some(e=>e.path===D[a])?D[a]:"",onValueChange:e=>_(d(d({},D),{},{[a]:e})),children:[(0,ea.jsx)(sb,{"data-testid":"bot-".concat(e,"-cta-page-select"),children:(0,ea.jsx)(tb,{placeholder:"Pick one of your pages\u2026"})}),(0,ea.jsx)(lb,{children:R.map(t=>(0,ea.jsxs)(rb,{value:t.path,"data-testid":"bot-".concat(e,"-cta-page-").concat(t.path),children:[t.title," ",(0,ea.jsxs)("span",{className:"text-slate-400",children:["(",t.path,")"]})]},t.path))})]}),(0,ea.jsx)(BN,{value:D[a],onChange:e=>_(d(d({},D),{},{[a]:e.target.value})),placeholder:"/contact or https://yoursite.com/contact","data-testid":"bot-".concat(e,"-cta-url-input")}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Pick an internal page, or type any link (page path, external URL, mailto:, tel:)."})]})]})},re=async()=>{try{var e,t;const[s,a]=await Promise.all([_l.get("/tenant/ai-assistant"),_l.get("/tenant/faqs")]);u(s.data),h(a.data||[]),null!==(e=s.data)&&void 0!==e&&e.enabled&&null!==(t=s.data)&&void 0!==t&&t.bot_id&&(Z(),ee(),ae(),_l.get("/tenant/ai-assistant/usage").then(e=>y(e.data)).catch(()=>{}))}catch(G2){qs.error("Could not load AI Assistant settings.")}finally{p(!1)}};(0,t.useEffect)(()=>{const e=new URLSearchParams(window.location.search).get("addon_session");e?_l.post("/tenant/ai-assistant/verify-addon",{session_id:e}).then(e=>{var t;null!==(t=e.data)&&void 0!==t&&t.activated?qs.success("AI Assistant add-on activated! You can now enable it below."):qs.info("Payment is processing. It may take a moment to activate.")}).catch(()=>{}).finally(()=>{window.history.replaceState({},"","/ai-assistant"),re()}):re()},[]);const ie=async()=>{f(!0);try{var e;const t=await _l.post("/tenant/ai-assistant/subscribe");null!==(e=t.data)&&void 0!==e&&e.checkout_url&&(window.location.href=t.data.checkout_url)}catch(G2){var t,s;qs.error((null===G2||void 0===G2||null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Could not start checkout."),f(!1)}};return(0,ea.jsxs)("div",{className:"flex","data-testid":"ai-assistant-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,ea.jsx)("div",{className:"h-11 w-11 rounded-xl bg-indigo-600 flex items-center justify-center text-white",children:(0,ea.jsx)(kw,{size:22})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold",style:{fontFamily:"Manrope, sans-serif"},children:"AI Assistant"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm",children:"A website chatbot that answers from your FAQs and published content."})]})]}),x?(0,ea.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading\u2026"}):null!==c&&void 0!==c&&c.available?(0,ea.jsxs)("div",{className:"space-y-6",children:[(null===c||void 0===c?void 0:c.addon_active)&&!(null!==c&&void 0!==c&&c.included)&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-indigo-600 bg-indigo-50 border border-indigo-100 rounded-lg px-4 py-2","data-testid":"ai-addon-active-banner",children:[(0,ea.jsx)($g,{size:15})," AI Assistant add-on active ($",c.addon_price,"/mo). Manage billing in Settings."]}),(null===c||void 0===c?void 0:c.included)&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-emerald-600 bg-emerald-50 border border-emerald-100 rounded-lg px-4 py-2","data-testid":"ai-included-banner",children:[(0,ea.jsx)($g,{size:15})," Included with your ",c.plan_level," plan."]}),!(null!==c&&void 0!==c&&c.provisioned)&&(0,ea.jsxs)(rD,{className:"border-indigo-200 bg-indigo-50/40","data-testid":"ai-provision-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center gap-2 text-base",children:[(0,ea.jsx)(Gl,{size:18,className:"text-indigo-600"})," Set Up AI Assistant"]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Provision your AI Assistant bot to get started. This creates a dedicated chatbot trained on your site content \u2014 takes just a second."}),"error"===(null===c||void 0===c?void 0:c.provision_status)&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-red-600 bg-red-50 border border-red-200 rounded-lg px-3 py-2","data-testid":"ai-provision-error",children:[(0,ea.jsx)(AN,{size:14})," Provisioning failed. Please try again."]}),(0,ea.jsx)(sg,{onClick:async()=>{b(!0);try{(await _l.post("/tenant/ai-assistant/provision",{website_url:window.location.origin})).data.already_provisioned?qs.info("AI Assistant bot is already provisioned."):qs.success("AI Assistant bot provisioned! You can now enable the chat widget below."),await re()}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not provision the AI Assistant.")}finally{b(!1)}},disabled:v,className:"gap-2","data-testid":"ai-provision-btn",children:v?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:15,className:"animate-spin"})," Provisioning\u2026"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Gl,{size:15})," Provision AI Assistant"]})})]})]}),(null===c||void 0===c?void 0:c.enabled)&&j&&(0,ea.jsxs)(rD,{"data-testid":"ai-usage-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center justify-between text-base",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Gl,{size:16,className:"text-indigo-500"})," Usage This Month"]}),(0,ea.jsxs)("span",{className:"text-sm font-normal text-slate-500",children:[j.period_start," \u2192 ",j.period_end]})]})}),(0,ea.jsxs)(dD,{className:"space-y-3",children:[(()=>{const e=Math.min(100,Math.round(j.query_count/j.included*100)),t=e>=100?"bg-red-500":e>=80?"bg-amber-500":"bg-emerald-500";return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,ea.jsxs)("span",{className:"font-medium text-slate-700",children:[j.query_count.toLocaleStr
2ing()," ",(0,ea.jsxs)("span",{className:"text-slate-400 font-normal",children:["/ ",j.included.toLocaleString()," included queries"]})]}),(0,ea.jsxs)("span",{className:"font-semibold ".concat(e>=100?"text-red-600":e>=80?"text-amber-600":"text-emerald-600"),children:[e,"%"]})]}),(0,ea.jsx)("div",{className:"w-full h-2.5 bg-slate-100 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full rounded-full transition-all ".concat(t),style:{width:"".concat(e,"%")},"data-testid":"ai-usage-bar"})})]})})(),j.overage_queries>0&&(0,ea.jsxs)("div",{className:"flex items-start gap-2 bg-red-50 border border-red-200 rounded-lg px-3 py-2.5 text-sm","data-testid":"ai-overage-warning",children:[(0,ea.jsx)(AN,{size:15,className:"text-red-500 mt-0.5 flex-shrink-0"}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"font-medium text-red-700",children:[j.overage_queries.toLocaleString()," queries over your limit"]}),(0,ea.jsxs)("p",{className:"text-red-600 text-xs mt-0.5",children:["Estimated extra charge: ",(0,ea.jsxs)("strong",{children:["$",j.estimated_overage_charge.toFixed(2)]})," \u2014 billed automatically on the 1st of next month ($",j.rate_per_100.toFixed(2)," per 100 queries)"]}
2)]})]}),0===j.overage_queries&&j.query_count/j.included>=.8&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2 text-sm text-amber-700","data-testid":"ai-usage-warning",children:[(0,ea.jsx)(AN,{size:14,className:"flex-shrink-0"}),"Approaching your monthly limit \u2014 ",j.included-j.query_count," queries remaining."]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:["Plan: ",(0,ea.jsx)("span",{className:"capitalize",children:j.addon_tier})," tier \u2014 ",j.included.toLocaleString()," queries/month included. Overages billed at $",j.rate_per_100.toFixed(2)," per 100 queries."]})]})]}),(null===c||void 0===c?void 0:c.provisioned)&&!(null!==c&&void 0!==c&&c.enabled)&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-indigo-600 bg-indigo-50 border border-indigo-100 rounded-lg px-4 py-2","data-testid":"ai-provisioned-banner",children:[(0,ea.jsx)(uD,{size:15})," Bot provisioned and ready \u2014 enable the chat widget below to go live."]}),(0,ea.jsxs)(rD,{"data-testid":"ai-enable-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)($g,{size:18})," Chatbot"]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:"Enable AI Assistant on your website"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:c.enabled?"Live \u2014 a chat bubble appears on your public site.":c.provisioned?"Turn on to add a chat bubble to every page of your site.":"Provision your bot above first, then enable it here."})]}),(0,ea.jsx)(wb,{checked:!!c.enabled,disabled:g||!c.provisioned,onCheckedChange:async e=>{f(!0);try{if(e){const e=await _l.post("/tenant/ai-assistant/enable",{website_url:window.location.origin});qs.success("AI Assistant enabled. ".concat(e.data.qa_synced," Q&A entries synced.")),e.data.crawl_error&&qs.info("Website crawling is not active on your current plan yet \u2014 the assistant will answer from your FAQs and articles.")}else await _l.post("/tenant/ai-assistant/disable"),qs.success("AI Assistant disabled. The chat widget is hidden from your site.");await re()}catch(G2){var t,s;qs.error((null===G2||void 0===G2||null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Could not update the AI Assistant.")}finally{f(!1)}},"data-testid":"ai-enable-toggle"})]}),c.enabled&&(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-3 pt-2 border-t",children:[(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-sm text-emerald-600",children:[(0,ea.jsx)(kj,{size:15})," Bot connected"]}),(0,ea.jsx)("span",{className:"text-sm text-slate-400",children:"\u2022"}),(0,ea.jsxs)("span",{className:"text-sm text-slate-600",children:[c.faq_count," curated FAQ(s)"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:async()=>{f(!0);try{const e=await _l.post("/tenant/ai-assistant/sync");qs.success("Synced ".concat(e.data.qa_synced," Q&A entries to your assistant."))}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Sync failed.")}finally{f(!1)}},disabled:g,className:"ml-auto gap-2","data-testid":"ai-sync-btn",children:[(0,ea.jsx)(gq,{size:14,className:g?"animate-spin":""})," Sync now"]})]})]})]}),c.bot_id&&(0,ea.jsxs)(rD,{"data-testid":"ai-test-bot-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2 text-base",children:[(0,ea.jsx)(kw,{size:18})," Test Bot"]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Ask a question to try your assistant \u2014 same answers your visitors get, without leaving this page."})]}),W.length>0&&(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",onClick:()=>{V([]),J(null),$("")},"data-testid":"ai-test-reset-btn",children:[(0,ea.jsx)(gq,{size:14,className:"mr-1"})," Reset"]})]})}),(0,ea.jsxs)(dD,{className:"space-y-3",children:[(0,ea.jsxs)("div",{ref:Q,className:"h-72 overflow-y-auto rounded-lg border bg-slate-50 p-3 space-y-3","data-testid":"ai-test-messages",children:[D.greeting_message&&(0,ea.jsx)("div",{className:"flex justify-start",children:(0,ea.jsx)("div",{className:"max-w-[80%] rounded-2xl rounded-tl-sm bg-white border px-3 py-2 text-sm text-slate-700 shadow-sm",children:D.greeting_message})}),0===W.length&&!D.greeting_message&&(0,ea.jsx)("p",{className:"text-sm text-slate-400 text-center py-6",children:"Type a question below to test your assistant."}),W.map((e,t)=>{var s,a,n,l;return"user"===e.role?(0,ea.jsx)("div",{className:"flex justify-end",children:(0,ea.jsx)("div",{className:"max-w-[80%] rounded-2xl rounded-tr-sm px-3 py-2 text-sm text-white shadow-sm",style:{backgroundColor:D.primary_color||"#4f46e5"},"data-testid":"ai-test-user-msg-".concat(t),children:e.text})},t):(0,ea.jsx)("div",{className:"flex justify-start",children:(0,ea.jsxs)("div",{className:"max-w-[80%] rounded-2xl rounded-tl-sm border px-3 py-2 text-sm shadow-sm ".concat(e.error?"bg-red-50 border-red-200 text-red-600":"bg-white text-slate-700"),"data-testid":"ai-test-bot-msg-".concat(t),children:[(0,ea.jsx)("p",{className:"whitespace-pre-wrap",children:e.text}),(null===(s=e.cta)||void 0===s?void 0:s.label)&&(null===(a=e.cta)||void 0===a?void 0:a.url)&&(0,ea.jsx)("a",{href:e.cta.url,target:"_blank",rel:"noreferrer",className:"inline-block mt-2 px-3 py-1.5 rounded-lg text-xs font-medium text-white",style:{backgroundColor:D.primary_color||"#4f46e5"},"data-testid":"ai-test-cta-".concat(t),children:e.cta.label}),e.footer&&(e.footer.message||e.footer.cta)&&(0,ea.jsxs)("div",{className:"mt-2 pt-2 border-t border-slate-100 text-xs text-slate-500",children:[e.footer.message&&(0,ea.jsx)("p",{children:e.footer.message}),(null===(n=e.footer.cta)||void 0===n?void 0:n.label)&&(null===(l=e.footer.cta)||void 0===l?void 0:l.url)&&(0,ea.jsx)("a",{href:e.footer.cta.url,target:"_blank",rel:"noreferrer",className:"inline-block mt-1 font-medium underline",style:{color:D.primary_color||"#4f46e5"},children:e.footer.cta.label})]}),Array.isArray(e.sources)&&e.sources.length>0&&(0,ea.jsxs)("p",{className:"mt-1.5 text-[10px] text-slate-400 truncate",children:["Source: ",e.sources[0].title||e.sources[0].url]})]})},t)}),G&&(0,ea.jsx)("div",{className:"flex justify-start",children:(0,ea.jsx)("div",{className:"rounded-2xl rounded-tl-sm bg-white border px-3 py-2 text-sm text-slate-400 shadow-sm",children:(0,ea.jsxs)("span",{className:"inline-flex gap-1",children:[(0,ea.jsx)("span",{className:"animate-bounce",children:"\u2022"}),(0,ea.jsx)("span",{className:"animate-bounce",style:{animationDelay:"0.15s"},children:"\u2022"}),(0,ea.jsx)("span",{className:"animate-bounce",style:{animationDelay:"0.3s"},children:"\u2022"})]})})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{value:q,onChange:e=>$(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),se())},placeholder:"Ask your assistant a question\u2026",disabled:G,"data-testid":"ai-test-input"}),(0,ea.jsxs)(sg,{onClick:se,disabled:G||!q.trim(),className:"gap-1.5 shrink-0","data-testid":"ai-test-send-btn",children:[(0,ea.jsx)(dr,{size:15})," Send"]})]})]})]}),c.enabled&&(null===C||void 0===C?void 0:C.bot_id)&&(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)(rD,{"data-testid":"ai-settings-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsx)(oD,{children:"Bot Settings"})}),(0,ea.jsxs)(dD,{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-1.5",children:[(0,ea.jsx)(tf,{children:"Bot name"}),(0,ea.jsx)(BN,{value:D.name,onChange:e=>_(d(d({},D),{},{name:e.target.value})),"data-testid":"bot-name-input"})]}),(0,ea.jsxs)("div",{className:"space-y-1.5",children:[(0,ea.jsx)(tf,{children:"Accent colour"}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("input",{type:"color",value:D.primary_color,onChange:e=>_(d(d({},D),{},{primary_color:e.target.value}
2)),className:"h-9 w-14 rounded border cursor-pointer","data-testid":"bot-color-input"}),(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:D.primary_color})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-1.5",children:[(0,ea.jsx)(tf,{children:"Greeting message"}),(0,ea.jsx)(YN,{rows:2,value:D.greeting_message,onChange:e=>_(d(d({},D),{},{greeting_message:e.target.value})),"data-testid":"bot-greeting-input"})]}),(0,ea.jsxs)("div",{className:"pt-5 border-t space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"text-sm font-semibold text-slate-800",children:"When the bot can't answer"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Shown only when the assistant can't find an answer."})]}),(0,ea.jsxs)("div",{className:"space-y-1.5",children:[(0,ea.jsx)(tf,{children:"Fallback message"}),(0,ea.jsx)(YN,{rows:2,value:D.fallback_message,onChange:e=>_(d(d({},D),{},{fallback_message:e.target.value})),placeholder:"Sorry, I couldn't find an answer. Our team is happy to help.","data-testid":"bot-fallback-message-input"})]}),le("fallback","Contact us")]}),(0,ea.jsxs)("div",{className:"pt-5 border-t space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"text-sm font-semibold text-slate-800",children:"Message footer"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Shown under every answered message (e.g. a note + a CTA)."})]}),(0,ea.jsx)(wb,{checked:D.footer_enabled,onCheckedChange:e=>_(d(d({},D),{},{footer_enabled:e})),"data-testid":"bot-footer-enabled-switch"})]}),D.footer_enabled&&(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-1.5",children:[(0,ea.jsxs)(tf,{children:["Footer message ",(0,ea.jsx)("span",{className:"text-slate-400 font-normal",children:"(optional)"})]}),(0,ea.jsx)(YN,{rows:2,value:D.footer_message,onChange:e=>_(d(d({},D),{},{footer_message:e.target.value})),placeholder:"Need more help? Reach out to our team.","data-testid":"bot-footer-message-input"})]}),le("footer","Get in touch")]})]}),(0,ea.jsxs)("div",{className:"pt-5 border-t space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"text-sm font-semibold text-slate-800",children:"Where the chat bubble appears"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Choose whether the bot shows on your whole site or only on chosen pages."})]}),(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,ea.jsxs)("button",{type:"button",onClick:()=>_(d(d({},D),{},{widget_scope:"all"})),className:"flex-1 text-left rounded-lg border p-3 transition-colors ".concat("all"===D.widget_scope?"border-indigo-500 bg-indigo-50":"border-slate-200 hover:bg-slate-50"),"data-testid":"widget-scope-all",children:[(0,ea.jsx)("p",{className:"text-sm font-medium",children:"All pages"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Show on every public page (recommended)"})]}),(0,ea.jsxs)("button",{type:"button",onClick:()=>_(d(d({},D),{},{widget_scope:"selected"})),className:"flex-1 text-left rounded-lg border p-3 transition-colors ".concat("selected"===D.widget_scope?"border-indigo-500 bg-indigo-50":"border-slate-200 hover:bg-slate-50"),"data-testid":"widget-scope-selected",children:[(0,ea.jsx)("p",{className:"text-sm font-medium",children:"Selected pages"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Only show on pages you pick below"})]})]}),"selected"===D.widget_scope&&(0,ea.jsx)("div",{className:"space-y-2 max-h-64 overflow-y-auto border rounded-lg p-3","data-testid":"widget-pages-list",children:0===R.length?(0,ea.jsx)("p",{className:"text-sm text-slate-400",children:"No published pages found."}):R.map(e=>{const t=(D.widget_paths||[]).includes(e.path);return(0,ea.jsxs)("label",{className:"flex items-center justify-between gap-3 py-1.5 cursor-pointer",children:[(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsx)("p",{className:"text-sm font-medium truncate",children:e.title}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 truncate",children:e.path})]}),(0,ea.jsx)(wb,{checked:t,onCheckedChange:t=>{const s=new Set(D.widget_paths||[]);t?s.add(e.path):s.delete(e.path),_(d(d({},D),{},{widget_paths:Array.from(s)}))},"data-testid":"widget-page-toggle-".concat(e.path)})]},e.path)})})]}),(0,ea.jsx)(sg,{onClick:async()=>{E(!0);try{await _l.put("/tenant/ai-assistant/settings",D),qs.success("Bot settings updated."),await Z()}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not save settings.")}finally{E(!1)}},disabled:S,className:"gap-2","data-testid":"bot-settings-save",children:S?"Saving\u2026":"Save settings"})]})]}),(0,ea.jsxs)(rD,{"data-testid":"ai-usage-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsx)(oD,{children:"Usage & Cost"})}),(0,ea.jsxs)(dD,{children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsx)(TJ,{label:"Questions answered",value:null!==(e=null===C||void 0===C||null===(s=C.usage)||void 0===s?void 0:s.total_queries)&&void 0!==e?e:0}),(0,ea.jsx)(TJ,{label:"Conversations",value:null!==(a=null===C||void 0===C||null===(n=C.usage)||void 0===n?void 0:n.total_sessions)&&void 0!==a?a:0}),(0,ea.jsx)(TJ,{label:"Active (24h)",value:null!==(l=null===C||void 0===C||null===(r=C.usage)||void 0===r?void 0:r.active_sessions_24h)&&void 0!==l?l:0}),(0,ea.jsx)(TJ,{label:"Cost to date",value:"$".concat((null!==(i=null===C||void 0===C||null===(o=C.cost)||void 0===o?void 0:o.total_cost)&&void 0!==i?i:0).toFixed(4))})]}),(0,ea.jsxs)("div",{className:"mt-4 flex items-center gap-2 text-xs",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Knowledge index:"}),(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full font-medium ".concat("completed"===(null===C||void 0===C?void 0:C.rag_status)?"bg-emerald-100 text-emerald-700":"indexing"===(null===C||void 0===C?void 0:C.rag_status)?"bg-amber-100 text-amber-700":"bg-slate-100 text-slate-600"),children:(null===C||void 0===C?void 0:C.rag_status)||"ready (FAQs + articles)"})]})]})]})]}),(0,ea.jsxs)(rD,{"data-testid":"ai-faq-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Knowledge \u2014 FAQs"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Curated Q&A the assistant uses to answer. Your published articles are added automatically. After changes, click ",(0,ea.jsx)("strong",{children:"Sync now"})," above."]})]}),(0,ea.jsxs)("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[(0,ea.jsx)("input",{ref:T,type:"file",accept:".csv,text/csv",className:"hidden",onChange:async e=>{var t;const s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",s)try{const e=function(e){const t=[];let s="",a=[],n=!1,l=0;for(;l<e.length;){const r=e[l];n?'"'===r?'"'===e[l+1]?(s+='"',l++):n=!1:s+=r:'"'===r?n=!0:","===r?(a.push(s),s=""):"\n"===r||"\r"===r?("\r"===r&&"\n"===e[l+1]&&l++,a.push(s),t.push(a),a=[],s=""):s+=r,l++}return(s.length||a.length)&&(a.push(s),t.push(a)),t.filter(e=>e.some(e=>""!==e.trim()))}(await s.text());if(!e.length)return void qs.error("That CSV looks empty.");let t=0;"question"===(e[0][0]||"").trim().toLowerCase()&&(t=1);const a=e.slice(t).map(e=>({question:(e[0]||"").trim(),answer:(e[1]||"").trim()})).filter(e=>e.question&&e.answer);if(!a.length)return void qs.error("No valid rows. Use two columns: question, answer.");F({rows:a})}catch(K2){qs.error("Could not read that file.")}},"data-testid":"faq-csv-input"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.click()},"data-testid":"faq-import-btn",children:[(0,ea.jsx)(kq,{size:14})," Import CSV"]}),(0,ea.jsx)("button",{className:"text-xs text-slate-400 hover:text-slate-600 underline",onClick:()=>{const e=new Blob(['question,answer\nWhat are your school hours?,"Our day runs 8:30am to 3:15pm, Monday to Frid
2ay."\nHow do I enrol?,Visit the Admissions page and complete the online form.\n'],{type:"text/csv"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="faq-template.csv",s.click(),URL.revokeObjectURL(t)},"data-testid":"faq-sample-btn",children:"Download template"})]})]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[A&&(0,ea.jsxs)("div",{className:"p-4 rounded-lg border border-indigo-200 bg-indigo-50 space-y-3","data-testid":"faq-import-panel",children:[(0,ea.jsxs)("p",{className:"text-sm font-medium",children:["Found ",A.rows.length," Q&A pair(s) in your CSV. How should we add them?"]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,ea.jsx)(sg,{size:"sm",onClick:()=>X("append"),"data-testid":"faq-import-append",children:"Append to existing"}),(0,ea.jsx)(sg,{size:"sm",variant:"destructive",onClick:()=>X("replace"),"data-testid":"faq-import-replace",children:"Replace all existing"}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>F(null),"data-testid":"faq-import-cancel",children:"Cancel"})]})]}),(0,ea.jsxs)("div",{className:"grid gap-3 p-4 rounded-lg border bg-slate-50",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Question"}),(0,ea.jsx)(BN,{value:N.question,onChange:e=>w(d(d({},N),{},{question:e.target.value})),placeholder:"e.g. What are your school hours?","data-testid":"faq-question-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Answer"}),(0,ea.jsx)(YN,{value:N.answer,onChange:e=>w(d(d({},N),{},{answer:e.target.value})),placeholder:"e.g. Our school day runs from 8:30am to 3:15pm, Monday to Friday.",rows:2,"data-testid":"faq-answer-input"})]}),(0,ea.jsxs)(sg,{onClick:async()=>{if(N.question.trim()&&N.answer.trim())try{await _l.post("/tenant/faqs",N),w({question:"",answer:"",priority:1}),qs.success('FAQ added. Click "Sync now" to push it to your assistant.'),await re()}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not add FAQ.")}else qs.error("Both a question and an answer are required.")},className:"gap-2 w-fit","data-testid":"faq-add-btn",children:[(0,ea.jsx)(Vj,{size:16})," Add FAQ"]})]}),0===m.length?(0,ea.jsx)("p",{className:"text-sm text-slate-400 text-center py-4",children:"No FAQs yet. Add your first above."}):(0,ea.jsx)("div",{className:"space-y-2","data-testid":"faq-list",children:m.map(e=>(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-3 p-3 rounded-lg border",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-sm",children:e.question}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:e.answer})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(async e=>{try{await _l.delete("/tenant/faqs/".concat(e)),await re()}catch(G2){qs.error("Could not delete FAQ.")}})(e.faq_id),"data-testid":"faq-delete-".concat(e.faq_id),children:(0,ea.jsx)(wD,{size:15,className:"text-red-500"})})]},e.faq_id))})]})]}),(0,ea.jsxs)(rD,{"data-testid":"ai-documents-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center gap-2 text-base",children:[(0,ea.jsx)(qN,{size:18})," Knowledge \u2014 Documents (PDF)"]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Pick PDFs from your Media Library for the assistant to read \u2014 handbooks, brochures, policies and more. The assistant answers directly from their contents. Upload PDFs in the ",(0,ea.jsx)("strong",{children:"Media"})," library first."]}),I&&0!==I.documents.length?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:[I.documents.filter(e=>e.included).length," of ",I.documents.length," document(s) included"]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>ne(!0),"data-testid":"ai-documents-include-all-btn",children:"Include all"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>
2ne(!1),"data-testid":"ai-documents-exclude-all-btn",children:"Exclude all"})]})]}),(0,ea.jsx)("div",{className:"space-y-2 max-h-80 overflow-y-auto","data-testid":"ai-documents-list",children:I.documents.map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-3 p-3 rounded-lg border",children:[(0,ea.jsxs)("div",{className:"min-w-0 flex items-center gap-3",children:[(0,ea.jsx)(qN,{size:16,className:"text-slate-400 shrink-0"}),(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsx)("p",{className:"font-medium text-sm truncate",children:e.filename}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 truncate",children:[e.size?"".concat((e.size/1024/1024).toFixed(1)," MB"):"",e.included&&e.page_count?" \xb7 ".concat(e.page_count," pages indexed"):""]})]})]}),(0,ea.jsx)(wb,{checked:e.included,onCheckedChange:()=>{return t=e.media_id,void O(e=>e&&d(d({},e),{},{documents:e.documents.map(e=>e.media_id===t?d(d({},e),{},{included:!e.included}):e)}));var t},"data-testid":"ai-document-toggle-".concat(e.media_id)})]},e.media_id))}),(0,ea.jsxs)("div",{className:"flex items-start gap-2 text-xs text-slate-400",children:[(0,ea.jsx)(AN,{size:13,className:"mt-0.5 shrink-0"}),(0,ea.jsx)("span",{children:"Text-based PDFs only (max 30 MB each). Scanned/image-only PDFs can't be read."})]}),(0,ea.jsxs)(sg,{onClick:async()=>{if(I){H(!0);try{const e=I.documents.filter(e=>e.included).map(e=>e.media_id),t=await _l.put("/tenant/ai-assistant/documents",{media_ids:e}),s=[];t.data.added&&s.push("".concat(t.data.added," added")),t.data.removed&&s.push("".concat(t.data.removed," removed")),qs.success("Documents updated".concat(s.length?" \u2014 "+s.join(", "):"",". ").concat(t.data.synced_count," PDF(s) now feed your assistant.")),(t.data.errors||[]).forEach(e=>{qs.error("".concat(e.filename||"A file",": ").concat(e.error))}),await ae()}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not update documents.")}finally{H(!1)}}},disabled:U,className:"gap-2 w-fit","data-testid":"ai-documents-save-btn",children:[U?(0,ea.jsx)(gq,{size:16,className:"animate-spin"}):(0,ea.jsx)(Xl,{size:16}),"Save documents"]})]}):(0,ea.jsx)("p",{className:"text-sm text-slate-400 text-center py-4","data-testid":"ai-documents-empty",children:"No PDFs in your Media Library yet. Upload a PDF under Media to make it available here."})]})]}),(0,ea.jsxs)(rD,{"data-testid":"crawl-pages-card",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center gap-2 text-base",children:[(0,ea.jsx)(hr,{size:18})," Website Pages"]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Choose which published pages the assistant is allowed to read. Turn a page off to exclude it from the assistant's knowledge."}),z&&0!==z.pages.length?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:[z.pages.filter(e=>e.included).length," of ",z.pages.length," pages included",z.last_crawled_at?" \xb7 last crawled ".concat(new Date(z.last_crawled_at).toLocaleDateString()):""]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>te(!0),"data-testid":"crawl-include-all-btn",children:"Include all"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>te(!1),"data-testid":"crawl-exclude-all-btn",children:"Exclude all"})]})]}),(0,ea.jsx)("div",{className:"space-y-2 max-h-80 overflow-y-auto","data-testid":"crawl-pages-list",children:z.pages.map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-3 p-3 rounded-lg border",children:[(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsx)("p",{className:"font-medium text-sm truncate",children:e.title}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 truncate",children:e.url})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,ea.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-slate-400",children:e.type}),(0,ea.jsx)(wb,{checked:e.included,onCheckedChange:()=>{return t=e.url,void M(e=>e&&d(d({},e),{},{pages:e.pages.map(e=>e.url===t?d(d({},e),{},{included:!e.included}):e)}));var t},"data-testid":"crawl-page-toggle-".concat(e.type)})]})]},e.url))}),(0,ea.jsxs)(sg,{onClick:async()=>
2{if(z){B(!0);try{const e=z.pages.filter(e=>!e.included).map(e=>e.url),t=await _l.put("/tenant/ai-assistant/pages",{excluded_urls:e,recrawl:!0});qs.success("Saved \u2014 ".concat(t.data.included," page(s) are now part of your assistant's knowledge.")),t.data.qa_error&&qs.error("Could not update the assistant knowledge: "+t.data.qa_error),await ee()}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not save page selection.")}finally{B(!1)}}},disabled:P,className:"gap-2 w-fit","data-testid":"crawl-pages-save-btn",children:[P?(0,ea.jsx)(gq,{size:16,className:"animate-spin"}):(0,ea.jsx)(Xl,{size:16}),"Save & re-crawl"]})]}):(0,ea.jsx)("p",{className:"text-sm text-slate-400 text-center py-4","data-testid":"crawl-pages-empty",children:"No published pages or articles found yet."})]})]}),(0,ea.jsxs)("div",{className:"flex items-start gap-2 text-xs text-slate-400",children:[(0,ea.jsx)(AN,{size:14,className:"mt-0.5 shrink-0"}),(0,ea.jsx)("span",{children:"Website crawling (auto-reading every page) depends on your plan. If it's not active, the assistant still answers from your FAQs and published articles."})]})]}):(()=>{var e;return(0,ea.jsx)(rD,{className:"border-indigo-200","data-testid":"ai-addon-card",children:(0,ea.jsxs)(dD,{className:"p-8 text-center",children:[(0,ea.jsx)("div",{className:"mx-auto mb-4 h-14 w-14 rounded-2xl bg-indigo-600 flex items-center justify-center text-white",children:(0,ea.jsx)(kw,{size:28})}),(0,ea.jsx)("h2",{className:"text-xl font-bold mb-2",children:"Add the AI Assistant to your site"}),(0,ea.jsx)("p",{className:"text-slate-600 max-w-md mx-auto mb-1",children:"A smart chatbot that answers your visitors from your FAQs and published content \u2014 set up in minutes, no code."}),(0,ea.jsxs)("p",{className:"text-3xl font-bold my-4",children:["$",null!==(e=null===c||void 0===c?void 0:c.addon_price)&&void 0!==e?e:39,(0,ea.jsx)("span",{className:"text-base font-normal text-slate-500",children:"/month"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-5",children:"Cancel anytime. Included free on the Pro plan and above."}),(0,ea.jsxs)(sg,{onClick:ie,disabled:g,size:"lg","data-testid":"ai-subscribe-btn",className:"gap-2",children:[(0,ea.jsx)($g,{size:18})," ",g?"Redirecting\u2026":"Add AI Assistant"]})]})})})()]})})]})}function MJ(){var e,s;const[a,n]=(0,t.useState)(null),[l,r]=(0,t.useState)(!0),i=async()=>{r(!0);try{const e=await _l.get("/admin/ai-bots");n(e.data)}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not load AI bots.")}finally{r(!1)}};return(0,t.useEffect)(()=>{i()},[]),(0,ea.jsxs)("div",{className:"flex","data-testid":"ai-bots-admin-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"h-11 w-11 rounded-xl bg-rose-600 flex items-center justify-center text-white",children:(0,ea.jsx)(kw,{size:22})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold",style:{fontFamily:"Manrope, sans-serif"},children:"AI Bots"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm",children:"Every tenant's AI Assistant \u2014 usage & cost across the platform."})]})]}),(0,ea.jsxs)("button",{onClick:i,className:"flex items-center gap-2 text-sm text-slate-600 hover:text-slate-900","data-testid":"ai-bots-refresh",children:[(0,ea.jsx)(gq,{size:15,className:l?"animate-spin":""})," Refresh"]})]}),a&&(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"p-4",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:a.total_bots}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Active bots"})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"p-4",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:a.total_queries}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Questions answered"})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"p-4",children:[(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:["$",(null!==(e=a.total_cost)&&void 0!==e?e:0).toFixed(4)]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Total cost"})]})})]}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"p-0",children:l?(0,ea.jsx)("div",{className:"p-8 text-center text-slate-400 animate-pulse",children:"Loading bots\u2026"}):null!==a&&void 0!==a&&null!==(s=a.bots)&&void 0!==s&&s.length?(0,ea.jsxs)("table",{className:"w-full text-sm","data-testid":"ai-bots-table",children:[(0,ea.jsx)("thead",{className:"text-left text-slate-500 border-b",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"p-3",children:"Tenant"}),(0,ea.jsx)("th",{className:"p-3",children:"Plan"}),(0,ea.jsx)("th",{className:"p-3",children:"Status"}),(0,ea.jsx)("th",{className:"p-3 text-right",children:"Questions"}),(0,ea.jsx)("th",{className:"p-3 text-right",children:"Conversations"}),(0,ea.jsx)("th",{className:"p-3 text-right",children:"Cost"})]})}),(0,ea.jsx)("tbody",{children:a.bots.map(e=>{var t;return(0,ea.jsxs)("tr",{className:"border-b last:border-0 hover:bg-slate-50","data-testid":"ai-bot-row-".concat(e.tenant_id),children:[(0,ea.jsx)("td",{className:"p-3 font-medium",children:e.name||e.tenant_id}),(0,ea.jsxs)("td",{className:"p-3 capitalize",children:[e.plan_level,e.addon_active?" + add-on":""]}),(0,ea.jsx)("td",{className:"p-3",children:(0,ea.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(e.enabled?"bg-emerald-100 text-emerald-700":"bg-slate-100 text-slate-500"),children:e.enabled?"Live":"Off"})}),(0,ea.jsx)("td",{className:"p-3 text-right",children:e.queries}),(0,ea.jsx)("td",{className:"p-3 text-right",children:e.sessions}),(0,ea.jsxs)("td",{className:"p-3 text-right",children:["$",(null!==(t=e.cost)&&void 0!==t?t:0).toFixed(4)]})]},e.bot_id)})})]}):(0,ea.jsx)("div",{className:"p-8 text-center text-slate-400",children:"No tenant bots have been created yet."})})})]})})]})}const PJ=Vl("key-round",[["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"}]]),BJ=Vl("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"}]]),RJ=Vl("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),LJ=Vl("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),IJ=Vl("plug",[["path",{d:"M12 22v-5",key:"1ega77"}
2],["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"}]]),OJ=()=>{const[e,s]=(0,t.useState)(null),[a,n]=(0,t.useState)("idle"),[l,r]=(0,t.useState)(""),i=(0,t.useRef)(null),[o,c]=(0,t.useState)(null),[d,u]=(0,t.useState)(!1),[m,h]=(0,t.useState)(""),[x,p]=(0,t.useState)("https://taptile.app"),[g,f]=(0,t.useState)(!1),[v,b]=(0,t.useState)(!1),[j,y]=(0,t.useState)(!1),[N,w]=(0,t.useState)(!1),[C,k]=(0,t.useState)(!1),[D,_]=(0,t.useState)(!1),[S,E]=(0,t.useState)(!1),A=(0,t.useCallback)(async()=>{try{const e=await _l.get("/integrations/taptile/settings");c(e.data),p(e.data.api_url||"https://taptile.app")}catch(e){c({connected:!1})}},[]),F=(0,t.useCallback)(async()=>{n("loading"),r("");try{clearTimeout(i.current);const e=await _l.post("/integrations/taptile/embed-token");s(e.data.embed_url),n("ready");const t=1e3*Math.max((e.data.expires_in||300)-30,30);i.current=setTimeout(F,t)}catch(G2){var e,t;n("error"),r((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not load Taptile embed.")}},[]);(0,t.useEffect)(()=>(A(),()=>clearTimeout(i.current)),[A]),(0,t.useEffect)(()=>{null!==o&&void 0!==o&&o.connected&&"idle"===a&&F()},[o,a,F]);const T=async()=>{if(window.confirm("Disconnect Taptile? Events push notifications and the embed will stop working.")){y(!0);try{await _l.delete("/integrations/taptile/settings"),qs.success("Taptile disconnected"),c({connected:!1}),n("idle"),s(null),clearTimeout(i.current)}catch(e){qs.error("Failed to disconnect")}finally{y(!1)}}},z=async()=>{w(!0);try{const e=await _l.post("/integrations/taptile/provision"),t="created"===e.data.status,a=e.data.invite_sent;if(t?a?qs.success("Taptile workspace created \u2014 check your email for the invite link."):qs.success("Taptile workspace created. Use the portal link to access your account."):qs.success("Taptile workspace re-enabled."),await A(),e.data.connected)n("idle");else try{await _l.post("/integrations/taptile/retrieve-api-key"),qs.success("API key retrieved automatically!"),await A(),n("idle")}catch(s){n("idle")}}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to enable Taptile")}finally{w(!1)}},M=async()=>{if(window.confirm("Disable Taptile? This will not delete your Taptile account \u2014 you can re-enable it at any time.")){k(!0);try{await _l.delete("/integrations/taptile/provision"),qs.success("Taptile disabled"),await A()}catch(e){qs.error("Failed to disable")}finally{k(!1)}}},P=async()=>{E(!0);try{(await _l.post("/integrations/taptile/retrieve-api-key")).data.already_connected?qs.info("Already connected \u2014 reloading."):qs.success("API key retrieved and connected automatically!"),await A(),n("idle")}catch(G2){var e,t;const a=(null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not auto-retrieve API key.";qs.warning(a),u(!0)}finally{E(!1)}},B=(0,t.useCallback)(async e=>{if(null!==o&&void 0!==o&&o.connected){_(!0);try{const e=(await _l.post("/integrations/taptile/embed-token")).data.embed_url;window.open(e,"_blank","noopener,noreferrer")}catch(t){window.open(e,"_blank","noopener,noreferrer")}finally{_(!1)}}else window.open(e,"_blank","noopener,noreferrer")},[o]),R=null===o;return"ready"===a&&e&&!d?(0,ea.jsxs)("div",{className:"flex h-screen overflow-hidden","data-testid":"taptile-app-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-white border-b border-slate-200 shrink-0",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,ea.jsx)("div",{className:"w-7 h-7 rounded-md bg-indigo-600 flex items-center justify-center text-white shrink-0",children:(0,ea.jsx)(RN,{size:14})}),(0,ea.jsx)("span",{className:"text-sm font-semibold text-slate-800",children:"Taptile"}),(0,ea.jsxs)("span",{className:"flex items-center gap-1 text-xs text-green-600 font-medium bg-green-50 border border-green-200 px-2 py-0.5 rounded-md",children:[(0,ea.jsx)(cr,{size:11})," Connected"]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ea.jsxs)(sg,{size:"sm",variant:"ghost",onClick:()=>window.open(e,"_blank","noopener,noreferrer"),className:"text-slate-500 hover:text-slate-800","data-testid":"taptile-open-new-tab",children:[(0,ea.jsx)(bj,{size:13,className:"mr-1"})," New tab"]}),(0,ea.jsxs)(sg,{size:"sm",variant:"ghost",onClick:()=>u(!0),className:"text-slate-500 hover:text-slate-800","data-testid":"taptile-toolbar-settings",children:[(0,ea.jsx)(PJ,{size:13,className:"mr-1"})," Settings"]}),(0,ea.jsxs)(sg,{size:"sm",variant:"ghost",onClick:T,disabled:j,className:"text-red-400 hover:text-red-600 hover:bg-red-50","data-testid":"taptile-toolbar-disconnect",children:[j?(0,ea.jsx)(ql,{size:13,className:"animate-spin mr-1"}):(0,ea.jsx)(BJ,{size:13,className:"mr-1"}),"Disconnect"]})]})]}),(0,ea.jsx)("iframe",{"data-testid":"taptile-embed-iframe",title:"Taptile",src:e,className:"flex-1 w-full border-none",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation-by-user-activation",allow:"clipboard-read; clipboard-write"},e)]})]}):(0,ea.jsxs)("div",{className:"flex","data-testid":"taptile-app-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-lg bg-indigo-600 flex items-center justify-center text-white",children:(0,ea.jsx)(RN,{size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Taptile"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Manage your Taptile app and configure event push notifications."})]})]}),(null===o||void 0===o?void 0:o.connected)&&!d&&!(null!==o&&void 0!==o&&o.provision_enabled)&&(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1.5 text-sm text-green-600 font-medium bg-green-50 border border-green-200 px-3 py-1.5 rounded-lg",children:[(0,ea.jsx)(cr,{size:14})," Connected"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>u(!0),"data-testid":"taptile-edit-btn",children:[(0,ea.jsx)(PJ,{size:14,className:"mr-1.5"})," Update API Key"]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:T,disabled:j,className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200","data-testid":"taptile-disconnect-btn",children:[j?(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-1"}):(0,ea.jsx)(BJ,{size:14,className:"mr-1.5"}),"Disconnect"]})]})]}),R&&(0,ea.jsx)("div",{className:"flex items-center justify-center py-16 text-slate-400",children:(0,ea.jsx)(ql,{className:"animate-spin",size:20})}
2),!R&&(()=>{const e=(null===o||void 0===o?void 0:o.plan_level)||"freemium",t=["pro","enterprise","reseller"].includes(e),s=null===o||void 0===o?void 0:o.provisioned,a=null===o||void 0===o?void 0:o.provision_enabled;return t?s&&a?(0,ea.jsx)("div",{className:"max-w-2xl mb-6","data-testid":"taptile-provision-active",children:(0,ea.jsx)("div",{className:"bg-green-50 border border-green-200 rounded-xl p-5",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-9 h-9 rounded-lg bg-green-100 flex items-center justify-center shrink-0",children:(0,ea.jsx)(Gl,{size:16,className:"text-green-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"font-semibold text-green-800 text-sm flex items-center gap-2",children:["Taptile workspace active",o.short_code&&(0,ea.jsx)("span",{className:"bg-green-100 text-green-700 text-xs font-mono px-2 py-0.5 rounded","data-testid":"taptile-short-code",children:o.short_code})]}),(0,ea.jsx)("p",{className:"text-xs text-green-600 mt-0.5",children:"Auto-provisioned \u2014 your account was created automatically. Use the portal link or the panel below to manage your app."})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[o.portal_url&&(0,ea.jsxs)("button",{onClick:()=>B(o.portal_url),disabled:D,className:"flex items-center gap-1.5 text-xs text-green-700 font-medium bg-white border border-green-200 px-3 py-1.5 rounded-lg hover:bg-green-50 transition-colors disabled:opacity-60","data-testid":"taptile-portal-link",children:[D?(0,ea.jsx)(ql,{size:12,className:"animate-spin"}):(0,ea.jsx)(bj,{size:12}),D?"Opening\u2026":"Open Taptile Portal"]}),(0,ea.jsxs)("button",{onClick:M,disabled:C,className:"flex items-center gap-1.5 text-xs text-slate-500 hover:text-red-600 transition-colors px-2 py-1.5","data-testid":"taptile-provision-disable-btn",children:[C?(0,ea.jsx)(ql,{size:14,className:"animate-spin"}):(0,ea.jsx)(RJ,{size:18,className:"text-green-500"}),(0,ea.jsx)("span",{children:"Enabled"})]})]})]})})}):null!==o&&void 0!==o&&o.connected&&!s?null:(0,ea.jsx)("div",{className:"max-w-lg mb-6","data-testid":"taptile-provision-panel",children:(0,ea.jsx)("div",{className:"bg-white border border-slate-200 rounded-xl p-5",children:(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-9 h-9 rounded-lg bg-indigo-50 flex items-center justify-center shrink-0 mt-0.5",children:(0,ea.jsx)(Gl,{size:16,className:"text-indigo-600"})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-800 text-sm",children:s?"Taptile workspace (disabled)":"Auto-provision Taptile"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:s?"Your Taptile workspace exists but is currently disabled in NexusCMS. Re-enable to restore the connection.":"Click Enable to automatically create your Taptile workspace. No separate signup required \u2014 the connection is fully automated."})]}),(0,ea.jsx)(sg,{size:"sm",onClick:z,disabled:N,className:"shrink-0 bg-indigo-600 hover:bg-indigo-700 text-white","data-testid":"taptile-provision-btn",children:N?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-1.5"})," Setting up\u2026"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(LJ,{size:14,className:"mr-1.5"})," ",s?"Re-enable":"Enable Taptile"]})})]})})}):(0,ea.jsx)("div",{className:"max-w-lg mb-6","data-testid":"taptile-provision-locked",children:(0,ea.jsxs)("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-5 flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-9 h-9 rounded-lg bg-slate-200 flex items-center justify-center shrink-0 mt-0.5",children:(0,ea.jsx)(Lj,{size:16,className:"text-slate-500"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-700 text-sm",children:"Taptile Auto-Provisioning"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500 mt-0.5",children:["Automatically create your Taptile workspace with one click. Available on the ",(0,ea.jsx)("strong",{children:"Pro plan"})," and above."]})]})]})})})(),!R&&(null===o||void 0===o?void 0:o.provisioned)&&(null===o||void 0===o?void 0:o.provision_enabled)&&!(null!==o&&void 0!==o&&o.connected)&&!d&&(()=>{const e="existing"===(null===o||void 0===o?void 0:o.provision_status);return(0,ea.jsx)("div",{className:"max-w-2xl mb-6","data-testid":"taptile-provision-no-key",children:(0,ea.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-5 flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-9 h-9 rounded-lg bg-amber-100 flex items-center justify-center shrink-0 mt-0.5",children:(0,ea.jsx)(WN,{size:16,className:"text-amber-600"})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("p",{className:"font-semibold text-amber-800 text-sm",children:e?"Your existing Taptile account has been re-linked \u2014 one step to finish":"One more step \u2014 enter your Taptile API key"}),(0,ea.jsx)("p",{className:"text-xs text-amber-700 mt-1",children:e?(0,ea.jsxs)(ea.Fragment,{children:["Because this is an existing Taptile account, the API key can't be retrieved automatically. Open your"," ",null!==o&&void 0!==o&&o.portal_url?(0,ea.jsx)("button",{onClick:()=>window.open(o.portal_url,"_blank","noopener,noreferrer"),className:"underline font-semibold hover:text-amber-900",children:"Taptile Portal"}):(0,ea.jsx)("span",{className:"font-semibold",children:"Taptile Portal"})," ","\u2192 Settings \u2192 API Key, copy it, and paste it below."]}):(0,ea.jsxs)(ea.Fragment,{children:["Your workspace was just created. Find your API key in your"," ",null!==o&&void 0!==o&&o.portal_url?(0,ea.jsx)("button",{onClick:()=>window.open(o.portal_url,"_blank","noopener,noreferrer"),className:"underline font-semibold hover:text-amber-900",children:"Taptile Portal"}):(0,ea.jsx)("span",{className:"font-semibold",children:"Taptile Portal"})," ","under Settings \u2192 API Key, or try Auto-connect below."]})}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,ea.jsxs)(sg,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",onClick:()=>u(!0),"data-testid":"taptile-enter-key-btn",children:[(0,ea.jsx)(PJ,{size:13,className:"mr-1.5"})," Enter API Key"]}),!e&&(0,ea.jsx)(sg,{size:"sm",variant:"outline",onClick:P,disabled:S,"data-testid":"taptile-auto-retrieve-btn",children:S?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:13,className:"animate-spin mr-1.5"})," Trying\u2026"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Gl,{size:13,className:"mr-1.5"})," Auto-connect"]})}),(null===o||void 0===o?void 0:o.portal_url)&&(0,ea.jsxs)("button",{onClick:()=>window.open(o.portal_url,"_blank","noopener,noreferrer"),className:"flex items-center gap-1.5 text-xs text-amber-700 underline hover:text-amber-900","data-testid":"taptile-portal-link-amber",children:[(0,ea.jsx)(bj,{size:12})," Open Taptile Portal"]})]})]})]})})})(),!R&&!(null!==o&&void 0!==o&&o.connected)&&!d&&!(null!==o&&void 0!==o&&o.provision_enabled)&&!["pro","enterprise","reseller"].includes((null===o||void 0===o?void 0:o.plan_level)||"freemium")&&(0,ea.jsxs)("div",{className:"max-w-lg mx-auto","data-testid":"taptile-not-connected",children:[(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-8 text-center mb-6",children:[(0,ea.jsx)("div",{className:"w-14 h-14 roun
2ded-full bg-slate-100 flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(IJ,{size:26,className:"text-slate-400"})}),(0,ea.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-2",children:"Connect your Taptile account"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-6",children:"Enter your Taptile API key below. This enables event push notifications and the in-app Taptile admin panel."}),(0,ea.jsxs)(sg,{onClick:()=>u(!0),className:"bg-indigo-600 hover:bg-indigo-700 w-full","data-testid":"taptile-connect-cta",children:[(0,ea.jsx)(PJ,{size:16,className:"mr-2"})," Enter API Key"]})]}),(0,ea.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4 text-sm text-amber-800",children:[(0,ea.jsx)("p",{className:"font-medium mb-1",children:"Where do I get my API key?"}),(0,ea.jsxs)("p",{children:["Your Taptile API key is provided by Taptile when you sign up. Contact ",(0,ea.jsx)("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"})," if you need it resent."]})]})]}),!R&&d&&(0,ea.jsx)("div",{className:"max-w-lg","data-testid":"taptile-settings-form",children:(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 space-y-5",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("h2",{className:"font-semibold text-slate-900",children:null!==o&&void 0!==o&&o.connected?"Update Taptile Connection":"Connect Taptile"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{u(!1),h("")},children:"Cancel"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700",children:"Taptile API Key *"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mb-1.5",children:["Issued by Taptile to your school/organisation.",(null===o||void 0===o?void 0:o.api_key_masked)&&(0,ea.jsxs)("span",{className:"ml-1 text-slate-500",children:["Current: ",(0,ea.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:o.api_key_masked})]})]}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(BN,{type:g?"text":"password",placeholder:null!==o&&void 0!==o&&o.connected?"Paste new key to replace\u2026":"Paste your Taptile API key",value:m,onChange:e=>h(e.target.value),className:"pr-10","data-testid":"taptile-api-key-input"}),(0,ea.jsx)("button",{type:"button",onClick:()=>f(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:g?(0,ea.jsx)(LN,{size:16}):(0,ea.jsx)(IN,{size:16})})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700",children:"Taptile Base URL"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-1.5",children:"Leave as default unless Taptile has given you a custom URL."}),(0,ea.jsx)(BN,{type:"url",value:x,onChange:e=>p(e.target.value),placeholder:"https://taptile.app","data-testid":"taptile-api-url-input"})]}),(0,ea.jsx)("div",{className:"flex gap-3 pt-1",children:(0,ea.jsxs)(sg,{onClick:async()=>{if(m.trim()){b(!0);try{await _l.post("/integrations/taptile/settings",{api_key:m.trim(),api_url:x}),qs.success("Taptile connected"),h(""),u(!1),await A(),n("idle")}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save")}finally{b(!1)}}else qs.error("API key is required")},disabled:v||!m.trim(),className:"flex-1","data-testid":"taptile-save-btn",children:[v?(0,ea.jsx)(ql,{size:15,className:"animate-spin mr-2"}):(0,ea.jsx)(cr,{size:15,className:"mr-2"}),null!==o&&void 0!==o&&o.connected?"Update Key":"Connect Taptile"]})})]})}),!R&&(null===o||void 0===o?void 0:o.connected)&&!d&&(0,ea.jsxs)(ea.Fragment,{children:["loading"===a&&(0,ea.jsxs)("div",{className:"flex items-center justify-center py-16 text-slate-400","data-testid":"taptile-embed-loading",children:[(0,ea.jsx)(ql,{className:"animate-spin mr-2",size:18})," Opening Taptile\u2026"]}),"error"===a&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-8 text-center max-w-lg","data-testid":"taptile-embed-error",children:[(0,ea.jsx)("p",{className:"text-slate-600 mb-1 text-sm font-medium",children:"Could not load the Taptile panel"}),(0,ea.jsx)("p",{className:"text-slate-400 text-xs mb-4",children:l}),(0,ea.jsxs)(sg,{variant:"outline",onClick:F,"data-testid":"taptile-embed-retry",children:[(0,ea.jsx)(gq,{size:15,className:"mr-2"})," Retry"]})]})]})]})]})},UJ=Vl("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"}]]),HJ=()=>{const[e,s]=(0,t.useState)(null),[a,n]=(0,t.useState)(!1),[l,r]=(0,t.useState)(!1),i=(0,t.useCallback)(async()=>{try{const e=await _l.get("/stripe-connect/status");s(e.data)}catch(e){s({connected:!1})}},[]);(0,t.useEffect)(()=>{i();const e=new URLSearchParams(window.location.search);"1"!==e.get("stripe_return")&&"1"!==e.get("stripe_refresh")||window.history.replaceState({},"",window.location.pathname)},[i]);const o=async()=>{n(!0);try{const e=await _l.post("/stripe-connect/start",{origin_url:window.location.origin});window.location.href=e.data.onboarding_url}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not start Stripe setup \u2014 please try again"),n(!1)}},c=null===e,d=null===e||void 0===e?void 0:e.charges_enabled,u=(null===e||void 0===e?void 0:e.connected)&&!(null!==e&&void 0!==e&&e.charges_enabled);return(0,ea.jsxs)("div",{className:"flex","data-testid":"stripe-payments-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-8",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-lg bg-violet-600 flex items-center justify-center text-white",children:(0,ea.jsx)(Aj,{size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Stripe Payments"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Connect your Str
2ipe account to receive event ticket sales directly."})]})]}),c&&(0,ea.jsx)("div",{className:"flex items-center justify-center py-16 text-slate-400",children:(0,ea.jsx)(ql,{className:"animate-spin",size:20})}),!c&&(0,ea.jsxs)("div",{className:"max-w-2xl space-y-6",children:[(0,ea.jsx)("div",{className:"rounded-xl border p-6 ".concat(d?"bg-emerald-50 border-emerald-200":u?"bg-amber-50 border-amber-200":"bg-white border-slate-200"),children:(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0 ".concat(d?"bg-emerald-100":u?"bg-amber-100":"bg-slate-100"),children:d?(0,ea.jsx)(cr,{size:20,className:"text-emerald-600"}):u?(0,ea.jsx)(ql,{size:20,className:"text-amber-500 animate-spin"}):(0,ea.jsx)(Aj,{size:20,className:"text-slate-400"})}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,ea.jsx)("h2",{className:"font-semibold text-slate-900 text-base",children:d?"Stripe account connected":u?"Completing Stripe setup\u2026":"No Stripe account connected"}),d&&(0,ea.jsx)(EC,{className:"bg-emerald-100 text-emerald-700 border-emerald-200","data-testid":"stripe-connect-active-badge",children:"Active"}),u&&(0,ea.jsx)(EC,{className:"bg-amber-100 text-amber-700 border-amber-200","data-testid":"stripe-connect-pending-badge",children:"Pending"})]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:d?"Ticket sales go directly to your bank account. NexusCMS deducts a 1% platform fee per transaction.":u?'Your Stripe account is being set up. If you haven\'t finished the sign-up, click "Continue setup" to complete it.':"Connect a Stripe account to receive ticket payments directly. New or existing Stripe accounts are both supported."}),d&&(null===e||void 0===e?void 0:e.account_id)&&(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1.5 font-mono","data-testid":"stripe-connect-account-id",children:["Account: ",e.account_id]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3 mt-4",children:[!(null!==e&&void 0!==e&&e.connected)&&(0,ea.jsx)(sg,{onClick:o,disabled:a,className:"bg-violet-600 hover:bg-violet-700 text-white","data-testid":"stripe-connect-btn",children:a?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:15,className:"animate-spin mr-2"})," Redirecting to Stripe\u2026"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(gJ,{size:15,className:"mr-2"})," Connect Stripe Account"]})}),u&&(0,ea.jsx)(sg,{onClick:o,disabled:a,className:"bg-amber-600 hover:bg-amber-700 text-white","data-testid":"stripe-connect-resume-btn",children:a?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:15,className:"animate-spin mr-2"})," Redirecting\u2026"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(wj,{size:15,className:"mr-2"})," Continue Setup"]})}),(null===e||void 0===e?void 0:e.connected)&&(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:async()=>{if(window.confirm("Disconnect your Stripe account?\n\nThis only removes the link from NexusCMS \u2014 your Stripe account will not be deleted. Ticket sales will fall back to the platform account until you reconnect.")){r(!0);try{await _l.delete("/stripe-connect/disconnect"),qs.success("Stripe account disconnected"),s({connected:!1})}catch(e){qs.error("Failed to disconnect")}finally{r(!1)}}},disabled:l,className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200","data-testid":"stripe-connect-disconnect-btn",children:[l?(0,ea.jsx)(ql,{size:14,className:"animate-spin mr-1.5"}):(0,ea.jsx)(UJ,{size:14,className:"mr-1.5"}),"Disconnect"]}),(null===e||void 0===e?void 0:e.connected)&&(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:i,"data-testid":"stripe-connect-refresh-btn",children:[(0,ea.jsx)(ql,{size:13,className:"mr-1.5"})," Refresh Status"]})]})]})]})}),(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-semibold text-slate-800 text-sm mb-4 flex items-center gap-2",children:[(0,ea.jsx)(qj,{size:15,className:"text-slate-400"}
2)," How it works"]}),(0,ea.jsx)("div",{className:"space-y-3",children:[{step:"1",title:"Connect your Stripe account",desc:'Click "Connect Stripe Account" above. You can create a new Stripe account or link an existing one. Stripe handles all identity verification.'},{step:"2",title:"Enable tickets on your events",desc:'In the Events module, toggle "Sell tickets via Stripe" on any event and set your ticket price.'},{step:"3",title:"Collect direct payouts",desc:"Buyers pay via Stripe Checkout. Funds go directly to your bank account. NexusCMS deducts a flat 1% platform fee automatically."}].map(e=>{let{step:t,title:s,desc:a}=e;return(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsx)("div",{className:"w-6 h-6 rounded-full bg-violet-100 text-violet-700 text-xs font-bold flex items-center justify-center shrink-0 mt-0.5",children:t}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-700",children:s}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:a})]})]},t)})})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-5",children:[(0,ea.jsx)("h3",{className:"font-semibold text-slate-700 text-sm mb-2",children:"Platform fee"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["NexusCMS charges a flat ",(0,ea.jsx)("strong",{className:"text-slate-700",children:"1% platform fee"})," on each ticket sale processed via your connected Stripe account. This is deducted automatically \u2014 you receive the remaining 99% (minus Stripe's own processing fees)."]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-2",children:"Example: $50 ticket \u2192 you receive $49.50 \u2212 Stripe fees. No monthly fees. No hidden charges."})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-500",children:[(0,ea.jsx)(bj,{size:14,className:"shrink-0"}),(0,ea.jsx)("a",{href:"https://dashboard.stripe.com",target:"_blank",rel:"noreferrer",className:"underline hover:text-slate-700","data-testid":"stripe-dashboard-link",children:"Open Stripe Dashboard"}),(0,ea.jsx)("span",{children:"to view payouts, transactions, and account settings."})]})]})]})]})},WJ=()=>{const{id:e}=je(),s=be(),a="new"===e,[n,l]=(0,t.useState)({title:"",subject:"",blocks:[],status:"draft",showReadInBrowser:!0}),[r,i]=(0,t.useState)(!a),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(""),[p,g]=(0,t.useState)(!1),[f,v]=(0,t.useState)("auto"),[b,j]=(0,t.useState)(!1),[y,N]=(0,t.useState)(""),[w,C]=(0,t.useState)("en"),[k,D]=(0,t.useState)(!1),[_,S]=(0,t.useState)([]),[E,A]=(0,t.useState)([]),[F,T]=(0,t.useState)([]),[z,M]=(0,t.useState)([]),[P,B]=(0,t.useState)(""),[R,L]=(0,t.useState)("now"),[I,O]=(0,t.useState)(""),[U,H]=(0,t.useState)(""),[W,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{a||q()},[e]);const q=async()=>{try{const t=(await _l.get("/newsletters/".concat(e))).data;t.blocks||(t.blocks=[]),l(t)}catch(t){qs.error("Failed to load newsletter"),s("/newsletters")}finally{i(!1)}},$=e=>{if(!e||0===e.length)return'<p style="color: #94a3b8; text-align: center; padding: 40px;">No content yet. Add blocks to see preview.</p>';const t=e.filter(e=>!1!==e.isPublished);return 0===t.length?'<p style="color: #94a3b8; text-align: center; padding: 40px;">All blocks are hidden. Unhide some blocks to see preview.</p>':t.map(e=>{var t,s,a;const{type:n,content:l={}}=e;switch(n){case"heading":const e=l.level||2,n=(l.html||l.text||"").replace(/<[^>]*>/g,"");return"<h".concat(e,' style="margin: 20px 0 10px 0; color: #1e293b;">').concat(n,"</h").concat(e,">");case"paragraph":{const e=l.blockButton||{};let t="";if(e.enabled&&e.text){const s=e.color||"#6366f1",a=e.textColor||"#ffffff",n=e.align||"center",l=e.fullWidth?"width: 100%; display: block; box-sizing: border-box;":"display: inline-block;",r="pill"===e.radius?"9999px":"square"===e.radius?"0px":"6px",i={sm:"8px 20px",md:"12px 30px",lg:"16px 40px"}[e.size||"md"]||"12px 30px",o=e.openInNewTab?' target="_blank" rel="noopener noreferrer"':"",c=e.marginTop||16;t='<div style="margin-top:'.concat(c,"px;text-align:").concat(n,';"><a href="').concat(e.url||"#",'"').concat(o,' style="').concat(l,"background-color:").concat(s,";color:").concat(a,";padding:").concat(i,";border-radius:").concat(r,';text-decoration:none;font-weight:600;text-align:center;">').concat(e.text,"</a></div>")}return'<div style="margin: 10px 0; line-height: 1.7; color: #475569;">'.concat(l.html||l.text||"","</div>").concat(t)}case"image":const r=l.url||l.imageUrl;return r?'\n <div style="margin: 20px 0; text-align: center;">\n <img src="'.concat(r,'" alt="').concat(l.alt||l.imageAlt||"",'" style="max-width: 100%; height: auto; border-radius: 8px;"/>\n ').concat(l.caption?'<p style="font-size: 14px; color: #94a3b8; margin-top: 8px;">'.concat(l.caption,"</p>"):"","\n </div>\n "):"";case"quote":return'<blockquote style="border-left: 4px solid #10b981; padding-left: 20px; margin: 20px 0; font-style: italic; color: #64748b;">'.concat(l.text||l.html||"","</blockquote>");case"list":const i=l.items||[];return'\n <ul style="margin: 10px 0; padding-left: 30px;">\n '.concat(i.map(e=>'<li style="margin: 5px 0; color: #475569;">'.concat(e,"</li>")).join(""),"\n </ul>\n ");case"code":return'<pre style="background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; font-family: monospace; font-size: 14px;">'.concat(l.code||"","</pre>");case"two-column":return'\n <table width="100%" cellpadding="0" cellspacing="0" style="margin: 20px 0;">\n <tr>\n <td width="48%" valign="top" style="padding-right: 2%;">'.concat(l.leftHtml||"",'</td>\n <td width="48%" valign="top" style="padding-left: 2%;">').concat(l.rightHtml||"","</td>\n </tr>\n </table>\n ");case"image-text-row":const o=l.imageUrl||"",c=l.textHtml||"<p>Text content</p>";return"left"===l.imagePosition?'\n <table width="100%" cellpadding="0" cellspacing="0" style="margin: 20px 0;">\n <tr>\n <td width="48%" valign="top" style="padding-right: 2%;">\n '.concat(o?'<img src="'.concat(o,'" alt="').concat(l.imageAlt||"",'" style="max-width: 100%; height: auto; border-radius: 8px;"/>'):"",'\n </td>\n <td width="48%" valign="top" style="padding-left: 2%;">').concat(c,"</td>\n </tr>\n </table>\n "):'\n <table width="100%" cellpadding="0" cellspacing="0" style="margin: 20px 0;">\n <tr>\n <td width="48%" valign="top" style="padding-right: 2%;">'.concat(c,'</td>\n <td width="48%" valign="top" style="padding-left: 2%;">\n ').concat(o?'<img src="'.concat(o,'" alt="').concat(l.imageAlt||"",'" style="max-width: 100%; height: auto; border-radius: 8px;"/>'):"","\n </td>\n </tr>\n </table>\n ");case"image-text-stack":const d=l.imageUrl||"",u=l.textHtml||"<p>Text content</p>";return"top"===l.imagePosition?'\n <div style="margin: 20px 0;">\n '.concat(d?'<div style="text-align: center; margin-bottom: 16px;"><img src="'.concat(d,'" alt="').concat(l.imageAlt||"",'" style="max-width: 100%; height: auto; border-radius: 8px;"/></div>'):"",'\n <div style="line-height: 1.7; color: #475569;">').concat(u,"</div>\n </div>\n "):'\n <div style="margin: 20px 0;">\n <div style="line-height: 1.7; color: #475569;">'.concat(u,"</div>\n ").concat(d?'<div style="text-align: center; margin-top: 16px;"><img src="'.concat(d,'" alt="').concat(l.imageAlt||"",'" style="max-width: 100%; height: auto; border-radius: 8px;"/></div>'):"","\n </div>\n ");case"card-grid":case"columns":{const e=l.columns||[];if(0===e.length)return"";const t=Math.floor(100/e.length),s=e=>{if(!e.hasButton||!e.buttonText)return"";const t=e.buttonColor||"#6366f1",s=e.buttonTextColor||"#ffffff",a=e.buttonStyle||"solid",n={sm:"6px 16px",md:"10px 24px",lg:"14px 32px"}[e.buttonSize||"md"]||"10px 24px",l=e.buttonAlign||"left",r=e.buttonFullWidth?"width: 100%; display: block; box-sizing: border-box;":"display: inline-block;",i=e.buttonUrl||"#",o=e.buttonOpenInNewTab?' target="_blank" rel="noopener noreferrer"':"",c="outline"===a?"transparent":t,d="outline"===a?t:s,u="outline"===a?"2px solid ".concat(t):"none";return'<div style="margin-top:12px;text-align:'.concat(l,';"><a href="').concat(i,'"').concat(o,' style="').concat(r,"background-color:").concat(c,";color:").concat(d,";border:").concat(u,";padding:").concat(n,';border-radius:6px;text-decoration:none;font-weight:600;text-align:center;">').concat(e.buttonText,"</a></div>")};return'\n <table width="100%" cellpadding="0" cellspacing="0" style="margin: 20px 0;">\n <tr>\n '.concat(e.map(e=>
2'\n <td width="'.concat(t,'%" valign="top" style="padding: 0 8px;">\n ').concat(e.imageUrl?'<img src="'.concat(e.imageUrl,'" alt="" style="max-width:100%;height:auto;border-radius:8px;margin-bottom:8px;"/>'):"","\n ").concat(e.html||e.text||"","\n ").concat(s(e),"\n </td>\n ")).join(""),"\n </tr>\n </table>\n ")}case"button":{const e=l.text||"Click Here",t=l.url||"#",s=l.color||"#6366f1",a=l.textColor||"#ffffff",n=l.align||"center",r=l.fullWidth||!1,i="pill"===l.borderRadius?"9999px":"square"===l.borderRadius?"0px":"6px",o=l.openInNewTab?' target="_blank" rel="noopener noreferrer"':"",c={sm:"8px 20px",md:"12px 30px",lg:"16px 40px",xl:"20px 48px"}[l.size]||"12px 30px",d=r?"width: 100%; display: block; box-sizing: border-box;":"display: inline-block;";return'\n <div style="margin: 20px 0; text-align: '.concat(n,';">\n <a href="').concat(t,'"').concat(o,' style="').concat(d," background-color: ").concat(s,"; color: ").concat(a,"; text-decoration: none; padding: ").concat(c,"; border-radius: ").concat(i,'; font-weight: 600; text-align: center; cursor: pointer;">').concat(e,"</a>\n </div>\n ")}case"hero":const m=(l.slides||[])[0]||{},h=null!==(t=null!==(s=null!==(a=m.imageUrl)&&void 0!==a?a:l.imageUrl)&&void 0!==s?s:l.backgroundImage)&&void 0!==t?t:"",x=void 0!==m.headline?m.headline:void 0!==l.headline?l.headline:l.title||"",p=void 0!==m.subheadline?m.subheadline:void 0!==l.subheadline?l.subheadline:l.subtitle||"",g=void 0!==m.buttonText?m.buttonText:void 0!==l.buttonText?l.buttonText:"",f=m.buttonUrl||l.buttonUrl||"#",v=l.useBackgroundColor||"color"===l.backgroundType,b=m.backgroundColor||l.backgroundColor||"#6366f1",j=x||p||g;let y=v?"background-color: ".concat(b,";"):h?"background-image: url('".concat(h,"'); background-size: cover; background-position: center;"):"background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);";return'\n <div style="margin: 20px 0; text-align: center; padding: 60px 20px; '.concat(y,' border-radius: 8px;">\n ').concat(j?'\n <div style="background: rgba(0,0,0,0.5); padding: 40px; border-radius: 8px; display: inline-block; max-width: 600px;">\n '.concat(x?'<h1 style="color: white; font-size: 32px; margin: 0 0 16px 0; font-weight: bold;">'.concat(x,"</h1>"):"","\n ").concat(p?'<p style="color: rgba(255,255,255,0.9); font-size: 18px; margin: 0 0 20px 0;">'.concat(p,"</p>"):"","\n ").concat(g?'<a href="'.concat(f,'" style="display: inline-block; background: white; color: #1e293b; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: 600;">').concat(g,"</a>"):"","\n </div>\n "):"","\n </div>\n ");case"article-card":const N=l.articleTitle||"Article Title",w=l.articleExcerpt||"",C=l.articleImage||"",k=l.articleDate||"",D=l.displayStyle||"card",_=!1!==l.showImage,S=!1!==l.showExcerpt,E=!1!==l.showDate,A=!1!==l.showReadMore,F=l.readMoreText||"Read Full Article";return"headline"===D?'\n <div style="margin: 20px 0; padding: 20px; border-left: 4px solid #6366f1;">\n <h2 style="margin: 0 0 8px 0; color: #1e293b; font-size: 24px;">'.concat(N,"</h2>\n ").concat(E&&k?'<p style="margin: 0; color: #64748b; font-size: 14px;">'.concat(k,"</p>"):"","\n </div>\n "):"full"===D?'\n <div style="margin: 20px 0;">\n '.concat(_&&C?'<img src="'.concat(C,'" alt="').concat(N,'" style="max-width: 100%; height: auto; border-radius: 8px; margin-bottom: 16px;"/>'):"",'\n <h2 style="margin: 0 0 12px 0; color: #1e293b; font-size: 24px;">').concat(N,"</h2>\n ").concat(E&&k?'<p style="margin: 0 0 12px 0; color: #64748b; font-size: 14px;">'.concat(k,"</p>"):"","\n ").concat(S&&w?'<p style="margin: 0; line-height: 1.6; color: #475569;">'.concat(w,"</p>"):"","\n </div>\n "):'\n <div style="margin: 20px 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;">\n '.concat(_&&C?'<img src="'.concat(C,'" alt="').concat(N,'" style="width: 100%; height: 200px; object-fit: cover;"/>'):"",'\n <div style="padding: 20px;">\n <h3 style="margin: 0 0 8px 0; color: #1e293b; font-size: 20px;">').concat(N,"</h3>\n ").concat(E&&k?'<p style="margin: 0 0 8px 0; color: #64748b; font-size: 12px;">'.concat(k,"</p>"):"","\n ").concat(S&&w?'<p style="margin: 0 0 16px 0; line-height: 1.5; color: #475569; font-size: 14px;">'.concat(w,"</p>"):"","\n ").concat(A?'<a href="#" style="color: #6366f1; text-decoration: none; font-weight: 600; font-size: 14px;">'.concat(F," \u2192</a>"):"","\n </div>\n </div>\n ");case"newsletter-header":const T=l.logoUrl||"",z=l.logoWidth||150,M=!1!==l.showLogo,P=l.backgroundColor||"#6366f1",B=l.textColor||"#ffffff",R=l.alignment||"center",L=l.links||[];let I=L.map((e,t)=>{const s=t<L.length-1?'<span style="color: '.concat(B,'; margin: 0 12px; opacity: 0.5;">|</span>'):"";return'<a href="'.concat(e.url||"#",'" style="color: ').concat(B,'; text-decoration: none; font-weight: 500; font-size: 14px;">').concat(e.text||"","</a>").concat(s)}).join("");return'\n <div style="background-color: '.concat(P,"; padding: 20px; text-align: ").concat(R,'; border-radius: 8px; margin: 0 0 20px 0;">\n ').concat(M&&T?'<img src="'.concat(T,'" alt="Logo" style="width: ').concat(z,"px; max-width: 100%; ").concat("center"===R?"display: block; margin: 0 auto 12px;":"margin-bottom: 12px;",'"/>'):"","\n <div>").concat(I,"</div>\n </div>\n ");default:return""}}).join("\n")};return r?(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 bg-white p-8 flex items-center justify-center",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading newsletter..."})})]}):(0,ea.jsxs)("div",{className:"flex","data-testid":"newsletter-editor",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 bg-white",children:[(0,ea.jsx)("div",{className:"border-b border-slate-200 px-8 py-4 bg-white sticky top-0 z-10",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto flex justify-between items-center",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4 flex-1",children:[(0,ea.jsx)(sg,{variant:"ghost",onClick:()=>s("/newsletters"),"data-testid":"back-button",children:(0,ea.jsx)(_j,{size:20})}),(0,ea.jsxs)("div",{className:"flex-1 max-w-2xl",children:[(0,ea.jsx)(BN,{value:n.title||"",onChange:e=>l(d(d({},n),{},{title:e.target.value})),placeholder:"Newsletter title...",className:"text-2xl font-semibold border-none p-0 focus:ring-0 mb-2","data-testid":"newsletter-title-input",style:{fontFamily:"Manrope, sans-serif"}}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Yl,{size:14,className:"text-slate-400"}),(0,ea.jsx)(BN,{value:n.subject||"",onChange:e=>l(d(d({},n),{},{subject:e.target.value})),placeholder:"Email subject line...",className:"text-base border-none p-0 focus:ring-0 flex-1","data-testid":"newsletter-subject-input"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-2 pt-2 border-t border-slate-100",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm text-slate-600 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==n.showRead
2InBrowser,onChange:e=>l(d(d({},n),{},{showReadInBrowser:e.target.checked})),className:"rounded border-slate-300"}),'Show "Read in Browser" link']}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"(adds link at top of email)"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(sg,{variant:p?"default":"outline",onClick:()=>g(!p),"data-testid":"preview-toggle",children:p?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(LN,{size:18,className:"mr-2"}),"Edit"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(IN,{size:18,className:"mr-2"}),"Preview"]})}),p&&(0,ea.jsxs)("div",{className:"inline-flex items-center rounded-md border border-slate-300 bg-white p-1","data-testid":"newsletter-viewport-switcher",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>v("mobile"),title:"Mobile (375 px)","data-testid":"newsletter-viewport-mobile",className:"p-1.5 rounded transition-colors ".concat("mobile"===f?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(RN,{size:16})}),(0,ea.jsx)("button",{type:"button",onClick:()=>v("tablet"),title:"Tablet (600 px \u2014 common email width)","data-testid":"newsletter-viewport-tablet",className:"p-1.5 rounded transition-colors ".concat("tablet"===f?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(MD,{size:16})}),(0,ea.jsx)("button",{type:"button",onClick:()=>v("auto"),title:"Auto (full pane)","data-testid":"newsletter-viewport-auto",className:"p-1.5 rounded transition-colors ".concat("auto"===f?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(PD,{size:16})})]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>{const t=window.open("","newsletter_preview_".concat(Date.now()));if(t){t.document.open();const s='\n <!DOCTYPE html>\n <html>\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Email Preview: '.concat(n.subject||"Newsletter",'</title>\n <style>\n * { box-sizing: border-box; margin: 0; padding: 0; }\n body { \n font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;\n background-color: #f1f5f9;\n padding: 20px;\n }\n .email-container {\n max-width: 600px;\n margin: 0 auto;\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);\n overflow: hidden;\n }\n .email-header {\n background: linear-gradient(135deg, #10b981 0%, #059669 100%);\n color: white;\n padding: 24px;\n }\n .email-header h1 {\n font-size: 14px;\n font-weight: 500;\n opacity: 0.9;\n margin-bottom: 8px;\n }\n .email-header h2 {\n font-size: 22px;\n font-weight: 700;\n }\n .email-body {\n padding: 32px 24px;\n }\n .email-body h1, .email-body h2, .email-body h3 {\n margin: 20px 0 10px 0;\n color: #1e293b;\n }\n .email-body p {\n margin: 10px 0;\n line-height: 1.7;\n color: #475569;\n }\n .email-body img {\n max-width: 100%;\n height: auto;\n margin: 20px 0;\n border-radius: 8px;\n }\n .email-body blockquote {\n border-left: 4px solid #10b981;\n padding-left: 20px;\n margin: 20px 0;\n font-style: italic;\n color: #64748b;\n }\n .email-body ul, .email-body ol {\n margin: 10px 0;\n padding-left: 30px;\n }
2\n .email-body li {\n margin: 5px 0;\n color: #475569;\n }\n .email-footer {\n background: #f8fafc;\n padding: 20px 24px;\n text-align: center;\n border-top: 1px solid #e2e8f0;\n }\n .email-footer p {\n font-size: 12px;\n color: #94a3b8;\n }\n .toolbar {\n position: fixed;\n top: 20px;\n right: 20px;\n background: white;\n padding: 12px 16px;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n font-size: 13px;\n color: #64748b;\n }\n </style>\n </head>\n <body>\n <div class="toolbar">\n \ud83d\udce7 Email Preview Mode | Width: 600px\n </div>\n <div class="email-container">\n ').concat(!1!==n.showReadInBrowser?'\n <div style="text-align: center; padding: 10px 0; margin-bottom: 20px; border-bottom: 1px solid #e2e8f0;">\n <a href="'.concat(a?"#":"".concat("","/api/public/newsletter/").concat(e,"/view"),'" \n target="_blank"\n style="color: #64748b; font-size: 12px; text-decoration: underline;">\n Having trouble viewing this email? Read in browser\n </a>\n ').concat(a?'<span style="display: block; font-size: 10px; color: #94a3b8; margin-top: 4px;">(Save newsletter first to enable this link)</span>':"","\n </div>\n "):"",'\n <div class="email-header">\n <h1>Subject Line</h1>\n <h2>').concat(n.subject||"No subject",'</h2>\n </div>\n <div class="email-body" id="email-content">\n ').concat($(n.blocks||[]),'\n </div>\n <div class="email-footer">\n <p>This is a preview of how your newsletter will appear in email clients.</p>\n <p style="margin-top: 8px;">\xa9 ').concat((new Date).getFullYear()," Your Company. All rights reserved.</p>\n </div>\n </div>\n </body>\n </html>\n ");t.document.write(s),t.document.close()}},"data-testid":"full-preview-button",title:"Open email preview in new window",children:[(0,ea.jsx)(bj,{size:18,className:"mr-2"}),"Email Preview"]}),!a&&(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>j(!0),"data-testid":"test-email-button",title:"Send a test email to yourself",children:[(0,ea.jsx)(pJ,{size:18,className:"mr-2"}),"Test Email"]}),(0,ea.jsxs)(sg,{onClick:async()=>{if(n.title&&n.subject){c(!0);try{if(a){const e=await _l.post("/newsletters",n);qs.success("Newsletter created successfully"),s("/newsletters/".concat(e.data.newsletter_id))}else await _l.put("/newsletters/".concat(e),n),qs.success("Newsletter updated successfully")}catch(t){qs.error("Failed to save newsletter")}finally{c(!1)}}else qs.error("Please enter title and subject")},disabled:o,variant:"outline","data-testid":"save-button",children:[(0,ea.jsx)(BD,{size:18,className:"mr-2"}),o?"Saving...":"Save"]}),!a&&(0,ea.jsxs)(sg,{onClick:()=>{T([]),M([]),x(""),B(""),L("now"),O(""),H(""),m(!0),(async()=>{try{const e=await _l.get("/subscriber-groups");S(e.data||[])}catch(e){console.error("Failed to load groups:",e)}})(),(async()=>{try{const e=await _l.get("/subscribers");A(e.data.subscribers||[])}catch(e){console.error("Failed to load subscribers:",e)}})()},className:"bg-emerald-600 hover:bg-emerald-700","data-testid":"send-button",children:[(0,ea.jsx)(dr,{size:18,className:"mr-2"}),"Send"]})]})]})}),(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)("div",{className:"".concat(p?"w-1/2 border-r border-slate-200":"flex-1"," px-8 pb-20 transition-all"),children:(0,ea.jsx)(nY,{blocks:n.blocks||[],onChange:e=>l(d(d({},n),{},{blocks:e})),pages:[]})}),p&&(0,ea.jsx)("div",{className:"w-1/2 bg-slate-100 p-6 overflow-auto",style:{maxHeight:"calc(100vh - 80px)"},children:(()=>{const e="mobile"===f?375:"tablet"===f?600:null,t=e?"":"max-w-lg",s=e?{width:"".concat(e,"px"),maxWidth:"100%"}:{};return(0,ea.jsxs)("div",{className:"".concat(t," mx-auto"),style:s,"data-testid":"newsletter-preview-".concat(f),children:[(0,ea.jsxs)("div",{className:"bg-slate-200 rounded-t-lg p-3 flex items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex gap-1.5",children:[(0,ea.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-400"}),(0,ea.jsx)("div",{className:"w-3 h-3 rounded-full bg-yellow-400"}),(0,ea.jsx)("div",{className:"w-3 h-3 rounded-full bg-green-400"})]}),(0,ea.jsxs)("span",{className:"text-xs text-slate-500 ml-2",children:["Email Preview",e?" \xb7 ".concat(e," px"):""]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-b-lg shadow-lg overflow-hidden",children:[(0,ea.jsxs)("div",{className:"bg-gradient-to-r from-emerald-500 to-emerald-600 text-white p-6",children:[(0,ea.jsx)("p",{className:"text-xs opacity-75 mb-1",children:"Subject"}),(0,ea.jsx)("h2",{className:"text-lg font-semibold",children:n.subject||"No subject"})]}
2),(0,ea.jsx)("div",{className:"p-6",children:n.blocks&&0!==n.blocks.length?(0,ea.jsx)(cN,{blocks:n.blocks,isQuickPreview:!0,showNavigation:!1}):(0,ea.jsx)("p",{className:"text-slate-400 text-center py-8",children:"Add content blocks to see preview"})}),(0,ea.jsx)("div",{className:"bg-slate-50 border-t border-slate-200 p-4 text-center",children:(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Preview of how your newsletter will appear in email clients"})})]})]})})()})]})]}),(0,ea.jsx)(Ok,{open:u,onOpenChange:m,children:(0,ea.jsxs)(Wk,{className:"max-w-xl max-h-[85vh] overflow-y-auto","data-testid":"send-dialog",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2 text-base",children:[(0,ea.jsx)(dr,{size:18,className:"text-emerald-600"}),"Send Newsletter"]})}),(0,ea.jsxs)("div",{className:"py-2 space-y-3",children:[(0,ea.jsx)("div",{className:"bg-slate-50 rounded-lg p-2",children:(0,ea.jsxs)("p",{className:"text-xs text-slate-600",children:[(0,ea.jsx)("strong",{children:"Subject:"})," ",n.subject||"No subject"]})}),(0,ea.jsxs)("div",{className:"bg-gradient-to-r from-blue-600 to-blue-700 rounded-lg p-4 shadow-md",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"text-white",children:[(0,ea.jsx)("p",{className:"font-semibold text-sm",children:"Quick Action"}),(0,ea.jsx)("p",{className:"text-blue-100 text-xs",children:"Send to all your subscribers at once"})]}),(0,ea.jsxs)("button",{type:"button","data-testid":"quick-select-all-btn",onClick:async()=>{try{const e=((await _l.get("/subscribers?page=1&per_page=10000")).data.subscribers||[]).filter(e=>"active"===e.status).map(e=>e.subscriber_id);M(e),qs.success("Selected all ".concat(e.length," subscribers!"))}catch(e){qs.error("Failed to select all")}},className:"bg-white text-blue-700 font-bold px-6 py-3 rounded-lg hover:bg-blue-50 transition-all shadow-sm flex items-center gap-2",children:[(0,ea.jsx)(uD,{size:20}),"SELECT ALL (",E.length||0,")"]})]}),z.length>0&&(0,ea.jsxs)("div",{className:"mt-2 pt-2 border-t border-blue-500 flex items-center justify-between",children:[(0,ea.jsxs)("span",{className:"text-white text-sm",children:[z.length," subscribers selected"]}),(0,ea.jsx)("button",{type:"button",onClick:()=>M([]),className:"text-blue-200 hover:text-white text-sm underline",children:"Clear selection"})]})]}),(F.length>0||z.length>0||h.trim())&&(0,ea.jsxs)("div",{className:"bg-emerald-50 border border-emerald-200 rounded-lg p-2",children:[(0,ea.jsxs)("p",{className:"text-xs font-medium text-emerald-800 flex items-center gap-1 mb-1",children:[(0,ea.jsx)(Bj,{size:12}),"Selected: ",F.length," groups, ",z.length," subscribers"]}
2),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1 max-h-12 overflow-y-auto",children:[F.map(e=>{const t=_.find(t=>t.group_id===e);return t&&(0,ea.jsxs)("span",{className:"px-1.5 py-0.5 bg-indigo-100 text-indigo-700 rounded text-[10px] flex items-center gap-0.5",children:[t.name," (",t.subscriber_count||0,")",(0,ea.jsx)("button",{onClick:()=>T(F.filter(t=>t!==e)),className:"ml-0.5 hover:text-indigo-900",children:"\xd7"})]},e)}),z.slice(0,3).map(e=>{const t=E.find(t=>t.subscriber_id===e);return t&&(0,ea.jsxs)("span",{className:"px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded text-[10px] flex items-center gap-0.5",children:[t.email.split("@")[0],"@...",(0,ea.jsx)("button",{onClick:()=>M(z.filter(t=>t!==e)),className:"ml-0.5 hover:text-blue-900",children:"\xd7"})]},e)}),z.length>3&&(0,ea.jsxs)("span",{className:"px-1.5 py-0.5 bg-blue-50 text-blue-600 rounded text-[10px]",children:["+",z.length-3," more"]})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)(Wj,{size:14,className:"text-indigo-600"}),"Send to Groups"]}),_.length>0?(0,ea.jsx)("div",{className:"flex flex-wrap gap-1.5",children:_.map(e=>(0,ea.jsxs)("button",{type:"button",className:"px-2.5 py-1 rounded-lg text-xs border-2 transition-all ".concat(F.includes(e.group_id)?"bg-indigo-100 border-indigo-400 text-indigo-700 font-medium":"bg-white border-slate-200 text-slate-600 hover:border-indigo-300 hover:bg-indigo-50"),onClick:()=>{const t=F.includes(e.group_id)?F.filter(t=>t!==e.group_id):[...F,e.group_id];T(t)},children:[F.includes(e.group_id)&&(0,ea.jsx)(uD,{size:12,className:"inline mr-1"}),e.name," ",(0,ea.jsxs)("span",{className:"text-slate-400 ml-1",children:["(",e.subscriber_count||0,")"]})]},e.group_id))}):(0,ea.jsx)("p",{className:"text-xs text-slate-500 italic",children:"No groups created yet."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)(Bj,{size:14,className:"text-blue-600"}),"Or Select Individual Subscribers",z.length>0&&(0,ea.jsxs)("span",{className:"text-xs text-blue-600",children:["(",z.length," selected)"]})]}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:14}),(0,ea.jsx)(BN,{placeholder:"Search...",value:P,onChange:e=>B(e.target.value),className:"pl-8 h-8 text-sm"})]}),E.length>0?(0,ea.jsx)("div",{className:"border rounded-lg max-h-28 overflow-y-auto",children:E.filter(e=>"active"===e.status).filter(e=>!P||e.email.toLowerCase().includes(P.toLowerCase())||(e.name||"").toLowerCase().includes(P.toLowerCase())).slice(0,50).map(e=>(0,ea.jsx)("div",{className:"flex items-center justify-between px-2 py-1.5 hover:bg-slate-50 cursor-pointer border-b last:border-b-0 ".concat(z.includes(e.subscriber_id)?"bg-blue-50":""),onClick:()=>{const t=z.includes(e.subscriber_id)?z.filter(t=>t!==e.subscriber_id):[...z,e.subscriber_id];M(t)},children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(fw,{checked:z.includes(e.subscriber_id),className:"pointer-events-none h-4 w-4"}),(0,ea.jsx)("p",{className:"text-xs font-medium",children:e.email})]})},e.subscriber_id))}):(0,ea.jsx)("p",{className:"text-xs text-slate-500 italic",children:"No subscribers yet."})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)(Yl,{size:14,className:"text-amber-600"}),"Additional Emails"]}),(0,ea.jsx)(YN,{value:h,onChange:e=>x(e.target.value),placeholder:"Enter emails (comma or newline separated)",className:"min-h-[50px] text-sm"})]}),(0,ea.jsxs)("div",{className:"space-y-2 pt-2 border-t",children:[(0,ea.jsx)(tf,{className:"text-sm",children:"When to Send"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)("button",{type:"button",className:"flex-1 px-3 py-2 rounded-lg border-2 transition-all flex items-center justify-center gap-2 ".concat("now"===R?"border-emerald-500 bg-emerald-50 text-emerald-700":"border-slate-200 hover:border-slate-300"),onClick:()=>L("now"),children:[(0,ea.jsx)(dr,{size:16}),(0,ea.jsx)("span",{className:"font-medium text-sm",children:"Send Now"})]}),(0,ea.jsxs)("button",{type:"button",className:"flex-1 px-3 py-2 rounded-lg border-2 transition-all flex items-center justify-center gap-2 ".concat("schedule"===R?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 hover:border-slate-300"),onClick:()=>L("schedule"),children:[(0,ea.jsx)(yj,{size:16}),(0,ea.jsx)("span",{className:"font-medium text-sm",children:"Schedule"})]})]}
2),"schedule"===R&&(0,ea.jsxs)("div",{className:"bg-slate-50 p-3 rounded-lg grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Date"}),(0,ea.jsx)(BN,{type:"date",value:I,onChange:e=>O(e.target.value),min:(new Date).toISOString().split("T")[0],className:"h-9"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Time"}),(0,ea.jsx)(BN,{type:"time",value:U,onChange:e=>H(e.target.value),className:"h-9"})]}),I&&U&&(0,ea.jsxs)("p",{className:"col-span-2 text-xs text-indigo-600 flex items-center gap-1",children:[(0,ea.jsx)(Kg,{size:12}),new Date("".concat(I,"T").concat(U)).toLocaleString()]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>m(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{const t=z.map(e=>{const t=E.find(t=>t.subscriber_id===e);return null===t||void 0===t?void 0:t.email}).filter(Boolean),s=h.split(/[,\n]/).map(e=>e.trim()).filter(e=>e&&e.includes("@")),a=[...new Set([...t,...s])];if(0===F.length&&0===a.length)return void qs.error("Please select groups, subscribers, or enter email addresses");let n=null;if("schedule"===R){if(!I||!U)return void qs.error("Please select both date and time for scheduling");const e=new Date("".concat(I,"T").concat(U));if(e<=new Date)return void qs.error("Scheduled time must be in the future");n=e.toISOString()}V(!0);try{const t={recipient_emails:a,group_ids:F};n&&(t.scheduled_at=n),await _l.post("/newsletters/".concat(e,"/send"),t);const s=F.reduce((e,t)=>{const s=_.find(e=>e.group_id===t);return e+((null===s||void 0===s?void 0:s.subscriber_count)||0)},0)+a.length;n?qs.success("Newsletter scheduled for ".concat(new Date(n).toLocaleString()," (").concat(s," recipients)")):qs.success("Newsletter is being sent to ".concat(s," recipients!")),m(!1),x(""),q()}catch(i){var l,r;qs.error((null===(l=i.response)||void 0===l||null===(r=l.data)||void 0===r?void 0:r.detail)||"Failed to send newsletter")}finally{V(!1)}},disabled:W,className:"schedule"===R?"bg-indigo-600 hover:bg-indigo-700":"bg-emerald-600 hover:bg-emerald-700","data-testid":"confirm-send-button",children:W?"Processing...":"schedule"===R?"Schedule":"Send Newsletter"})]})]})}),(0,ea.jsx)(Ok,{open:b,onOpenChange:j,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(pJ,{size:20,className:"text-indigo-600"}),"Send Test Email"]})}),(0,ea.jsxs)("div",{className:"py-4 space-y-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Send this newsletter to yourself to preview how it will appear in email clients."}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-600",children:[(0,ea.jsx)("strong",{children:"Subject:"})," ",n.subject||"No subject"]}),(0,ea.jsxs)("p",{className:"text-sm text-slate-600 mt-1",children:[(0,ea.jsx)("strong",{children:"Content:"})," ",(n.blocks||[]).length," blocks"]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Your Email Address"}),(0,ea.jsx)(BN,{type:"email",placeholder:"[email protected]",value:y,onChange:e=>N(e.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Test Language"}),(0,ea.jsxs)(eb,{value:w,onValueChange:C,children:[(0,ea.jsx)(sb,{"data-testid":"test-language-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"en",children:"English (Original)"}),(0,ea.jsx)(rb,{value:"fr",children:"French (Fran\xe7ais)"}),(0,ea.jsx)(rb,{value:"de",children:"German (Deutsch)"}),(0,ea.jsx)(rb,{value:"es",children:"Spanish (Espa\xf1ol)"}),(0,ea.jsx)(rb,{value:"it",children:"Italian (Italiano)"}),(0,ea.jsx)(rb,{value:"pt",children:"Portuguese (Portugu\xeas)"}),(0,ea.jsx)(rb,{value:"nl",children:"Dutch (Nederlands)"}),(0,ea.jsx)(rb,{value:"pl",children:"Polish (Polski)"}),(0,ea.jsx)(rb,{value:"zh",children:"Chinese (\u4e2d\u6587)"}),(0,ea.jsx)(rb,{value:"ja",children:"Japanese (\u65e5\u672c\u8a9e)"}),(0,ea.jsx)(rb,{value:"ar",children:"Arabic (\u0627\u0644\u0639\u0631\u0628\u064a\u0629)"}),(0,ea.jsx)(rb,{value:"ru",children:"Russian (\u0420\u0443\u0441\u0441\u043a\u0438\u0439)"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"en"!==w?"Newsletter will be translated before sending (requires Premium translation tier)":"Send in original language"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:async()=>
2{if(y.trim())if(a)qs.error("Please save the newsletter first");else{D(!0);try{await _l.post("/newsletters/".concat(e,"/send"),{recipient_emails:[y.trim()],test_language:"en"!==w?w:void 0});const t="en"!==w?" (translated to ".concat(w.toUpperCase(),")"):"";qs.success("Test email sent to ".concat(y).concat(t)),j(!1),N(""),C("en")}catch(n){var t,s;qs.error((null===(t=n.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to send test email")}finally{D(!1)}}else qs.error("Please enter an email address")},disabled:k,className:"bg-indigo-600 hover:bg-indigo-700",children:[(0,ea.jsx)(pJ,{size:16,className:"mr-2"}),k?"Sending...":"Send Test"]})]})]})})]})},VJ=Vl("square-check-big",[["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"}]]),qJ=Vl("zoom-in",[["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"}]]),$J=()=>{var e,s,a,n,l;const[r,i]=(0,t.useState)([]),[o,c]=(0,t.useState)([]),[u,m]=(0,t.useState)(""),[h,x]=(0,t.useState)(!0),[p,g]=(0,t.useState)(!1),[f,v]=(0,t.useState)(null),[b,j]=(0,t.useState)({}),[y,N]=(0,t.useState)(!1),[w,C]=(0,t.useState)(!1),[k,D]=(0,t.useState)(!1),[_,S]=(0,t.useState)(!1),[E,A]=(0,t.useState)(!1),[F,T]=(0,t.useState)(!1),[z,M]=(0,t.useState)(""),[P,B]=(0,t.useState)(null),[R,L]=(0,t.useState)(null),[I,O]=(0,t.useState)(null),[U,H]=(0,t.useState)(null),[W,V]=(0,t.useState)(null),[q,$]=(0,t.useState)({alt_text:"",title:"",caption:""}),[G,K]=(0,t.useState)(!1),[Y,J]=(0,t.useState)(""),[Q,X]=(0,t.useState)(!1),[Z,ee]=(0,t.useState)(new Set),[te,se]=(0,t.useState)(!1),[ae,ne]=(0,t.useState)(""),[le,re]=(0,t.useState)(1),[ie,oe]=(0,t.useState)(()=>{try{return localStorage.getItem("nexuscms_media_sort")||"newest"}catch(G2){return"newest"}});(0,t.useEffect)(()=>{try{localStorage.setItem("nexuscms_media_sort",ie)}catch(G2){}},[ie]),(0,t.useEffect)(()=>{re(1)},[f,ae,ie]),(0,t.useEffect)(()=>{ce()},[]);const ce=async()=>{try{const[e,t,s]=await Promise.all([_l.get("/media"),_l.get("/media/folders"),_l.get("/tenant")]);i(e.data),c(t.data);const a=s.data;null!==a&&void 0!==a&&a.custom_domain?m("https://".concat(a.custom_domain)):null!==a&&void 0!==a&&a.subdomain&&m(window.location.origin)}catch(e){qs.error("Failed to load media")}finally{x(!1)}},de=(0,t.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;if(!e||0===e.length)return;const s=Array.from(e),a=s.length;g(!0);const n=s.map(async e=>{const s=new FormData;return s.append("file",e),t&&s.append("folder_id",t),_l.post("/media/upload".concat(t?"?folder_id=".concat(t):""),s,{headers:{"Content-Type":"multipart/form-data"}})});try{await Promise.all(n),qs.success("".concat(a," file(s) uploaded successfully")),ce()}catch(l){qs.error("Failed to upload some files")}finally{g(!1)}},[f]),ue=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),N(!0)},[]),me=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),N(!1)},[]),he=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),N(!1);const t=e.dataTransfer.files;t&&t.length>0&&de(t)},[de]),xe=async e=>{if(Z.size>0)try{const t=await _l.post("/media/move-bulk",{media_ids:Array.from(Z),folder_id:e||null});qs.success(t.data.message||"".concat(Z.size," file(s) moved")),S(!1),ee(new Set),se(!1),ce()}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to move files")}else if(I)try{await _l.put("/media/".concat(I.media_id,"/move"),null,{params:{folder_id:e||null}}),qs.success("Media moved"),S(!1),O(null),ce()}catch(a){qs.error("Failed to move media")}},pe=e=>{if(null!==e&&void 0!==e&&e.custom_slug){const t=u||window.location.origin;return"".concat(t,"/documents/").concat(e.custom_slug)}return(null===e||void 0===e?void 0:e.url)||""},ge=e=>{ee(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[fe,ve]=(0,t.useState)(!1),be=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return o.filter(t=>t.parent_id===e).map(e=>d(d({},e),{},{children:be(e.folder_id)}))},je=be(),ye=f?(e=>{const t=[];let s=o.find(t=>t.folder_id===e);for(;s;)t.unshift(s),s=o.find(e=>e.folder_id===s.parent_id);return t})(f):[],Ne=e=>{if(!e)return"Root";const t=o.find(t=>t.folder_id===e);return t?t.name:"Root"},we=ae.trim().toLowerCase(),Ce=we.length>0,ke=r.filter(e=>
2Ce?(e=>!Ce||[e.filename,e.original_filename,e.alt_text,e.title,e.caption,e.custom_slug].some(e=>"string"===typeof e&&e.toLowerCase().includes(we)))(e):!f||e.folder_id===f),De=(()=>{const e=[...ke],t=e=>new Date(e.uploaded_at||0).getTime(),s=e=>(e.filename||"").toLowerCase(),a=e=>Number(e.size||0);switch(ie){case"oldest":e.sort((e,s)=>t(e)-t(s));break;case"name-asc":e.sort((e,t)=>s(e).localeCompare(s(t)));break;case"name-desc":e.sort((e,t)=>s(t).localeCompare(s(e)));break;case"size-desc":e.sort((e,t)=>a(t)-a(e));break;case"size-asc":e.sort((e,t)=>a(e)-a(t));break;default:e.sort((e,s)=>t(s)-t(e))}return e})(),_e=Math.max(1,Math.ceil(De.length/60)),Se=Math.min(le,_e),Ee=60*(Se-1),Ae=De.slice(Ee,Ee+60),Fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const s=e.children&&e.children.length>0,a=b[e.folder_id],n=f===e.folder_id;return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer group ".concat(n?"bg-indigo-100 text-indigo-700":"hover:bg-slate-100"),style:{paddingLeft:"".concat(16*t+8,"px")},children:[s?(0,ea.jsx)("button",{onClick:()=>{return t=e.folder_id,void j(e=>d(d({},e),{},{[t]:!e[t]}));var t},className:"p-0.5",children:a?(0,ea.jsx)(tr,{size:14}):(0,ea.jsx)(ax,{size:14})}):(0,ea.jsx)("span",{className:"w-5"}),(0,ea.jsx)(bD,{size:16,className:n?"text-indigo-600":"text-slate-400"}),(0,ea.jsx)("span",{className:"flex-1 text-sm truncate",title:e.name,onClick:()=>v(e.folder_id),children:e.name}),(0,ea.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex gap-1",children:[(0,ea.jsx)("button",{onClick:t=>{t.stopPropagation(),L(e),M(e.name),D(!0)},className:"p-1 hover:bg-slate-200 rounded",title:"Rename",children:(0,ea.jsx)(bJ,{size:12})}),(0,ea.jsx)("button",{onClick:t=>{t.stopPropagation(),(async e=>{if(confirm("Delete this folder? Files inside will be moved to root."))try{await _l.delete("/media/folders/".concat(e)),qs.success("Folder deleted"),f===e&&v(null),ce()}catch(t){qs.error("Failed to delete folder")}})(e.folder_id)},className:"p-1 hover:bg-red-100 text-red-500 rounded",title:"Delete",children:(0,ea.jsx)(wD,{size:12})})]})]}),s&&a&&(0,ea.jsx)("div",{children:e.children.map(e=>Fe(e,t+1))})]},e.folder_id)};return(0,ea.jsxs)("div",{className:"flex","data-testid":"media-library-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 bg-slate-50 flex",children:[(0,ea.jsxs)("div",{className:"w-64 bg-white border-r border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ea.jsx)("h2",{className:"font-semibold text-sm text-slate-600",children:"Folders"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{B(f),C(!0)},className:"h-7 w-7 p-0",title:"New Folder",children:(0,ea.jsx)(vD,{size:16})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer mb-1 ".concat(null===f?"bg-indigo-100 text-indigo-700":"hover:bg-slate-100"),onClick:()=>v(null),children:[(0,ea.jsx)(bD,{size:16,className:null===f?"text-indigo-600":"text-slate-400"}),(0,ea.jsx)("span",{className:"text-sm",children:"All Media"})]}),(0,ea.jsx)("div",{className:"mt-2",children:je.map(e=>Fe(e))})]}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 p-8",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold",style:{fontFamily:"Manrope, sans-serif"},children:"Media Library"}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 mt-2 text-sm text-slate-500",children:[(0,ea.jsx)("button",{onClick:()=>v(null),className:"hover:text-indigo-600",children:"Root"}),ye.map((e,s)=>(0,ea.jsxs)(t.Fragment,{children:[(0,ea.jsx)(ax,{size:14}),(0,ea.jsx)("button",{onClick:()=>v(e.folder_id),className:s===ye.length-1?"text-slate-700 font-medium":"hover:text-indigo-600",title:e.name,children:e.name})]},e.folder_id))]})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[Z.size>0?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("span",{className:"flex items-center text-sm text-slate-600 mr-2",children:[Z.size," selected"]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>S(!0),children:[(0,ea.jsx)(Fq,{size:16,className:"mr-2"}),"Move Selected"]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>
2{if(0!==Z.size&&confirm("Delete ".concat(Z.size," selected file(s)?")))try{const e=Array.from(Z).map(e=>_l.delete("/media/".concat(e)));await Promise.all(e),qs.success("".concat(Z.size," file(s) deleted")),ee(new Set),se(!1),ce()}catch(e){qs.error("Failed to delete some files")}},className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:[(0,ea.jsx)(wD,{size:16,className:"mr-2"}),"Delete"]}),(0,ea.jsxs)(sg,{variant:"ghost",onClick:()=>{ee(new Set),se(!1)},children:[(0,ea.jsx)(sr,{size:16,className:"mr-1"}),"Clear"]})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(sg,{variant:te?"secondary":"outline",onClick:()=>se(!te),children:[(0,ea.jsx)(VJ,{size:16,className:"mr-2"}),te?"Exit Select":"Select Multiple"]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>{ve(!0);try{const e=(await _l.post("/media/rewrite-urls")).data,t=e.slugs_backfilled>0?" Generated pretty URLs for ".concat(e.slugs_backfilled," older file").concat(1===e.slugs_backfilled?"":"s","."):"";qs.success("Done! Updated ".concat(e.media_updated," media files, ").concat(e.articles_updated," articles, ").concat(e.pages_updated," pages to use your domain.").concat(t)),ce()}catch(e){qs.error("Failed to update URLs")}finally{ve(!1)}},disabled:fe,title:"Update all file URLs to use your site's domain, and auto-generate pretty /documents/<slug> URLs for any older files that don't have one yet.",children:[(0,ea.jsx)(gq,{size:16,className:"mr-2 ".concat(fe?"animate-spin":"")}),fe?"Updating...":"Fix URLs"]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>{B(f),C(!0)},children:[(0,ea.jsx)(vD,{size:18,className:"mr-2"}),"New Folder"]})]}),(0,ea.jsx)("input",{type:"file",id:"file-upload",className:"hidden",onChange:e=>{de(e.target.files),e.target.value=""},disabled:p,multiple:!0}),(0,ea.jsx)("label",{htmlFor:"file-upload",children:(0,ea.jsx)(sg,{asChild:!0,className:"bg-purple-600 hover:bg-purple-700","data-testid":"upload-button",children:(0,ea.jsxs)("span",{className:"cursor-pointer",children:[(0,ea.jsx)(kq,{size:18,className:"mr-2"}),p?"Uploading...":"Upload Files"]})})})]})]}),(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 mb-4",children:[(0,ea.jsxs)("div",{className:"relative flex-1",children:[(0,ea.jsx)(fj,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none"}),(0,ea.jsx)(BN,{type:"text",value:ae,onChange:e=>ne(e.target.value),placeholder:"Search all media \u2014 filename, alt text, title, caption\u2026",className:"pl-9 pr-10","data-testid":"media-search-input"}),ae&&(0,ea.jsx)("button",{type:"button",onClick:()=>ne(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-slate-100 text-slate-400 hover:text-slate-600",title:"Clear search","data-testid":"media-search-clear",children:(0,ea.jsx)(sr,{size:14})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,ea.jsx)(tf,{htmlFor:"media-sort",className:"text-xs text-slate-500 whitespace-nowrap",children:"Sort by"}),(0,ea.jsxs)(eb,{value:ie,onValueChange:oe,children:[(0,ea.jsx)(sb,{id:"media-sort",className:"h-9 w-[170px]","data-testid":"media-sort-trigger",children:(0,ea.jsx)(tb,{placeholder:"Sort by"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"newest","data-testid":"media-sort-newest",children:"Newest first"}),(0,ea.jsx)(rb,{value:"oldest","data-testid":"media-sort-oldest",children:"Oldest first"}),(0,ea.jsx)(rb,{value:"name-asc","data-testid":"media-sort-name-asc",children:"Name A \u2013 Z"}),(0,ea.jsx)(rb,{value:"name-desc","data-testid":"media-sort-name-desc",children:"Name Z \u2013 A"}),(0,ea.jsx)(rb,{value:"size-desc","data-testid":"media-sort-size-desc",children:"Largest first"}),(0,ea.jsx)(rb,{value:"size-asc","data-testid":"media-sort-size-asc",children:"Smallest first"})]})]})]})]}),Ce&&(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mb-3","data-testid":"media-search-result-count",children:[ke.length," ",1===ke.length?"result":"results"," for",(0,ea.jsxs)("span",{className:"font-medium text-slate-700",children:[' "',ae,'"']})," across all folders"]}),(0,ea.jsxs)("div",{onDragOver:ue,onDragLeave:me,onDrop:he,className:"border-2 border-dashed rounded-xl p-8 mb-6 text-center transition-all ".concat(y?"border-indigo-500 bg-indigo-50":"border-slate-300 hover:border-slate-400"),children:[(0,ea.jsx)(kq,{size:40,className:"mx-auto mb-3 ".concat(y?"text-indigo-500":"text-slate-400")}),(0,ea.jsx)("p",{className:"text-lg font-medium ".concat(y?"text-indigo-600":"text-slate-600"),children:y?"Drop files here":"Drag & drop files here"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"or use the upload button above"})]}),te&&ke.length>0&&(0,ea.jsxs)("div",{className:"flex items-center justify-between bg-indigo-50 border border-indigo-200 rounded-lg px-4 py-2 mb-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsxs)("button",{onClick:()=>{Z.size===ke.length?ee(new Set):(()=>{const e=ke.map(e=>e.media_id);ee(new Set(e))})()},className:"flex items-center gap-2 text-sm text-indigo-700 hover:text-indigo-900",children:[Z.size===ke.length?(0,ea.jsx)(VJ,{size:18}):(0,ea.jsx)(Sq,{size:18}),Z.size===ke.length?"Deselect All":"Select All"]}),(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:[ke.length," ",f?"items in folder":"items total"]})]}),(0,ea.jsx)("p",{className:"text-xs text-indigo-600",children:"Click images to select them"})]}),h?(0,ea.jsx)("div",{className:"text-center py-12",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading media..."})}):0===ke.length?(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-12 text-center",children:[(0,ea.jsx)(kq,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:Ce?'No media matches "'.concat(ae,'".'):f?"No media files in this folder":"No media files yet \u2014 upload your first image to get started."})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:Ae.map(e=>{var t;const s=Z.has(e.media_id);return(0,ea.jsxs)("div",{"data-testid":"media-item-".concat(e.media_id),className:"bg-white border rounded-lg p-3 hover:shadow-lg transition-all group relative ".concat(s?"border-indigo-500 ring-2 ring-indigo-200":"border-slate-200"),onClick:t=>{te&&(t.stopPropagation(),ge(e.media_id))},children:[(te||s)&&(0,ea.jsx)("button",{onClick:t=>{t.stopPropagation(),ge(e.media_id)},className:"absolute top-2 left-2 z-10 w-6 h-6 rounded flex items-center justify-center transition-all ".concat(s?"bg-indigo-600 text-white":"bg-white/90 border border-slate-300 hover:border-indigo-400"),children:s&&(0,ea.jsx)(Xl,{size:14})}),(0,ea.jsx)("div",{className:"aspect-square bg-slate-100 rounded mb-2 flex items-center justify-center relative ".concat(te?"":"cursor-pointer"),onClick:t=>{var s;!te&&null!==(s=e.mime_type)&&void 0!==s&&s.startsWith("image/")&&(t.stopPropagation(),H(e),A(!0))},children:null!==(t=e.mime_type)&&void 0!==t&&t.startsWith("image/")?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("img",{src:e.url,alt:e.filename,className:"w-full h-full object-cover rounded"}),!te&&(0,ea.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-30 transition-all flex items-center justify-center rounded",children:(0,ea.jsx)(qJ,{size:24,className:"text-white opacity-0 group-hover:opacity-100"})})]}):(0,ea.jsx)("span",{className:"text-4xl text-slate-300",children:"\ud83d\udcc4"})}),(0,ea.jsx)("p",{className:"text-xs text-slate-600 truncate mb-1",title:e.filename,children:e.filename}),Ce&&(0,ea.jsxs)("button",{type:"button",onClick:t=>{t.stopPropagation(),v(e.folder_id||null),ne("")},className:"text-[11px] text-indigo-600 hover:text-indigo-800 truncate mb-1 flex items-center gap-1 max-w-full",title:"Open folder: ".concat(Ne(e.folder_id)),"data-testid":"media-result-folder-".concat(e.media_id),children:[(0,ea.jsx)(bD,{size:10}),(0,ea.jsx)("span",{className:"truncate",children:Ne(e.folder_id)})]}),e.alt_text&&(0,ea.jsxs)("p",{className:"text-xs text-green-600 truncate mb-1 flex items-center gap-1",children:[(0,ea.jsx)(qN,{size:10}),"Alt text set"]}),!te&&(0,ea.jsxs)("div",{className:"flex flex-col gap-1 opacity-0 group-hover:opacity-100 transition-opacity overflow-hidden",children:[(0,ea.jsxs)(sg,{size:"sm",variant:"outline",className:"h-7 w-full text-xs bg-white",onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(pe(e)),qs.success(e.custom_slug?"Pretty URL copied":"URL copied to clipboard")},"data-testid":"copy-url-".concat(e.media_id),children:[(0,ea.jsx)(DD,{size:12,className:"mr-1"}),"Copy URL"]}),(0,ea.jsxs)("div",{className:"flex gap-1 min-w-0",children:[(0,ea.jsxs)(sg,{size:"sm",variant:"ghost",className:"h-7 flex-1 min-w-0 text-xs px-1",onClick:t=>{var s;t.stopPropagation(),V(s=e),$({alt_text:s.alt_text||"",title:s.title||"",caption:s.caption||""}),J(s.custom_slug||""),T(!0)},"data-testid":"edit-metadata-".concat(e.media_id),children:[(0,ea.jsx)(bJ,{size:12,className:"mr-1"}),"Edit"]}),(0,ea.jsxs)(sg,{size:"sm",variant:"ghost",className:"h-7 flex-1 min-w-0 text-xs px-1",onClick:t=>{t.stopPropagation(),O(e),S(!0)},children:[(0,ea.jsx)(Fq,{size:12,className:"mr-1"}),"Move"]}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",className:"h-7 w-9 shrink-0 text-red-500 hover:text-red-700 hover:bg-red-50 px-0",onClick:()=>(async e=>{if(confirm("Delete this media file?"))try{await _l.delete("/media/".concat(e)),qs.success("Media deleted"),ce()}catch(t){qs.error("Failed to delete media")}})(e.media_id),"data-testid":"delete-media-".concat(e.media_id),children:(0,ea.jsx)(wD,{size:14})})]})]})]},e.media_id)})}),_e>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-between mt-6 px-1","data-testid":"media-pagination",children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-500","data-testid":"media-pagination-status",children:["Showing ",(0,ea.jsx)("span",{className:"font-medium text-slate-700",children:Ee+1}),"\u2013",(0,ea.jsx)("span",{className:"font-medium text-slate-700",children:Math.min(Ee+60,ke.length)})," ","of ",(0,ea.jsx)("span",{className:"font-medium text-slate-700",children:ke.length})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>re(e=>Math.max(1,e-1)),disabled:Se<=1,"data-testid":"media-pagination-prev",children:"Previous"}),(0,ea.jsxs)("span",{className:"text-xs text-slate-600 px-2",children:["Page ",(0,ea.jsx)("span",{className:"font-medium",children:Se})," of ",_e]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>re(e=>Math.min(_e,e+1)),disabled:Se>=_e,"data-testid":"media-pagination-next",children:"Next"})]})]})]})]})})]}),(0,ea.jsx)(Ok,{open:w,onOpenChange:C,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Create New Folder"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Folder Name"}),(0,ea.jsx)(BN,{value:z,onChange:e=>M(e.target.value),placeholder:"Enter folder name",className:"mt-1",autoFocus:!0})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"Parent Folder"}),(0,ea.jsxs)(eb,{value:P||"root",onValueChange:e=>B("root"===e?null:e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{placeholder:"Select parent folder"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"root",children:"Root (No parent)"}),o.map(e=>(0,ea.jsx)(rb,{value:e.folder_id,children:e.name},e.folder_id))]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(z.trim())try{await _l.post("/media/folders",{name:z,parent_id:P}),qs.success("Folder created"),C(!1),M(""),B(null),ce()}catch(e){qs.error("Failed to create folder")}else qs.error("Please enter a folder name")},className:"bg-indigo-600 hover:bg-indigo-700",children:"Create"})]})]})}),(0,ea.jsx)(Ok,{open:k,onOpenChange:D,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Rename Folder"})}),(0,ea.jsxs)("div",{className:"py-4",children:[(0,ea.jsx)("label",{className:"text-sm font-medium",children:"New Name"}),(0,ea.jsx)(BN,{value:z,onChange:e=>M(e.target.value),placeholder:"Enter new folder name",className:"mt-1",autoFocus:!0})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(z.trim()&&R)try{await _l.put("/media/folders/".concat(R.folder_id),{name:z}),qs.success("Folder renamed"),D(!1),M(""),L(null),ce()}catch(e){qs.error("Failed to rename folder")}},className:"bg-indigo-600 hover:bg-indigo-700",children:"Rename"})]})]})}),(0,ea.jsx)(Ok,{open:_,onOpenChange:S,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Move Media"})}),(0,ea.jsxs)("div",{className:"py-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-600 mb-4",children:Z.size>0?"Select destination folder for ".concat(Z.size," selected file(s)"):(0,ea.jsxs)(ea.Fragment,{children:["Select destination folder for: ",(0,ea.jsx)("strong",{children:null===I||void 0===I?void 0:I.filename})]})}),(0,ea.jsxs)("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[(0,ea.jsxs)("button",{onClick:()=>xe(null),className:"w-full flex items-center gap-2 px-3 py-2 rounded hover:bg-slate-100 text-left",children:[(0,ea.jsx)(bD,{size:16,className:"text-slate-400"}),(0,ea.jsx)("span",{children:"Root (No folder)"})]}),o.map(e=>(0,ea.jsxs)("button",{onClick:()=>xe(e.folder_id),disabled:0===Z.size&&(null===I||void 0===I?void 0:I.folder_id)===e.folder_id,className:"w-full flex items-center gap-2 px-3 py-2 rounded hover:bg-slate-100 text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,ea.jsx)(bD,{size:16,className:"text-slate-400"}),(0,ea.jsx)("span",{children:e.name}),0===Z.size&&(null===I||void 0===I?void 0:I.folder_id)===e.folder_id&&(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"(current)"})]},e.folder_id))]})]}),(0,ea.jsx)(qk,{children:(0,ea.jsx)(sg,{variant:"outline",onClick:()=>S(!1),children:"Cancel"})})]})}),(0,ea.jsx)(Ok,{open:E,onOpenChange:A,children:(0,ea.jsxs)(Wk,{className:"max-w-4xl p-0 overflow-hidden",children:[(0,ea.jsx)("button",{onClick:()=>A(!1),className:"absolute top-4 right-4 z-10 p-2 bg-black bg-opacity-50 rounded-full text-white hover:bg-opacity-70",children:(0,ea.jsx)(sr,{size:20})}),U&&(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)("img",{src:U.url,alt:U.alt_text||U.filename,className:"w-full h-auto max-h-[80vh] object-contain bg-slate-900"}),(0,ea.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4",children:[(0,ea.jsx)("p",{className:"text-white font-medium",children:U.filename}),(0,ea.jsxs)("p",{className:"text-white/70 text-sm",children:[(U.size/1024).toFixed(1)," KB \u2022 ",U.mime_type]}),U.alt_text&&(0,ea.jsxs)("p",{className:"text-white/50 text-xs mt-1",children:["Alt: ",U.alt_text]})]})]})]})}),(0,ea.jsx)(Ok,{open:F,onOpenChange:T,children:(0,ea.jsxs)(Wk,{className:"max-w-lg overflow-hidden",children:[(0,ea.jsx)(Vk,{className:"pr-8",children:(0,ea.jsx)($k,{className:"flex items-center gap-2",children:null!==W&&void 0!==W&&null!==(e=W.mime_type)&&void 0!==e&&e.startsWith("image/")?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)($N,{size:20,className:"text-indigo-600"}),"Edit Image Metadata"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(qN,{size:20,className:"text-indigo-600"}),"Edit File Details"]})})}),W&&(0,ea.jsxs)("div",{className:"space-y-4 min-w-0 max-h-[70vh] overflow-y-auto pr-1",children:[null!==(s=W.mime_type)&&void 0!==s&&s.startsWith("image/")?(0,ea.jsx)("div",{className:"w-full h-40 bg-slate-100 rounded-lg overflow-hidden",children:(0,ea.jsx)("img",{src:W.url,alt:W.filename,className:"w-full h-full object-contain"})}):(0,ea.jsxs)("div",{className:"w-full h-32 bg-slate-100 rounded-lg flex flex-col items-center justify-center gap-2",children:[(0,ea.jsx)(qN,{size:40,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"text-xs uppercase tracking-wide text-slate-500",children:(W.mime_type||"file").split("/").pop()})]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 text-center truncate",title:W.filename,children:W.filename}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-slate-100 rounded-lg min-w-0",children:[(0,ea.jsx)(CV,{size:14,className:"text-slate-400 flex-shrink-0"}),(0,ea.jsx)("code",{className:"text-xs text-slate-600 truncate flex-1 min-w-0",title:pe(W),children:pe(W)}),(0,ea.jsxs)(sg,{size:"sm",variant:"outline",className:"h-7 text-xs flex-shrink-0",onClick:()=>{navigator.clipboard.writeText(pe(W)),qs.success(W.custom_slug?"Pretty URL copied":"URL copied to clipboard")},children:[(0,ea.jsx)(DD,{size:12,className:"mr-1"}),"Copy"]})]}),(null===(a=W.mime_type)||void 0===a?void 0:a.startsWith("image/"))&&(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{htmlFor:"alt-text",className:"text-sm font-medium",children:["Alt Text ",(0,ea.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ea.jsx)(YN,{id:"alt-text",value:q.alt_text,onChange:e=>$(t=>d(d({},t),{},{alt_text:e.target.value})),placeholder:"Describe the image for screen readers and SEO (e.g., 'Team members discussing project in meeting room')",className:"mt-1 h-20 resize-none","data-testid":"media-alt-text-input"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Important for accessibility and SEO. Describe what's in the image."})]}),(null===(n=W.mime_type)||void 0===n?void 0:n.startsWith("image/"))&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"image-title",className:"text-sm font-medium",children:"Title (Optional)"}),(0,ea.jsx)(BN,{id:"image-title",value:q.title,onChange:e=>$(t=>d(d({},t),{},{title:e.target.value})),placeholder:"Image title (shown on hover)",className:"mt-1","data-testid":"media-title-input"})]}),(null===(l=W.mime_type)||void 0===l?void 0:l.startsWith("image/"))&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"image-caption",className:"text-sm font-medium",children:"Caption (Optional)"}),(0,ea.jsx)(YN,{id:"image-caption",value:q.caption,onChange:e=>$(t=>d(d({},t),{},{caption:e.target.value})),placeholder:"Caption to display below the image",className:"mt-1 h-16 resize-none","data-testid":"media-caption-input"})]}),(0,ea.jsxs)("div",{className:"border-t pt-4",children:[(0,ea.jsx)(tf,{htmlFor:"custom-slug",className:"text-sm font-medium",children:"Custom URL"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1 mb-2",children:"Give this file a clean public URL. If you change it later, the old URL will automatically redirect to the new one \u2014 existing links keep working."}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs text-slate-500
2whitespace-nowrap",children:"/documents/"}),(0,ea.jsx)(BN,{id:"custom-slug",value:Y,onChange:e=>J(e.target.value),placeholder:"annual-report-2026",className:"flex-1 font-mono text-sm","data-testid":"media-slug-input"}),(0,ea.jsx)(sg,{size:"sm",onClick:async()=>{if(!W)return;const e=(Y||"").trim();if(e){X(!0);try{var t;const s=await _l.put("/media/".concat(W.media_id,"/slug"),{custom_slug:e}),a=(null===(t=s.data)||void 0===t?void 0:t.custom_slug)||e;i(e=>e.map(e=>{var t;return e.media_id===W.media_id?d(d({},e),{},{custom_slug:a,slug_history:(null===(t=s.data)||void 0===t?void 0:t.slug_history)||e.slug_history}):e})),V(e=>{var t;return e?d(d({},e),{},{custom_slug:a,slug_history:(null===(t=s.data)||void 0===t?void 0:t.slug_history)||e.slug_history}):e}),J(a),qs.success("Custom URL updated")}catch(n){var s,a;const e=(null===n||void 0===n||null===(s=n.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Failed to update custom URL";qs.error(e)}finally{X(!1)}}else qs.error("Custom URL cannot be empty")},disabled:Q||!Y.trim()||Y.trim()===(W.custom_slug||""),"data-testid":"media-save-slug-btn",children:Q?"Saving\u2026":"Save URL"})]}),W.custom_slug&&(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2 p-2 mt-2 bg-indigo-50 rounded-lg min-w-0",children:[(0,ea.jsx)(CV,{size:14,className:"text-indigo-500 flex-shrink-0"}),(0,ea.jsxs)("code",{className:"text-xs text-indigo-700 truncate flex-1 min-w-0",title:"/documents/".concat(W.custom_slug),children:["/documents/",W.custom_slug]}),(0,ea.jsxs)(sg,{size:"sm",variant:"outline",className:"h-7 text-xs flex-shrink-0",onClick:()=>{navigator.clipboard.writeText(pe(W)),qs.success("Pretty URL copied to clipboard")},"data-testid":"media-copy-pretty-url-btn",children:[(0,ea.jsx)(DD,{size:12,className:"mr-1"}),"Copy"]}),(()=>{const e=(W.mime_type||"").toLowerCase();if(!("application/pdf"===e||e.startsWith("image/")))return null;const t=pe(W),s=t+(t.includes("?")?"&":"?")+"download=1";return(0,ea.jsxs)(sg,{size:"sm",variant:"outline",className:"h-7 text-xs flex-shrink-0",onClick:()=>{navigator.clipboard.writeText(s),qs.success("Download link copied \u2014 opens the browser save dialog")},"data-testid":"media-copy-download-url-btn",title:"Copy a force-download link (adds ?download=1)",children:[(0,ea.jsx)(DD,{size:12,className:"mr-1"}),"Copy download link"]})})()]}),Array.isArray(W.slug_history)&&W.slug_history.length>0&&(0,ea.jsxs)("div",{className:"mt-2 text-xs text-slate-500",children:[(0,ea.jsx)("p",{className:"font-medium mb-1",children:"Previous URLs (auto-redirected):"}),(0,ea.jsx)("ul",{className:"space-y-0.5 pl-4 list-disc",children:W.slug_history.map((e,t)=>(0,ea.jsxs)("li",{className:"font-mono",children:["/documents/",e.slug]},"".concat(e.slug,"-").concat(t)))})]})]})]}),(0,ea.jsxs)(qk,{className:"mt-4",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(W){K(!0);try{await _l.put("/media/".concat(W.media_id),q);i(e=>e.map(e=>e.media_id===W.media_id?d(d({},e),q):e)),qs.success("Image metadata saved"),T(!1),V(null)}catch(e){qs.error("Failed to save metadata")}finally{K(!1)}}},disabled:G,className:"bg-indigo-600 hover:bg-indigo-700",children:G?"Saving...":"Save Metadata"})]})]})})]})},GJ=Vl("user-plus",[["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"}]]),KJ=Vl("ellipsis-vertical",[["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"}]]),YJ={admin:{label:"Admin",color:"bg-purple-100 text-purple-700",description:"Full access to all features"},editor:{label:"Editor",color:"bg-blue-100 text-blue-700",description:"Can create and edit content"},viewer:{label:"Viewer",color:"bg-slate-100 text-slate-700",description:"Read-only access"}},JJ=()=>{const{user:e}=Al(),[s,a]=(0,t.useState)([]),[n,l]=(0,t.useState)(!0),[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)({full_name:"",email:"",password:"",role:"editor"}),[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(!1),[f,v]=(0,t.useState)(null),[b,j]=(0,t.useState)({full_name:"",email:"",role:""}),[y,N]=(0,t.useState)(!1),[w,C]=(0,t.useState)(null),[k,D]=(0,t.useState)(!1),[_,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(""),[F,T]=(0,t.useState)(!1),z="admin"===(null===e||void 0===e?void 0:e.role)||"super_admin"===(null===e||void 0===e?void 0:e.role);(0,t.useEffect)(()=>{M()},[]);const M=async()=>{try{const e=await _l.get("/team");a(e.data)}catch(e){qs.error("Failed to load team")}finally{l(!1)}},P=s.filter(e=>{var t,s;return(null===(t=e.full_name)||void 0===t?void 0:t.toLowerCase().includes(r.toLowerCase()))||(null===(s=e.email)||void 0===s?void 0:s.toLowerCase().includes(r.toLowerCase()))});return(0,ea.jsxs)("div",{className:"flex","data-testid":"team-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Team Members"}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Manage staff access to your account"})]}),z&&(0,ea.jsxs)(sg,{onClick:()=>c(!0),className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"inv
2ite-button",children:[(0,ea.jsx)(GJ,{size:18,className:"mr-2"}),"Invite Team Member"]})]}),(0,ea.jsx)("div",{className:"mb-6",children:(0,ea.jsxs)("div",{className:"relative max-w-md",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search team members...",value:r,onChange:e=>i(e.target.value),className:"pl-10"})]})}),(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"p-4 flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Bj,{size:20,className:"text-indigo-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:s.length}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Total Members"})]})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"p-4 flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Kl,{size:20,className:"text-purple-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:s.filter(e=>"admin"===e.role).length}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Admins"})]})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"p-4 flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(ND,{size:20,className:"text-blue-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:s.filter(e=>"editor"===e.role).length}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Editors"})]})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"p-4 flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-slate-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Bj,{size:20,className:"text-slate-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:s.filter(e=>"viewer"===e.role).length}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Viewers"})]})]})})]}),n?(0,ea.jsx)("div",{className:"text-center py-12",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading team..."})}):0===P.length?(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"flex flex-col items-center justify-center py-16",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mb-4",children:(0,ea.jsx)(Bj,{size:32,className:"text-slate-400"})}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:r?"No members found":"No team members yet"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4 text-center max-w-md",children:r?"Try adjusting your search":"Invite your first team member to collaborate on content"}),!r&&z&&(0,ea.jsxs)(sg,{onClick:()=>c(!0),children:[(0,ea.jsx)(GJ,{size:18,className:"mr-2"})," Invite Team Member"]})]})}):(0,ea.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Member"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Role"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Joined"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Status"}),z&&(0,ea.jsx)("th",{className:"text-right px-6 py-3 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{children:P.map(t=>{var s,a,n,l;return(0,ea.jsxs)("tr",{className:"border-b border-slate-100 hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600 font-semibold",children:(null===(s=t.full_name)||void 0===s?void 0:s.charAt(0).toUpperCase())||"?"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-900",children:t.full_name}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:t.email})]}),t.user_id===(null===e||void 0===e?void 0:e.user_id)&&(0,ea.jsx)(EC,{variant:"outline",className:"text-xs",children:"You"})]})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)(EC,{className:(null===(a=YJ[t.role])||void 0===a?void 0:a.color)||"bg-slate-100",children:(null===(n=YJ[t.role])||void 0===n?void 0:n.label)||t.role})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm text-slate-600",children:(l=t.created_at,l?new Date(l).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"N/A")}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)(EC,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Active"})}),z&&(0,ea.jsx)("td",{className:"px-6 py-4 text-right",children:t.user_id!==(null===e||void 0===e?void 0:e.user_id)&&(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",children:(0,ea.jsx)(KJ,{size:16})})}),(0,ea.jsxs)(Bp,{align:"end",children:[(0,ea.jsxs)(Rp,{onClick:()=>(e=>{v(e),j({full_name:e.full_name||"",email:e.email||"",role:e.role||"editor"}),g(!0)})(t),children:[(0,ea.jsx)(ND,{size:16,className:"mr-2"})," Edit Details"]}
2),(0,ea.jsxs)(Rp,{onClick:()=>(e=>{S(e),A(""),D(!0)})(t),children:[(0,ea.jsx)(PJ,{size:16,className:"mr-2"})," Reset Password"]}),(0,ea.jsx)(Ip,{}),(0,ea.jsxs)(Rp,{className:"text-red-600",onClick:()=>(e=>{C(e),N(!0)})(t),children:[(0,ea.jsx)(wD,{size:16,className:"mr-2"})," Remove"]})]})]})})]},t.user_id)})})]})})]})}),(0,ea.jsx)(Ok,{open:o,onOpenChange:c,children:(0,ea.jsxs)(Wk,{className:"sm:max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Invite Team Member"}),(0,ea.jsx)(Gk,{children:"Add a new staff member to your account. They will receive login credentials."})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"name",children:"Full Name *"}),(0,ea.jsx)(BN,{id:"name",value:u.full_name,onChange:e=>m(d(d({},u),{},{full_name:e.target.value})),placeholder:"John Smith",className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"email",children:"Email *"}),(0,ea.jsx)(BN,{id:"email",type:"email",value:u.email,onChange:e=>m(d(d({},u),{},{email:e.target.value})),placeholder:"[email protected]",className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"password",children:"Password *"}),(0,ea.jsx)(BN,{id:"password",type:"password",value:u.password,onChange:e=>m(d(d({},u),{},{password:e.target.value})),placeholder:"Create a password",className:"mt-1"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Minimum 6 characters"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Role"}),(0,ea.jsxs)(eb,{value:u.role,onValueChange:e=>m(d(d({},u),{},{role:e})),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:["super_admin"===(null===e||void 0===e?void 0:e.role)&&(0,ea.jsx)(rb,{value:"super_admin",children:(0,ea.jsxs)("div",{className:"flex flex-col",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Super Admin"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Platform-wide access, manage all tenants"})]})}),(0,ea.jsx)(rb,{value:"admin",children:(0,ea.jsxs)("div",{className:"flex flex-col",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Admin"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Full access to all features"})]})}),(0,ea.jsx)(rb,{value:"editor",children:(0,ea.jsxs)("div",{className:"flex flex-col",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Editor"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Can create and edit content"})]})}),(0,ea.jsx)(rb,{value:"viewer",children:(0,ea.jsxs)("div",{className:"flex flex-col",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Viewer"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Read-only access"})]})})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(u.full_name&&u.email&&u.password){x(!0);try{await _l.post("/team/invite",u);qs.success("".concat(u.full_name," has been added to your team")),c(!1),m({full_name:"",email:"",password:"",role:"editor"}),M()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to add team member")}finally{x(!1)}}else qs.error("Please fill in all required fields")},disabled:h,className:"bg-indigo-600 hover:bg-indigo-700",children:h?"Adding...":"Add Team Member"})]})]})}),(0,ea.jsx)(Ok,{open:p,onOpenChange:g,children:(0,ea.jsxs)(Wk,{className:"sm:max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Edit Team Member"}),(0,ea.jsxs)(Gk,{children:["Update details for ",null===f||void 0===f?void 0:f.full_name]})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"edit-name",children:"Full Name"}),(0,ea.jsx)(BN,{id:"edit-name",value:b.full_name,onChange:e=>j(d(d({},b),{},{full_name:e.target.value})),placeholder:"Full name",className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"edit-email",children:"Email"}),(0,ea.jsx)(BN,{id:"edit-email",type:"email",value:b.email,onChange:e=>j(d(d({},b),{},{email:e.target.value})),placeholder:"Email address",className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Role"}),(0,ea.jsxs)(eb,{value:b.role,onValueChange:e=>j(d(d({},b),{},{role:e})),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:["super_admin"===(null===e||void 0===e?void 0:e.role)&&(0,ea.jsx)(rb,{value:"super_admin",children:"Super Admin - Platform-wide access"}),(0,ea.jsx)(rb,{value:"admin",children:"Admin - Full access"}),(0,ea.jsx)(rb,{value:"editor",children:"Editor - Create & edit content"}),(0,ea.jsx)(rb,{value:"viewer",children:"Viewer - Read-only"})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(f)try{const e={};if(b.full_name&&b.full_name!==f.full_name&&(e.full_name=b.full_name),b.email&&b.email!==f.email&&(e.email=b.email),b.role&&b.role!==f.role&&(e.role=b.role),0===Object.keys(e).length)return qs.info("No changes to save"),void g(!1);await _l.put("/team/".concat(f.user_id),e),qs.success("Updated ".concat(b.full_name,"'s details")),g(!1),v(null),M()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to update member")}},className:"bg-indigo-600 hover:bg-indigo-700",children:"Save Changes"})]})]})}),(0,ea.jsx)(Ok,{open:y,onOpenChange:N,children:(0,ea.jsxs)(Wk,{className:"sm:max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Remove Team Member"}),(0,ea.jsxs)(Gk,{children:["Are you sure you want to remove ",null===w||void 0===w?void 0:w.full_name," from your team? They will lose access to this account immediately."]})]}),(0,ea.jsxs)(qk,{className:"mt-4",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:async()=>{if(w)try{await _l.delete("/team/".concat(w.user_id)),qs.success("".concat(w.full_name," has been removed from the team")),N(!1),C(null),M()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to remove team member")}},children:"Remove Member"})]})]})}),(0,ea.jsx)(Ok,{open:k,onOpenChange:D,children:(0,ea.jsxs)(Wk,{className:"sm:max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Reset Password"}),(0,ea.jsxs)(Gk,{children:["Set a new password for ",null===_||void 0===_?void 0:_.full_name,". They will need to use this password on their next login."]})]}),(0,ea.jsx)("div",{className:"space-y-4 py-4",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"new-password",children:"New Password"}),(0,ea.jsx)(BN,{id:"new-password",type:"password",value:E,onChange:e=>A(e.target.value),placeholder:"Enter new password",className:"mt-1"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Minimum 6 characters"})]})}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(_&&E)if(E.length<6)qs.error("Password must be at least 6 characters");else{T(!0);try{await _l.post("/team/".concat(_.user_id,"/reset-password"),{new_password:E}),qs.success("Password reset successfully for ".concat(_.full_name)),D(!1),S(null),A("")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to reset password")}finally{T(!1)}}else qs.error("Please enter a new password")},disabled:F||!E,className:"bg-indigo-600 hover:bg-indigo-700",children:F?"Resetting...":"Reset Password"})]})]})})]})},QJ=Vl("log-in",[["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"}]]),XJ=Vl("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"}]]),ZJ=Vl("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"}]]),eQ=Vl("shield-check",[["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"}]]),tQ=["className","variant"],sQ=["className"],aQ=["className"],nQ=Zp("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),lQ=t.forwardRef((e,t)=>
2{let{className:s,variant:a}=e,n=l(e,tQ);return(0,ea.jsx)("div",d({ref:t,role:"alert",className:Np(nQ({variant:a}),s)},n))});lQ.displayName="Alert";t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,sQ);return(0,ea.jsx)("h5",d({ref:t,className:Np("mb-1 font-medium leading-none tracking-tight",s)},a))}).displayName="AlertTitle";const rQ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,aQ);return(0,ea.jsx)("div",d({ref:t,className:Np("text-sm [&_p]:leading-relaxed",s)},a))});rQ.displayName="AlertDescription";const iQ=[{value:"all",label:"All Roles"},{value:"master_admin",label:"Master Admin"},{value:"super_admin",label:"Super Admin"},{value:"admin",label:"Admin"},{value:"editor",label:"Editor"},{value:"viewer",label:"Viewer"}],oQ=[{value:"all",label:"All Plans"},{value:"freemium",label:"Freemium"},{value:"free",label:"Free (Legacy)"},{value:"starter",label:"Starter"},{value:"pro",label:"Pro"},{value:"enterprise",label:"Enterprise"},{value:"reseller",label:"Reseller"}],cQ=[{value:"all",label:"All Statuses"},{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"},{value:"pending",label:"Pending"}],dQ=[{value:"recently_created",label:"Recently Created"},{value:"alpha",label:"Alphabetical (Name)"},{value:"email",label:"Email"},{value:"role",label:"Role"},{value:"plan",label:"Plan"}],uQ=[10,20,50,100],mQ=()=>{const{user:e,setToken:s,startImpersonation:a}=Al(),n=be(),l="super_admin"===(null===e||void 0===e?void 0:e.role)||"master_admin"===(null===e||void 0===e?void 0:e.role),r="master_admin"===(null===e||void 0===e?void 0:e.role),[i,o]=(0,t.useState)([]),[c,u]=(0,t.useState)(!0),[m,h]=(0,t.useState)(0),[x,p]=(0,t.useState)(1),[g,f]=(0,t.useState)(""),[v,b]=(0,t.useState)("all"),[j,y]=(0,t.useState)("all"),[N,w]=(0,t.useState)("all"),[C,k]=(0,t.useState)("recently_created"),[D,_]=(0,t.useState)("desc"),[S,E]=(0,t.useState)(1),[A,F]=(0,t.useState)(10),[T,z]=(0,t.useState)(!1),[M,P]=(0,t.useState)(!1),[B,R]=(0,t.useState)(!1),[L,I]=(0,t.useState)(!1),[O,U]=(0,t.useState)(!1),[H,W]=(0,t.useState)(!1),[V,q]=(0,t.useState)(null),[$,G]=(0,t.useState)(10),[K,Y]=(0,t.useState)(""),[J,Q]=(0,t.useState)(null),[X,Z]=(0,t.useState)(!1),[ee,te]=(0,t.useState)(!1),[se,ae]=(0,t.useState)(!1),[ne,le]=(0,t.useState)({translation_enabled:!1,translation_tier:"free",translation_positions:["floating"],default_language:"en",enabled_languages:null,translation_mode:"selector"}),[re,ie]=(0,t.useState)(!1),[oe,ce]=(0,t.useState)(!1),[de,ue]=(0,t.useState)(null),[me,he]=(0,t.useState)(!1),[xe,pe]=(0,t.useState)({email:"",password:"",first_name:"",last_name:"",company:"",role:"editor",plan:"starter",status:"active",billing_type:"free"}),[ge,fe]=(0,t.useState)("");(0,t.useEffect)(()=>{e&&!l&&(qs.error("Access denied. Super Admin privileges required."),n("/dashboard"))},[e,l,n]);const ve=(0,t.useCallback)(async()=>{if(l){u(!0);try{const e=new URLSearchParams({page:S.toString(),per_page:A.toString(),sort_by:C,sort_order:D});"all"!==v&&e.append("role_filter",v),"all"!==j&&e.append("plan_filter",j),"all"!==N&&e.append("status_filter",N),g&&e.append("search",g);const t=await _l.get("/users?".concat(e.toString()));o(t.data.users),h(t.data.total),p(t.data.total_pages)}catch(e){console.error("Failed to fetch users:",e),qs.error("Failed to load users")}finally{u(!1)}}},[S,A,C,D,v,j,N,g,l]);(0,t.useEffect)(()=>{ve()},[ve]),(0,t.useEffect)(()=>{const e=setTimeout(()=>{E(1)},300);return()=>clearTimeout(e)},[g]);const je=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(V)try{if(e){const e=(await _l.post("/users/".concat(V.user_id,"/hard-delete"))).data.tenant_deleted;qs.success(e?"User and their entire workspace permanently deleted. Email is now available for re-use.":"User permanently deleted. Email is now available for re-use.")}else await _l.delete("/users/".concat(V.user_id)),qs.success("User deactivated (soft delete). Email is still reserved.");I(!1),q(null),ve()}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to delete user")}},ye=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"keep";if(!l)return void qs.error("Only Super Admins can end trials");const s=e.company||e.email,a="keep"===t?e.plan||"current":t,n=a.charAt(0).toUpperCase()+a.slice(1),r="keep"===t?"End the trial for ".concat(s," and keep them on ").concat(n," at NO COST?\n\nThis stops all trial-ending emails and removes the 14-day cutoff, but their plan stays as ").concat(n,"."):"End the trial for ".concat(s," and move them to ").concat(n," (free)?\n\nThis stops all trial-ending emails and removes the 14-day cutoff.");if(window.confirm(r))try{const s="keep"===t?"":"?plan=".concat(encodeURIComponent(t));await _l.post("/users/".concat(e.user_id,"/end-trial").concat(s)),qs.success("Trial ended. Account is now ".concat(n," at no cost.")),ve()}catch(c){var i,o;qs.error((null===(i=c.response)||void 0===i||null===(o=i.data)||void 0===o?void 0:o.detail)||"Failed to end trial")}},Ne=()=>{pe({email:"",password:"",first_name:"",last_name:"",company:"",role:"editor",plan:"starter",status:"active",billing_type:"free"})},we=e=>{const t={active:"bg-green-100 text-green-700 border-green-200",inactive:"bg-slate-100 text-slate-700 border-slate-200",suspended:"bg-red-100 text-red-700 border-red-200",pending:"bg-amber-100 text-amber-700 border-amber-200"};return t[e]||t.inactive},Ce=e=>{const t={master_admin:"bg-rose-100 text-rose-700 border-rose-200",super_admin:"bg-purple-100 text-purple-700 border-purple-200",admin:"bg-blue-100 text-blue-700 border-blue-200",editor:"bg-cyan-100 text-cyan-700 border-cyan-200",viewer:"bg-slate-100 text-slate-700 border-slate-200"};return t[e]||t.viewer},ke=e=>{const t={freemium:"bg-green-100 text-green-600",free:"bg-slate-100 text-slate-600",starter:"bg-blue-100 text-blue-600",pro:"bg-indigo-100 text-indigo-600",enterprise:"bg-purple-100 text-purple-600",reseller:"bg-orange-100 text-orange-600",inherited:"bg-slate-50 text-slate-500 border border-slate-200"};return t[e]||t.free};return l?(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 p-8",children:[(0,ea.jsxs)("div",{className:"flex flex-wrap justify-between items-start gap-4 mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold text-slate-900 flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(Rw,{className:"text-indigo-600",size:32}),"User Management"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:l?"Manage all users across the platform":"Manage users in your organization"})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{onClick:()=>{Ne(),z(!0)},variant:"outline",className:"gap-2",children:[(0,ea.jsx)(Vj,{size:18}),"Add Team Member"]}),(0,ea.jsxs)(sg,{onClick:()=>{Ne(),P(!0)},className:"gap-2",children:[(0,ea.jsx)(Fw,{size:18}),"Create New Customer"]})]})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 mb-6",children:(0,ea.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,ea.jsxs)("div",{className:"relative flex-1 min-w-64",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search users...",value:g,onChange:e=>f(e.target.value),className:"pl-10"})]}),(0,ea.jsxs)(eb,{value:C,onValueChange:e=>{k(e),E(1)},children:[(0,ea.jsxs)(sb,{className:"w-48",children:[(0,ea.jsx)(CD,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Sort by"})]}),(0,ea.jsx)(lb,{children:dQ.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsxs)(eb,{value:v,onValueChange:e=>{b(e),E(1)},children:[(0,ea.jsxs)(sb,{className:"w-40",children:[(0,ea.jsx)(Kl,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Role"})]}),(0,ea.jsx)(lb,{children:iQ.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsxs)(eb,{value:j,onValueChange:e=>{y(e),E(1)},children:[(0,ea.jsxs)(sb,{className:"w-40",children:[(0,ea.jsx)(Fw,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Plan"})]}),(0,ea.jsx)(lb,{children:oQ.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsxs)(eb,{value:N,onValueChange:e=>{w(e),E(1)},children:[(0,ea.jsxs)(sb,{className:"w-40",children:[(0,ea.jsx)(kD,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Status"})]}),(0,ea.jsx)(lb,{children:cQ.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"User"}),(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"Email"}),(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"Role"}),(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"Company"}),(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"Plan"}),(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"Billing"}),(0,ea.jsx)("th",{className:"text-left px-6 py-4 text-sm font-semibold text-slate-600",children:"Date Joined"}),(0,ea.jsx)("th",{className:"text-right px-6 py-4 text-sm font-semibold text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-100",children:c?(0,ea.jsx)("tr",{children:(0,ea.jsx)("td",{colSpan:9,className:"px-6 py-12 text-center text-slate-500",children:"Loading users..."})}):0===i.length?(0,ea.jsx)("tr",{children:(0,ea.jsx)("td",{colSpan:9,className:"px-6 py-12 text-center text-slate-500",children:"No users found"})}):i.map(t=>{var s,n,r;return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50 transition-colors",children:[(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600 font-semibold",children:((null===(s=t.first_name)||void 0===s?void 0:s[0])||(null===(n=t.full_name)||void 0===n?void 0:n[0])||t.email[0]).toUpperCase()}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("p",{className:"font-medium text-slate-900",children:t.first_name?"".concat(t.first_name," ").concat(t.last_name||"").trim():t.full_name||t.email}),l&&(null===e||void 0===e?void 0:e.tenant_id)&&t.tenant_id===e.tenant_id&&t.user_id!==e.user_id&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-medium rounded bg-blue-100 text-blue-700",children:[(0,ea.jsx)(Bj,{size:10}),"Team"]})]}),l&&t.tenant_name&&(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:[t.tenant_name,t.tenant_id&&(0,ea.jsxs)("span",{className:"ml-2 text-slate-400 font-mono",title:"Tenant ID",children:["(",t.tenant_id.substring(0,8),"...)"]})]}),l&&!t.tenant_name&&t.tenant_id&&(0,ea.jsxs)("p",{className:"text-xs text-slate-400 font-mono",title:"Tenant ID",children:["ID: ",t.tenant_id.substring(0,8),"..."]})]})]})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-slate-600",children:t.email}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)("span",{className:"inline-flex px-2 py-1 text-xs font-medium rounded-full border ".concat(Ce(t.role)),children:null===(r=t.role)||void 0===r?void 0:r.replace("_"," ")})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-slate-600",children:t.company||"-"}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(()=>{const e=(e=>(e=>e.tenant_id&&!["admin","super_admin","master_admin"].includes(e.role))(e)?{plan:"inherited",label:"Team Member"}:{plan:e.plan||"starter",label:e.plan||"starter"})(t),s=(e=>{if(!e.is_trial||!e.trial_end_date)return null;const t=new Date(e.trial_end_date).getTime();if(Number.isNaN(t))return null;const s=Math.ceil((t-Date.now())/864e5);return s<=0?{label:"Trial expired",tone:"bg-red-100 text-red-700 border border-red-200"}:s<=3?{label:"Trial \xb7 ".concat(s,"d left"),tone:"bg-orange-100 text-orange-700 border border-orange-200"}:{label:"Trial \xb7 ".concat(s,"d left"),tone:"bg-amber-100 text-amber-700 border border-amber-200"}})(t);return(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,ea.jsx)("span",{className:"inline-flex px-2 py-1 text-xs font-medium rounded-full ".concat(ke(e.plan)),children:e.label}),s&&(0,ea.jsx)("span",{className:"inline-flex px-2 py-0.5 text-[10px] font-semibold rounded-full ".concat(s.tone),title:t.trial_end_date?"Ends ".concat(new Date(t.trial_end_date).toLocaleDateString()):"","data-testid":"user-trial-badge-".concat(t.user_id),children:s.label})]})})()}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)("span",{className:"inline-flex px-2 py-1 text-xs font-medium rounded-full border ".concat(we(t.status)),children:t.status||"active"})}),(0,ea.jsx)("td",{className:"px-6 py-4",children:(0,ea.jsx)("span",{className:"inline-flex px-2 py-1 text-xs font-medium rounded-full ".concat("paid"===t.billing_type?"bg-green-100 text-green-700":"bg-slate-100 text-slate-600"),children:"paid"===t.billing_type?"Paid":"Free"})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-slate-600 text-sm",children:new Date(t.created_at).toLocaleDateString()}),(0,ea.jsx)("td",{className:"px-6 py-4 text-right",children:(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",children:(0,ea.jsx)(yD,{size:18})})}),(0,ea.jsxs)(Bp,{align:"end",children:[l&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{if(l)try{const t=await _l.post("/users/".concat(e.user_id,"/impersonate"));qs.success("Now impersonating ".concat(e.email)),a(t.data.access_token,t.data.user),window.location.href="/dashboard"}catch(n){var t,s;qs.error((null===(t=n.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to impersonate user")}else qs.error("Only Super Admins can impersonate users")})(t),className:"gap-2",children:[(0,ea.jsx)(QJ,{size:16}),"Impersonate"]}),(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{if(q(e),G(10),Y(""),Q(null),W(!0),e.tenant_id)try{const t=await _l.get("/ai/admin/credits/".concat(e.tenant_id));Q(t.data.credits)}catch(t){console.error("Failed to fetch credits:",t)}})(t),className:"gap-2",children:[(0,ea.jsx)(XJ,{size:16}),"Manage Credits"]}),(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{if(q(e),le({translation_enabled:!1,translation_tier:"free",translation_positions:["floating"],default_language:"en",enabled_languages:null}),ae(!0),e.tenant_id)try{const t=await _l.get("/admin/tenant/".concat(e.tenant_id,"/translation-settings"));le({translation_enabled:t.data.translation_enabled||!1,translation_tier:t.data.translation_tier||"free",translation_positions:t.data.translation_positions||["floating"],default_language:t.data.default_language||"en",enabled_languages:t.data.enabled_languages,translation_mode:t.data.translation_mode||"selector"})}catch(t){console.error("Failed to fetch translation settings:",t)}})(t),className:"gap-2",children:[(0,ea.jsx)(ZJ,{size:16}),"Translation Settings"]}),(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{if(q(e),ue(null),ce(!0),null!==e&&void 0!==e&&e.tenant_id)try{const t=await _l.get("/admin/wonde/status/".concat(e.tenant_id));ue(t.data)}catch(K2){ue({wonde_enabled:!1,connected:!1})}})(t),className:"gap-2",children:[(0,ea.jsx)(NJ,{size:16}),"Wonde MIS Settings"]}),t.is_trial&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(Rp,{onClick:()=>ye(t,"keep"),className:"gap-2 text-emerald-700 focus:text-emerald-700","data-testid":"end-trial-keep-".concat(t.user_id),children:[(0,ea.jsx)(eQ,{size:16}),"End Trial (keep ",t.plan||"current"," \xb7 $0)"]}),(0,ea.jsxs)(Rp,{onClick:()=>ye(t,"freemium"),className:"gap-2","data-testid":"end-trial-freemium-".concat(t.user_id),children:[(0,
2ea.jsx)(eQ,{size:16}),"End Trial \u2192 Move to Freemium"]})]}),(0,ea.jsx)(Ip,{})]}),(0,ea.jsxs)(Rp,{onClick:()=>{q(t),U(!0)},className:"gap-2",children:[(0,ea.jsx)(Ew,{size:16}),"Reset Password"]}),(0,ea.jsxs)(Rp,{onClick:()=>(e=>{q(e),pe({email:e.email,first_name:e.first_name||"",last_name:e.last_name||"",company:e.company||"",role:e.role||"editor",plan:e.plan||"starter",status:e.status||"active",billing_type:e.billing_type||"free"}),R(!0)})(t),className:"gap-2",children:[(0,ea.jsx)(ND,{size:16}),"Edit User"]}),(0,ea.jsx)(Ip,{}),(0,ea.jsxs)(Rp,{onClick:()=>{q(t),I(!0)},className:"gap-2 text-red-600 focus:text-red-600",children:[(0,ea.jsx)(wD,{size:16}),"Delete User"]})]})]})})]},t.user_id)})})]})}),(0,ea.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-t border-slate-200 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)("span",{className:"text-sm text-slate-600",children:["Showing ",(S-1)*A+1," to ",Math.min(S*A,m)," of ",m," users"]}),(0,ea.jsxs)(eb,{value:A.toString(),onValueChange:e=>{F(parseInt(e)),E(1)},children:[(0,ea.jsx)(sb,{className:"w-20",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:uQ.map(e=>(0,ea.jsx)(rb,{value:e.toString(),children:e},e))})]}),(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:"per page"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>E(e=>Math.max(1,e-1)),disabled:1===S,children:(0,ea.jsx)(vj,{size:16})}),(0,ea.jsxs)("span",{className:"text-sm text-slate-600 px-2",children:["Page ",S," of ",x]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>E(e=>Math.min(x,e+1)),disabled:S===x,children:(0,ea.jsx)(ax,{size:16})})]})]})]}),(0,ea.jsx)(Ok,{open:T,onOpenChange:z,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Add Team Member"}),(0,ea.jsxs)(Gk,{children:["Add a new team member to ",(0,ea.jsx)("strong",{children:"your organization"}),". They will share access to your pages, forms, and content."]})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"First Name *"}),(0,ea.jsx)(BN,{value:xe.first_name,onChange:e=>pe(d(d({},xe),{},{first_name:e.target.value})),placeholder:"John"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Last Name *"}),(0,ea.jsx)(BN,{value:xe.last_name,onChange:e=>pe(d(d({},xe),{},{last_name:e.target.value})),placeholder:"Doe"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email *"}),(0,ea.jsx)(BN,{type:"email",value:xe.email,onChange:e=>pe(d(d({},xe),{},{email:e.target.value})),placeholder:"[email protected]"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Password *"}),(0,ea.jsx)(BN,{type:"password",value:xe.password,onChange:e=>pe(d(d({},xe),{},{password:e.target.value})),placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Company"}),(0,ea.jsx)(BN,{value:xe.company,onChange:e=>pe(d(d({},xe),{},{company:e.target.value})),placeholder:"Acme Inc."})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Role"}),(0,ea.jsxs)(eb,{value:xe.role,onValueChange:e=>pe(d(d({},xe),{},{role:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[r&&(0,ea.jsx)(rb,{value:"master_admin",children:"Master Admin"}),l&&(0,ea.jsx)(rb,{value:"super_admin",children:"Super Admin"}),(0,ea.jsx)(rb,{value:"admin",children:"Admin"}),(0,ea.jsx)(rb,{value:"editor",children:"Editor"}),(0,ea.jsx)(rb,{value:"viewer",children:"Viewer"})]})]})]}),["admin","super_admin","master_admin"].includes(xe.role)?(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Plan"}),(0,ea.jsxs)(eb,{value:xe.plan,onValueChange:e=>pe(d(d({},xe),{},{plan:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"freemium",children:"Freemium (Free Forever)"}),(0,ea.jsx)(rb,{value:"free",children:"Free (Legacy)"}),(0,ea.jsx)(rb,{value:"starter",children:"Starter"}),(0,ea.jsx)(rb,{value:"pro",children:"Pro"}),(0,ea.jsx)(rb,{value:"enterprise",children:"Enterprise"}),(0,ea.jsx)(rb,{value:"reseller",children:"Reseller"})]})]})]}):(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Plan"}),(0,ea.jsx)("div",{className:"h-10 px-3 py-2 rounded-md border border-slate-200 bg-slate-50 text-sm text-slate-500 flex items-center",children:"Inherits company plan"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Status"}),(0,ea.jsxs)(eb,{value:xe.status,onValueChange:e=>pe(d(d({},xe),{},{status:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"active",children:"Active"}),(0,ea.jsx)(rb,{value:"inactive",children:"Inactive"}),(0,ea.jsx)(rb,{value:"suspended",children:"Suspended"}),(0,ea.jsx)(rb,{value:"pending",children:"Pending"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Billing"}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 h-10",children:[(0,ea.jsx)("span",{className:"text-sm ".concat("free"===xe.billing_type?"text-slate-900 font-medium":"text-slate-500"),children:"Free"}),(0,ea.jsx)(wb,{checked:"paid"===xe.billing_type,onCheckedChange:e=>pe(d(d({},xe),{},{billing_type:e?"paid":"free"}))}),(0,ea.jsx)("span",{className:"text-sm ".concat("paid"===xe.billing_type?"text-slate-900 font-medium":"text-slate-500"),children:"Paid"})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>z(!1),disabled:X,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(!X){Z(!0);try{await _l.post("/users",xe),qs.success("Team member created successfully"),z(!1),Ne(),ve()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to create user")}finally{Z(!1)}}},disabled:X,children:X?"Creating...":"Add Team Member"})]})]})}),(0,ea.jsx)(Ok,{open:M,onOpenChange:P,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Fw,{size:20,className:"text-amber-500"}),"Create New Customer Account"]}),(0,ea.jsxs)(Gk,{children:["This creates a ",(0,ea.jsx)("strong",{children:"completely independent account"})," with its own tenant, workspace, and data. The customer will start with a 14-day free trial."]})]}),(0,ea.jsxs)(lQ,{className:"bg-amber-50 border-amber-200",children:[(0,ea.jsx)(AN,{size:16,className:"text-amber-600"}),(0,ea.jsxs)(rQ,{className:"text-amber-800",children:[(0,ea.jsx)("strong",{children:"Important:"}),' This is NOT for adding team members to your organization. Use "Add Team Member" for that. This creates a separate customer account that will have their own pages, forms, and content.']})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"First Name *"}),(0,ea.jsx)(BN,{value:xe.first_name,onChange:e=>pe(d(d({},xe),{},{first_name:e.target.value})),placeholder:"John"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Last Name *"}),(0,ea.jsx)(BN,{value:xe.last_name,onChange:e=>pe(d(d({},xe),{},{last_name:e.target.value})),placeholder:"Doe"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email *"}),(0,ea.jsx)(BN,{type:"email",value:xe.email,onChange:e=>pe(d(d({},xe),{},{email:e.target.value})),placeholder:"[email protected]"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Password *"}),(0,ea.jsx)(BN,{type:"password",value:xe.password,onChange:e=>pe(d(d({},xe),{},{password:e.target.value})),placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Organization / School Name *"}),(0,ea.jsx)(BN,{value:xe.company,onChange:e=>pe(d(d({},xe),{},{company:e.target.value})),placeholder:"Springfield Elementary School"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"This will be used as the customer's tenant/workspace name"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Starting Plan"}),(0,ea.jsxs)(eb,{value:xe.plan,onValueChange:e=>pe(d(d({},xe),{},{plan:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"freemium",children:"Freemium (Free Forever - Limited)"}),(0,ea.jsx)(rb,{value:"starter",children:"Starter"}),(0,ea.jsx)(rb,{value:"pro",children:"Pro"}),(0,ea.jsx)(rb,{value:"enterprise",children:"Enterprise"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Customer will start with a 14-d
2ay trial regardless of plan"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>P(!1),disabled:X,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(!X){Z(!0);try{const e=await _l.post("/users/create-customer",xe);qs.success("New customer account created: ".concat(e.data.email,". They have their own independent workspace.")),P(!1),Ne(),ve()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to create customer account")}finally{Z(!1)}}},disabled:X,className:"bg-amber-500 hover:bg-amber-600",children:X?"Creating...":"Create Customer Account"})]})]})}),(0,ea.jsx)(Ok,{open:B,onOpenChange:R,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Edit User"}),(0,ea.jsx)(Gk,{children:"Update user information"})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"First Name"}),(0,ea.jsx)(BN,{value:xe.first_name,onChange:e=>pe(d(d({},xe),{},{first_name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Last Name"}),(0,ea.jsx)(BN,{value:xe.last_name,onChange:e=>pe(d(d({},xe),{},{last_name:e.target.value}))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email"}),(0,ea.jsx)(BN,{type:"email",value:xe.email,onChange:e=>pe(d(d({},xe),{},{email:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Company"}),(0,ea.jsx)(BN,{value:xe.company,onChange:e=>pe(d(d({},xe),{},{company:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Role"}),(0,ea.jsxs)(eb,{value:xe.role,onValueChange:e=>pe(d(d({},xe),{},{role:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[r&&(0,ea.jsx)(rb,{value:"master_admin",children:"Master Admin"}),l&&(0,ea.jsx)(rb,{value:"super_admin",children:"Super Admin"}),(0,ea.jsx)(rb,{value:"admin",children:"Admin"}),(0,ea.jsx)(rb,{value:"editor",children:"Editor"}),(0,ea.jsx)(rb,{value:"viewer",children:"Viewer"})]})]})]}),["admin","super_admin","master_admin"].includes(xe.role)?(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Plan"}),(0,ea.jsxs)(eb,{value:xe.plan,onValueChange:e=>pe(d(d({},xe),{},{plan:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"freemium",children:"Freemium (Free Forever)"}),(0,ea.jsx)(rb,{value:"free",children:"Free (Legacy)"}),(0,ea.jsx)(rb,{value:"starter",children:"Starter"}),(0,ea.jsx)(rb,{value:"pro",children:"Pro"}),(0,ea.jsx)(rb,{value:"enterprise",children:"Enterprise"}),(0,ea.jsx)(rb,{value:"reseller",children:"Reseller"})]})]})]}):(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Plan"}),(0,ea.jsx)("div",{className:"h-10 px-3 py-2 rounded-md border border-slate-200 bg-slate-50 text-sm text-slate-500 flex items-center",children:"Inherits company plan"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Status"}),(0,ea.jsxs)(eb,{value:xe.status,onValueChange:e=>pe(d(d({},xe),{},{status:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"active",children:"Active"}),(0,ea.jsx)(rb,{value:"inactive",children:"Inactive"}),(0,ea.jsx)(rb,{value:"suspended",children:"Suspended"}),(0,ea.jsx)(rb,{value:"pending",children:"Pending"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Billing"}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 h-10",children:[(0,ea.jsx)("span",{className:"text-sm ".concat("free"===xe.billing_type?"text-slate-900 font-medium":"text-slate-500"),children:"Free"}),(0,ea.jsx)(wb,{checked:"paid"===xe.billing_type,onCheckedChange:e=>pe(d(d({},xe),{},{billing_type:e?"paid":"free"}))}),(0,ea.jsx)("span",{className:"text-sm ".concat("paid"===xe.billing_type?"text-slate-900 font-medium":"text-slate-500"),children:"Paid"})]})]})]}),(null===V||void 0===V?void 0:V.tenant_id)&&(0,ea.jsxs)("div",{className:"space-y-2 pt-2 border-t border-slate-100",children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Tenant ID"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("code",{className:"flex-1 px-3 py-2 bg-slate-50 border border-slate-200 rounded-md text-sm font-mono text-slate-600 select-all",children:V.tenant_id}),(0,ea.jsx)(sg,{type:"button",variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(V.tenant_id),qs.success("Tenant ID copied to clipboard")},children:"Copy"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"This is the unique identifier for this user's workspace"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>R(!1),disabled:ee,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(V&&!ee){te(!0);try{const e=d({},xe);delete e.password,await _l.put("/users/".concat(V.user_id),e),qs.success("User updated successfully"),R(!1),q(null),ve()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to update user")}finally{te(!1)}}},disabled:ee,children:ee?"Saving...":"Save Changes"})]})]})}),(0,ea.jsx)(Ok,{open:L,onOpenChange:I,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Delete User"}),(0,ea.jsx)(Gk,{children:"Choose how you want to remove this user from the system."})]}),V&&(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)(lQ,{className:"bg-amber-50 border-amber-200",children:(0,ea.jsxs)(rQ,{className:"text-amber-800",children:["User to delete: ",(0,ea.jsx)("strong",{children:V.email}),V.company&&(0,ea.jsxs)("span",{className:"block text-sm mt-1",children:["Organization: ",V.company]})]})}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)("div",{className:"p-4 border rounded-lg hover:bg-slate-50 cursor-pointer",onClick:()=>je(!1),children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-full bg-amber-100 flex items-center justify-center",children:(0,ea.jsx)(sr,{size:20,className:"text-amber-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:"Deactivate (Soft Delete)"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Sets status to inactive. Email remains reserved. Can be reactivated later."})]})]})}),(0,ea.jsx)("div",{className:"p-4 border border-red-200 rounded-lg hover:bg-red-50 cursor-pointer",onClick:()=>je(!0),children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-full bg-red-100 flex items-center justify-center",children:(0,ea.jsx)(wD,{size:20,className:"text-red-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-red-700",children:"Permanently Delete"}),(0,ea.jsx)("p",{className:"text-sm text-red-600",children:"Completely removes user and frees up email for re-use. If they are the only user in their org, all their data will be deleted too."})]})]})})]})]}),(0,ea.jsx)(qk,{children:(0,ea.jsx)(sg,{variant:"outline",onClick:()=>I(!1),children:"Cancel"})})]})}),(0,ea.jsx)(Ok,{open:O,onOpenChange:U,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Reset Password"}),(0,ea.jsxs)(Gk,{children:["Set a new password for ",null===V||void 0===V?void 0:V.email]})]}),(0,ea.jsx)("div",{className:"space-y-4 py-4",children:(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"New Password"}),(0,ea.jsx)(BN,{type:"password",value:ge,onChange:e=>fe(e.target.value),placeholder:"Enter new password"})]})}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>{U(!1),fe("")},children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(V&&ge)try{await _l.post("/users/".concat(V.user_id,"/reset-password?new_password=").concat(encodeURIComponent(ge))),qs.success("Password reset successfully"),U(!1),q(null),fe("")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to reset password")}},children:"Reset Password"})]})]})}),(0,ea.jsx)(Ok,{open:H,onOpenChange:W,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(XJ,{className:"text-amber-500",size:24}),"Manage AI Generations"]}),(0,ea.jsxs)(Gk,{children:["Add or subtract top-up AI Generations for ",(null===V||void 0===V?void 0:V.full_name)||(null===V||void 0===V?void 0:V.email),"'s account"]})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[null!==J&&(0,ea.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Top-up Balance (never expires)"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold text-slate-900",children:[J," generations"]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Action"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{type:"button",variant:$>=0?"default":"outline",size:"sm",onClick:()=>G(Math.abs($)),className:$>=0?"bg-green-600 hover:bg-green-700":"",children:"Add Credits"}),(0,ea.jsx)(sg,{type:"button",variant:$<0?"default":"outline",size:"sm",onClick:()=>G(-Math.abs($||10)),className:$<0?"bg-red-600 hover:bg-red-700":"",children:"Subtract Credits"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Amount"}),(0,ea.jsx)("div",{className:"flex gap-2",children:[10,25,50,100,200].map(e=>(0,ea.jsx)(sg,{type:"button",variant:Math.abs($)===e?"default":"outline",size:"sm",onClick:()=>
2G($<0?-e:e),children:e},e))}),(0,ea.jsx)(BN,{type:"number",min:"1",value:Math.abs($),onChange:e=>{const t=parseInt(e.target.value)||0;G($<0?-t:t)},placeholder:"Custom amount",className:"mt-2"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Reason (optional)"}),(0,ea.jsx)(YN,{value:K,onChange:e=>Y(e.target.value),placeholder:"e.g., Promotional credits, Refund, etc.",rows:2})]}),null!==J&&(0,ea.jsx)("div",{className:"p-3 rounded-lg border ".concat($>=0?"bg-green-50 border-green-200":"bg-red-50 border-red-200"),children:(0,ea.jsxs)("p",{className:"text-sm ".concat($>=0?"text-green-700":"text-red-700"),children:["New balance will be: ",(0,ea.jsxs)("strong",{children:[Math.max(0,J+$)," generations"]}),$<0&&J+$<0&&(0,ea.jsxs)("span",{className:"block text-xs mt-1",children:["(Cannot go below 0 - will remove ",J," generations)"]})]})})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>W(!1),children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:async()=>{if(null!==V&&void 0!==V&&V.tenant_id)try{const e=await _l.post("/ai/admin/add-credits",{tenant_id:V.tenant_id,credits:$,reason:K||void 0});qs.success(e.data.message),W(!1)}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to add credits")}else qs.error("User does not have a tenant")},disabled:0===$,className:$<0?"bg-red-600 hover:bg-red-700":"",children:[(0,ea.jsx)(XJ,{size:16,className:"mr-2"}),$>=0?"Add ".concat($," Generations"):"Remove ".concat(Math.abs($)," Generations")]})]})]})}),(0,ea.jsx)(Ok,{open:se,onOpenChange:ae,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(ZJ,{className:"text-blue-500",size:24}),"Translation Settings"]}),(0,ea.jsxs)(Gk,{children:["Configure automatic translation for ",(null===V||void 0===V?void 0:V.company)||(null===V||void 0===V?void 0:V.email),"'s website"]})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4 max-h-[60vh] overflow-y-auto",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-base font-medium",children:"Enable Translation"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Allow visitors to translate pages into their language"})]}),(0,ea.jsx)(wb,{checked:ne.translation_enabled,onCheckedChange:e=>le(d(d({},ne),{},{translation_enabled:e}))})]}),ne.translation_enabled&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Translation Tier"}),(0,ea.jsxs)(eb,{value:ne.translation_tier,onValueChange:e=>le(d(d({},ne),{},{translation_tier:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"free",children:"Free (Google Widget)"}),(0,ea.jsx)(rb,{value:"premium",children:"Premium (API - Higher Quality)"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"free"===ne.translation_tier?"Uses Google Translate browser widget - no API costs":"Uses Google Cloud Translation API - cached for cost efficiency"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Selector Positions"}),(0,ea.jsx)("div",{className:"space-y-2",children:[{id:"header",label:"Header (Right Side)",desc:"In the navigation menu"},{id:"footer",label:"Footer",desc:"At the bottom of the page"},{id:"floating",label:"Floating",desc:"Fixed position (top-left corner)"}].map(e=>{var t;return(0,ea.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded border border-slate-200",children:[(0,ea.jsx)("input",{type:"checkbox",id:"pos-".concat(e.id),checked:null===(t=ne.translation_positions)||void 0===t?void 0:t.includes(e.id),onChange:t=>{const s=ne.translation_positions||[];t.target.checked?le(d(d({},ne),{},{translation_positions:[...s,e.id]})):le(d(d({},ne),{},{translation_positions:s.filter(t=>t!==e.id)}))},className:"rounded"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{htmlFor:"pos-".concat(e.id),className:"text-sm font-medium cursor-pointer",children:e.label}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:e.desc})]})]},e.id)})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Default Language"}),(0,ea.jsxs)(eb,{value:ne.default_language,onValueChange:e=>le(d(d({},ne),{},{default_language:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"en",children:"English"}),(0,ea.jsx)(rb,{value:"es",children:"Spanish"}),(0,ea.jsx)(rb,{value:"fr",children:"French"}),(0,ea.jsx)(rb,{value:"de",children:"German"}),(0,ea.jsx)(rb,{value:"it",children:"Italian"}),(0,ea.jsx)(rb,{value:"pt",children:"Portuguese"}),(0,ea.jsx)(rb,{value:"zh",children:"Chinese"}),(0,ea.jsx)(rb,{value:"ja",children:"Japanese"}),(0,ea.jsx)(rb,{value:"ko",children:"Korean"}),(0,ea.jsx)(rb,{value:"ar",children:"Arabic"}),(0,ea.jsx)(rb,{value:"hi",children:"Hindi"}),(0,ea.jsx)(rb,{value:"pl",children:"Polish"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"The original language of the website content"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Auto-Translation Mode"}),(0,ea.jsxs)(eb,{value:ne.translation_mode||"selector",onValueChange:e=>le(d(d({},ne),{},{translation_mode:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"selector",children:"Manual Selection Only"}),(0,ea.jsx)(rb,{value:"auto",children:"Auto-detect (Browser Language)"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"auto"===ne.translation_mode?"Automatically translates based on visitor's browser language settings":"Visitors must manually select their language using the selector"})]}),(0,ea.jsxs)(lQ,{className:"premium"===ne.translation_tier?"bg-purple-50 border-purple-200":"bg-blue-50 border-blue-200",children:[(0,ea.jsx)(ZJ,{size:16,className:"premium"===ne.translation_tier?"text-purple-600":"text-blue-600"}),(0,ea.jsxs)(rQ,{className:"premium"===ne.translation_tier?"text-purple-800":"text-blue-800",children:[(0,ea.jsx)("strong",{children:"premium"===ne.translation_tier?"Premium Translation":"Free Translation"}),(0,ea.jsx)("br",{}),"premium"===ne.translation_tier?"Higher quality translations with caching. API costs apply but are minimized through intelligent caching.":"Uses browser-based Google Translate. Free but may show Google branding."]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>ae(!1),disabled:re,children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:async()=>
2{if(null!==V&&void 0!==V&&V.tenant_id){ie(!0);try{await _l.put("/admin/tenant/".concat(V.tenant_id,"/translation-settings"),ne),qs.success("Translation ".concat(ne.translation_enabled?"enabled":"disabled"," for ").concat(V.company||V.email)),ae(!1)}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to update translation settings")}finally{ie(!1)}}else qs.error("User does not have a tenant")},disabled:re,className:"bg-blue-600 hover:bg-blue-700",children:[(0,ea.jsx)(ZJ,{size:16,className:"mr-2"}),re?"Saving...":"Save Settings"]})]})]})}),(0,ea.jsx)(Ok,{open:oe,onOpenChange:ce,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(NJ,{size:20,className:"text-green-600"}),"Wonde MIS Settings"]}),(0,ea.jsxs)(Gk,{children:["Enable or disable Wonde MIS sync for ",(null===V||void 0===V?void 0:V.company)||(null===V||void 0===V?void 0:V.email)]})]}),(0,ea.jsx)("div",{className:"py-4 space-y-4",children:null===de?(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-400 text-sm py-2",children:[(0,ea.jsx)(ql,{size:16,className:"animate-spin"}),"Loading Wonde status..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"text-sm font-medium text-slate-800",children:"Wonde Integration"}),(0,ea.jsx)("div",{className:"text-xs text-slate-500 mt-0.5",children:"Allow this tenant to sync parent contacts from Wonde MIS"})]}),(0,ea.jsx)(wb,{checked:(null===de||void 0===de?void 0:de.wonde_enabled)||!1,onCheckedChange:async()=>{if(null!==V&&void 0!==V&&V.tenant_id){he(!0);try{const e=(await _l.post("/admin/wonde/toggle/".concat(V.tenant_id))).data.wonde_enabled;ue(t=>d(d({},t),{},{wonde_enabled:e})),qs.success("Wonde ".concat(e?"enabled":"disabled"," for ").concat(V.company||V.email))}catch(K2){var e,t;qs.error((null===(e=K2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to toggle Wonde")}finally{he(!1)}}},disabled:me,"data-testid":"wonde-admin-toggle"})]}),(null===de||void 0===de?void 0:de.connected)&&(0,ea.jsxs)("div",{className:"p-3 bg-green-50 border border-green-200 rounded-lg text-sm",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-green-700 font-medium mb-1",children:[(0,ea.jsx)(cr,{size:14}),"School Connected"]}),(0,ea.jsx)("div",{className:"text-slate-600",children:de.school_name}),de.last_sync_at&&(0,ea.jsxs)("div",{className:"text-xs text-slate-400 mt-1",children:["Last sync: ",new Date(de.last_sync_at).toLocaleString()]})]}),(null===de||void 0===de?void 0:de.wonde_enabled)&&!(null!==de&&void 0!==de&&de.connected)&&(0,ea.jsx)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-700",children:"Wonde enabled but not yet configured. The tenant admin will need to connect their school via Newsletters \u2192 Contact Sync."}),!(null!==de&&void 0!==de&&de.wonde_enabled)&&(0,ea.jsx)("div",{className:"p-3 bg-slate-50 border border-slate-200 rounded-lg text-sm text-slate-500",children:"When enabled, this tenant can connect their Wonde account and sync parent contacts into subscriber lists grouped by year."})]})}),(0,ea.jsx)(qk,{children:(0,ea.jsx)(sg,{variant:"outline",onClick:()=>ce(!1),children:"Close"})})]})})]})]}):(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)(AN,{className:"mx-auto text-amber-500 mb-4",size:48}),(0,ea.jsx)("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Access Denied"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"You need Super Admin privileges to access User Management."}),(0,ea.jsx)("p",{className:"text-sm text-slate-400",children:"Use the Team page to manage your organization's team members."}),(0,ea.jsx)(sg,{onClick:()=>n("/team"),className:"mt-4",children:"Go to Team Management"})]})})]})},hQ=["className"],xQ=["className"],pQ=["className"],gQ=["className"],fQ=["className"],vQ=["className"],bQ=["className"],jQ=["className"],yQ=t.forwardRef((e,t)=>
2{let{className:s}=e,a=l(e,hQ);return(0,ea.jsx)("div",{className:"relative w-full overflow-auto",children:(0,ea.jsx)("table",d({ref:t,className:Np("w-full caption-bottom text-sm",s)},a))})});yQ.displayName="Table";const NQ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,xQ);return(0,ea.jsx)("thead",d({ref:t,className:Np("[&_tr]:border-b",s)},a))});NQ.displayName="TableHeader";const wQ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,pQ);return(0,ea.jsx)("tbody",d({ref:t,className:Np("[&_tr:last-child]:border-0",s)},a))});wQ.displayName="TableBody";t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,gQ);return(0,ea.jsx)("tfoot",d({ref:t,className:Np("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s)},a))}).displayName="TableFooter";const CQ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,fQ);return(0,ea.jsx)("tr",d({ref:t,className:Np("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s)},a))});CQ.displayName="TableRow";const kQ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,vQ);return(0,ea.jsx)("th",d({ref:t,className:Np("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s)},a))});kQ.displayName="TableHead";const DQ=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,bQ);return(0,ea.jsx)("td",d({ref:t,className:Np("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s)},a))});DQ.displayName="TableCell";t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,jQ);return(0,ea.jsx)("caption",d({ref:t,className:Np("mt-4 text-sm text-muted-foreground",s)},a))}).displayName="TableCaption";const _Q=()=>{var e,s,a,n;const l=be(),{user:r}=Al(),[i,o]=(0,t.useState)([]),[c,d]=(0,t.useState)(null),[u,m]=(0,t.useState)([]),[h,x]=(0,t.useState)([]),[p,g]=(0,t.useState)(!0),[f,v]=(0,t.useState)(1),[b,j]=(0,t.useState)(1),[y,N]=(0,t.useState)(0),[w,C]=(0,t.useState)("all"),[k,D]=(0,t.useState)("all"),[_,S]=(0,t.useState)(""),[E,A]=(0,t.useState)("7"),[F,T]=(0,t.useState)(!1);if("super_admin"!==(null===r||void 0===r?void 0:r.role)&&"master_admin"!==(null===r||void 0===r?void 0:r.role))return(0,ea.jsx)("div",{className:"flex items-center justify-center h-96",children:(0,ea.jsx)(rD,{className:"w-96",children:(0,ea.jsxs)(dD,{className:"pt-6 text-center",children:[(0,ea.jsx)(Kl,{className:"w-12 h-12 mx-auto text-red-500 mb-4"}),(0,ea.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Access Denied"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Only Super Admins can view audit logs."})]})})});const z=async()=>{g(!0);try{const e=localStorage.getItem("token"),t=new URLSearchParams({page:f.toString(),per_page:"25"});if(w&&"all"!==w&&t.append("tenant_id",w),k&&"all"!==k&&t.append("event_type",k),_&&t.append("user_email",_),E){const e=new Date;e.setDate(e.getDate()-parseInt(E)),t.append("start_date",e.toISOString())}F&&t.append("impersonated_only","true");const s=await fetch("".concat("","/api/super-admin/audit-logs?").concat(t),{headers:{Authorization:"Bearer ".concat(e)}});if(!s.ok)throw new Error("Failed to fetch logs");const a=await s.json();o(a.logs||[]),j(a.total_pages||1),N(a.total||0)}catch(e){console.error("Error fetching logs:",e),qs.error("Failed to load audit logs")}finally{g(!1)}},M=async()=>{try{const e=localStorage.getItem("token"),t=await fetch("".concat("","/api/super-admin/audit-logs/stats?days=").concat(E),{headers:{Authorization:"Bearer ".concat(e)}});if(t.ok){const e=await t.json();d(e)}}catch(e){console.error("Error fetching stats:",e)}};(0,t.useEffect)(()=>{(async()=>{try{const e=localStorage.getItem("token"),t=await fetch("".concat("","/api/super-admin/tenants"),{headers:{Authorization:"Bearer ".concat(e)}});if(t.ok){const e=await t.json();m(e||[])}}catch(e){console.error("Error fetching tenants:",e)}})(),(async()=>{try{const e=localStorage.getItem("token"),t=await fetch("".concat("","/api/super-admin/audit-logs/event-types"),{headers:{Authorization:"Bearer ".concat(e)}});if(t.ok){const e=await t.json();x(e.event_types||[])}}catch(e){console.error("Error fetching event types:",e)}})()},[]),(0,t.useEffect)(()=>{z(),M()},[f,w,k,E,F]);const P=()=>
2{v(1),z()},B=e=>null!==e&&void 0!==e&&e.includes("login")?(0,ea.jsx)(Pj,{className:"w-4 h-4"}):null!==e&&void 0!==e&&e.includes("page")?(0,ea.jsx)(qN,{className:"w-4 h-4"}):null!==e&&void 0!==e&&e.includes("newsletter")||null!==e&&void 0!==e&&e.includes("subscriber")?(0,ea.jsx)(Yl,{className:"w-4 h-4"}):null!==e&&void 0!==e&&e.includes("settings")||null!==e&&void 0!==e&&e.includes("2fa")?(0,ea.jsx)(Oj,{className:"w-4 h-4"}):null!==e&&void 0!==e&&e.includes("impersonate")?(0,ea.jsx)(Kl,{className:"w-4 h-4"}):(0,ea.jsx)(Kg,{className:"w-4 h-4"}),R=e=>(null===e||void 0===e?void 0:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()))||"Unknown",L=e=>{if(!e)return"-";return new Date(e).toLocaleString()};return(0,ea.jsxs)("div",{className:"p-6 space-y-6","data-testid":"audit-logs-page",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>l("/dashboard"),"data-testid":"back-to-dashboard",children:[(0,ea.jsx)(_j,{className:"w-4 h-4 mr-2"}),"Back to Dashboard"]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold",children:"Audit Logs"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Monitor tenant activity across the platform"})]})]}),(0,ea.jsxs)(sg,{onClick:()=>{z(),M()},variant:"outline","data-testid":"refresh-logs",children:[(0,ea.jsx)(gq,{className:"w-4 h-4 mr-2"}),"Refresh"]})]}),c&&(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Total Events"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:null===(e=c.total_events)||void 0===e?void 0:e.toLocaleString()})]}),(0,ea.jsx)(Kg,{className:"w-8 h-8 text-blue-500"})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-2",children:["Last ",E," days"]})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Failed Logins"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-red-500",children:null===(s=c.failed_logins)||void 0===s?void 0:s.toLocaleString()})]}),(0,ea.jsx)(AN,{className:"w-8 h-8 text-red-500"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-2",children:"Security events"})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-2",children:"Top Events"}),(0,ea.jsx)("div",{className:"space-y-1",children:null===(a=c.event_breakdown)||void 0===a?void 0:a.slice(0,3).map((e,t)=>(0,ea.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-600 truncate",children:R(e.event_type)}),(0,ea.jsx)("span",{className:"font-medium",children:e.count})]},t))})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-2",children:"Most Active Tenants"}),(0,ea.jsx)("div",{className:"space-y-1",children:null===(n=c.most_active_tenants)||void 0===n?void 0:n.slice(0,3).map((e,t)=>(0,ea.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-600 truncate",children:e.tenant_name}),(0,ea.jsx)("span",{className:"font-medium",children:e.count})]},t))})]})})})]}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex flex-wrap gap-4 items-end",children:[(0,ea.jsxs)("div",{className:"w-48",children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Tenant"}),(0,ea.jsxs)(eb,{value:w,onValueChange:e=>{C(e),v(1)},children:[(0,ea.jsx)(sb,{"data-testid":"tenant-filter",children:(0,ea.jsx)(tb,{placeholder:"All Tenants"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Tenants"}),u.map(e=>(0,ea.jsx)(rb,{value:e.tenant_id,children:e.name},e.tenant_id))]})]})]}),(0,ea.jsxs)("div",{className:"w-48",children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Event Type"}),(0,ea.jsxs)(eb,{value:k,onValueChange:e=>{D(e),v(1)},children:[(0,ea.jsx)(sb,{"data-testid":"event-type-filter",children:(0,ea.jsx)(tb,{placeholder:"All Events"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Events"}),h.map(e=>(0,ea.jsx)(rb,{value:e,children:R(e)},e))]})]})]}),(0,ea.jsxs)("div",{className:"w-32",children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Time Range"}),(0,ea.jsxs)(eb,{value:E,onValueChange:e=>{A(e),v(1)},children:[(0,ea.jsx)(sb,{"data-testid":"date-range-filter",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"1",children:"Last 24h"}),(0,ea.jsx)(rb,{value:"7",children:"Last 7 days"}),(0,ea.jsx)(rb,{value:"30",children:"Last 30 days"}),(0,ea.jsx)(rb,{value:"90",children:"Last 90 days"})]})]})]}),(0,ea.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,ea.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Search by Email"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{placeholder:"[email protected]",value:_,onCh
2ange:e=>S(e.target.value),onKeyDown:e=>"Enter"===e.key&&P(),"data-testid":"email-search"}),(0,ea.jsx)(sg,{onClick:P,variant:"secondary",children:(0,ea.jsx)(fj,{className:"w-4 h-4"})})]})]}),(0,ea.jsx)("div",{className:"flex items-end",children:(0,ea.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 border rounded-md cursor-pointer hover:bg-slate-50 text-sm font-medium","data-testid":"impersonated-only-toggle",children:[(0,ea.jsx)("input",{type:"checkbox",checked:F,onChange:e=>{T(e.target.checked),v(1)},className:"w-4 h-4 accent-amber-600"}),(0,ea.jsx)(Kl,{className:"w-4 h-4 text-amber-600"}),"Impersonated only"]})})]})})}),(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsx)("div",{className:"flex items-center justify-between",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Activity Log"}),(0,ea.jsxs)(cD,{children:[y.toLocaleString()," events found"]})]})})}),(0,ea.jsx)(dD,{children:p?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(gq,{className:"w-6 h-6 animate-spin text-slate-400"})}):0===i.length?(0,ea.jsxs)("div",{className:"text-center py-12 text-slate-500",children:[(0,ea.jsx)(Kg,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),(0,ea.jsx)("p",{children:"No audit logs found matching your filters."})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(yQ,{children:[(0,ea.jsx)(NQ,{children:(0,ea.jsxs)(CQ,{children:[(0,ea.jsx)(kQ,{className:"w-[180px]",children:"Timestamp"}),(0,ea.jsx)(kQ,{children:"Tenant"}),(0,ea.jsx)(kQ,{children:"Event"}),(0,ea.jsx)(kQ,{children:"User"}),(0,ea.jsx)(kQ,{children:"Description"}),(0,ea.jsx)(kQ,{children:"IP Address"})]})}),(0,ea.jsx)(wQ,{children:i.map((e,t)=>{return(0,ea.jsxs)(CQ,{className:e.impersonated_by_email?"master_admin"===e.impersonated_by_role?"bg-rose-50/40 hover:bg-rose-50":"bg-amber-50/40 hover:bg-amber-50":"","data-testid":"audit-row-".concat(e.log_id||t),children:[(0,ea.jsx)(DQ,{className:"text-sm text-slate-500",children:L(e.created_at)}),(0,ea.jsx)(DQ,{children:(0,ea.jsx)("span",{className:"font-medium text-sm",children:e.tenant_name||"Unknown"})}),(0,ea.jsx)(DQ,{children:(0,ea.jsxs)(EC,{variant:(s=e.event_type,null!==s&&void 0!==s&&s.includes("failed")||null!==s&&void 0!==s&&s.includes("deleted")?"destructive":null!==s&&void 0!==s&&s.includes("created")||null!==s&&void 0!==s&&s.includes("success")?"default":null!==s&&void 0!==s&&s.includes("impersonate")?"secondary":"outline"),className:"flex items-center gap-1 w-fit",children:[B(e.event_type),R(e.event_type)]})}),(0,ea.jsx)(DQ,{className:"text-sm",children:(0,ea.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,ea.jsx)("span",{children:e.user_email||"-"}),e.impersonated_by_email&&(()=>{const t="master_admin"===e.impersonated_by_role,s=t?Fw:Kl,a=t?"master admin":"super admin",n=t?"text-rose-700":"text-amber-700";return(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium ".concat(n),title:"This action was performed by ".concat(a," ").concat(e.impersonated_by_email," while impersonating ").concat(e.user_email),"data-testid":"impersonated-by-badge",children:[(0,ea.jsx)(s,{className:"w-3 h-3"}),"via ",a,": ",e.impersonated_by_email]})})()]})}),(0,ea.jsx)(DQ,{className:"text-sm text-slate-600 max-w-[300px] truncate",children:e.event_description}),(0,ea.jsx)(DQ,{className:"text-sm text-slate-400",children:e.ip_address||"-"})]},e.log_id||t);var s})})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Page ",f," of ",b]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>v(e=>Math.max(1,e-1)),disabled:f<=1,children:"Previous"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>v(e=>Math.min(b,e+1)),disabled:f>=b,children:"Next"})]})]})]})})]})]})},SQ=["pending","in_progress","completed","rejected"],EQ={pending:"bg-amber-100 text-amber-800 border-amber-200",in_progress:"bg-blue-100 text-blue-800 border-blue-200",completed:"bg-emerald-100 text-emerald-800 border-emerald-200",rejected:"bg-rose-100 text-rose-800 border-rose-200"},AQ=e=>{if(!e)return"\u2014";
2try{return new Date(e).toLocaleString()}catch(t){return e}},FQ=()=>{const e=be(),{user:s}=Al(),[a,n]=(0,t.useState)([]),[l,r]=(0,t.useState)(!0),[i,o]=(0,t.useState)(null),c="super_admin"===(null===s||void 0===s?void 0:s.role)||"master_admin"===(null===s||void 0===s?void 0:s.role),u=async()=>{r(!0);try{var e;const t=await _l.get("/admin/go-live-requests");n((null===(e=t.data)||void 0===e?void 0:e.requests)||[])}catch(G2){var t,s;qs.error((null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to load go-live requests")}finally{r(!1)}};(0,t.useEffect)(()=>{c&&u()},[]);if(!c)return(0,ea.jsxs)("div",{className:"flex","data-testid":"go-live-requests-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 bg-slate-50 flex items-center justify-center h-screen",children:(0,ea.jsx)(rD,{className:"w-96",children:(0,ea.jsxs)(dD,{className:"pt-6 text-center",children:[(0,ea.jsx)(Kl,{className:"w-12 h-12 mx-auto text-red-500 mb-4"}),(0,ea.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Access Denied"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Only Super Admins can view go-live requests."}),(0,ea.jsx)(sg,{className:"mt-4",onClick:()=>e("/dashboard"),children:"Back to Dashboard"})]})})})]});const m=a.filter(e=>"pending"===e.status).length;return(0,ea.jsxs)("div",{className:"flex","data-testid":"go-live-requests-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-4xl font-bold mb-2 flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(Mj,{className:"text-emerald-600",size:32}),"Go Live Requests"]}),(0,ea.jsxs)("p",{className:"text-slate-600",children:["Customers ready to launch."," ",m>0&&(0,ea.jsxs)("span",{className:"font-semibold text-amber-700",children:[m," pending review."]})]})]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:u,disabled:l,"data-testid":"refresh-go-live-button",children:[(0,ea.jsx)(gq,{size:16,className:"mr-2 ".concat(l?"animate-spin":"")}),"Refresh"]})]}),l?(0,ea.jsx)("div",{className:"text-center py-20 text-slate-400",children:"Loading requests\u2026"}):0===a.length?(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"py-16 text-center",children:[(0,ea.jsx)(uD,{className:"w-12 h-12 mx-auto text-slate-300 mb-4"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No go-live requests yet."})]})}):(0,ea.jsx)("div",{className:"space-y-4",children:a.map(e=>(0,ea.jsx)(rD,{"data-testid":"go-live-request-".concat(e.request_id),className:"overflow-hidden",children:(0,ea.jsx)(dD,{className:"p-5",children:(0,ea.jsxs)("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4",children:[(0,ea.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-900 truncate",children:e.tenant_name||"Unknown Tenant"}),(0,ea.jsx)(EC,{variant:"outline",className:"capitalize ".concat(EQ[e.status]||""),children:(e.status||"pending").replace("_"," ")})]}),(0,ea.jsxs)("div",{className:"mt-2 grid sm:grid-cols-2 gap-x-6 gap-y-1 text-sm text-slate-600",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Yl,{size:14,className:"text-slate-400"})," ",e.requested_by||"\u2014"]}),(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Kg,{size:14,className:"text-slate-400"})," ",AQ(e.created_at)]})]}),Array.isArray(e.checklist_completed)&&e.checklist_completed.length>0&&(0,ea.jsxs)("div",{className:"mt-3",children:[(0,ea.jsxs)("p",{className:"text-xs font-semibold text-slate-500 mb-1 flex items-center gap-1",children:[(0,ea.jsx)(hr,{size:12})," Checklist completed"]}),(0,ea.jsx)("ul",{className:"text-sm text-slate-700 space-y-0.5",children:e.checklist_completed.map((e,t)=>(0,ea.jsxs)("li",{className:"flex items-center gap-2",children:[(0,ea.jsx)(uD,{size:14,className:"text-emerald-500 shrink-0"})," ",e]},t))})]}),e.notes&&(0,ea.jsxs)("p",{className:"mt-3 text-sm text-slate-700 bg-slate-50 border border-slate-100 rounded-lg p-3",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Notes: "}),e.notes]})]}),(0,ea.jsxs)("div",{className:"shrink-0 w-full md:w-44",children:[(0,ea.jsx)("label",{className:"text-xs font-semibold text-slate-500 mb-1 block",children:"Update status"}),(0,ea.jsxs)(eb,{value:e.status||"pending",onValueChange:t=>(async(e,t)=>{o(e);try{await _l.put("/admin/go-live-requests/".concat(e,"/status"),{status:t}),n(s=>s.map(s=>s.request_id===e?d(d({},s),{},{status:t}):s)),qs.success("Marked as ".concat(t.replace("_"," ")))}catch(G2){var s,a;qs.error((null===(s=G2.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Failed to update status")}finally{o(null)}})(e.request_id,t),disabled:i===e.request_id,children:[(0,ea.jsx)(sb,{"data-testid":"status-select-".concat(e.request_id),children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:SQ.map(e=>(0,ea.jsx)(rb,{value:e,className:"capitalize",children:e.replace("_"," ")},e))})]})]})]})})},e.request_id))})]})})]})},TQ={max_pages:"Pages",max_articles:"Articles",max_newsletters:"Newsletter sends / mo",max_subscribers:"Subscribers",max_forms:"Forms",max_form_submissions:"Form submissions / mo",max_assets:"Media files",max_storage_mb:"Storage (MB)",max_team_members:"Team members",max_landing_pages:"Landing pages"},zQ={analytics:"Analytics",api_access:"API access",ai_features:"AI features",custom_domain:"Custom domain",remove_branding:"Remove branding"},MQ=()=>
2{const e=be(),{user:s}=Al(),[a,n]=(0,t.useState)(null),[l,r]=(0,t.useState)(!0),[i,o]=(0,t.useState)(null),[c,u]=(0,t.useState)({}),m="master_admin"===(null===s||void 0===s?void 0:s.role),h=async()=>{r(!0);try{const e=await _l.get("/admin/plan-limits");n(e.data);const t={};(e.data.plans||[]).forEach(e=>{t[e.plan_level]={},Object.keys(TQ).forEach(s=>{t[e.plan_level][s]=e.overrides&&null!=e.overrides[s]?String(e.overrides[s]):""}),Object.keys(zQ).forEach(s=>{t[e.plan_level][s]=e.overrides&&null!=e.overrides[s]?e.overrides[s]?"on":"off":"default"})}),u(t)}catch(G2){var e,t;qs.error((null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to load plan limits")}finally{r(!1)}};(0,t.useEffect)(()=>{m&&h()},[]);const x=(e,t,s)=>{u(a=>d(d({},a),{},{[e]:d(d({},a[e]),{},{[t]:s})}))};if(!m)return(0,ea.jsxs)("div",{className:"flex","data-testid":"plan-limits-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 bg-slate-50 flex items-center justify-center h-screen",children:(0,ea.jsx)(rD,{className:"w-96",children:(0,ea.jsxs)(dD,{className:"pt-6 text-center",children:[(0,ea.jsx)(Kl,{className:"w-12 h-12 mx-auto text-rose-500 mb-4"}),(0,ea.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Access Denied"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Only Master Admins can configure plan limits."}),(0,ea.jsx)(sg,{className:"mt-4",onClick:()=>e("/dashboard"),children:"Back to Dashboard"})]})})})]});const p=(null===a||void 0===a?void 0:a.plans)||[];return(0,ea.jsxs)("div",{className:"flex","data-testid":"plan-limits-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8 min-h-screen",children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,ea.jsxs)("div",{className:"mb-8",children:[(0,ea.jsxs)("h1",{className:"text-4xl font-bold mb-2 flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(Fw,{className:"text-rose-500",size:32}),"Plan Limits"]}),(0,ea.jsxs)("p",{className:"text-slate-600",children:["Override the per-plan caps that gate Storage, Newsletter sends, Team size, Pages/Articles and feature access. Leave a field blank to use the built-in default. Use ",(0,ea.jsx)("code",{children:"-1"})," for unlimited."]})]}),l?(0,ea.jsx)("div",{className:"text-center py-20 text-slate-400",children:"Loading plan limits\u2026"}):(0,ea.jsx)("div",{className:"space-y-6",children:p.map(e=>(0,ea.jsx)(rD,{"data-testid":"plan-card-".concat(e.plan_level),children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ea.jsx)("h2",{className:"text-xl font-semibold capitalize",children:e.display_name||e.plan_level}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>(async e=>{o(e);try{await _l.put("/admin/plan-limits/".concat(e),{overrides:{}}),qs.success("".concat(e," reset to defaults")),await h()}catch(G2){var t,s;qs.error((null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to reset")}finally{o(null)}})(e.plan_level),disabled:i===e.plan_level,"data-testid":"reset-".concat(e.plan_level),children:[(0,ea.jsx)(Nj,{size:14,className:"mr-1"})," Reset"]}),(0,ea.jsxs)(sg,{size:"sm",onClick:()=>(async e=>{o(e);const t={};Object.keys(TQ).forEach(s=>{const a=c[e][s];t[s]=""===a||null==a?null:parseInt(a,10)}),Object.keys(zQ).forEach(s=>{const a=c[e][s];t[s]="default"===a?null:"on"===a});try{await _l.put("/admin/plan-limits/".concat(e),{overrides:t}),qs.success("".concat(e," limits saved")),await h()}catch(G2){var s,a;qs.error((null===(s=G2.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Failed to save")}finally{o(null)}})(e.plan_level),disabled:i===e.plan_level,"data-testid":"save-".concat(e.plan_level),children:[(0,ea.jsx)(BD,{size:14,className:"mr-1"})," ",i===e.plan_level?"Saving\u2026":"Save"]})]})]}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3",children:Object.entries(TQ).map(t=>{var s,a;let[n,l]=t;return(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:l}),(0,ea.jsx)(BN,{type:"number",value:null!==(s=null===(a=c[e.plan_level])||void 0===a?void 0:a[n])&&void 0!==s?s:"",onCh
2ange:t=>x(e.plan_level,n,t.target.value),placeholder:"Default: ".concat((r=e.defaults[n],-1===r?"Unlimited":void 0===r||null===r?"\u2014":String(r))),className:"h-8 text-sm","data-testid":"limit-".concat(e.plan_level,"-").concat(n)})]},n);var r})}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 mt-4 pt-4 border-t border-slate-100",children:Object.entries(zQ).map(t=>{var s;let[a,n]=t;return(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-600",children:n}),(0,ea.jsxs)(eb,{value:(null===(s=c[e.plan_level])||void 0===s?void 0:s[a])||"default",onValueChange:t=>x(e.plan_level,a,t),children:[(0,ea.jsx)(sb,{className:"h-8 text-sm","data-testid":"feature-".concat(e.plan_level,"-").concat(a),children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsxs)(rb,{value:"default",children:["Default (",e.defaults[a]?"On":"Off",")"]}),(0,ea.jsx)(rb,{value:"on",children:"Enabled"}),(0,ea.jsx)(rb,{value:"off",children:"Disabled"})]})]})]},a)})})]})},e.plan_level))})]})})]})},PQ=e=>{let{children:t}=e;return(0,ea.jsxs)("div",{className:"flex min-h-screen",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 bg-slate-50 min-h-screen overflow-auto",children:t})]})},BQ=Vl("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"}]]),RQ={name:"",bio:"",logo_url:"",link:"",featured:!1,order:0},LQ=()=>{const{user:e,isImpersonating:s}=Al(),a=!s&&"master_admin"===(null===e||void 0===e?void 0:e.role),[n,l]=(0,t.useState)([]),[r,i]=(0,t.useState)(!0),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)(null),[h,x]=(0,t.useState)(RQ),[p,g]=(0,t.useState)(!1),[f,v]=(0,t.useState)(!1),b=(0,t.useCallback)(async()=>{try{const e=await _l.get("/marketplace/partners");l(e.data||[])}catch(G2){qs.error("Failed to load marketplace partners")}finally{i(!1)}},[]);(0,t.useEffect)(()=>{b()},[b]);return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto px-6 py-8","data-testid":"marketplace-page",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between mb-2 flex-wrap gap-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-11 h-11 rounded-xl bg-indigo-600 flex items-center justify-center text-white",children:(0,ea.jsx)(Mw,{size:22})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900",children:"Marketplace"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-0.5",children:"Trusted partners and tools, hand-picked for you."})]})]}),a&&(0,ea.jsxs)(sg,{onClick:()=>{m(null),x(RQ),c(!0)},"data-testid":"marketplace-add-partner-btn",className:"bg-rose-600 hover:bg-rose-700",children:[(0,ea.jsx)(Vj,{size:16,className:"mr-2"})," Add Partner"]})]}),r?(0,ea.jsx)("div",{className:"py-24 text-center text-slate-400","data-testid":"marketplace-loading",children:"Loading partners\u2026"}):0===n.length?(0,ea.jsxs)("div",{className:"py-24 text-center border-2 border-dashed border-slate-200 rounded-2xl mt-6","data-testid":"marketplace-empty",children:[(0,ea.jsx)(Mw,{size:40,className:"mx-auto text-slate-300 mb-3"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No partners yet."}),a&&(0,ea.jsx)("p",{className:"text-slate-400 text-sm mt-1",children:"Click \u201cAdd Partner\u201d to feature your first partner."})]}):(0,ea.jsx)("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-5 mt-6","data-testid":"marketplace-grid",children:n.map(e=>(0,ea.jsxs)("div",{"data-testid":"marketplace-card-".concat(e.partner_id),className:"relative flex flex-col bg-white border border-slate-200 rounded-2xl p-5 shadow-sm hover:shadow-md transition-shadow",children:[e.featured&&(0,ea.jsxs)("span",{className:"absolute top-3 right-3 inline-flex items-center gap-1 text-[11px] font-semibold text-amber-700 bg-amber-100 px-2 py-0.5 rounded-full","data-testid":"marketplace-featured-".concat(e.partner_id),children:[(0,ea.jsx)($l,{size:11,className:"fill-amber-500 text-amber-500"})," Featured"]}),(0,ea.jsx)("div",{className:"h-16 flex items-center mb-4",children:e.logo_url?(0,ea.jsx)("img",{src:e.logo_url,alt:e.name,className:"max-h-16 max-w-[160px] object-contain"}
2):(0,ea.jsx)("div",{className:"w-14 h-14 rounded-xl bg-slate-100 flex items-center justify-center text-slate-400",children:(0,ea.jsx)($N,{size:22})})}),(0,ea.jsx)("h3",{className:"font-semibold text-slate-900 text-lg",children:e.name}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1 flex-1 line-clamp-4",children:e.bio}),(0,ea.jsxs)("div",{className:"mt-4 flex items-center justify-between gap-2",children:[(0,ea.jsxs)(sg,{onClick:()=>(async e=>{var t;window.open((t=e.link)?/^(https?:|mailto:|tel:)/i.test(t)?t:"https://".concat(t):"#","_blank","noopener,noreferrer");try{await _l.post("/marketplace/partners/".concat(e.partner_id,"/click")),l(t=>t.map(t=>t.partner_id===e.partner_id?d(d({},t),{},{click_count:(t.click_count||0)+1}):t))}catch(G2){}})(e),"data-testid":"marketplace-visit-".concat(e.partner_id),className:"bg-indigo-600 hover:bg-indigo-700",size:"sm",children:["Visit partner ",(0,ea.jsx)(bj,{size:14,className:"ml-1.5"})]}),a&&(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-slate-400","data-testid":"marketplace-clicks-".concat(e.partner_id),title:"Total clicks",children:[(0,ea.jsx)(EE,{size:13})," ",e.click_count||0]}),(0,ea.jsx)("button",{onClick:()=>(e=>{m(e.partner_id),x({name:e.name,bio:e.bio||"",logo_url:e.logo_url||"",link:e.link,featured:!!e.featured,order:e.order||0}),c(!0)})(e),"data-testid":"marketplace-edit-".concat(e.partner_id),className:"text-slate-400 hover:text-indigo-600 p-1",title:"Edit",children:(0,ea.jsx)(BQ,{size:15})}),(0,ea.jsx)("button",{onClick:()=>(async e=>{if(window.confirm('Delete partner "'.concat(e.name,'"?')))try{await _l.delete("/marketplace/partners/".concat(e.partner_id)),qs.success("Partner deleted"),l(t=>t.filter(t=>t.partner_id!==e.partner_id))}catch(G2){qs.error("Failed to delete partner")}})(e),"data-testid":"marketplace-delete-".concat(e.partner_id),className:"text-slate-400 hover:text-red-600 p-1",title:"Delete",children:(0,ea.jsx)(wD,{size:15})})]})]})]},e.partner_id))}),(0,ea.jsx)(Ok,{open:o,onOpenChange:c,children:(0,ea.jsxs)(Wk,{className:"max-w-lg","data-testid":"marketplace-dialog",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:u?"Edit Partner":"Add Partner"}),(0,ea.jsx)(Gk,{children:"Partners appear in every tenant's Marketplace. Add a logo, a short bio and your affiliate link."})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Partner name *"}),(0,ea.jsx)(BN,{value:h.name,onChange:e=>x(d(d({},h),{},{name:e.target.value})),placeholder:"e.g. Acme Analytics","data-testid":"marketplace-form-name"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Short bio"}),(0,ea.jsx)(YN,{value:h.bio,onChange:e=>x(d(d({},h),{},{bio:e.target.value})),placeholder:"A short description of this partner\u2026",rows:3,"data-testid":"marketplace-form-bio"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Logo / image"}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[h.logo_url?(0,ea.jsx)("img",{src:h.logo_url,alt:"logo",className:"h-12 w-12 object-contain border border-slate-200 rounded"}):(0,ea.jsx)("div",{className:"h-12 w-12 rounded border border-dashed border-slate-300 flex items-center justify-center text-slate-300",children:(0,ea.jsx)($N,{size:18})}),(0,ea.jsx)(sg,{type:"button",variant:"outline",size:"sm",onClick:()=>v(!0),"data-testid":"marketplace-form-pick-logo",children:"Choose from Media Library"}),h.logo_url&&(0,ea.jsx)("button",{type:"button",className:"text-xs text-red-500",onClick:()=>x(d(d({},h),{},{logo_url:""})),"data-testid":"marketplace-form-clear-logo",children:"Remove"})]}),(0,ea.jsx)(BN,{value:h.logo_url,onChange:e=>x(d(d({},h),{},{logo_url:e.target.value})),placeholder:"\u2026or paste an image URL",className:"mt-2","data-testid":"marketplace-form-logo-url"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Affiliate link *"}),(0,ea.jsx)(BN,{value:h.link,onChange:e=>x(d(d({},h),{},{link:e.target.value})),placeholder:"https://partner.com/?ref=yourcode","data-testid":"marketplace-form-link"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:h.featured,onCheckedChange:e=>x(d(d({},h),{},{featured:e})),"data-testid":"marketplace-form-featured"}),(0,ea.jsx)(tf,{className:"cursor-pointer",children:"Featured (pin to top)"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{className:"text-sm text-slate-500",children:"Order"}),(0,ea.jsx)(BN,{type:"number",value:h.order,onChange:e=>x(d(d({},h),{},{order:parseInt(e.target.value)||0})),className:"w-20","data-testid":"marketplace-form-order"})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(h.name.trim()&&h.link.trim()){g(!0);try{u?(await _l.put("/marketplace/partners/".concat(u),h),qs.success("Partner updated")):(await _l.post("/marketplace/partners",h),qs.success("Partner added")),c(!1),b()}catch(G2){var e,t;qs.error((null===G2||void 0===G2||null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save partner")}finally{g(!1)}}else qs.error("Name and link are required")},disabled:p,className:"bg-rose-600 hover:bg-rose-700","data-testid":"marketplace-form-save",children:p?"Saving\u2026":u?"Save changes":"Add partner"})]})]})}),(0,ea.jsx)(Dq,{open:f,onClose:()=>v(!1),onSelect:e=>{x(t=>d(d({},t),{},{logo_url:e.url})),v(!1)}})]})})},IQ=[{id:"pages",label:"Created and published key pages (Home, About, Contact)"},{id:"branding",label:"Uploaded logo and set brand colors in Site Theme"},{id:"navigation",label:"Set up header and footer navigation menus"},{id:"content",label:"Added content to pages (text, images, etc.)"},{id:"domain",label:"Have a custom domain ready (e.g., myschool.com.au)"},{id:"tested",label:"Previewed and tested pages on different devices"}],OQ=e=>{let{isOpen:s,onClose:a}=e;const[n,l]=(0,t.useState)([]),[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)(!1),[d,u]=(0,t.useState)(!1);return s?(0,ea.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto shadow-xl",children:[(0,ea.jsxs)("div",{className:"p-6 border-b border-slate-200 flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-emerald-100 rounded-full flex items-center justify-center",children:(0,ea.jsx)(Mj,{className:"w-5 h-5 text-emerald-600"})}),(0,ea.jsx)("h2",{className:"text-xl font-bold text-slate-900",children:"Ready to Go Live?"})]}),(0,ea.jsx)("button",{onClick:a,className:"text-slate-400 hover:text-slate-600",children:(0,ea.jsx)(sr,{size:24})})]}),(0,ea.jsx)("div",{className:"p-6",children:d?(0,ea.jsxs)("div",{className:"text-center py-8",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-emerald-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(Xl,{className:"w-8 h-8 text-emerald-600"})}),(0,ea.jsx)("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Request Submitted!"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"We've received your Go Live request. Our team will review it and contact you within 1-2 business days."}),(0,ea.jsx)("h4",{className:"font-semibold text-slate-900 mb-3",children:"What happens next?"}),(0,ea.jsxs)("ul",{className:"text-left text-sm text-slate-600 space-y-2 max-w-sm mx-auto",children:[(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"1."}),"Our team will review your site"]}),(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"2."}),"We'll help you set up your custom domain"]}),(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"3."}),"DNS configuration and SSL setup"]}),(0,ea.jsxs)("li",{className:"flex items-start gap-2",children:[(0,ea.jsx)("span",{className:"text-emerald-500 mt-0.5",children:"4."}),"Final checks and your site goes live! \ud83c\udf89"]})]}),(0,ea.jsx)(sg,{onClick:a,className:"mt-6",children:"Close"})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"Before we launch your site, let's make sure everything is ready. Check off the items you've completed:"}),(0,ea.jsx)("div",{className:"space-y-3 mb-6",children:IQ.map(e=>(0,ea.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg hover:bg-slate-50",children:[(0,ea.jsx)(fw,{id:"settings-".concat(e.id),checked:n.includes(e.id),onCheckedChange:t=>((e,t)=>{l(t?[...n,e]:n.filter(t=>t!==e))})(e.id,t)}),(0,ea.jsx)(tf,{htmlFor:"settings-".concat(e.id),className:"text-sm text-slate-700 cursor-pointer leading-relaxed",children:e.label})]},e.id))}),(0,ea.jsxs)("div",{className:"mb-6",children:[(0,ea.jsx)(tf,{htmlFor:"settings-notes",className:"text-sm font-medium text-slate-700 mb-2 block",children:"Additional notes or questions (optional)"}),(0,ea.jsx)(YN,{id:"settings-notes",value:r,onChange:e=>i(e.target.value),placeholder:"e.g., I'd like help setting up my domain, or I have questions about...",rows:3})]}),(0,ea.jsxs)("div",{className:"mb-6 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-700",children:"Checklist Progress"}),(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:[n.length," of ",IQ.length]})]}),(0,ea.jsx)("div",{className:"w-full bg-slate-200 rounded-full h-2",children:(0,ea.jsx)("div",{className:"bg-emerald-500 h-2 rounded-full transition-all duration-300",style:{width:"".concat(n.length/IQ.length*100,"%")}})})]}),(0,ea.jsx)(sg,{onClick:async()=>{c(!0);try{const e=IQ.filter(e=>n.includes(e.id)).map(e=>e.label);await _l.post("/tenant/go-live-request",{checklist_completed:e,notes:r||null}),u(!0),qs.success("Go Live request submitted!")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to submit request")}finally{c(!1)}},disabled:o,className:"w-full bg-emerald-600 hover:bg-emerald-700",children:o?"Submitting...":"\ud83d\ude80 Submit Go Live Request"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 text-center mt-4",children:"Don't worry if you haven't completed everything \u2013 we'll help you get there!"})]})})]})}):null},UQ=()=>{var e,s,a,n,l;const{user:r}=Al(),{planLevel:i}=Yk(),o=(i||(null===r||void 0===r?void 0:r.plan)||"freemium").toLowerCase(),c="freemium"===o||"free"===o,[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(null),[f,v]=(0,t.useState)({sender_email:"",sender_name:"",default_sender_email:"",is_custom:!1,verification_status:null,is_verified:!1,domain_auth_request:null}),[b,j]=(0,t.useState)(!0),[y,N]=(0,t.useState)(!1),[w,C]=(0,t.useState)(!1),[k,D]=(0,t.useState)(!1),[_,S]=(0,t.useState)({domain:"",notes:""}),[E,A]=(0,t.useState)({ga_measurement_id:"",enable_builtin_analytics:!0}),[F,T]=(0,t.useState)(!0),[z,M]=(0,t.useState)(!1),[P,B]=(0,t.useState)({translation_enabled:!1,translation_tier:"free",translation_positions:["floating"],default_language:"en",enabled_languages:null,translation_mode:"selector"}),[R,L]=(0,t.useState)(!0),[I,O]=(0,t.useState)(!1),[U,H]=(0,t.useState)({enabled:!1,message:'We use cookies to enhance your browsing experience and analyse site traffic. By clicking "Accept", you consent to the use of cookies.',accept_text:"Accept",decline_text:"Decline",privacy_url:"",privacy_text:"Privacy Policy",position:"bottom",bg_color:"#1e293b",text_color:"#f8fafc",button_bg:"#4f46e5",button_text_color:"#ffffff",show_decline:!0}),[W,V]=(0,t.useState)(!0),[q,$]=(0,t.useState)(!1),[G,K]=(0,t.useState)(null),[Y,J]=(0,t.useState)([]),[Q,X]=(0,t.useState)(!0),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(!1),[ae,ne]=(0,t.useState)(null);(0,t.useEffect)(()=>{const e=new URLSearchParams(window.location.search).get("session_id");e&&me(e),ce(),ie(),oe(),de(),ue(),le(),re()},[]);const le=async()=>{try{const e=await _l.get("/platform/pricing");ne(e.data)}catch(e){console.log("Could not load platform pricing")}},re=async()=>{try{const e=await _l.get("/system/version");g(e.data)}catch(e){console.log("Could not load version info")}},ie=async()=>{T(!0);try{const e=await _l.get("/tenant/analytics-settings");A({ga_measurement_id:e.data.ga_measurement_id||"",enable_builtin_analytics:!1!==e.data.enable_builtin_analytics})}
2catch(e){console.log("Could not load analytics settings")}finally{T(!1)}},oe=async()=>{L(!0);try{const e=await _l.get("/tenant/translation-settings");B({translation_enabled:e.data.translation_enabled||!1,translation_tier:e.data.translation_tier||"free",translation_positions:e.data.translation_positions||["floating"],default_language:e.data.default_language||"en",enabled_languages:e.data.enabled_languages,translation_mode:e.data.translation_mode||"selector"})}catch(e){console.log("Could not load translation settings")}finally{L(!1)}},ce=async()=>{try{const e=await _l.get("/tenant/email-settings");v({sender_email:e.data.sender_email||"",sender_name:e.data.sender_name||"",default_sender_email:e.data.default_sender_email||"",is_custom:e.data.is_custom||!1,verification_status:e.data.verification_status,is_verified:e.data.is_verified||!1,domain_auth_request:e.data.domain_auth_request})}catch(e){console.error("Failed to load email settings:",e)}finally{j(!1)}},de=async()=>{V(!0);try{var e;const t=null===(e=(await _l.get("/tenant")).data)||void 0===e?void 0:e.tenant_id;if(t){const e=await _l.get("/tenant/".concat(t,"/cookie-consent"));H(t=>d(d({},t),e.data))}}catch(t){console.log("Could not load cookie consent settings")}finally{V(!1)}},ue=async()=>{X(!0);try{const[e,t]=await Promise.all([_l.get("/billing/info"),_l.get("/billing/history")]);K(e.data),J(t.data.transactions||[])}catch(e){console.error("Failed to load billing info:",e)}finally{X(!1)}},me=async e=>{try{"paid"===(await _l.get("/billing/status/".concat(e))).data.payment_status&&qs.success("Payment successful! Your subscription is now active."),window.history.replaceState({},"","/settings")}catch(t){console.error("Failed to check payment status:",t)}},he=(null===ae||void 0===ae?void 0:ae.tiers)||{},xe=(null===ae||void 0===ae?void 0:ae.support_email)||"[email protected]",pe=[{name:"Freemium",slug:"freemium",price:0,priceLabel:"Free",features:["1 Landing Page","1 Form","250 MB Storage","Affiliate Program Access","Includes Dynatex branding"]},{name:"Starter",slug:"starter",price:null!==(e=null===(s=he.basic)||void 0===s?void 0:s.price_monthly)&&void 0!==e?e:39,features:["5 Pages","1,000 Newsletter Emails/month","1GB Storage","2 Team Members"]},{name:"Professional",slug:"pro",price:null!==(a=null===(n=he.pro)||void 0===n?void 0:n.price_monthly)&&void 0!==a?a:99,features:["Unlimited Pages","10,000 Newsletter Emails/month","10GB Storage","10 Team Members","Priority Support"],recommended:!0},{name:"Enterprise",slug:"enterprise",price:null,contactSales:!0,features:["Unlimited Everything","Custom Domain","Dedicated Support","SLA","Advanced Analytics"]}];return(0,ea.jsxs)("div",{className:"flex","data-testid":"settings-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,ea.jsx)("h1",{className:"text-4xl font-bold",style:{fontFamily:"Manrope, sans-serif"},children:"Settings"}),(0,ea.jsxs)(sg,{onClick:()=>x(!0),className:"bg-emerald-600 hover:bg-emerald-700","data-testid":"settings-go-live-button",children:[(0,ea.jsx)(Mj,{size:18,className:"mr-2"}),"Ready to Go Live"]})]}),(0,ea.jsxs)("div",{className:"mb-12","data-testid":"billing-management-section",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,ea.jsx)("h2",{className:"text-2xl font-semibold",style:{fontFamily:"Manrope, sans-serif"},children:"Billing Management"}),(0,ea.jsx)(DC,{content:"View your current plan, payment history, and manage your subscription",children:(0,ea.jsx)(Aw,{size:18,className:"text-slate-400 cursor-help"})})]}),Q?(0,ea.jsxs)("div",{className:"bg-white rounded-xl p-8 text-center",children:[(0,ea.jsx)(gq,{className:"animate-spin mx-auto mb-2",size:24}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading billing information..."})]}):G?(0,ea.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:[(0,ea.jsxs)("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Aj,{size:20,className:"text-indigo-600"}),"Current Plan"]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Plan"}),(0,ea.jsxs)("span",{className:"font-semibold text-lg",children:[G.plan_name||"Starter","active"===G.subscription_status&&(0,ea.jsx)("span",{className:"ml-2 px-2 py-0.5 bg-emerald-100 text-emerald-700 text-xs rounded-full",children:"Active"}),"trial"===G.subscription_status&&(0,ea.jsx)("span",{className:"ml-2 px-2 py-0.5 bg-amber-100 text-amber-700 text-xs rounded-full",children:"Trial"}),"cancelled"===G.subscription_status&&(0,ea.jsx)("span",{className:"ml-2 px-2 py-0.5 bg-red-100 text-red-700 text-xs rounded-full",children:"Cancelled"})]})]}),G.next_billing_date&&(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Next Billing Date"}),(0,ea.jsx)("span",{className:"font-medium",children:new Date(G.next_billing_date).toLocaleDateString()})]}),G.last_payment&&(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Last Payment"}),(0,ea.jsxs)("span",{className:"font-medium",children:["$",null===(l=G.last_payment.amount)||void 0===l?void 0:l.toFixed(2)," on ",new Date(G.last_payment.date).toLocaleDateString()]})]}),(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Member Since"}),(0,ea.jsx)("span",{className:"font-medium",children:G.member_since?new Date(G.member_since).toLocaleDateString():"N/A"})]}),"active"===G.subscription_status&&(0,ea.jsx)("div",{className:"pt-4 border-t border-slate-100",children:(0,ea.jsx)(sg,{variant:"outline",onClick:()=>ee(!0),className:"text-red-600 border-red-200 hover:bg-red-50","data-testid":"cancel-subscription-btn",children:"Cancel Subscription"})})]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:[(0,ea.jsxs)("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Kg,{size:20,className:"text-indigo-600"}),"Payment History"]}),Y.length>0?(0,ea.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:Y.map((e,t)=>{var s;return(0,ea.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-slate-100 last:border-0",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"font-medium text-sm",children:[e.package?e.package.charAt(0).toUpperCase()+e.package.slice(1):"Subscription"," Plan"]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:new Date(e.created_at).toLocaleDateString()})]}),(0,ea.jsxs)("div",{className:"text-right",children:[(0,ea.jsxs)("p",{className:"font-semibold",children:["$",(null===(s=e.amount)||void 0===s?void 0:s.toFixed(2))||"0.00"]}),(0,ea.jsx)("p",{className:"text-xs ".concat("paid"===e.payment_status?"text-emerald-600":"initiated"===e.payment_status?"text-amber-600":"text-slate-500"),children:"paid"===e.payment_status?"\u2713 Paid":"initiated"===e.payment_status?"Pending":e.payment_status})]})]},e.transaction_id||t)})}):(0,ea.jsxs)("div",{className:"text-center py-8 text-slate-500",children:[(0,ea.jsx)(Aj,{size:32,className:"mx-auto mb-2 opacity-50"}),(0,ea.jsx)("p",{children:"No payment history yet"})]})]})]}):(0,ea.jsxs)("div",{className:"bg-white rounded-xl p-8 text-center",children:[(0,ea.jsx)(WN,{className:"mx-auto mb-2 text-amber-500",size:32}),(0,ea.jsx)("p",{className:"text-slate-600",children:"Could not load billing information"}),(0,ea.jsxs)(sg,{onClick:ue,variant:"outline",className:"mt-4",children:[(0,ea.jsx)(gq,{size:16,className:"mr-2"}),"Retry"]})]})]}),Z&&(0,ea.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl max-w-md w-full p-6 shadow-xl",children:[(0,ea.jsx)("h3",{className:"text-xl font-bold mb-4 text-red-600",children:"Cancel Subscription"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-4",children:"Are you sure you want to cancel your subscription? You will retain access until the end of your current billing period."}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>ee(!1),className:"flex-1",children:"Keep Subscription"}),(0,ea.jsx)(sg,{onClick:async()=>{se(!0);try{const e=await _l.post("/billing/cancel");qs.success(e.data.message),ee(!1),ue()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to cancel subscription")}finally{se(!1)}},disabled:te,className:"flex-1 bg-red-600 hover:bg-red-700",children:te?"Cancelling...":"Yes, Cancel"})]})]})}),(0,ea.jsxs)("div",{className:"mb-12",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,ea.jsx)("h2",{className:"text-2xl font-semibold",style:{fontFamily:"Manrope, sans-serif"},children:"Subscription Plans"}),(0,ea.jsx)(DC,{content:"Choose a plan that fits your needs. You can upgrade or downgrade anytime.",children:(0,ea.jsx)(Aw,{size:18,className:"text-slate-400 cursor-help"})})]}),(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:pe.map(e=>{const t=o===e.slug||"free"===o&&"freemium"===e.slug;return(0,ea.jsxs)("div",{"data-testid":"package-".concat(e.slug),className:"bg-white rounded-xl border-2 p-6 hover:shadow-lg transition-all ".concat(t?"border-emerald-500":e.recommended?"border-indigo-600":"border-slate-200"),children:[t?(0,ea.jsx)("span",{className:"inline-block px-3 py-1 bg-emerald-500 text-white text-xs font-semibold rounded-full mb-4",children:"Current Plan"}):e.recommended?(0,ea.jsx)("span",{className:"inline-block px-3 py-1 bg-indigo-600 text-white text-xs font-semibold rounded-full mb-4",children:"Recommended"}):null,(0,ea.jsx)("h3",{className:"text-2xl font-bold mb-2",children:e.name}),(0,ea.jsx)("p",{className:"text-4xl font-bold mb-6",children:e.contactSales?(0,ea.jsx)(ea.Fragment,{children:"Contact us"}):0===e.price?(0,ea.jsxs)(ea.Fragment,{children:[e.priceLabel||"Free",(0,ea.jsx)("span",{className:"text-lg text-slate-500 font-normal",children:" forever"})]}):(0,ea.jsxs)(ea.Fragment,{children:["$",e.price,(0,ea.jsx)("span",{className:"text-lg text-slate-500 font-normal",children:"/mo"})]})}),(0,ea.jsx)("ul",{className:"space-y-3 mb-6",children:e.features.map(e=>(0,ea.jsxs)("li",{className:"flex items-center gap-2 text-sm",children:[(0,ea.jsx)("span",{className:"text-emerald-600",children:"\u2713"}),e]},e))}),t?(0,ea.jsxs)(sg,{disabled:!0,className:"w-full bg-slate-200 text-slate-600 cursor-not-allowed","data-testid":"subscribe-".concat(e.slug,"-current"),children:[(0,ea.jsx)(Xl,{size:18,className:"mr-2"}),"Current Plan"]}):"freemium"===e.slug?(0,ea.jsx)(sg,{disabled:!0,className:"w-full bg-slate-100 text-slate-500 cursor-not-allowed",title:"Freemium is the default plan \u2014 cancel a paid subscription to return to Freemium","data-testid":"subscribe-".concat(e.slug),children:"Default Plan"}):e.contactSales?(0,ea.jsx)(sg,{onClick:()=>{window.location.href="mailto:".concat(xe,"?subject=").concat(encodeURIComponent("Enterprise plan enquiry"))},className:"w-full bg-slate-900 hover:bg-slate-800","data-testid":"subscribe-".concat(e.slug),children:"Contact Sales"}):(0,ea.jsxs)(sg,{onClick:()=>(async e=>{m(!0);try{const t=await _l.post("/billing/checkout",{package:e});window.location.href=t.data.url}catch(t){qs.error("Failed to create checkout session"),m(!1)}})(e.slug),disabled:u,className:"w-full ".concat(e.recommended?"bg-indigo-600 hover:bg-indigo-700":"bg-slate-900 hover:bg-slate-800"),"data-testid":"subscribe-".concat(e.slug),children:[(0,ea.jsx)(Aj,{size:18,className:"mr-2"}),"Subscribe"]})]},e.slug)})})]}),(0,ea.jsxs)("div",{className:"mb-12",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,ea.jsx)("h2",{className:"text-2xl font-semibold",style:{fontFamily:"Manrope, sans-serif"},children:"Email Settings"}),(0,ea.jsx)(DC,{content:"Configure your custom sender email for form notifications and newsletters",children:(0,ea.jsx)(Aw,{size:18,className:"text-slate-400 cursor-help"})})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:b?(0,ea.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex items-start gap-4 mb-6",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-indigo-100 flex items-center justify-center",children:(0,ea.jsx)(Yl,{size:24,className:"text-indigo-600"})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-2",children:"Single Sender Verification"}),(0,ea.jsx)("p",{className:"text-slate-600 text-sm",children:'Set a custom "From" address for emails. Enter your email and click verify - we\'ll send a confirmation link to your inbox.'})]})]}),(0,ea.jsxs)("div",{className:"space-y-4 mb-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Sender Email Address"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"email",value:f.sender_email,onChange:e=>v(d(d({},f),{},{sender_email:e.target.value,is_verified:!1,verification_status:null})),placeholder:f.default_sender_email||"[email protected]",className:"flex-1 px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500","data-testid":"sender-email-input"}),(0,ea.jsxs)(sg,{onClick:async()=>
2{if(f.sender_email){C(!0);try{"verified"===(await _l.post("/tenant/email-settings/verify-sender",{email:f.sender_email,name:f.sender_name||null})).data.status?qs.success("Email is already verified!"):qs.success("Verification email sent! Check your inbox."),ce()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to request verification")}finally{C(!1)}}else qs.error("Please enter an email address first")},disabled:w||!f.sender_email,className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"verify-email-btn",children:[(0,ea.jsx)(dr,{size:16,className:"mr-2"}),w?"Sending...":"Verify"]})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500 mt-1",children:["Platform default: ",f.default_sender_email]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Sender Name"}),(0,ea.jsx)("input",{type:"text",value:f.sender_name,onChange:e=>v(d(d({},f),{},{sender_name:e.target.value})),placeholder:"Your Company Name",className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500","data-testid":"sender-name-input"})]})]}),f.is_custom&&(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg mb-6 ".concat(f.is_verified?"bg-emerald-50 border border-emerald-200":"bg-amber-50 border border-amber-200"),children:[(0,ea.jsx)("div",{className:"flex items-center gap-2",children:f.is_verified?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(cr,{size:20,className:"text-emerald-600"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("span",{className:"text-sm font-medium text-emerald-700",children:"Verified"}),(0,ea.jsxs)("p",{className:"text-xs text-emerald-600",children:[f.sender_email," is ready to use"]})]})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Kg,{size:20,className:"text-amber-600"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("span",{className:"text-sm font-medium text-amber-700",children:"Pending Verification"}),(0,ea.jsx)("p",{className:"text-xs text-amber-600",children:"Check your inbox for the verification email"})]})]})}),!f.is_verified&&(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{onClick:async()=>{C(!0);try{(await _l.get("/tenant/email-settings/check-verification")).data.verified?qs.success("Email is verified!"):qs.info("Still pending verification. Check your inbox."),ce()}catch(e){qs.error("Failed to check verification status")}finally{C(!1)}},disabled:w,variant:"outline",size:"sm",className:"text-amber-700 border-amber-300 hover:bg-amber-100",children:[(0,ea.jsx)(gq,{size:14,className:"mr-1 ".concat(w?"animate-spin":"")}),"Check Status"]}),(0,ea.jsxs)(sg,{onClick:async()=>{C(!0);try{(await _l.post("/tenant/email-settings/resend-verification")).data.already_verified?qs.success("Email is already verified!"):qs.success("Verification email resent!"),ce()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to resend verification")}finally{C(!1)}},disabled:w,variant:"outline",size:"sm",className:"text-amber-700 border-amber-300 hover:bg-amber-100",children:[(0,ea.jsx)(dr,{size:14,className:"mr-1"}),"Resend"]})]})]}),!f.is_custom&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-3 rounded-lg mb-6 bg-slate-50",children:[(0,ea.jsx)(WN,{size:18,className:"text-slate-500"}),(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:"Using platform default sender"})]}),(0,ea.jsxs)("div",{className:"flex gap-3 mb-8",children:[(0,ea.jsxs)(sg,{onClick:async()=>{N(!0);try{await _l.put("/tenant/email-settings",{sender_email:f.sender_email||null,sender_name:f.sender_name||null}),qs.success("Email settings saved successfully"),ce()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save email settings")}finally{N(!1)}},disabled:y,className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"save-email-settings",children:[(0,ea.jsx)(BD,{size:18,className:"mr-2"}),y?"Saving...":"Save Settings"]}),f.is_custom&&(0,ea.jsxs)(sg,{onClick:async()=>{N(!0);
2try{await _l.delete("/tenant/email-settings"),v(d(d({},f),{},{sender_email:"",sender_name:"",is_custom:!1,verification_status:null,is_verified:!1})),qs.success("Email settings reset to platform defaults")}catch(e){qs.error("Failed to reset email settings")}finally{N(!1)}},disabled:y,variant:"outline","data-testid":"reset-email-settings",children:[(0,ea.jsx)(Nj,{size:18,className:"mr-2"}),"Reset to Default"]})]}),(0,ea.jsxs)("div",{className:"border-t border-slate-200 pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-start gap-4 mb-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-purple-100 flex items-center justify-center",children:(0,ea.jsx)(hr,{size:24,className:"text-purple-600"})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("h3",{className:"font-semibold",children:"Domain Authentication"}),(0,ea.jsx)("span",{className:"px-2 py-0.5 bg-purple-100 text-purple-700 text-xs font-medium rounded",children:"Premium"})]}),(0,ea.jsx)("p",{className:"text-slate-600 text-sm mt-1",children:"Authenticate your entire domain for better deliverability. Any email @yourdomain.com will work automatically."})]})]}),f.domain_auth_request?(0,ea.jsxs)("div",{className:"p-4 rounded-lg ".concat("verified"===f.domain_auth_request.status?"bg-emerald-50 border border-emerald-200":"bg-blue-50 border border-blue-200"),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:["verified"===f.domain_auth_request.status?(0,ea.jsx)(cr,{size:18,className:"text-emerald-600"}):(0,ea.jsx)(Kg,{size:18,className:"text-blue-600"}),(0,ea.jsx)("span",{className:"text-sm font-medium ".concat("verified"===f.domain_auth_request.status?"text-emerald-700":"text-blue-700"),children:"verified"===f.domain_auth_request.status?"Domain Authenticated":"Request Pending"})]}),(0,ea.jsxs)("p",{className:"text-sm text-slate-600",children:["Domain: ",(0,ea.jsx)("strong",{children:f.domain_auth_request.domain})]}),"pending"===f.domain_auth_request.status&&(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Our team will c
2ontact you within 1-2 business days with DNS records."})]}):k?(0,ea.jsx)("div",{className:"bg-slate-50 rounded-lg p-4",children:(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Your Domain"}),(0,ea.jsx)("input",{type:"text",value:_.domain,onChange:e=>S(d(d({},_),{},{domain:e.target.value})),placeholder:"yourcompany.com",className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Notes (optional)"}),(0,ea.jsx)("textarea",{value:_.notes,onChange:e=>S(d(d({},_),{},{notes:e.target.value})),placeholder:"Any additional information...",rows:2,className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500"})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{onClick:async()=>{if(_.domain){C(!0);try{const e=await _l.post("/tenant/email-settings/request-domain-auth",_);qs.success(e.data.message),D(!1),S({domain:"",notes:""}),ce()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to submit request")}finally{C(!1)}}else qs.error("Please enter a domain")},disabled:w||!_.domain,className:"bg-purple-600 hover:bg-purple-700",children:w?"Submitting...":"Submit Request"}),(0,ea.jsx)(sg,{onClick:()=>D(!1),variant:"outline",children:"Cancel"})]})]})}):(0,ea.jsxs)(sg,{onClick:()=>D(!0),variant:"outline",className:"border-purple-300 text-purple-700 hover:bg-purple-50",children:[(0,ea.jsx)(hr,{size:16,className:"mr-2"}),"Request Domain Authentication"]})]})]})})]}),c?(0,ea.jsxs)("div",{className:"mb-12","data-testid":"freemium-locked-settings",children:[(0,ea.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,ea.jsx)("h2",{className:"text-2xl font-semibold",style:{fontFamily:"Manrope, sans-serif"},children:"More Settings"})}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-dashed border-slate-300 p-8 text-center",children:[(0,ea.jsx)("div",{className:"w-12 h-12 mx-auto rounded-full bg-slate-100 flex items-center justify-center mb-3",children:(0,ea.jsx)(Lj,{className:"text-slate-500",size:22})}),(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-800 mb-1",children:"Analytics, Translations, API Access & Cookie Banner are paid features"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-5",children:"Upgrade to a paid plan to unlock Google Analytics, multi-language translations, the REST API and a customisable cookie consent banner."}),(0,ea.jsx)(sg,{asChild:!0,className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"freemium-upgrade-from-locked-settings",children:(0,ea.jsx)("a",{href:"#billing-management-section",children:"View Upgrade Options"})})]})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"mb-12",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,ea.jsx)("h2",{className:"text-2xl font-semibold",style:{fontFamily:"Manrope, sans-serif"},children:"Analytics Settings"}),(0,ea.jsx)(DC,{content:"Configure how you track visitor analytics on your public site",children:(0,ea.jsx)(Aw,{size:18,className:"text-slate-400 cursor-help"})})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:F?(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading analytics settings..."}):(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-start gap-4 mb-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-orange-100 flex items-center justify-center",children:(0,ea.jsx)(Cw,{size:24,className:"text-orange-600"})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-1",children:"Google Analytics 4"}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Add your GA4 Measurement ID to enable Google Analytics tracking on your public site."})]})]}),(0,ea.jsxs)("div",{className:"ml-16",children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"GA4 Measurement ID"}),(0,ea.jsx)("div",{className:"flex gap-2",children:(0,ea.jsx)("input",{type:"text",value:E.ga_measurement_id,onChange:e=>A(d(d({},E),{},{ga_measurement_id:e.target.value})),placeholder:"G-XXXXXXXXXX",className:"flex-1 max-w-xs px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 font-mono"})}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Find this in Google Analytics \u2192 Admin \u2192 Data Streams \u2192 Your Stream \u2192 Measurement ID"})]})]}),(0,ea.jsx)("hr",{className:"border-slate-200"}),(0,ea.jsx)("div",{children:(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-indigo-100 flex items-center justify-center",children:(0,ea.jsx)(Cw,{size:24,className:"text-indigo-600"})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-1",children:"Built-in Analytics"}),(0,ea.jsx)("p",{className:"text-sm text-slate-600 mb-3",children:"Our privacy-friendly analytics - no cookies, GDPR compliant."}),(0,ea.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:E.enable_builtin_analytics,onChange:e=>A(d(d({},E),{},{enable_builtin_analytics:e.target.checked})),className:"w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"}),(0,ea.jsx)("span",{className:"text-sm text-slate-700",children:"Enable built-in analytics tracking"})]})]})]})}),(0,ea.jsx)("div",{className:"flex justify-end pt-4 border-t border-slate-200",children:(0,ea.jsx)(sg,{onClick:async()=>{M(!0);try{await _l.put("/tenant/analytics-settings",E),qs.success("Analytics settings saved successfully")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save analytics settings")}finally{M(!1)}},disabled:z,className:"bg-indigo-600 hover:bg-indigo-700",children:z?"
2Saving...":"Save Analytics Settings"})})]})})]}),(0,ea.jsxs)("div",{className:"mb-12","data-testid":"translation-settings-section",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,ea.jsx)("h2",{className:"text-2xl font-semibold",style:{fontFamily:"Manrope, sans-serif"},children:"Translation Settings"}),(0,ea.jsx)(DC,{content:"Configure how visitors can translate your public pages into different languages",children:(0,ea.jsx)(Aw,{size:18,className:"text-slate-400 cursor-help"})})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:R?(0,ea.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})}):(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-blue-100 flex items-center justify-center",children:(0,ea.jsx)(ZJ,{size:24,className:"text-blue-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"font-semibold",children:"Enable Translation"}),(0,ea.jsx)("p",{className:"text-sm text-slate-600 mt-1",children:"Allow visitors to translate your pages into their preferred language"})]})]}),(0,ea.jsx)("input",{type:"checkbox",checked:P.translation_enabled,onChange:e=>B(d(d({},P),{},{translation_enabled:e.target.checked})),className:"w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500","data-testid":"translation-enabled-toggle"})]}),P.translation_enabled&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700",children:"Auto-Translation Mode"}),(0,ea.jsxs)("select",{value:P.translation_mode||"selector",onChange:e=>B(d(d({},P),{},{translation_mode:e.target.value})),className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500","data-testid":"translation-mode-select",children:[(0,ea.jsx)("option",{value:"selector",children:"Manual Selection Only"}),(0,ea.jsx)("option",{value:"auto",children:"Auto-detect (Browser Language)"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"auto"===P.translation_mode?"Pages will automatically translate based on visitor's browser language":"Visitors must manually select their language from the language selector"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700",children:"Translation Tier"}),(0,ea.jsxs)("select",{value:P.translation_tier,onChange:e=>B(d(d({},P),{},{translation_tier:e.target.value})),className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500","data-testid":"translation-tier-select",children:[(0,ea.jsx)("option",{value:"free",children:"Free (Google Widget)"}),(0,ea.jsx)("option",{value:"premium",children:"Premium (API - Higher Quality)"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"free"===P.translation_tier?"Uses Google Translate browser widget - no API costs":"Uses Google Cloud Translation API - cached for cost efficiency"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700",children:"Language Selector Positions"}),(0,ea.jsx)("div",{className:"space-y-2",children:[{id:"header",label:"Header (Right Side)",desc:"In the navigation menu"},{id:"footer",label:"Footer",desc:"At the bottom of the page"},{id:"floating",label:"Floating",desc:"Fixed position (top-left corner)"}].map(e=>{var t;return(0,ea.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded border border-slate-200",children:[(0,ea.jsx)("input",{type:"checkbox",id:"settings-pos-".concat(e.id),checked:null===(t=P.translation_positions)||void 0===t?void 0:t.includes(e.id),onChange:t=>{const s=P.translation_positions||[];t.target.checked?B(d(d({},P),{}
2,{translation_positions:[...s,e.id]})):B(d(d({},P),{},{translation_positions:s.filter(t=>t!==e.id)}))},className:"rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{htmlFor:"settings-pos-".concat(e.id),className:"text-sm font-medium cursor-pointer",children:e.label}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:e.desc})]})]},e.id)})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"block text-sm font-medium text-slate-700",children:"Default Language"}),(0,ea.jsxs)("select",{value:P.default_language,onChange:e=>B(d(d({},P),{},{default_language:e.target.value})),className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500","data-testid":"default-language-select",children:[(0,ea.jsx)("option",{value:"en",children:"English"}),(0,ea.jsx)("option",{value:"es",children:"Spanish"}),(0,ea.jsx)("option",{value:"fr",children:"French"}),(0,ea.jsx)("option",{value:"de",children:"German"}),(0,ea.jsx)("option",{value:"it",children:"Italian"}),(0,ea.jsx)("option",{value:"pt",children:"Portuguese"}),(0,ea.jsx)("option",{value:"zh",children:"Chinese"}),(0,ea.jsx)("option",{value:"ja",children:"Japanese"}),(0,ea.jsx)("option",{value:"ko",children:"Korean"}),(0,ea.jsx)("option",{value:"ar",children:"Arabic"}),(0,ea.jsx)("option",{value:"hi",children:"Hindi"}),(0,ea.jsx)("option",{value:"pl",children:"Polish"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"The original language of your website content"})]})]}),(0,ea.jsx)("div",{className:"flex justify-end pt-4 border-t border-slate-200",children:(0,ea.jsx)(sg,{onClick:async()=>{O(!0);try{await _l.put("/tenant/translation-settings",P),qs.success("Translation settings saved successfully")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save translation settings")}finally{O(!1)}},disabled:I,className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"save-translation-settings-btn",children:I?"Saving...":"Save Translation Settings"})})]})})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,ea.jsx)("h2",{className:"text-2xl font-semibold",style:{fontFamily:"Manrope, sans-serif"},children:"API Access"}),(0,ea.jsx)(DC,{content:"Use our REST API to integrate NexusCMS with external systems",children:(0,ea.jsx)(Aw,{size:18,className:"text-slate-400 cursor-help"})})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-slate-100 flex items-center justify-center",children:(0,ea.jsx)(Ew,{size:24,className:"text-slate-600"})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-2",children:"API Documentation"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-4",children:"Access our REST API to integrate NexusCMS with your applications."}),(0,ea.jsx)(sg,{variant:"outline",asChild:!0,children:(0,ea.jsx)("a",{href:"/api-docs",children:"View API Docs"})})]})]})})]}),(0,ea.jsxs)("div",{className:"mb-12","data-testid":"cookie-consent-section",children:[(0,ea.jsx)("h2",{className:"text-lg font-semibold text-slate-800 mb-4",children:"Cookie Consent Banner"}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:W?(0,ea.jsx)("div",{className:"flex justify-center py-8",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-indigo-600"})}):(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Enable Cookie Banner"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Show a cookie consent banner to visitors"})]}),(0,ea.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:U.enabled,onChange:e=>H(t=>d(d({},t),{},{enabled:e.target.checked})),className:"sr-only peer","data-testid":"cookie-enabled-toggle"}),(0,ea.jsx)("div",{className:"w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-500 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"})]})]}),U.enabled&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Banner Message"}),(0,ea.jsx)("textarea",{value:U.message,onChange:e=>H(t=>d(d({},t),{},{message:e.target.value})),rows:3,className:"w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500","data-testid":"cookie-message-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Accept Button Text"}),(0,ea.jsx)("input",{type:"text",value:U.accept_text,onChange:e=>H(t=>d(d({},t),{},{accept_text:e.target.value})),className:"w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-indigo-500","data-testid":"cookie-accept-text-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Decline Button Text"}),(0,ea.jsx)("input",{type:"text",value:U.decline_text,onChange:e=>H(t=>d(d({},t),{},{decline_text:e.target.value})),className:"w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-indigo-500","data-testid":"cookie-decline-text-input"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"checkbox",checked:U.show_decline,onChange:e=>H(t=>d(d({},t),{},{show_decline:e.target.checked})),className:"rounded border-slate-300","data-testid":"cookie-show-decline"}),(0,ea.jsx)("label",{className:"text-sm text-slate-700",children:"Show decline button"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Privacy Policy URL"}),(0,ea.jsx)("input",{type:"url",value:U.privacy_url,onChange:e=>H(t=>d(d({},t),{},{privacy_url:e.target.value})),placeholder:"https://example.com/privacy",className:"w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-indigo-500","data-testid":"cookie-privacy-url-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Privacy Link Text"}),(0,ea.jsx)("input",{type:"text",value:U.privacy_text,onChange:e=>H(t=>d(d({},t),{},{privacy_text:e.target.value})),className:"w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-indigo-500","data-testid":"cookie-privacy-text-input"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Position"}),(0,ea.jsx)("div",{className:"flex gap-2",children:["bottom","top"].map(e=>(0,ea.jsx)("button",{onClick:()=>H(t=>d(d({},t),{},{position:e})),className:"px-4 py-2 text-sm rounded-lg border transition-colors ".concat(U.position===e?"bg-indigo-100 border-indigo-300 text-indigo-700 font-medium":"bg-white border-slate-300 text-slate-600 hover:bg-slate-50"),"data-testid":"cookie-position-".concat(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-2 block",children:"Colours"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Backgroun
2d"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:U.bg_color,onChange:e=>H(t=>d(d({},t),{},{bg_color:e.target.value})),className:"w-8 h-8 rounded border border-slate-300 cursor-pointer"}),(0,ea.jsx)("input",{type:"text",value:U.bg_color,onChange:e=>H(t=>d(d({},t),{},{bg_color:e.target.value})),className:"flex-1 border border-slate-300 rounded px-2 py-1 text-xs font-mono"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Text"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:U.text_color,onChange:e=>H(t=>d(d({},t),{},{text_color:e.target.value})),className:"w-8 h-8 rounded border border-slate-300 cursor-pointer"}),(0,ea.jsx)("input",{type:"text",value:U.text_color,onChange:e=>H(t=>d(d({},t),{},{text_color:e.target.value})),className:"flex-1 border border-slate-300 rounded px-2 py-1 text-xs font-mono"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Button BG"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:U.button_bg,onChange:e=>H(t=>d(d({},t),{},{button_bg:e.target.value})),className:"w-8 h-8 rounded border border-slate-300 cursor-pointer"}),(0,ea.jsx)("input",{type:"text",value:U.button_bg,onChange:e=>H(t=>d(d({},t),{},{button_bg:e.target.value})),className:"flex-1 border border-slate-300 rounded px-2 py-1 text-xs font-mono"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-xs text-slate-500 mb-1 block",children:"Button Text"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"color",value:U.button_text_color,onChange:e=>H(t=>d(d({},t),{},{button_text_color:e.target.value})),className:"w-8 h-8 rounded border border-slate-300 cursor-pointer"}),(0,ea.jsx)("input",{type:"text",value:U.button_text_color,onChange:e=>H(t=>d(d({},t),{},{button_text_color:e.target.value})),className:"flex-1 border border-slate-300 rounded px-2 py-1 text-xs font-mono"})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700 mb-2 block",children:"Preview"}),(0,ea.jsx)("div",{className:"rounded-lg p-4",style:{backgroundColor:U.bg_color,color:U.text_color},children:(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-3",children:[(0,ea.jsxs)("p",{className:"text-sm flex-1",style:{opacity:.9},children:[U.message,U.privacy_url&&(0,ea.jsx)("span",{className:"underline ml-1 font-medium",children:U.privacy_text})]}),(0,ea.jsxs)("div",{className:"flex gap-2 flex-shrink-0",children:[U.show_decline&&(0,ea.jsx)("span",{className:"px-3 py-1.5 text-sm rounded-lg border",style:{color:U.text_color,borderColor:"".concat(U.text_color,"40")},children:U.decline_text}),(0,ea.jsx)("span",{className:"px-4 py-1.5 text-sm font-semibold rounded-lg",style:{backgroundColor:U.button_bg,color:U.button_text_color},children:U.accept_text})]})]})})]})]}),(0,ea.jsx)("div",{className:"flex justify-end pt-2",children:(0,ea.jsx)(sg,{onClick:async()=>{$(!0);try{var e;const t=null===(e=(await _l.get("/tenant")).data)||void 0===e?void 0:e.tenant_id;t&&(await _l.put("/tenant/".concat(t,"/cookie-consent"),U),qs.success("Cookie consent settings saved successfully"))}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to save cookie consent settings")}finally{$(!1)}},disabled:q,"data-testid":"save-cookie-settings-btn",children:q?"Saving...":"Save Cookie Settings"})})]})})]})]}),p&&(0,ea.jsx)("div",{className:"mt-6 p-4 bg-slate-50 rounded-lg border border-slate-200",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-sm font-medium text-slate-700",children:"Deployment Version"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500 mt-1",children:[(0,ea.jsx)("span",{className:"font-mono bg-slate-200 px-2 py-0.5 rounded",children:p.version}),(0,ea.jsxs)("span",{className:"ml-2",children:["Deployed: ",p.date]})]}),p.notes&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:p.notes})]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(p.version),qs.success("Version copied to clipboard")},children:"Copy Version"})]})})]})}),(0,ea.jsx)(OQ,{isOpen:h,onClose:()=>x(!1)})]})},HQ=()=>{const{refreshBranding:e}=Bl(),[s,a]=(0,t.useState)(null),[n,l]=(0,t.useState)({}),[r,i]=(0,t.useState)(!0),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)({logo_url:"",favicon_url:"",custom_head_html:"",custom_body_html:"",cookie_banner_enabled:!1,cookie_banner_title:"",cookie_banner_message:"",cookie_banner_accept_text:"",cookie_banner_reject_text:"",cookie_banner_policy_url:"",physical_address:""}),[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(""),[f,v]=(0,t.useState)(null),[b,j]=(0,t.useState)({custom_head_html:"",custom_body_html:""}),[y,N]=(0,t.useState)({cookie_banner_enabled:!1,cookie_banner_title:"",cookie_banner_message:"",cookie_banner_accept_text:"",cookie_banner_reject_text:"",cookie_banner_policy_url:""});(0,t.useEffect)(()=>{D(),_(),w()},[]);const w=async()=>{try{const e=await _l.get("/tenant/branding"),t={logo_url:e.data.logo_url||"",favicon_url:e.data.favicon_url||"",custom_head_html:e.data.custom_head_html||"",custom_body_html:e.data.custom_body_html||"",cookie_banner_enabled:!!e.data.cookie_banner_enabled,cookie_banner_title:e.data.cookie_banner_title||"",cookie_banner_message:e.data.cookie_banner_message||"",cookie_banner_accept_text:e.data.cookie_banner_accept_text||"",cookie_banner_reject_text:e.data.cookie_banner_reject_text||"",cookie_banner_policy_url:e.data.cookie_banner_policy_url||"",physical_address:e.data.physical_address||""};m(t),g(t.physical_address),j({custom_head_html:t.custom_head_html,custom_body_html:t.custom_body_html}),N({cookie_banner_enabled:t.cookie_banner_enabled,cookie_banner_title:t.cookie_banner_title,cookie_banner_message:t.cookie_banner_message,cookie_banner_accept_text:t.cookie_banner_accept_text,cookie_banner_reject_text:t.cookie_banner_reject_text,cookie_banner_policy_url:t.cookie_banner_policy_url})}catch(G2){console.error("Failed to load branding",G2)}},C=async t=>{x(!0);try{const s=await _l.put("/tenant/branding",t);m({logo_url:s.data.logo_url||"",favicon_url:s.data.favicon_url||"",custom_head_html:s.data.custom_head_html||"",custom_body_html:s.data.custom_body_html||"",cookie_banner_enabled:!!s.data.cookie_banner_enabled,cookie_banner_title:s.data.cookie_banner_title||"",cookie_banner_message:s.data.cookie_banner_message||"",cookie_banner_accept_text:s.data.cookie_banner_accept_text||"",cookie_banner_reject_text:s.data.cookie_banner_reject_text||"",cookie_banner_policy_url:s.data.cookie_banner_policy_url||"",physical_address:s.data.physical_address||""}),qs.success("Branding saved"),void 0!==t.favicon_url&&e()}catch(G2){qs.error("Failed to save branding")}finally{x(!1)}},k=y.cookie_banner_enabled!==u.cookie_banner_enabled||y.cookie_banner_title!==u.cookie_banner_title||y.cookie_banner_message!==u.cookie_banner_message||y.cookie_banner_accept_text!==u.cookie_banner_accept_text||y.cookie_banner_reject_text!==u.cookie_banner_reject_text||y.cookie_banner_policy_url!==u.cookie_banner_policy_url,D=async()=>{try{const e=await _l.get("/theme");a(e.data)}catch(e){qs.error("Failed to load theme settings")}finally{i(!1)}},_=async()=>{try{const e=await _l.get("/theme/presets");l(e.data)}catch(e){console.error("Failed to load presets")}},S=(()=>
2{if(!s||!n||0===Object.keys(n).length)return null;for(const[r,i]of Object.entries(n)){var e,t,a,l;if((null===(e=s.primary_color)||void 0===e?void 0:e.toLowerCase())===(null===(t=i.primary_color)||void 0===t?void 0:t.toLowerCase())&&(null===(a=s.background_color)||void 0===a?void 0:a.toLowerCase())===(null===(l=i.background_color)||void 0===l?void 0:l.toLowerCase()))return{key:r,name:i.name}}return null})(),E=async e=>{if("default"===e){if(!window.confirm("Reset your Site Theme to the built-in Default look?\n\nThis will replace every colour, font and shape setting with the app defaults (indigo primary, Manrope headings, Inter body, white background, rounded corners).\n\nYour logo and favicon are NOT affected. Anything you have set \u2014 colours, fonts, font sizes, shadows, spacing \u2014 will be overwritten."))return}try{var t;const s=await _l.post("/theme/apply-preset/".concat(e));a(s.data),qs.success('Applied "'.concat(null===(t=n[e])||void 0===t?void 0:t.name,'" theme'))}catch(s){qs.error("Failed to apply preset")}},A=(e,t)=>{a(s=>d(d({},s),{},{[e]:t}))},F=xq.filter(e=>"inherit"!==e.value).map(e=>({value:e.value.split(",")[0].trim(),label:e.label,fullValue:e.value})),T=[{value:"none",label:"None"},{value:"lift",label:"Lift"},{value:"glow",label:"Glow"},{value:"darken",label:"Darken"},{value:"scale",label:"Scale"},{value:"shadow",label:"Shadow"}];if(r||!s)return(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 bg-slate-50 p-8 flex items-center justify-center",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading theme settings..."})})]});return(0,ea.jsxs)("div",{className:"flex","data-testid":"theme-settings-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"border-b border-slate-200 bg-white px-8 py-4 flex justify-between items-center sticky top-0 z-10",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold",style:{fontFamily:"Manrope, sans-serif"},children:"Site Theme Settings"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("p",{className:"text-slate-500 text-sm",children:"Customize the look and feel of your site"}),s&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-700",children:[(0,ea.jsx)("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s.primary_color}}),S?S.name:"Custom Theme"]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:D,title:"Discard any unsaved changes and reload the last saved theme settings",children:[(0,ea.jsx)(Nj,{size:16,className:"mr-2"}),"Reset"]}),(0,ea.jsxs)(sg,{onClick:async()=>{c(!0);try{await _l.put("/theme",s),qs.success("Theme settings saved!")}catch(e){qs.error("Failed to save theme")}finally{c(!1)}},disabled:o,className:"bg-indigo-600 hover:bg-indigo-700",children:[(0,ea.jsx)(BD,{size:16,className:"mr-2"}),o?"Saving...":"Save Changes"]})]})]}),(0,ea.jsxs)("div",{className:"p-8 max-w-6xl mx-auto",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mb-6",children:[(0,ea.jsxs)("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Dw,{size:20}),"Quick Presets"]}),(0,ea.jsxs)("div",{className:"mb-6",children:[(0,ea.jsx)("h3",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide mb-3",children:"Basic"}),(0,ea.jsx)("div",{className:"grid grid-cols-4 md:grid-cols-7 gap-3",children:Object.entries(n).filter(e=>{let[t]=e;return["default","light","dark","warm","cool","gradient-purple","gradient-ocean","gradient-sunset"].includes(t)}).sort((e,t)=>{let[s]=e,[a]=t;return"default"===s?-1:"default"===a?1:0}).map(e=>{var t;let[s,a]=e;const n=(null===S||void 0===S?void 0:S.key)===s,l="default"===s,r=(0,ea.jsxs)("button",{onClick:()=>E(s),"data-testid":"theme-preset-".concat(s),className:"group p-3 rounded-lg border-2 transition-all text-center relative w-full ".concat(n?"border-indigo-500 ring-2 ring-indigo-200":l?"border-dashed border-slate-300 hover:border-indigo-400 bg-slate-50/50":"border-slate-200 hover:border-indigo-400"),children:[n&&(0,ea.jsx)("div",{className:"absolute -top-2 -right-2 w-5 h-5 bg-indigo-500 rounded-full flex items-center justify-center",children:(0,ea.jsx)(Xl,{size:12,className:"text-white"})}),(0,ea.jsx)("div",{className:"w-full h-12 rounded-md mb-2 shadow-inner flex items-center justify-center",style:l?{background:"#f8fafc",color:"#64748b"}:{background:null!==(t=a.background_type)&&void 0!==t&&t.includes("gradient")?"linear-gradient(to bottom right, ".concat(a.gradient_start,", ").concat(a.gradient_end,")"):a.background_color},children:l&&(0,ea.jsx)(Nj,{size:18,className:"text-slate-400"})}),(0,ea.jsx)("span",{className:"text-xs font-medium ".concat(n?"text-indigo-600":"text-slate-600 group-hover:text-indigo-600"),children:a.name})]},s);return l?(0,ea.jsx)(DC,{content:(0,ea.jsxs)("span",{className:"block max-w-xs text-left",children:[(0,ea.jsx)("span",{className:"block font-semibold mb-1",children:"Default"}),(0,ea.jsx)("span",{className:"block text-xs leading-relaxed",children:"Resets your entire Site Theme back to the built-in factory look \u2014 indigo primary colour, Manrope headings, Inter body font, white background, subtle shadows and rounded corners. Use this if you want to start fresh. Your logo and favicon are kept. Everything else is overwritten."})]}),side:"top",children:(0,ea.jsx)("div",{children:r})},s):r})})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h3",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide mb-3 flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-amber-500",children:"\u2605"})," Professional Themes"]}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-5 ga
2p-4",children:Object.entries(n).filter(e=>{let[t]=e;return!["default","light","dark","warm","cool","gradient-purple","gradient-ocean","gradient-sunset"].includes(t)}).map(e=>{var t,s;let[a,n]=e;const l=(null===S||void 0===S?void 0:S.key)===a;return(0,ea.jsxs)("button",{onClick:()=>E(a),className:"group p-4 rounded-xl border-2 transition-all text-left relative ".concat(l?"border-indigo-500 ring-2 ring-indigo-200 shadow-lg":"border-slate-200 hover:border-indigo-400 hover:shadow-lg"),children:[l&&(0,ea.jsx)("div",{className:"absolute -top-2 -right-2 w-6 h-6 bg-indigo-500 rounded-full flex items-center justify-center shadow-md",children:(0,ea.jsx)(Xl,{size:14,className:"text-white"})}),(0,ea.jsx)("div",{className:"w-full h-16 rounded-lg mb-3 shadow-inner flex items-end p-2",style:{background:null!==(t=n.background_type)&&void 0!==t&&t.includes("gradient")?"linear-gradient(to bottom right, ".concat(n.gradient_start||n.primary_color,", ").concat(n.gradient_end||n.secondary_color,")"):n.primary_color||n.background_color},children:(0,ea.jsxs)("div",{className:"flex gap-1",children:[(0,ea.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.primary_color}}),(0,ea.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.secondary_color||n.accent_color}}),(0,ea.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.accent_color}})]})}),(0,ea.jsx)("span",{className:"text-sm font-semibold block ".concat(l?"text-indigo-600":"text-slate-700 group-hover:text-indigo-600"),children:null===(s=n.name)||void 0===s?void 0:s.replace(" (School)","")}),n.description&&(0,ea.jsx)("span",{className:"text-xs text-slate-500 mt-1 block line-clamp-2",children:n.description})]},a)})})]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mb-6",children:[(0,ea.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Live Preview"}),(0,ea.jsxs)("div",{className:"rounded-lg p-8 min-h-[200px] transition-all",style:{background:"linear-gradient"===s.background_type?"linear-gradient(".concat(s.gradient_direction||"to bottom",", ").concat(s.gradient_start||"#6366f1",", ").concat(s.gradient_end||"#8b5cf6",")"):"radial-gradient"===s.background_type?"radial-gradient(circle, ".concat(s.gradient_start||"#6366f1",", ").concat(s.gradient_end||"#8b5cf6",")"):s.background_color||"#ffffff",fontFamily:s.body_font},children:[(0,ea.jsx)("h1",{className:"font-bold mb-2",style:{color:s.heading_color,fontFamily:s.heading_font,fontSize:"".concat(s.h1_size||48,"px")},children:"H1 Heading"}),(0,ea.jsx)("h2",{className:"font-bold mb-2",style:{color:s.heading_color,fontFamily:s.heading_font,fontSize:"".concat(s.h2_size||36,"px")},children:"H2 Heading"}),(0,ea.jsx)("h3",{className:"font-semibold mb-4",style:{color:s.heading_color,fontFamily:s.heading_font,fontSize:"".concat(s.h3_size||28,"px")},children:"H3 Heading"}),(0,ea.jsx)("p",{style:{color:s.body_color,fontSize:"".concat(s.body_size||16,"px")},className:"mb-4",children:"This is how your body text will look. The quick brown fox jumps over the lazy dog."}),(0,ea.jsx)("p",{style:{color:s.muted_color,fontSize:"".concat(s.small_size||14,"px")},className:"mb-4",children:"This is smaller/muted text for captions and secondary content."}),(0,ea.jsx)("a",{href:"#",style:{color:s.link_color,fontSize:"".concat(s.body_size||16,"px")},className:"underline mb-4 inline-block",children:"This is a link"}),(0,ea.jsxs)("div",{className:"mt-4 flex gap-3",children:[(0,ea.jsx)("button",{className:"px-4 py-2 rounded transition-all",style:{backgroundColor:"solid"===s.button_style?s.primary_color:"transparent",color:"solid"===s.button_style?"#fff":s.primary_color,border:"solid"!==s.button_style?"2px solid ".concat(s.primary_color):"none",borderRadius:"pill"===s.border_radius?"9999px":"rounded"===s.border_radius?"8px":"4px"},children:"Primary Button"}),(0,ea.jsx)("button",{className:"px-4 py-2 rounded transition-all",style:{backgroundColor:"transparent",color:s.secondary_color,border:"2px solid ".concat(s.secondary_color),borderRadius:"pill"===s.border_radius?"9999px":"rounded"===s.border_radius?"8px":"4px"},children:"Secondary Button"})]})]})]}),(0,ea.jsxs)(nJ,{defaultValue:"background",className:"bg-white rounded-xl border border-slate-200",children:[(0,ea.jsxs)(lJ,{className:"w-full border-b border-slate-200 rounded-none bg-slate-50 p-1",children:[(0,ea.jsxs)(rJ,{value:"background",className:"flex-1",children:[(0,ea.jsx)(Dw,{size:16,className:"mr-2"}
2)," Background"]}),(0,ea.jsxs)(rJ,{value:"typography",className:"flex-1",children:[(0,ea.jsx)(wE,{size:16,className:"mr-2"})," Typography"]}),(0,ea.jsxs)(rJ,{value:"colors",className:"flex-1",children:[(0,ea.jsx)(Dw,{size:16,className:"mr-2"})," Colors"]}),(0,ea.jsxs)(rJ,{value:"shape",className:"flex-1",children:[(0,ea.jsx)(Sq,{size:16,className:"mr-2"})," Shape & Style"]}),(0,ea.jsxs)(rJ,{value:"branding",className:"flex-1","data-testid":"branding-tab",children:[(0,ea.jsx)($N,{size:16,className:"mr-2"})," Branding"]}),(0,ea.jsxs)(rJ,{value:"custom-code",className:"flex-1","data-testid":"custom-code-tab",children:[(0,ea.jsx)(kE,{size:16,className:"mr-2"})," Custom Code"]})]}),(0,ea.jsx)(iJ,{value:"background",className:"p-6",children:(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Background Type"}),(0,ea.jsxs)(eb,{value:s.background_type,onValueChange:e=>A("background_type",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid Color"}),(0,ea.jsx)(rb,{value:"linear-gradient",children:"Linear Gradient"}),(0,ea.jsx)(rb,{value:"radial-gradient",children:"Radial Gradient"})]})]})]}),"solid"===s.background_type&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:s.background_color,onChange:e=>A("background_color",e.target.value),className:"w-16 h-10 p-1 cursor-pointer"}),(0,ea.jsx)(BN,{value:s.background_color,onChange:e=>A("background_color",e.target.value),className:"flex-1"})]})]}),"solid"!==s.background_type&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Gradient Direction"}),(0,ea.jsxs)(eb,{value:s.gradient_direction,onValueChange:e=>A("gradient_direction",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"to bottom",label:"Top to Bottom"},{value:"to top",label:"Bottom to Top"},{value:"to right",label:"Left to Right"},{value:"to left",label:"Right to Left"},{value:"to bottom right",label:"Diagonal \u2198"},{value:"to bottom left",label:"Diagonal \u2199"},{value:"to top right",label:"Diagonal \u2197"},{value:"to top left",label:"Diagonal \u2196"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Gradient Start Color"}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:s.gradient_start||"#6366f1",onChange:e=>A("gradient_start",e.target.value),className:"w-16 h-10 p-1 cursor-pointer"}),(0,ea.jsx)(BN,{value:s.gradient_start||"#6366f1",onChange:e=>A("gradient_start",e.target.value),className:"flex-1"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Gradient End Color"}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:s.gradient_end||"#8b5cf6",onChange:e=>A("gradient_end",e.target.value),className:"w-16 h-10 p-1 cursor-pointer"}),(0,ea.jsx)(BN,{value:s.gradient_end||"#8b5cf6",onChange:e=>A("gradient_end",e.target.value),className:"flex-1"})]})]})]})]})}),(0,ea.jsx)(iJ,{value:"typography",className:"p-6",children:(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide mb-3",children:"Font Families"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Heading Font"}),(0,ea.jsxs)(eb,{value:s.heading_font,onValueChange:e=>A("heading_font",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:F.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Body Font"}),(0,ea.jsxs)(eb,{value:s.body_font,onValueChange:e=>A("body_font",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:F.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide mb-3",children:"Font Sizes"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"H1 Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:"16",max:"96",value:s.h1_size||48,onChange:e=>A("h1_size",parseInt(e.target.value)||48),className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"H2 Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:"14",max:"72",value:s.h2_size||36,onChange:e=>A("h2_size",parseInt(e.target.value)||36),className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"H3 Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:"12",max:"48",value:s.h3_size||28,onChange:e=>A("h3_size",parseInt(e.target.value)||28),className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"H4 Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:"12",max:"36",value:s.h4_size||22,onChange:e=>A("h4_size",parseInt(e.target.value)||22),className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Body Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:"12",max:"24",value:s.body_size||16,onChange:e=>A("body_size",parseInt(e.target.value)||16),className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Small Text Size (px)"}),(0,ea.jsx)(BN,{type:"number",min:"10",max:"18",value:s.small_size||14,onChange:e=>A("small_size",parseInt(e.target.value)||14),className:"mt-1"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-3",children:"These sizes will be used as defaults across your site. Individual blocks can override these settings."})]})]})}),(0,ea.jsxs)(iJ,{value:"colors",className:"p-6",children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-500 mb-4",children:["Hover the ",(0,ea.jsx)(qj,{size:12,className:"inline -mt-0.5 mx-0.5"})," icon next to each colour to see where it's applied across your site."]}),(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-6",children:[{key:"heading_color",label:"Heading Color",tip:"Applied to all H1\u2013H6 headings across pages, blog articles, hero subheadings and section titles."},{key:"body_color",label:"Body Text Color",tip:"The main paragraph colour. Used for body copy in pages, articles, descriptions, and form labels."},{key:"muted_color",label:"Muted Text Color",tip:"Secondary text \u2014 captions, dates, metadata, footer copyright, image credits, and field helper text."},{key:"primary_color",label:"Primary Color",tip:"Your main brand colour. Used on primary buttons, active nav items, link underlines, focus rings, and key call-to-actions."},{key:"secondary_color",label:"Secondary Color",tip:"Used on secondary/outline buttons, hover states, and supporting accents around the primary colour."},{key:"accent_color",label:"Accent Color",tip:"Used for badges, tags, pricing-card highlights, alerts, and small decorative touches that need attention."},{key:"link_color",label:"Link Color",tip:"Default colour of clickable text links in body content and articles."}
2,{key:"link_hover_color",label:"Link Hover Color",tip:"Colour links shift to when the visitor hovers over them. Usually a darker shade of the link colour."},{key:"border_color",label:"Border Color",tip:"Subtle borders used on cards, dividers, form inputs, tables, and section separators."}].map(e=>{let{key:t,label:a,tip:n}=e;return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(tf,{children:a}),(0,ea.jsx)(DC,{content:n,side:"top",children:(0,ea.jsx)("span",{className:"cursor-help text-slate-400 hover:text-slate-600",children:(0,ea.jsx)(qj,{size:13})})})]}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,ea.jsx)(BN,{type:"color",value:s[t]||"#000000",onChange:e=>A(t,e.target.value),className:"w-16 h-10 p-1 cursor-pointer","data-testid":"theme-color-".concat(t)}),(0,ea.jsx)(BN,{value:s[t]||"#000000",onChange:e=>A(t,e.target.value),className:"flex-1"})]})]},t)})})]}),(0,ea.jsx)(iJ,{value:"shape",className:"p-6",children:(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Border Radius"}),(0,ea.jsxs)(eb,{value:s.border_radius,onValueChange:e=>A("border_radius",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"sharp",label:"Sharp (0px)"},{value:"subtle",label:"Subtle (4px)"},{value:"rounded",label:"Rounded (8px)"},{value:"more-rounded",label:"More Rounded (16px)"},{value:"pill",label:"Pill (Full)"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Shadow Preset"}),(0,ea.jsxs)(eb,{value:s.shadow_preset,onValueChange:e=>A("shadow_preset",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"none",label:"None"},{value:"subtle",label:"Subtle"},{value:"medium",label:"Medium"},{value:"dramatic",label:"Dramatic"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Spacing Scale"}),(0,ea.jsxs)(eb,{value:s.spacing_scale,onValueChange:e=>A("spacing_scale",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"compact",label:"Compact"},{value:"normal",label:"Normal"},{value:"spacious",label:"Spacious"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Button Style"}),(0,ea.jsxs)(eb,{value:s.button_style,onValueChange:e=>A("button_style",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"solid",label:"Solid"},{value:"outline",label:"Outline"},{value:"ghost",label:"Ghost"},{value:"soft",label:"Soft"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]})}),(0,ea.jsx)(iJ,{value:"animations",className:"p-6",children:(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Default Page Load Animation"}),(0,ea.jsxs)(eb,{value:s.default_animation,onValueChange:e=>A("default_animation",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"none",label:"None"},{value:"fadeIn",label:"Fade In"},{value:"fadeInUp",label:"Fade In Up"},{value:"fadeInDown",label:"Fade In Down"},{value:"slideLeft",label:"Slide from Left"},{value:"slideRight",label:"Slide from Right"},{value:"zoomIn",label:"Zoom In"},{value:"bounce",label:"Bounce"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Animation Duration"}),(0,ea.jsxs)(eb,{value:s.animation_duration,onValueChange:e=>A("animation_duration",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"0.3s",children:"Fast (0.3s)"}),(0,ea.jsx)(rb,{value:"0.5s",children:"Normal (0.5s)"}),(0,ea.jsx)(rb,{value:"0.8s",children:"Slow (0.8s)"}),(0,ea.jsx)(rb,{value:"1.2s",children:"Very Slow (1.2s)"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Text Over Image Animation"}),(0,ea.jsxs)(eb,{value:s.text_overlay_animation,onValueChange:e=>A("text_overlay_animation",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"none",label:"None"},{value:"fade-in",label:"Fade In"},{value:"slide-up",label:"Slide Up"},{value:"slide-down",label:"Slide Down"},{value:"typewriter",label:"Typewriter"},{value:"zoom",label:"Zoom"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]})}),(0,ea.jsx)(iJ,{value:"interactions",className:"p-6",children:(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Default Hover Effect"}),(0,ea.jsxs)(eb,{value:s.hover_effect,onValueChange:e=>A("hover_effect",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:T.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Button Hover Effect"}),(0,ea.jsxs)(eb,{value:s.button_hover_effect,onValueChange:e=>A("button_hover_effect",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:T.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Click Effect"}),(0,ea.jsxs)(eb,{value:s.click_effect,onValueChange:e=>A("click_effect",e),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:[{value:"none",label:"None"},{value:"scale",label:"Scale Down"},{value:"flip",label:"Flip"},{value:"shake",label:"Shake"},{value:"highlight",label:"Highlight"},{value:"color-change",label:"Color Change"}].map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]})]})}),(0,ea.jsx)(iJ,{value:"branding",className:"p-6","data-testid":"branding-tab-content",children:(0,ea.jsxs)("div",{className:"max-w-2xl space-y-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-900 mb-1",children:"Site Branding"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Upload your logo and favicon. The favicon appears in browser tabs and bookmarks."})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-5 bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-semibold",children:"Site Logo"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Used in navigation, footer, and login screens. Recommended: transparent PNG, height ~80px."})]}),u.logo_url&&(0,ea.jsxs)(sg,{type:"button",variant:"ghost",size:"sm",onClick:()=>C({logo_url:""}),className:"text-red-500 hover:text-red-600","data-testid":"remove-logo-btn",children:[(0,ea.jsx)(sr,{size:14,className:"mr-1"})," Remove"]})]}),u.logo_url?(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-48 h-24 bg-slate-50 border border-slate-200 rounded-lg flex items-center justify-center p-3",children:(0,ea.jsx)("img",{src:u.logo_url,alt:"Logo",className:"max-w-full max-h-full object-contain"})}),(0,ea.jsx)(sg,{type:"button",variant:"outline",onClick:()=>v("logo"),"data-testid":"change-logo-btn",children:"Change Logo"})]}):(0,ea.jsxs)("button",{type:"button",onClick:()=>v("logo"),className:"w-full max-w-md h-32 border-2 border-dashed border-slate-300 rounded-lg flex flex-col items-center justify-center gap-2 hover:border-indigo-400 hover:bg-indigo-50/50 transition-colors","data-testid":"pick-logo-btn",children:[(0,ea.jsx)($N,{size:24,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Choose Logo from Media Library"})]})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-5 bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-semibold",children:"Favicon"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Tiny icon shown in browser tabs and bookmarks. Recommended: square PNG/SVG, 32\xd732 to 256\xd7256."})]}),u.favicon_url&&(0,ea.jsxs)(sg,{type:"button",variant:"ghost",size:"sm",onClick:()=>C({favicon_url:""}),className:"text-red-500 hover:text-red-600","data-testid":"remove-favicon-btn",children:[(0,ea.jsx)(sr,{size:14,className:"mr-1"})," Remove"]})]}),u.favicon_url?(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-slate-50 border border-slate-200 rounded-lg flex items-center justify-center p-2",children:(0,ea.jsx)("img",{src:u.favicon_url,alt:"Favicon",className:"max-w-full max-h-full object-contain"})}),(0,ea.jsx)(sg,{type:"button",variant:"outline",onClick:()=>v("favicon"),"data-testid":"change-favicon-btn",children:"Change Favicon"})]}):(0,ea.jsxs)("button",{type:"button",onClick:()=>
2v("favicon"),className:"w-full max-w-md h-32 border-2 border-dashed border-slate-300 rounded-lg flex flex-col items-center justify-center gap-2 hover:border-indigo-400 hover:bg-indigo-50/50 transition-colors","data-testid":"pick-favicon-btn",children:[(0,ea.jsx)($N,{size:24,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Choose Favicon from Media Library"})]})]}),h&&(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Saving branding..."}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-5 bg-white space-y-2 mt-6","data-testid":"newsletter-address-section",children:[(0,ea.jsx)(tf,{htmlFor:"newsletter-address",className:"text-sm font-semibold",children:"Newsletter mailing address"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Shown in the footer of every newsletter. A valid physical postal address is legally required for bulk email (CAN-SPAM / CASL / Australian Spam Act)."}),(0,ea.jsx)("textarea",{id:"newsletter-address",value:p,onChange:e=>g(e.target.value),placeholder:"e.g. Springfield Primary School, 1 School Rd, Sydney NSW 2000, Australia",rows:2,className:"w-full text-sm px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent resize-y","data-testid":"newsletter-address-input"}),(0,ea.jsx)("div",{className:"flex justify-end",children:(0,ea.jsx)("button",{onClick:()=>C(d(d({},u),{},{physical_address:p})),disabled:h||p===u.physical_address,className:"px-4 py-2 text-sm font-medium rounded-lg bg-indigo-600 text-white disabled:opacity-40 disabled:cursor-not-allowed hover:bg-indigo-700 transition-colors","data-testid":"save-newsletter-address-btn",children:"Save address"})})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-5 bg-white space-y-2",children:[(0,ea.jsx)(tf,{className:"text-sm font-semibold",children:"Language selector position"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Choose where the language switcher appears on your public site. Only affects sites with translation turned on."}),(0,ea.jsxs)(eb,{value:s.language_selector_position||"floating",onValueChange:e=>A("language_selector_position",e),children:[(0,ea.jsx)(sb,{className:"h-9 text-sm","data-testid":"language-selector-position-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"floating",children:(0,ea.jsxs)("span",{className:"inline-flex flex-col items-start",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Floating pill"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Bottom-left on mobile, top-right on de
2sktop (default)"})]})}),(0,ea.jsx)(rb,{value:"top_bar",children:(0,ea.jsxs)("span",{className:"inline-flex flex-col items-start",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Top bar"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Slim strip at the very top of the page, above your header"})]})}),(0,ea.jsx)(rb,{value:"hidden",children:(0,ea.jsxs)("span",{className:"inline-flex flex-col items-start",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Hidden"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Don't render \u2014 place your own inside a custom-HTML block"})]})})]})]})]})]})}),(0,ea.jsx)(iJ,{value:"custom-code",className:"p-6","data-testid":"custom-code-tab-content",children:(0,ea.jsxs)("div",{className:"max-w-3xl space-y-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-900 mb-1",children:"Custom Code"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Paste HTML snippets (chat widgets, analytics, font preloads) that should appear on every public page. Changes apply immediately the next time a visitor loads a page \u2014 no republish needed."})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-xs text-amber-800 flex items-start gap-2",children:[(0,ea.jsx)(qj,{size:14,className:"mt-0.5 flex-shrink-0"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("strong",{className:"font-semibold",children:"Security:"})," code here runs on your public site. Only paste snippets from trusted providers (e.g. Google Analytics, or an official chat-widget embed code). A bad snippet can break the page or steal visitor data."]})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-5 bg-white space-y-2",children:[(0,ea.jsxs)(tf,{htmlFor:"custom-head-html",className:"text-sm font-semibold",children:["Head Code ",(0,ea.jsx)("span",{className:"text-slate-400 font-normal",children:"(inside <head>)"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Use this for things that must load early: Google Analytics / GTM, font preloads, meta verification tags."}),(0,ea.jsx)("textarea",{id:"custom-head-html",value:b.custom_head_html,onChange:e=>j(d(d({},b),{},{custom_head_html:e.target.value})),placeholder:'\x3c!-- Example: Google Analytics --\x3e\n<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"><\/script>',rows:6,className:"w-full font-mono text-xs px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent resize-y",spellCheck:!1,"data-testid":"custom-head-html-input"})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-5 bg-white space-y-2",children:[(0,ea.jsxs)(tf,{htmlFor:"custom-body-html",className:"text-sm font-semibold",children:["Body Code ",(0,ea.jsx)("span",{className:"text-slate-400 font-normal",children:"(before </body>)"})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Use this for widgets that don't need to block page load: ",(0,ea.jsx)("strong",{children:"chat widgets"}),", Intercom, Crisp, Drift, etc. This is where most chat widget embed codes belong."]}),(0,ea.jsx)("textarea",{id:"custom-body-html",value:b.custom_body_html,onChange:e=>j(d(d({},b),{},{custom_body_html:e.target.value})),placeholder:'\x3c!-- Example: chat widget --\x3e\n<script src="https://example.com/widget.js" data-id="XXXX"><\/script>',rows:8,className:"w-full font-mono text-xs px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent resize-y",spellCheck:!1,"data-testid":"custom-body-html-input"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:b.custom_head_html===u.custom_head_html&&b.custom_body_html===u.custom_body_html?"No unsaved changes":"Unsaved changes"}),(0,ea.jsxs)(sg,{type:"button",onClick:async()=>{await C({custom_head_html:b.custom_head_html,custom_body_html:b.custom_body_html})},disabled:h||b.custom_head_html===u.custom_head_html&&b.custom_body_html===u.custom_body_html,"data-testid":"save-custom-code-btn",children:[(0,ea.jsx)(BD,{size:16,className:"mr-2"}),h?"Saving\u2026":"Save Custom Code"]})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-5 bg-white space-y-4 mt
2-6",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)(tf,{className:"text-sm font-semibold flex items-center gap-2",children:"Cookie Consent Banner"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Show a small banner asking visitors to accept cookies before any of your Custom Code scripts (chat widgets, analytics) run. Helps with GDPR, Australian Privacy Act, and similar compliance."})]}),(0,ea.jsx)("button",{type:"button",role:"switch","aria-checked":y.cookie_banner_enabled,onClick:()=>N(d(d({},y),{},{cookie_banner_enabled:!y.cookie_banner_enabled})),className:"relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent transition-colors ".concat(y.cookie_banner_enabled?"bg-indigo-600":"bg-slate-300"),"data-testid":"cookie-banner-toggle",children:(0,ea.jsx)("span",{className:"inline-block h-5 w-5 transform rounded-full bg-white shadow transition-transform ".concat(y.cookie_banner_enabled?"translate-x-5":"translate-x-0")})})]}),y.cookie_banner_enabled&&(0,ea.jsxs)("div",{className:"space-y-3 pl-1",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"banner-title",className:"text-xs font-medium text-slate-700",children:"Title"}),(0,ea.jsx)("input",{id:"banner-title",type:"text",value:y.cookie_banner_title,onChange:e=>N(d(d({},y),{},{cookie_banner_title:e.target.value})),placeholder:"We use cookies",className:"mt-1 w-full px-3 py-2 text-sm border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent","data-testid":"banner-title-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"banner-message",className:"text-xs font-medium text-slate-700",children:"Message"}),(0,ea.jsx)("textarea",{id:"banner-message",rows:3,value:y.cookie_banner_message,onChange:e=>N(d(d({},y),{},{cookie_banner_message:e.target.value})),placeholder:"We use cookies to enhance your browsing experience and analyse our traffic. By clicking Accept, you consent to our use of cookies.",className:"mt-1 w-full px-3 py-2 text-sm border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent resize-y","data-testid":"banner-message-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"banner-accept",className:"text-xs font-medium text-slate-700",children:"Accept button text"}),(0,ea.jsx)("input",{id:"banner-accept",type:"text",value:y.cookie_banner_accept_text,onChange:e=>N(d(d({},y),{},{cookie_banner_accept_text:e.target.value})),placeholder:"Accept all",className:"mt-1 w-full px-3 py-2 text-sm border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent","data-testid":"banner-accept-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"banner-reject",className:"text-xs font-medium text-slate-700",children:"Reject button text"}),(0,ea.jsx)("input",{id:"banner-reject",type:"text",value:y.cookie_banner_reject_text,onChange:e=>N(d(d({},y),{},{cookie_banner_reject_text:e.target.value})),placeholder:"Reject",className:"mt-1 w-full px-3 py-2 text-sm border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent","data-testid":"banner-reject-input"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"banner-policy",className:"text-xs font-medium text-slate-700",children:"Privacy policy URL (optional)"}),(0,ea.jsx)("input",{id:"banner-policy",type:"text",value:y.cookie_banner_policy_url,onChange:e=>N(d(d({},y),{},{cookie_banner_policy_url:e.target.value})),placeholder:"/privacy-policy",className:"mt-1 w-full px-3 py-2 text-sm border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent","data-testid":"banner-policy-input"}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400 mt-1",children:'If set, shows a "Learn more" link inside the banner.'})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-4",children:[(0,ea.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-2",children:"Live preview"}),(0,ea.jsxs)("div",{className:"rounded-xl bg-slate-900 text-white p-4 max-w-md",children:[(0,ea.jsx)("strong",{className:"text-sm font-semibold",children:y.cookie_banner_title||"We use cookies"}),(0,ea.jsxs)("p",{className:"text-xs mt-1 opacity-90",children:[y.cookie_banner_message||"We use cookies to enhance your browsing experience and analyse our traffic.",y.cookie_banner_policy_url?(0,ea.jsxs)("span",{children:[" ",(0,ea.jsx)("a",{href:y.cookie_banner_policy_url,className:"underline",target:"_blank",rel:"noreferrer",children:"Learn more"})]}):null]}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-3",children:[(0,ea.jsx)("span",{className:"flex-1 text-center text-xs font-semibold bg-indigo-600 rounded-md py-2",children:y.cookie_banner_accept_text||"Accept all"}),(0,ea.jsx)("span",{className:"flex-1 text-center text-xs font-medium border border-white/20 rounded-md py-2",children:y.cookie_banner_reject_text||"Reject"})]})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-slate-100",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:k?"Unsaved changes":"No unsaved changes"}),(0,ea.jsxs)(sg,{type:"button",onClick:async()=>{await C({cookie_banner_enabled:y.cookie_banner_enabled,cookie_banner_title:y.cookie_banner_title,cookie_banner_message:y.cookie_banner_message,cookie_banner_accept_text:y.cookie_banner_accept_text,cookie_banner_reject_text:y.cookie_banner_reject_text,cookie_banner_policy_url:y.cookie_banner_policy_url})},disabled:h||!k,"data-testid":"save-banner-btn",children:[(0,ea.jsx)(BD,{size:16,className:"mr-2"}),h?"Saving\u2026":"Save Banner Settings"]})]})]})]})})]})]})]}),(0,ea.jsx)(Dq,{open:!!f,onClose:()=>v(null),onSelect:e=>{const t="favicon"===f?{favicon_url:e.url}:{logo_url:e.url};C(t),v(null)}})]})},WQ=()=>{var e,s,a,n,l;const[r,i]=(0,t.useState)(!0),[o,c]=(0,t.useState)(null),[d,u]=(0,t.useState)(null),[m,h]=(0,t.useState)(null),[x,p]=(0,t.useState)(!1),[g,f]=(0,t.useState)(""),[v,b]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),[N,w]=(0,t.useState)(!1),[C,k]=(0,t.useState)(!1),[D,_]=(0,t.useState)(""),[S,E]=(0,t.useState)(!1),[A,F]=(0,t.useState)(!1),[T,z]=(0,t.useState)(!1);(0,t.useEffect)(()=>{M()},[]);const M=async()=>{try{const[e,t,s]=await Promise.all([_l.get("/tenant/subdomain"),_l.get("/tenant/domain"),_l.get("/tenant/plan-features")]);c(e.data),u(t.data),h(s.data),f(e.data.subdomain||"")}catch(e){console.error("Failed to load settings:",e),qs.error("Failed to load domain settings")}finally{i(!1)}},P=e=>{const t=e.toLowerCase().replace(/[^a-z0-9-]/g,"");f(t),y(null),clearTimeout(window.subdomainCheckTimeout),window.subdomainCheckTimeout=setTimeout(()=>{(async e=>{if(!e||e.length<3)y(null);else{b(!0);try{const t=await _l.get("/tenant/subdomain/check/".concat(e));y(t.data.available)}catch(t){y(!1)}finally{b(!1)}}})(t)},500)},B=e=>{navigator.clipboard.writeText(e),qs.success("Copied to clipboard!")},R=e=>{switch(e){case"enterprise":return(0,ea.jsx)(Fw,{className:"text-amber-500",size:20});case"reseller":return(0,ea.jsx)(Bw,{className:"text-purple-500",size:20});case"pro":return(0,ea.jsx)($g,{className:"text-indigo-500",size:20});case"starter":return(0,ea.jsx)(hr,{className:"text-blue-500",size:20});case"freemium":case"free":return(0,ea.jsx)(hr,{className:"text-emerald-500",size:20});default:return(0,ea.jsx)(hr,{className:"text-slate-400",size:20})}};if(r)return(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 bg-slate-50 p-8 flex items-center justify-center",children:(0,ea.jsx)(gq,{className:"animate-spin text-indigo-600",size:32})})]});const L=(null===m||void 0===m?void 0:m.plan_level)||"starter",I=(null===m||void 0===m||null===(e=m.features)||void 0===e?void 0:e.custom_domain)||!1;return(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,ea.jsxs)("div",{className:"mb-8",children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(hr,{className:"text-indigo-600",size:32}),"Domain Settings"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-2",children:"Manage your subdomain and custom domain settings"})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mb-6",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center ".concat("enterprise"===L?"bg-amber-100":"reseller"===L?"bg-purple-100":"pro"===L?"bg-indigo-100":"bg-slate-100"),children:R(L)}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Current Plan"}),(0,ea.jsx)("p",{className:"text-xl font-semibold capitalize",children:L})]})]}),(0,ea.jsx)("div",{className:"flex items-center gap-2",children:I?(0,ea.jsxs)("span",{className:"flex items-center gap-1 text-emerald-600 text-sm bg-emerald-50 px-3 py-1 rounded-full",children:[(0,ea.jsx)(Xl,{size:14}),"Custom Domain Enabled"]}):(0,ea.jsxs)("span",{className:"flex items-center gap-1 text-slate-500 text-sm bg-slate-100 px-3 py-1 rounded-full",children:[(0,ea.jsx)(Lj,{size:14}),"Upgrade for Custom Domain"]})})]})}),(0,ea.jsxs)(nJ,{defaultValue:"subdomain",className:"space-y-6",children:[(0,ea.jsxs)(lJ,{children:[(0,ea.jsxs)(rJ,{value:"subdomain",className:"gap-2",children:[(0,ea.jsx)(hr,{size:16}),"Subdomain"]}),(0,ea.jsxs)(rJ,{value:"custom-domain",className:"gap-2",children:[(0,ea.jsx)($g,{size:16}),"Custom Domain",!I&&(0,ea.jsx)(Lj,{size:14,className:"ml-1 text-slate-400"})]}),(0,ea.jsxs)(rJ,{value:"plans",className:"gap-2",children:[(0,ea.jsx)(Fw,{size:16}),"Plans"]})]}),(0,ea.jsx)(iJ,{value:"subdomain",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsxs)("div",{className:"p-6 border-b border-slate-100",children:[(0,ea.jsx)("h2",{className:"text-xl font-semibold",children:"Your Site URL"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Your public site is accessible at this address. This works on all hosting platforms."})]}),(0,ea.jsx)("div",{className:"p-6",children:x?(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Choose your subdomain"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,ea.jsxs)("div",{className:"flex-1 relative",children:[(0,ea.jsx)(BN,{value:g,onChange:e=>P(e.target.value),placeholder:"my-school",className:"pr-10"}),v&&(0,ea.jsx)(gq,{className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-slate-400",size:16}),!v&&!0===j&&(0,ea.jsx)(cr,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-emerald-500",size:16}),!v&&!1===j&&(0,ea.jsx)(fJ,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-red-500",size:16})]}),(0,ea.jsxs)("span",{className:"text-slate-500 font-mono",children:[".",(null===o||void 0===o?void 0:o.base_domain)||"nexuscms.ai"]})]}),!1===j&&(0,ea.jsx)("p",{className:"text-red-500 text-sm mt-1",children:"This subdomain is not available"}),!0===j&&(0,ea.jsx)("p",{className:"text-emerald-500 text-sm mt-1",children:"This subdomain is available!"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>{try{const e=await _l.post("/tenant/subdomain/generate",{});f(e.data.suggested),y(!0)}catch(e){qs.error("Failed to generate subdomain")}},size:"sm",children:[(0,ea.jsx)($g,{size:14,className:"mr-1"}),"Suggest"]}),(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:"Generate a subdomain from your organization name"})]}),(0,ea.jsxs)("div",{className:"flex gap-2 pt-4 border-t",children:[(0,ea.jsx)(sg,{onClick:async()=>
2{if(!g||g.length<3)qs.error("Subdomain must be at least 3 characters");else{w(!0);try{await _l.post("/tenant/subdomain",{subdomain:g});qs.success("Subdomain updated successfully!"),p(!1),M()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save subdomain")}finally{w(!1)}}},disabled:N||!1===j||!g,children:N?"Saving...":"Save Subdomain"}),(0,ea.jsx)(sg,{variant:"outline",onClick:()=>{p(!1),f((null===o||void 0===o?void 0:o.subdomain)||""),y(null)},children:"Cancel"})]})]}):(0,ea.jsx)("div",{className:"space-y-4",children:null!==o&&void 0!==o&&o.subdomain?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"flex items-center gap-4 p-4 bg-indigo-50 rounded-lg border border-indigo-100",children:(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-indigo-700",children:"Primary Site URL"}),(0,ea.jsx)("span",{className:"text-xs bg-indigo-100 text-indigo-600 px-2 py-0.5 rounded-full",children:"Recommended"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("code",{className:"text-lg font-mono text-indigo-600",children:[window.location.origin,"/site/",o.subdomain]}),(0,ea.jsx)(DC,{content:"Copy URL",children:(0,ea.jsx)("button",{onClick:()=>B("".concat(window.location.origin,"/site/").concat(o.subdomain)),className:"p-1.5 hover:bg-indigo-100 rounded",children:(0,ea.jsx)(DD,{size:16,className:"text-indigo-500"})})}),(0,ea.jsx)(DC,{content:"Open in new tab",children:(0,ea.jsx)("a",{href:"/site/".concat(o.subdomain),target:"_blank",rel:"noopener noreferrer",className:"p-1.5 hover:bg-indigo-100 rounded",children:(0,ea.jsx)(bj,{size:16,className:"text-indigo-500"})})})]}),(0,ea.jsx)("p",{className:"text-xs text-indigo-600 mt-2",children:"\u2713 Works everywhere \u2022 No DNS setup needed \u2022 Share this URL with your audience"})]})}),(0,ea.jsx)("div",{className:"flex items-center gap-4 p-4 bg-slate-50 rounded-lg",children:(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Subdomain URL"}),(0,ea.jsx)("span",{className:"text-xs bg-slate-200 text-slate-600 px-2 py-0.5 rounded-full",children:"Future Use"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("code",{className:"text-base font-mono text-slate-600",children:o.full_url}),(0,ea.jsx)(DC,{content:"Copy URL",children:(0,ea.jsx)("button",{onClick:()=>B(o.full_url),className:"p-1.5 hover:bg-slate-200 rounded",children:(0,ea.jsx)(DD,{size:16,className:"text-slate-400"})})})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2",children:"Requires external hosting with wildcard subdomain support"})]})}),(0,ea.jsx)("div",{className:"flex justify-end",children:(0,ea.jsx)(sg,{variant:"outline",onClick:()=>p(!0),children:"Change Site Slug"})})]}):(0,ea.jsxs)("div",{className:"text-center py-8",children:[(0,ea.jsx)(hr,{className:"mx-auto text-slate-300 mb-4",size:48}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"No subdomain configured yet"}),(0,ea.jsx)(sg,{onClick:()=>p(!0),children:"Set Up Subdomain"})]})})})]})}),(0,ea.jsx)(iJ,{value:"custom-domain",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsxs)("div",{className:"p-6 border-b border-slate-100",children:[(0,ea.jsx)("h2",{className:"text-xl font-semibold",children:"Custom Domain"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Connect your own domain for a fully branded experience"})]}),(0,ea.jsx)("div",{className:"p-6",children:I?null!==d&&void 0!==d&&d.custom_domain?(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(e=>{switch(e){case"verified":return(0,ea.jsx)(cr,{className:"text-emerald-500",size:20});case"failed":return(0,ea.jsx)(fJ,{className:"text-red-500",size:20});default:return(0,ea.jsx)(Kg,{className:"text-amber-500",size:20})}})(d.custom_domain_status),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("code",{className:"text-lg font-mono",children:d.custom_domain}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 capitalize mt-1",children:["Status: ",d.
2custom_domain_status||"pending"]})]})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:["verified"!==d.custom_domain_status&&(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>{F(!0);try{const e=await _l.post("/tenant/domain/verify");e.data.verified?qs.success(e.data.message):qs.info(e.data.message),M()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to verify domain")}finally{F(!1)}},disabled:A,children:[(0,ea.jsx)(gq,{size:16,className:"mr-2 ".concat(A?"animate-spin":"")}),"Verify"]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>{if(window.confirm("Are you sure you want to remove this custom domain?")){z(!0);try{await _l.delete("/tenant/domain"),qs.success("Custom domain removed"),M()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to remove domain")}finally{z(!1)}}},disabled:T,className:"text-red-600 hover:text-red-700",children:[(0,ea.jsx)(wD,{size:16,className:"mr-2"}),"Remove"]})]})]}),"verified"!==d.custom_domain_status&&(0,ea.jsx)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)(AN,{className:"text-amber-500 flex-shrink-0 mt-0.5",size:20}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"font-medium text-amber-800",children:"DNS Configuration Required"}),(0,ea.jsx)("p",{className:"text-sm text-amber-700 mt-1 mb-3",children:"Add the following DNS record to your domain provider:"}),(0,ea.jsxs)("div",{className:"bg-white rounded p-3 space-y-2 text-sm font-mono",children:[(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Type:"}),(0,ea.jsx)("span",{className:"font-semibold",children:null===(s=d.dns_instructions)||void 0===s?void 0:s.type})]}),(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Name:"}),(0,ea.jsx)("span",{className:"font-semibold",children:null===(a=d.dns_instructions)||void 0===a?void 0:a.name})]}),(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Target:"}),(0,ea.jsx)("span",{className:"font-semibold",children:null===(n=d.dns_instructions)||void 0===n?void 0:n.target})]})]}),(0,ea.jsx)("p",{className:"text-xs text-amber-600 mt-2",children:null===(l=d.dns_instructions)||void 0===l?void 0:l.note})]})]})})]}):(0,ea.jsxs)("div",{className:"text-center py-8",children:[(0,ea.jsx)(hr,{className:"mx-auto text-slate-300 mb-4",size:48}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"No custom domain configured"}),(0,ea.jsxs)(sg,{onClick:()=>k(!0),children:[(0,ea.jsx)(hr,{size:16,className:"mr-2"}),"Add Custom Domain"]})]}):(0,ea.jsxs)("div",{className:"text-center py-8 bg-slate-50 rounded-lg",children:[(0,ea.jsx)(Lj,{className:"mx-auto text-slate-300 mb-4",size:48}),(0,ea.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Custom Domains - Pro Feature"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4 max-w-md mx-auto",children:"Upgrade to Pro, Enterprise, or Reseller plan to connect your own domain (e.g., yourschool.com)"}),(0,ea.jsxs)(sg,{onClick:()=>window.location.href="/settings",children:[(0,ea.jsx)(Fw,{size:16,className:"mr-2"}),"Upgrade Plan"]})]})})]})}),(0,ea.jsx)(iJ,{value:"plans",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsxs)("div",{className:"p-6 border-b border-slate-100",children:[(0,ea.jsx)("h2",{className:"text-xl font-semibold",children:"Available Plans"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Compare features across different plan tiers"})]}),(0,ea.jsxs)("div",{className:"p-6",children:[(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4",children:(null===m||void 0===m?void 0:m.all_plans)&&Object.entries(m.all_plans).filter(e=>{let[t]=e;return"free"!==t}).map(e=>{let[t,s]=e;return(0,ea.jsxs)("div",{className:"border rounded-xl p-4 ".concat(L===t||"free"===L&&"freemium"===t?"border-indigo-500 bg-indigo-50":"border-slate-200"),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[R(t),(0,ea.jsx)("h3",{className:"font-semibold capitalize text-sm",children:s.display_name||t})]}),(L===t||"free"===L&&"freemium"===t)&&(0,ea.jsx)("span",{className:"inline-block text-xs bg-indigo-600 text-white px-2 py-0.5 rounded-full mb-3",children:"Current"}),"freemium"===t&&(0,ea.jsx)("p",{className:"text-xs text-emerald-600 font-medium mb-2",children:"Free Forever"}),s.price_monthly>0&&(0,ea.jsxs)("p",{className:"text-lg font-bold mb-2",children:["$",s.price_monthly,(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"/mo"})]}),(0,ea.jsxs)("ul",{className:"space-y-1.5 text-xs",children:[(0,ea.jsxs)("li",{className:"flex items-center gap-1.5",children:[s.subdomain?(0,ea.jsx)(Xl,{size:12,className:"text-emerald-500"}):(0,ea.jsx)(fJ,{size:12,className:"text-slate-300"}),(0,ea.jsx)("span",{children:"Subdomain"})]}),(0,ea.jsxs)("li",{className:"flex items-center gap-1.5",children:[s.custom_domain?(0,ea.jsx)(Xl,{size:12,className:"text-emerald-500"}):(0,ea.jsx)(fJ,{size:12,className:"text-slate-300"}),(0,ea.jsx)("span",{children:"Custom Domain"})]}),(0,ea.jsxs)("li",{className:"flex items-center gap-1.5",children:[!s.forced_branding&&s.remove_branding?(0,ea.jsx)(Xl,{size:12,className:"text-emerald-500"}):(0,ea.jsx)(fJ,{size:12,className:"text-slate-300"}),(0,ea.jsx)("span",{children:"Remove Branding"})]}),(0,ea.jsxs)("li",{className:"text-slate-500",children:[-1===s.max_pages?"\u221e":0===s.max_pages?"Landing only":s.max_pages," pages"]}),(0,ea.jsxs)("li",{className:"text-slate-500",children:[-1===s.max_forms?"\u221e":s.max_forms," forms"]}),(0,ea.jsxs)("li",{className:"text-slate-500",children:[-1===s.max_assets?"\u221e":s.max_assets," assets"]}),(0,ea.jsxs)("li",{className:"text-slate-500",children:[-1===s.max_team_members?"\u221e":0===s.max_team_members?"1 admin":"+".concat(s.max_team_members)," team"]}),void 0!==s.max_newsletters&&(0,ea.jsxs)("li",{className:"flex items-center gap-1.5",children:[0!==s.max_newsletters?(0,ea.jsx)(Xl,{size:12,className:"text-emerald-500"}):(0,ea.jsx)(fJ,{size:12,className:"text-slate-300"}),(0,ea.jsx)("span",{children:"Newsletters"})]}),s.analytics&&(0,ea.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,ea.jsx)(Xl,{size:12,className:"text-emerald-500"}),(0,ea.jsx)("span",{children:"Analytics"})]}),s.ai_features&&(0,ea.jsxs)("li",{className:"flex items-center gap-1.5 text-purple-600",children:[(0,ea.jsx)(Xl,{size:12}),(0,ea.jsx)("span",{children:"AI Features"})]}),s.api_access&&(0,ea.jsxs)("li",{className:"flex items-center gap-1.5 text-purple-600",children:[(0,ea.jsx)(Xl,{size:12}
2),(0,ea.jsx)("span",{children:"API Access"})]}),s.sso&&(0,ea.jsxs)("li",{className:"flex items-center gap-1.5 text-purple-600",children:[(0,ea.jsx)(Xl,{size:12}),(0,ea.jsx)("span",{children:"SSO"})]}),s.white_label&&(0,ea.jsxs)("li",{className:"flex items-center gap-1.5 text-purple-600",children:[(0,ea.jsx)(Xl,{size:12}),(0,ea.jsx)("span",{children:"White Label"})]})]})]},t)})}),(0,ea.jsx)("div",{className:"mt-6 text-center",children:(0,ea.jsx)(sg,{onClick:()=>window.location.href="/settings",children:"Manage Subscription"})})]})]})})]})]})}),(0,ea.jsx)(Ok,{open:C,onOpenChange:k,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Add Custom Domain"})}),(0,ea.jsx)("div",{className:"space-y-4 py-4",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Domain"}),(0,ea.jsx)(BN,{value:D,onChange:e=>_(e.target.value),placeholder:"yourschool.com",className:"mt-2"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mt-2",children:["Enter your root domain only \u2014 no ",(0,ea.jsx)("code",{children:"www."}),", no ",(0,ea.jsx)("code",{children:"http://"})," or ",(0,ea.jsx)("code",{children:"https://"})," (e.g. ",(0,ea.jsx)("strong",{children:"yourschool.com"}),"). The ",(0,ea.jsx)("code",{children:"www."})," version is handled automatically."]})]})}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(D.trim()){E(!0);try{const e=await _l.post("/tenant/domain",{custom_domain:D});qs.success(e.data.message),k(!1),_(""),M()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to add domain")}finally{E(!1)}}else qs.error("Please enter a domain")},disabled:S,children:S?"Adding...":"Add Domain"})]})]})})]})},VQ=()=>{const[e,s]=(0,t.useState)(!0),[a,n]=(0,t.useState)({enabled:!1,backup_codes_remaining:0}),[l,r]=(0,t.useState)("2fa"),[i,o]=(0,t.useState)(!1),[c,d]=(0,t.useState)(null),[u,m]=(0,t.useState)(""),[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(!1),[f,v]=(0,t.useState)(!1),[b,j]=(0,t.useState)(""),[y,N]=(0,t.useState)(!1),[w,C]=(0,t.useState)(!1),[k,D]=(0,t.useState)(""),[_,S]=(0,t.useState)(null),[E,A]=(0,t.useState)([]),[F,T]=(0,t.useState)(!1),[z,M]=(0,t.useState)([]),[P,B]=(0,t.useState)([]);(0,t.useEffect)(()=>{R()},[]),(0,t.useEffect)(()=>{"activity"===l?L():"security"===l&&(I(),O())},[l]);const R=async()=>{try{const e=await _l.get("/auth/2fa/status");n(e.data)}catch(e){console.error("Failed to fetch 2FA status:",e)}finally{s(!1)}},L=async()=>{T(!0);try{const e=await _l.get("/audit-logs/recent?limit=50");A(e.data)}catch(e){console.error("Failed to fetch audit logs:",e)}finally{T(!1)}},I=async()=>{try{const e=await _l.get("/audit-logs/security?limit=20");M(e.data)}catch(e){console.error("Failed to fetch security events:",e)}},O=async()=>{try{const e=await _l.get("/audit-logs/failed-logins?hours=72");B(e.data)}catch(e){console.error("Failed to fetch failed logins:",e)}},U=e=>{navigator.clipboard.writeText(e),qs.success("Copied to clipboard")},H=e=>{switch(e){case"login_success":return(0,ea.jsx)(QJ,{className:"text-emerald-500",size:16});case"login_failed":return(0,ea.jsx)(AN,{className:"text-red-500",size:16});case"logout":return(0,ea.jsx)(zw,{className:"text-slate-500",size:16});case"2fa_enabled":case"2fa_disabled":return(0,ea.jsx)(RN,{className:"text-indigo-500",size:16});case"password_changed":return(0,ea.jsx)(Ew,{className:"text-amber-500",size:16});case"user_created":case"user_deleted":return(0,ea.jsx)(Pj,{className:"text-blue-500",size:16});case"settings_changed":return(0,ea.jsx)(Oj,{className:"text-purple-500",size:16});case"newsletter_sent":return(0,ea.jsx)(Yl,{className:"text-emerald-500",size:16});case"user_impersonated":return(0,ea.jsx)(IN,{className:"text-red-500",size:16});default:return(0,ea.jsx)(Kg,{className:"text-slate-400",size:16})}},W=e=>{if(!e)return"-";return new Date(e).toLocaleString()};return(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,ea.jsxs)("div",{className:"mb-8",children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(Kl,{className:"text-indigo-600",size:32}),"Security Settings"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-2",children:"Manage two-factor authentication and view security activity"})]}),(0,ea.jsxs)(nJ,{value:l,onValueChange:r,children:[(0,ea.jsxs)(lJ,{className:"mb-6",children:[(0,ea.jsxs)(rJ,{value:"2fa",className:"gap-2",children:[(0,ea.jsx)(RN,{size:16}),"Two-Factor Auth"]}),(0,ea.jsxs)(rJ,{value:"activity",className:"gap-2",children:[(0,ea.jsx)(Kg,{size:16}
2),"Activity Log"]}),(0,ea.jsxs)(rJ,{value:"security",className:"gap-2",children:[(0,ea.jsx)(AN,{size:16}),"Security Events"]})]}),(0,ea.jsxs)(iJ,{value:"2fa",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,ea.jsx)(Lj,{size:20}),"Two-Factor Authentication (2FA)"]}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Add an extra layer of security to your account using an authenticator app"})]}),e?(0,ea.jsx)("div",{className:"text-slate-400",children:"Loading..."}):a.enabled?(0,ea.jsx)("div",{className:"flex items-center gap-2",children:(0,ea.jsxs)("span",{className:"flex items-center gap-1 px-3 py-1 bg-emerald-100 text-emerald-700 rounded-full text-sm",children:[(0,ea.jsx)(cr,{size:16}),"Enabled"]})}):(0,ea.jsx)("span",{className:"px-3 py-1 bg-slate-100 text-slate-600 rounded-full text-sm",children:"Not Enabled"})]}),(0,ea.jsx)("div",{className:"mt-6 border-t border-slate-100 pt-6",children:a.enabled?(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-emerald-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-emerald-800",children:"2FA is Active"}),(0,ea.jsx)("p",{className:"text-sm text-emerald-600",children:"Your account is protected with two-factor authentication"})]}),(0,ea.jsx)(cr,{className:"text-emerald-500",size:24})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:"Backup Codes"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[a.backup_codes_remaining," codes remaining"]})]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>C(!0),children:[(0,ea.jsx)(gq,{size:16,className:"mr-1"}),"Regenerate"]})]}),(0,ea.jsx)("div",{className:"pt-4 border-t border-slate-100",children:(0,ea.jsxs)(sg,{variant:"outline",className:"text-red-600 hover:bg-red-50",onClick:()=>v(!0),children:[(0,ea.jsx)(wD,{size:16,className:"mr-2"}),"Disable 2FA"]})})]}):(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsx)("div",{className:"p-4 bg-amber-50 rounded-lg",children:(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)(AN,{className:"text-amber-600 mt-0.5",size:20}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-amber-800",children:"Recommended for School Accounts"}),(0,ea.jsx)("p",{className:"text-sm text-amber-700",children:"Two-factor authentication adds an extra layer of security and is required for many school compliance standards."})]})]})}),(0,ea.jsxs)(sg,{onClick:async()=>{x(!0);try{const e=await _l.post("/auth/2fa/setup");d(e.data),o(!0)}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to start 2FA setup")}finally{x(!1)}},disabled:h,children:[(0,ea.jsx)(RN,{size:18,className:"mr-2"}),h?"Setting up...":"Enable Two-Factor Authentication"]})]})})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mt-6",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-4",children:"How Two-Factor Authentication Works"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-6",children:[(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-3",children:(0,ea.jsx)("span",{className:"text-indigo-600 font-bold",children:"1"})}),(0,ea.jsx)("h4",{className:"font-medium mb-1",children:"Install App"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Download Google Authenticator or Authy on your phone"})]}),(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-3",children:(0,ea.jsx)("span",{className:"text-indigo-600 font-bold",children:"2"})}),(0,ea.jsx)("h4",{className:"font-medium mb-1",children:"Scan QR Code"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Use the app to scan the QR code we provide"})]}),(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-3",children:(0,ea.jsx)("span",{className:"text-indigo-600 font-bold",children:"3"})}),(0,ea.jsx)("h4",{className:"font-medium mb-1",children:"Enter Code"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Enter the 6-digit code when you login"})]})]})]})]}),(0,ea.jsx)(iJ,{value:"activity",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsxs)("div",{className:"px-6 py-4 border-b border-slate-200 flex justify-between items-center",children:[(0,ea.jsx)("h3",{className:"font-semibold",children:"Recent Activity"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:L,children:[(0,ea.jsx)(gq,{size:16,className:"mr-1"}),"Refresh"]})]}),F?(0,ea.jsx)("div",{className:"p-12 text-center text-slate-500",children:"Loading activity..."}):0===E.length?(0,ea.jsx)("div",{className:"p-12 text-center text-slate-500",children:"No activity recorded yet"}):(0,ea.jsx)("div",{className:"divide-y divide-slate-100",children:E.map((e,t)=>(0,ea.jsx)("div",{className:"px-6 py-4 hover:bg-slate-50",children:(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)("div",{className:"mt-1",children:H(e.event_type)}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("p",{className:"text-sm",children:e.event_description}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 mt-1 text-xs text-slate-500",children:[(0,ea.jsx)("span",{children:W(e.created_at)}),e.ip_address&&(0,ea.jsxs)("span",{children:["IP: ",e.ip_address]}),e.user_email&&(0,ea.jsx)("span",{children:e.user_email})]})]})]})},e.log_id||t))})]})}),(0,ea.jsxs)(iJ,{value:"security",children:[P.length>0&&(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-red-200 p-6 mb-6",children:[(0,ea.jsxs)("h3",{className:"font-semibold text-red-800 flex items-center gap-2 mb-4",children:[(0,ea.jsx)(AN,{size:20}),"Failed Login Attempts (Last 72 Hours)"]}),(0,ea.jsx)("div",{className:"space-y-3",children:P.slice(0,10).map((e,t)=>{var s;return(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-red-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-red-800",children:e.user_email||"Unknown"}),(0,ea.jsx)("p",{className:"text-xs text-red-600",children:(null===(s=e.metadata)||void 0===s?void 0:s.reason)||"Invalid credentials"})]}),(0,ea.jsxs)("div",{className:"text-right text-xs text-red-600",children:[(0,ea.jsx)("p",{children:W(e.created_at)}),e.ip_address&&(0,ea.jsxs)("p",{children:["IP: ",e.ip_address]})]})]},e.log_id||t)})})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsx)("div",{className:"px-6 py-4 border-b border-slate-200",children:(0,ea.jsx)("h3",{className:"font-semibold",children:"Security Events"})}),0===z.length?(0,ea.jsxs)("div",{className:"p-12 text-center text-slate-500",children:[(0,ea.jsx)(Kl,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{children:"No security events recorded"})]}):(0,ea.jsx)("div",{className:"divide-y divide-slate-100",children:z.map((e,t)=>(0,ea.jsx)("div",{className:"px-6 py-4 hover:bg-slate-50",children:(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)("div",{className:"mt-1",children:H(e.event_type)}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("p",{className:"text-sm",children:e.event_description}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 mt-1 text-xs text-slate-500",children:[(0,ea.jsx)("span",{children:W(e.created_at)}),e.ip_address&&(0,ea.jsxs)("span",{children:["IP: ",e.ip_address]})]})]})]})},e.log_id||t))})]})]})]})]})}),(0,ea.jsx)(Ok,{open:i,onOpenChange:o,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Set Up Two-Factor Authentication"})}),c&&(0,ea.jsxs)("div",{className:"py-4 space-y-4",children:[(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-600 mb-4",children:"Scan this QR code with your authenticator app"}),(0,ea.jsx)("img",{src:c.qr_code,alt:"2FA QR Code",className:"mx-auto border rounded-lg"})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-3",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-1",children:"Or enter this code manually:"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("code",{className:"text-sm font-mono flex-1",children:c.secret}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>U(c.secret),children:(0,ea.jsx)(DD,{size:14})})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Enter the 6-digit code from your app"}),(0,ea.jsx)(BN,{type:"text",maxLength:6,placeholder:"000000",value:u,onChange:e=>m(e.target.value.replace(/\D/g,"")),className:"text-center text-2xl tracking-widest"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(u&&6===u.length)try{await _l.post("/auth/2fa/verify-setup",{code:u}),qs.success("Two-factor authentication enabled!"),o(!1),g(!0),R()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Invalid code")}else qs.error("Please enter a 6-digit code")},children:"Verify & Enable"})]})]})}),(0,ea.jsx)(Ok,{open:p,onOpenChange:g,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Ew,{className:"text-amber-600"}),"Save Your Backup Codes"]})}),(0,ea.jsxs)("div",{className:"py-4",children:[(0,ea.jsx)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 mb-4",children:(0,ea.jsxs)("p",{className:"text-sm text-amber-800",children:[(0,ea.jsx)("strong",{children:"Important:"})," Save these backup codes in a safe place. You can use them to access your account if you lose your phone."]})}),(null===c||void 0===c?void 0:c.backup_codes)&&(0,ea.jsx)("div",{className:"grid grid-cols-2 gap-2 font-mono text-sm",children:c.backup_codes.map((e,t)=>(0,ea.jsx)("div",{className:"bg-slate-100 rounded px-3 py-2 text-center",children:e},t))}),(0,ea.jsxs)(sg,{variant:"outline",className:"w-full mt-4",onClick:()=>{var e;return U(null===c||void 0===c||null===(e=c.backup_codes)||void 0===e?void 0:e.join("\n"))},children:[(0,ea.jsx)(DD,{size:16,className:"mr-2"}),"Copy All Codes"]})]}),(0,ea.jsx)(qk,{children:(0,ea.jsx)(sg,{onClick:()=>g(!1),children:"I've Saved My Codes"})})]})}),(0,ea.jsx)(Ok,{open:f,onOpenChange:v,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{className:"text-red-600",children:"Disable Two-Factor Authentication"})}),(0,ea.jsxs)("div",{className:"py-4 space-y-4",children:[(0,ea.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,ea.jsxs)("p",{className:"text-sm text-red-800",children:[(0,ea.jsx)("strong",{children:"Warning:"})," Disabling 2FA will make your account less secure."]})}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Enter your 2FA code to confirm"}),(0,ea.jsx)(BN,{type:"text",maxLength:6,placeholder:"000000",value:b,onChange:e=>j(e.target.value.replace(/\D/g,"")),className:"text-center text-2xl tracking-widest"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:async()=>{if(b&&6===b.length){N(!0);try{await _l.post("/auth/2fa/disable",{code:b}),qs.success("Two-factor authentication disabled"),v(!1),j(""),R()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Invalid code")}finally{N(!1)}}else qs.error("Please enter a 6-digit code")},disabled:y,children:y?"Disabling...":"Disable 2FA"})]})]})}),(0,ea.jsx)(Ok,{open:w,onOpenChange:e=>{C(e),e||(D(""),S(null))},children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Regenerate Backup Codes"})}),(0,ea.jsx)("div",{className:"py-4 space-y-4",children:_?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"bg-emerald-50 border border-emerald-200 rounded-lg p-4",children:(0,ea.jsx)("p",{className:"text-sm text-emerald-800",children:"New backup codes generated! Save them securely."})}),(0,ea.jsx)("div",{className:"grid grid-cols-2 gap-2 font-mono text-sm",children:_.map((e,t)=>(0,ea.jsx)("div",{className:"bg-slate-100 rounded px-3 py-2 text-center",children:e},t))}),(0,ea.jsxs)(sg,{variant:"outline",className:"w-full",onClick:()=>U(_.join("\n")),children:[(0,ea.jsx)(DD,{size:16,className:"mr-2"}),"Copy All Codes"]})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"This will invalidate your existing backup codes and generate new ones."}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Enter your 2FA code to confirm"}),(0,ea.jsx)(BN,{type:"text",maxLength:6,placeholder:"000000",value:k,onChange:e=>D(e.target.value.replace(/\D/g,"")),className:"text-center text-2xl tracking-widest"})]})]})}),(0,ea.jsx)(qk,{children:_?(0,ea.jsx)(sg,{onClick:()=>C(!1),children:"Done"}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(k&&6===k.length)try{const e=await _l.post("/auth/2fa/regenerate-backup-codes",{code:k});S(e.data.backup_codes),qs.success("New backup codes generated"),R()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Invalid code")}else qs.error("Please enter a 6-digit code")},children:"Generate New Codes"})]})})]})})]})};function qQ(){const{user:e}=Al(),[s,a]=(0,t.useState)([]),[n,l]=(0,t.useState)(!0),[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)({name:"",description:"",scope:"read",rsvps_read:!1}),[h,x]=(0,t.useState)(!1),[p,g]=(0,t.useState)(null),[f,v]=(0,t.useState)(!1),[b,j]=(0,t.useState)(!1),[y,N]=(0,t.useState)(null),w=(0,t.useCallback)(async()=>{l(!0);try{const e=await _l.get("/api-keys");a(e.data||[])}catch(e){qs.error("Failed to load API keys")}finally{l(!1)}},[]);(0,t.useEffect)(()=>{w(),null!==e&&void 0!==e&&e.tenant_id?i(e.tenant_id):_l.get("/auth/me").then(e=>{var t;return i((null===(t=e.data)||void 0===t?void 0:t.tenant_id)||"")}).catch(()=>{})},[w,e]);const C=e=>e?new Date(e).toLocaleString():"\u2014";return(0,ea.jsxs)("div",{className:"flex h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 overflow-auto",children:(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-10 space-y-8",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold text-slate-900 flex items-center gap-3",children:[(0,ea.jsx)(Ew,{className:"w-7 h-7 text-indigo-600"})," API Keys"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1 text-sm",children:"Generate keys for third-party platforms (e.g. Gametime) that need read access to your events."})]}),(0,ea.jsxs)(sg,{onClick:()=>c(!0),"data-testid":"create-key-btn",children:[(0,ea.jsx)(Vj,{className:"w-4 h-4 mr-1"})," Generate Key"]})]}),r&&(0,ea.jsxs)("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 p-4 flex items-start gap-3",children:[(0,ea.jsx)(qj,{className:"w-4 h-4 text-indigo-500 mt-0.5 shrink-0"}),(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsx)("p",{className:"text-sm font-semibold text-indigo-800 mb-1",children:"Your Tenant ID"}),(0,ea.jsx)("p",{className:"text-xs text-indigo-600 mb-2",children:"Share this alongside your API key with any third-party developer. It identifies your organisation."}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("code",{className:"text-xs bg-white border border-indigo-200 rounded px-2 py-1 font-mono text-indigo-900 select-all","data-testid":"tenant-id-display",children:r}),(0,ea.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(r),qs.success("Tenant ID copied")},className:"text-xs text-indigo-600 hover:text-indigo-800 flex items-center gap-1","data-testid":"copy-tenant-id",children:[(0,ea.jsx)(DD,{className:"w-3 h-3"})," Copy"]})]})]})]}),n?(0,ea.jsx)("div",{className:"flex justify-center py-16 text-slate-400",children:(0,ea.jsx)(ql,{className:"w-6 h-6 animate-spin"})}):0===s.length?(0,ea.jsxs)("div",{className:"bg-white rounded-2xl border-2 border-dashed border-slate-200 p-14 text-center",children:[(0,ea.jsx)(Ew,{className:"w-10 h-10 mx-auto mb-3 text-slate-300"}),(0,ea.jsx)("p",{className:"font-semibold text-slate-600",children:"No API keys yet"}),(0,ea.jsx)("p",{className:"text-sm text-slate-400 mt-1 mb-5",children:"Generate a key to give a third-party platform access to your events."}),(0,ea.jsx)(sg,{onClick:()=>c(!0),children:"Generate your first key"})]}):(0,ea.jsx)("div",{className:"space-y-3","data-testid":"api-keys-list",children:s.map(e=>(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 flex flex-wrap items-center gap-4","data-testid":"api-key-row-".concat(e.key_id),children:[(0,ea.jsx)("div",{className:"w-9 h-9 rounded-lg bg-indigo-50 flex items-center justify-center shrink-0",children:(0,ea.jsx)(Ew,{className:"w-4 h-4 text-indigo-600"})}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:e.name}),e.description&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 truncate",children:e.description}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mt-1 text-xs text-slate-500",children:[(0,ea.jsxs)("span",{className:"font-mono bg-slate-100 px-1.5 py-0.5 rounded",children:[e.key_prefix,"\u2026"]}),(e.scopes||[]).includes("events:write")?(0,ea.jsx)("span",{className:"bg-amber-100 text-amber-700 px-1.5 py-0.5 rounded font-medium",children:"Read + Write"}):(0,ea.jsx)("span",{className:"bg-slate-100 text-slate-500 px-1.5 py-0.5 rounded",children:"Read only"}),(e.scopes||[]).includes("rsvps:read")&&(0,ea.jsx)("span",{className:"bg-blue-50 text-blue-600 px-1.5 py-0.5 rounded",children:"RSVP access"}),(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Kg,{className:"w-3 h-3"})," Created ",C(e.created_at)]}),e.last_used_at?(0,ea.jsxs)("span",{className:"flex items-center gap-1 text-emerald-600",children:[(0,ea.jsx)(uD,{className:"w-3 h-3"})," Last used ",C(e.last_used_at)]}):(0,ea.jsx)("span",{className:"text-slate-400 italic",children:"Never used"})]})]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",className:"text-red-500 hover:text-red-700 shrink-0",onClick:()=>(async e=>{if(window.confirm('Revoke "'.concat(e.name,'"? Any system using this key will immediately lose access.'))){N(e.key_id);try{await _l.delete("/api-keys/".concat(e.key_id)),qs.success('"'.concat(e.name,'" revoked')),w()}catch(t){qs.error("Failed to revoke key")}finally{N(null)}}}
2)(e),disabled:y===e.key_id,"data-testid":"revoke-key-btn-".concat(e.key_id),children:[y===e.key_id?(0,ea.jsx)(ql,{className:"w-4 h-4 animate-spin"}):(0,ea.jsx)(wD,{className:"w-4 h-4"}),"Revoke"]})]},e.key_id))}),(0,ea.jsxs)("div",{className:"rounded-xl border border-slate-200 bg-white p-5 space-y-3 text-sm text-slate-600",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-800",children:"How API keys work"}),(0,ea.jsxs)("ul",{className:"list-disc list-inside space-y-1.5",children:[(0,ea.jsxs)("li",{children:["Each key grants ",(0,ea.jsx)("strong",{children:"read-only access"})," to your published events via the App Feed API."]}),(0,ea.jsxs)("li",{children:["The full key is shown ",(0,ea.jsx)("strong",{children:"once only"})," at creation \u2014 copy it immediately and store it securely."]}),(0,ea.jsx)("li",{children:"You can generate multiple keys \u2014 one per integration \u2014 and revoke any individually."}),(0,ea.jsx)("li",{children:"Taptile continues to use its own separate key and is unaffected by changes here."})]})]})]})}),(0,ea.jsx)(Ok,{open:o,onOpenChange:c,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Generate a new API key"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{children:["Name ",(0,ea.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ea.jsx)(BN,{value:u.name,onChange:e=>m(t=>d(d({},t),{},{name:e.target.value})),placeholder:"e.g. Gametime, Partner App","data-testid":"new-key-name-input"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Helps you identify which integration is using this key."})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{children:["Description ",(0,ea.jsx)("span",{className:"text-slate-400 text-xs",children:"(optional)"})]}),(0,ea.jsx)(BN,{value:u.description,onChange:e=>m(t=>d(d({},t),{},{description:e.target.value})),placeholder:"e.g. Pulls match fixtures for the Gametime app","data-testid":"new-key-desc-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Access level"}),(0,ea.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,ea.jsxs)("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-slate-200 hover:bg-slate-50","data-testid":"scope-read-option",children:[(0,ea.jsx)("input",{type:"radio",name:"scope",value:"read",checked:"read"===u.scope,onChange:()=>m(e=>d(d({},e),{},{scope:"read"})),className:"mt-0.5"}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"text-sm font-medium text-slate-800",children:["Read only ",(0,ea.jsx)("span",{className:"text-xs text-slate-400 font-normal ml-1",children:"(recommended)"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Can fetch and filter events. Cannot create, update or delete."})]})]}),(0,ea.jsxs)("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-lg border border-amber-200 bg-amber-50/40 hover:bg-amber-50","data-testid":"scope-write-option",children:[(0,ea.jsx)("input",{type:"radio",name:"scope",value:"write",checked:"write"===u.scope,onChange:()=>m(e=>d(d({},e),{},{scope:"write"})),className:"mt-0.5"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-800",children:"Read + Write"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Can also create, update, and delete events. Only share with trusted integrations."})]})]})]})]}),(0,ea.jsx)("div",{className:"rounded-lg border border-slate-200 p-3",children:(0,ea.jsxs)("label",{className:"flex items-start gap-3 cursor-pointer","data-testid":"scope-rsvps-option",children:[(0,ea.jsx)("input",{type:"checkbox",checked:u.rsvps_read,onChange:e=>m(t=>d(d({},t),{},{rsvps_read:e.target.checked})),className:"mt-0.5"}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"text-sm font-medium text-slate-800",children:["RSVP list access ",(0,ea.jsx)("span",{className:"text-xs bg-slate-100 text-slate-500 px-1.5 py-0.5 rounded ml-1",children:"rsvps:read"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Allows reading attendee names, emails and party sizes. Only enable for integrations that need it \u2014 this is personal data."})]})]})})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:async()=>
2{if(u.name.trim()){x(!0);try{const e="write"===u.scope?["events:read","events:write"]:["events:read"];u.rsvps_read&&e.push("rsvps:read");const t=await _l.post("/api-keys",{name:u.name,description:u.description,scopes:e});g(t.data),v(!1),j(!1),c(!1),m({name:"",description:"",scope:"read",rsvps_read:!1}),w()}catch(G2){var e,t;qs.error((null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to create key")}finally{x(!1)}}else qs.error("Name is required")},disabled:h,"data-testid":"create-key-confirm-btn",children:[h?(0,ea.jsx)(ql,{className:"w-4 h-4 animate-spin mr-1"}):(0,ea.jsx)(Ew,{className:"w-4 h-4 mr-1"}),"Generate Key"]})]})]})}),p&&(0,ea.jsx)(Ok,{open:!!p,onOpenChange:()=>g(null),children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(uD,{className:"w-5 h-5 text-emerald-500"}),' Key generated \u2014 "',p.name,'"']})}),(0,ea.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ea.jsxs)("div",{className:"rounded-xl border-2 border-amber-300 bg-amber-50 p-4 flex gap-3",children:[(0,ea.jsx)(AN,{className:"w-5 h-5 text-amber-500 shrink-0 mt-0.5"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold text-amber-800 text-sm",children:"Copy this key now"}),(0,ea.jsx)("p",{className:"text-xs text-amber-700 mt-0.5",children:"This is the only time the full key will be shown. Once you close this window it cannot be retrieved \u2014 you would need to generate a new one."})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Your API Key"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)("div",{className:"relative flex-1",children:[(0,ea.jsx)("input",{readOnly:!0,value:p.key,type:f?"text":"password",className:"w-full font-mono text-xs bg-slate-50 border border-slate-200 rounded-lg px-3 py-2.5 pr-10 select-all","data-testid":"new-key-value"}),(0,ea.jsx)("button",{onClick:()=>v(e=>!e),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:f?(0,ea.jsx)(LN,{className:"w-4 h-4"}):(0,ea.jsx)(IN,{className:"w-4 h-4"})})]}),(0,ea.jsxs)(sg,{onClick:()=>{return e=p.key,void navigator.clipboard.writeText(e).then(()=>{j(!0),qs.success("Copied to clipboard"),setTimeout(()=>j(!1),3e3)});var e},variant:"outline",className:b?"border-emerald-400 text-emerald-600":"","data-testid":"copy-new-key-btn",children:[b?(0,ea.jsx)(uD,{className:"w-4 h-4"}):(0,ea.jsx)(DD,{className:"w-4 h-4"}),b?"Copied!":"Copy"]})]})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Send this key and your ",(0,ea.jsx)("strong",{children:"Tenant ID"})," to the developer. Use header ",(0,ea.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:"X-API-Key"})," for the key and ",(0,ea.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:"X-Tenant-ID"})," for your Tenant ID."]})]}),(0,ea.jsx)(qk,{children:(0,ea.jsx)(sg,{onClick:()=>g(null),"data-testid":"close-new-key-btn",children:"Done \u2014 I've saved the key"})})]})})]})}const $Q=Vl("clipboard-check",[["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"}]]),GQ=Vl("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"}]]),KQ=()=>{const[e,s]=(0,t.useState)("documents"),a=[{id:"dpa",title:"Data Processing Agreement (DPA)",description:"Legal agreement governing how we process your data. Required for GDPR compliance.",icon:Sw,filename:"NexusCMS_Data_Processing_Agreement.pdf",size:"~45 KB",lastUpdated:"January 2025",audie
2nce:["Schools","Businesses","Organizations"]},{id:"security-policy",title:"Security Policy",description:"Technical and organizational security measures we implement to protect your data.",icon:Kl,filename:"NexusCMS_Security_Policy.pdf",size:"~25 KB",lastUpdated:"January 2025",audience:["IT Teams","Security Officers","Procurement"]},{id:"questionnaire",title:"School Security Questionnaire",description:"Pre-filled security questionnaire with answers for school procurement processes.",icon:$Q,filename:"NexusCMS_Security_Questionnaire.pdf",size:"~35 KB",lastUpdated:"January 2025",audience:["Schools","Education Authorities"]},{id:"privacy-template",title:"Privacy Policy Template",description:"Customizable privacy policy template for your website.",icon:Lj,filename:"Privacy_Policy_Template.docx",size:"~15 KB",lastUpdated:"January 2025",audience:["All Customers"]}];return(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,ea.jsxs)("div",{className:"mb-8",children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(Sw,{className:"text-indigo-600",size:32}),"Compliance & Documentation"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-2",children:"Security policies, compliance documents, and certifications for NexusCMS"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-emerald-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Kl,{className:"text-emerald-600",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:"AES-256"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Encryption"})]})]})}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Lj,{className:"text-indigo-600",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:"2FA"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Authentication"})]})]})}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-amber-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(GQ,{className:"text-amber-600",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:"3"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Data Regions"})]})]})}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Bj,{className:"text-purple-600",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-2xl font-bold",children:"GDPR"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Compliant"})]})]})})]}),(0,ea.jsxs)(nJ,{value:e,onValueChange:s,children:[(0,ea.jsxs)(lJ,{className:"mb-6",children:[(0,ea.jsxs)(rJ,{value:"documents",className:"gap-2",children:[(0,ea.jsx)(qN,{size:16}),"Documents"]}),(0,ea.jsxs)(rJ,{value:"compliance",className:"gap-2",children:[(0,ea.jsx)(cr,{size:16}),"Compliance Status"]}),(0,ea.jsxs)(rJ,{value:"security",className:"gap-2",children:[(0,ea.jsx)(Kl,{size:16}),"Security Features"]})]}),(0,ea.jsxs)(iJ,{value:"documents",children:[(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:a.map(e=>{const t=e.icon;return(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center flex-shrink-0",children:(0,ea.jsx)(t,{className:"text-indigo-600",size:24})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("h3",{className:"font-semibold text-lg",children:e.title}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:e.description}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2 mt-3",children:e.audience.map((e,t)=>(0,ea.jsx)("span",{className:"px-2 py-0.5 bg-slate-100 text-slate-600 rounded text-xs",children:e},t))}),(0,ea.jsxs)("div",{className:"mt-4 pt-4 border-t border-slate-100",children:[(0,ea.jsxs)("div",{className:"text-xs text-slate-500 mb-4",children:[(0,ea.jsx)("p",{className:"truncate",children:e.filename}),(0,ea.jsxs)("p",{children:["Updated: ",e.lastUpdated]})]}),(0,ea.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,ea.jsxs)(sg,{size:"sm",variant:"outline",onClick:()=>(e=>{qs.success("Preparing ".concat(e.title," for download..."));const t="\n".concat(e.title,"\n==================\n\nThis document is available for download.\nPlease contact us at [email protected] to request the full document.\n\nDocument: ").concat(e.filename,"\nLast Updated: ").concat(e.lastUpdated,"\n ").trim(),s=new Blob([t],{type:"text/plain"}),a=window.URL.createObjectURL(s),n=document.createElement("a");n.href=a,n.download=e.filename.replace(".pdf",".txt").replace(".docx",".txt"),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(a)})(e),children:[(0,ea.jsx)(jj,{size:14,className:"mr-1"}),"Preview"]}),(0,ea.jsx)(sg,{size:"sm",onClick:()=>(e=>{window.location.href="mailto:[email protected]?subject=Document Request: ".concat(e.title,"&body=Hello,%0D%0A%0D%0AI would like to request a copy of the ").concat(e.title,".%0D%0A%0D%0AOrganization: %0D%0AContact Name: %0D%0A%0D%0AThank you.")})(e),children:"Request"})]})]})]})]})},e.id)})}),(0,ea.jsx)("div",{className:"bg-indigo-50 rounded-xl border border-indigo-200 p-6 mt-6",children:(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center flex-shrink-0",children:(0,ea.jsx)(qN,{className:"text-indigo-600",size:24})}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("h3",{className:"font-semibold text-lg text-indigo-900",children:"Need a Custom Document?"}),(0,ea.jsx)("p",{className:"text-sm text-indigo-700 mt-1",children:"If your organization requires additional documentation, security attestations, or custom agreements, please contact our compliance team."}),(0,ea.jsx)(sg,{className:"mt-4",onClick:()=>window.location.href="mailto:[email protected]",children:"Contact Compliance Team"})]})]})})]}),(0,ea.jsxs)(iJ,{value:"compliance",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsx)("div",{className:"px-6 py-4 border-b border-slate-200",children:(0,ea.jsx)("h3",{className:"font-semibold",children:"Compliance & Certification Status"})}),(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Standard"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-sm font-medium text-slate-600",children:"Notes"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-200",children:[{standard:"GDPR (EU)",status:"compliant",notes:"Full compliance with EU data protection regulations"},{standard:"UK GDPR",status:"compliant",notes:"Compliant with UK data protection framework"},{standard:"Australian Privacy Act",status:"compliant",notes:"Meets Australian Privacy Principles"},{standard:"COPPA",status:"compliant",notes:"Children's privacy protections in place"}
2,{standard:"ISO 27001",status:"planned",notes:"Infrastructure providers certified; platform certification planned"},{standard:"SOC 2 Type II",status:"planned",notes:"Infrastructure providers certified; platform certification planned"},{standard:"Cyber Essentials (UK)",status:"planned",notes:"Certification planned for Q2 2025"}].map((e,t)=>(0,ea.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"px-6 py-4 text-sm font-medium",children:e.standard}),(0,ea.jsx)("td",{className:"px-6 py-4",children:"compliant"===e.status?(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-emerald-100 text-emerald-700 rounded-full text-xs",children:[(0,ea.jsx)(cr,{size:12}),"Compliant"]}):"planned"===e.status?(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-amber-100 text-amber-700 rounded-full text-xs",children:[(0,ea.jsx)(AN,{size:12}),"Planned"]}):(0,ea.jsx)("span",{className:"px-2 py-1 bg-slate-100 text-slate-600 rounded-full text-xs",children:e.status})}),(0,ea.jsx)("td",{className:"px-6 py-4 text-sm text-slate-600",children:e.notes})]},t))})]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mt-6",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-4",children:"Data Residency Options"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-2xl mb-1",children:"\ud83c\uddea\ud83c\uddfa"}),(0,ea.jsx)("p",{className:"font-medium",children:"European Union"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Frankfurt, Germany"})]}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-2xl mb-1",children:"\ud83c\udde6\ud83c\uddfa"}),(0,ea.jsx)("p",{className:"font-medium",children:"Australia"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Sydney"})]}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-2xl mb-1",children:"\ud83c\uddf8\ud83c\uddec"}),(0,ea.jsx)("p",{className:"font-medium",children:"Southeast Asia"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Singapore"})]})]})]})]}),(0,ea.jsxs)(iJ,{value:"security",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsx)("div",{className:"px-6 py-4 border-b border-slate-200",children:(0,ea.jsx)("h3",{className:"font-semibold",children:"Security Features & Controls"})}),(0,ea.jsx)("div",{className:"divide-y divide-slate-200",children:[{feature:"Data Encryption (Transit)",status:!0,details:"TLS 1.2/1.3"},{feature:"Data Encryption (Rest)",status:!0,details:"AES-256"},{feature:"Two-Factor Authentication",status:!0,details:"TOTP-based"},{feature:"Role-Based Access Control",status:!0,details:"4 role levels"},{feature:"Audit Logging",status:!0,details:"12 month retention"},{feature:"DDoS Protection",status:!0,details:"Cloudflare"},{feature:"Web Application Firewall",status:!0,details:"Cloudflare WAF"},{feature:"Automated Backups",status:!0,details:"Daily + hourly incremental"},{feature:"Data Residency Options",status:!0,details:"EU, AU, Singapore"},{feature:"Penetration Testing",status:!0,details:"Annual third-party testing"}].map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 hover:bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ".concat(e.status?"bg-emerald-100":"bg-slate-100"),children:e.status?(0,ea.jsx)(cr,{className:"text-emerald-600",size:16}):(0,ea.jsx)(AN,{className:"text-slate-400",size:16})}),(0,ea.jsx)("span",{className:"font-medium",children:e.feature})]}),(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:e.details})]},t))})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mt-6",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-4",children:"Sub-processors"}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:"MongoDB Atlas"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Database Hosting"})]}),(0,ea.jsx)("span",{className:"text-xs bg-emerald-100 text-emerald-700 px-2 py-1 rounded",children:"SOC 2, ISO 27001"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:"Cloudflare"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"CDN, Security, WAF"})]}),(0,ea.jsx)("span",{className:"text-xs bg-emerald-100 text-emerald-700 px-2 py-1 rounded",children:"SOC 2, ISO 27001"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:"SendGrid (Twilio)"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Email Delivery"})]}),(0,ea.jsx)("span",{className:"text-xs bg-emerald-100 text-emerald-700 px-2 py-1 rounded",children:"SOC 2"})]})]})]})]})]})]})})]})},YQ=Vl("circle-play",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]),JQ=Vl("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"}]]),QQ=["type"],XQ=["value","defaultValue","onValueChange","collapsible"],ZQ=["value","defaultValue","onValueChange"],eX=["__scopeAccordion","disabled","dir","orientation"],tX=["__scopeAccordion","value"],sX=["__scopeAccordion"],aX=["__scopeAccordion"],nX=["__scopeAccordion"];var lX="Accordion",rX=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[iX,oX,cX]=$r(lX),[dX,uX]=jr(lX,[cX,mY]),mX=mY(),hX=t.forwardRef((e,t)=>
2{const{type:s}=e,a=l(e,QQ),n=a,r=a;return(0,ea.jsx)(iX.Provider,{scope:e.__scopeAccordion,children:"multiple"===s?(0,ea.jsx)(bX,d(d({},r),{},{ref:t})):(0,ea.jsx)(vX,d(d({},n),{},{ref:t}))})});hX.displayName=lX;var[xX,pX]=dX(lX),[gX,fX]=dX(lX,{collapsible:!1}),vX=t.forwardRef((e,s)=>{const{value:a,defaultValue:n,onValueChange:r=()=>{},collapsible:i=!1}=e,o=l(e,XQ),[c,u]=Cr({prop:a,defaultProp:null!==n&&void 0!==n?n:"",onChange:r,caller:lX});return(0,ea.jsx)(xX,{scope:e.__scopeAccordion,value:t.useMemo(()=>c?[c]:[],[c]),onItemOpen:u,onItemClose:t.useCallback(()=>i&&u(""),[i,u]),children:(0,ea.jsx)(gX,{scope:e.__scopeAccordion,collapsible:i,children:(0,ea.jsx)(NX,d(d({},o),{},{ref:s}))})})}),bX=t.forwardRef((e,s)=>{const{value:a,defaultValue:n,onValueChange:r=()=>{}}=e,i=l(e,ZQ),[o,c]=Cr({prop:a,defaultProp:null!==n&&void 0!==n?n:[],onChange:r,caller:lX}),u=t.useCallback(e=>c(function(){return[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e]}),[c]),m=t.useCallback(e=>c(function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(t=>t!==e)}),[c]);return(0,ea.jsx)(xX,{scope:e.__scopeAccordion,value:o,onItemOpen:u,onItemClose:m,children:(0,ea.jsx)(gX,{scope:e.__scopeAccordion,collapsible:!0,children:(0,ea.jsx)(NX,d(d({},i),{},{ref:s}))})})}),[jX,yX]=dX(lX),NX=t.forwardRef((e,s)=>{const{__scopeAccordion:a,disabled:n,dir:r,orientation:i="vertical"}=e,o=l(e,eX),c=fr(t.useRef(null),s),u=oX(a),m="ltr"===Qr(r),h=xr(e.onKeyDown,e=>{var t;if(!rX.includes(e.key))return;const s=e.target,a=u().filter(e=>{var t;return!(null!==(t=e.ref.current)&&void 0!==t&&t.disabled)}),n=a.findIndex(e=>e.ref.current===s),l=a.length;if(-1===n)return;e.preventDefault();let r=n;const o=l-1,c=()=>{r=n+1,r>o&&(r=0)},d=()=>
2{r=n-1,r<0&&(r=o)};switch(e.key){case"Home":r=0;break;case"End":r=o;break;case"ArrowRight":"horizontal"===i&&(m?c():d());break;case"ArrowDown":"vertical"===i&&c();break;case"ArrowLeft":"horizontal"===i&&(m?d():c());break;case"ArrowUp":"vertical"===i&&d()}null===(t=a[r%l].ref.current)||void 0===t||t.focus()});return(0,ea.jsx)(jX,{scope:a,disabled:n,direction:r,orientation:i,children:(0,ea.jsx)(iX.Slot,{scope:a,children:(0,ea.jsx)(Tr.div,d(d({},o),{},{"data-orientation":i,ref:c,onKeyDown:n?void 0:h}))})})}),wX="AccordionItem",[CX,kX]=dX(wX),DX=t.forwardRef((e,t)=>{const{__scopeAccordion:s,value:a}=e,n=l(e,tX),r=yX(wX,s),i=pX(wX,s),o=mX(s),c=ki(),u=a&&i.value.includes(a)||!1,m=r.disabled||e.disabled;return(0,ea.jsx)(CX,{scope:s,open:u,disabled:m,triggerId:c,children:(0,ea.jsx)(NY,d(d(d({"data-orientation":r.orientation,"data-state":zX(u)},o),n),{},{ref:t,disabled:m,open:u,onOpenChange:e=>{e?i.onItemOpen(a):i.onItemClose(a)}}))})});DX.displayName=wX;var _X="AccordionHeader",SX=t.forwardRef((e,t)=>{const{__scopeAccordion:s}=e,a=l(e,sX),n=yX(lX,s),r=kX(_X,s);return(0,ea.jsx)(Tr.h3,d(d({"data-orientation":n.orientation,"data-state":zX(r.open),"data-disabled":r.disabled?"":void 0},a),{},{ref:t}))});SX.displayName=_X;var EX="AccordionTrigger",AX=t.forwardRef((e,t)=>{const{__scopeAccordion:s}=e,a=l(e,aX),n=yX(lX,s),r=kX(EX,s),i=fX(EX,s),o=mX(s);return(0,ea.jsx)(iX.ItemSlot,{scope:s,children:(0,ea.jsx)(wY,d(d(d({"aria-disabled":r.open&&!i.collapsible||void 0,"data-orientation":n.orientation,id:r.triggerId},o),a),{},{ref:t}))})});AX.displayName=EX;var FX="AccordionContent",TX=t.forwardRef((e,t)=>{const{__scopeAccordion:s}=e,a=l(e,nX),n=yX(lX,s),r=kX(FX,s),i=mX(s);return(0,ea.jsx)(CY,d(d(d({role:"region","aria-labelledby":r.triggerId,"data-orientation":n.orientation},i),a),{},{ref:t,style:d({"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)"},e.style)}))});function zX(e){return e?"open":"closed"}TX.displayName=FX;var MX=DX,PX=SX,BX=AX,RX=TX;const LX=["className"],IX=["className","children"],OX=["className","children"],UX=hX,HX=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,LX);return(0,ea.jsx)(MX,d({ref:t,className:Np("border-b",s)},a))});HX.displayName="AccordionItem";const WX=t.forwardRef((e,t)=>{let{className:s,children:a}=e,n=l(e,IX);return(0,ea.jsx)(PX,{className:"flex",children:(0,ea.jsxs)(BX,d(d({ref:t,className:Np("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",s)},n),{},{children:[a,(0,ea.jsx)(tr,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]}))})});WX.displayName=BX.displayName;const VX=t.forwardRef((e,t)=>{let{className:s,children:a}=e,n=l(e,OX);return(0,ea.jsx)(RX,d(d({ref:t,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"},n),{},{children:(0,ea.jsx)("div",{className:Np("pb-4 pt-0",s),children:a})}))});VX.displayName=RX.displayName;const qX=e=>{let{onClose:s}=e;const[a,n]=(0,t.useState)(0),[l,r]=(0,t.useState)(null),[i,o]=(0,t.useState)(!0),c=be(),d=ge(),u=[{title:"Welcome to NexusCMS!",description:"Let's take a quick tour of the platform. This interactive guide will show you the key features and how to use them.",target:null,position:"center",route:"/dashboard"},{title:"The Sidebar",description:"This is your main navigation. Access all features from here including Pages, Newsletters, Media Library, and Settings.",target:'[data-testid="sidebar"]',position:"right",route:"/dashboard"},{title:"Dashboard Overview",description:"Your dashboard shows key statistics and recent activity. Quick access to your pages, newsletters, and team.",target:null,position:"center",route:"/dashboard"},{title:"Create New Content",description:"Use these buttons to quickly create new pages or newsletters. You can also access these from the sidebar.",target:null,position:"center",route:"/dashboard"},{title:"Pages Section",description:"Here you can create and manage all your web pages. Use the block editor to build beautiful content.",target:null,position:"center",route:"/pages"},{title:"Newsletters",description:"Create email newsletters, manage subscribers, and track analytics. Send beautiful emails to your audience.",target:null,position:"center",route:"/newsletters"},{title:"Media Library",description:"Upload and manage all your images and files. Easily insert them into pages and newsletters.",target:null,position:"center",route:"/media"},{title:"Settings",description:"Configure your account, branding, and preferences. Customize NexusCMS to match your needs.",target:null,position:"center",route:"/settings"},{title:"Security Settings",description:"Enable Two-Factor Authentication and review audit logs to keep your account secure.",target:null,position:"center",route:"/security-settings"},{title:"Tour Complete!",description:"You're all set! Explore the platform and start creating amazing content. Visit Help & Tutorials anytime for more guidance.",target:null,position:"center",route:"/dashboard"}];(0,t.useEffect)(()=>{const e=u[a];e.route&&d.pathname!==e.route&&c(e.route);const t=setTimeout(()=>{if(e.target){const t=document.querySelector(e.target);t&&(r(t),t.scrollIntoView({behavior:"smooth",block:"center"}))}else r(null)},300);return()=>clearTimeout(t)},[a,c,d.pathname]);const m=u[a],h=a===u.length-1,x=0===a;return(0,ea.jsxs)("div",{className:"fixed inset-0 z-[9999]",children:[(0,ea.jsx)("div",{className:"absolute inset-0 bg-black/60",onClick:s}),l&&(0,ea.jsx)("div",{className:"absolute border-4 border-indigo-500 rounded-lg pointer-events-none animate-pulse",style:{to
2p:l.getBoundingClientRect().top-8,left:l.getBoundingClientRect().left-8,width:l.getBoundingClientRect().width+16,height:l.getBoundingClientRect().height+16,boxShadow:"0 0 0 9999px rgba(0,0,0,0.5)"}}),(0,ea.jsxs)("div",{className:"absolute bg-white rounded-xl shadow-2xl p-6 max-w-md z-10",style:(()=>{if("center"===m.position||!l)return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};const e=l.getBoundingClientRect();switch(m.position){case"right":return{top:"".concat(e.top+e.height/2,"px"),left:"".concat(e.right+20,"px"),transform:"translateY(-50%)"};case"bottom":return{top:"".concat(e.bottom+20,"px"),left:"".concat(e.left+e.width/2,"px"),transform:"translateX(-50%)"};case"left":return{top:"".concat(e.top+e.height/2,"px"),right:"".concat(window.innerWidth-e.left+20,"px"),transform:"translateY(-50%)"};case"top":return{bottom:"".concat(window.innerHeight-e.top+20,"px"),left:"".concat(e.left+e.width/2,"px"),transform:"translateX(-50%)"};default:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}})(),children:[(0,ea.jsx)("button",{onClick:s,className:"absolute top-3 right-3 text-slate-400 hover:text-slate-600",children:(0,ea.jsx)(sr,{size:20})}),(0,ea.jsx)("div",{className:"flex gap-1.5 mb-4",children:u.map((e,t)=>(0,ea.jsx)("div",{className:"h-1.5 rounded-full transition-all ".concat(t===a?"w-6 bg-indigo-600":t<a?"w-1.5 bg-indigo-400":"w-1.5 bg-slate-200")},t))}),(0,ea.jsxs)("div",{className:"mb-6",children:[h&&(0,ea.jsx)("div",{className:"w-16 h-16 rounded-full bg-emerald-100 flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(cr,{className:"text-emerald-600",size:32})}),(0,ea.jsx)("h3",{className:"text-xl font-bold mb-2",style:{fontFamily:"Manrope, sans-serif"},children:m.title}),(0,ea.jsx)("p",{className:"text-slate-600",children:m.description})]}),(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("div",{className:"text-sm text-slate-500",children:["Step ",a+1," of ",u.length]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[!x&&(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{a>0&&n(a-1)},children:[(0,ea.jsx)(vj,{size:16,className:"mr-1"}),"Back"]}),(0,ea.jsx)(sg,{size:"sm",onClick:()=>{a<u.length-1?n(a+1):s()},children:h?"Finish Tour":(0,ea.jsxs)(ea.Fragment,{children:["Next",(0,ea.jsx)(ax,{size:16,className:"ml-1"})]})})]})]})]})]})},$X="".concat("","/api"),GX=()=>{const[e,s]=(0,t.useState)("getting-started"),[a,n]=(0,t.useState)(""),[l,r]=(0,t.useState)(!1),[i,o]=(0,t.useState)(""),[c,u]=(0,t.useState)(""),[m,h]=(0,t.useState)(null),[x,p]=(0,t.useState)({}),[g,f]=(0,t.useState)(null),[v,b]=(0,t.useState)(!1),[j,y]=(0,t.useState)([]),[N,w]=(0,t.useState)({}),[C,k]=(0,t.useState)("videos"),[D,_]=(0,t.useState)(!1),S="master_admin"===i||"master_admin"===c;(0,t.useEffect)(()=>{const e=localStorage.getItem("token");if(!e)return;const t={Authorization:"Bearer ".concat(e)};kl.get("".concat($X,"/auth/me"),{headers:t}).then(e=>{var t,s,a,n;o((null===(t=e.data)||void 0===t?void 0:t.role)||""),u((null===(s=e.data)||void 0===s?void 0:s.impersonator_role)||""),console.log("[Help] logged-in role =",null===(a=e.data)||void 0===a?void 0:a.role,"| impersonator_role =",null===(n=e.data)||void 0===n?void 0:n.impersonator_role)}).catch(()=>{}),kl.get("".concat($X,"/help/content"),{headers:t}).then(e=>{var t,s;h(Array.isArray(null===(t=e.data)||void 0===t?void 0:t.videos)?e.data.videos:[]),p(null!==(s=e.data)&&void 0!==s&&s.tutorials&&"object"===typeof e.data.tutorials?e.data.tutorials:{})}).catch(()=>h([]))},[]);const E=()=>{y((m||[]).map(e=>d({},e)));const e={};Object.entries(z).forEach(t=>{let[s,a]=t;const n=(null===x||void 0===x?void 0:x[s])||{};e[s]={title:n.title||a.title,description:n.description||a.description,sections:(n.sections||a.sections||[]).map(e=>({title:e.title||"",content:e.content||""}))}}),w(e),k("videos"),b(!0)},A=(e,t)=>{y(s=>s.map((s,a)=>a===e?d(d({},s),t):s))},F=(e,t)=>{w(s=>d(d({},s),{},{[e]:d(d({},s[e]||{}),t)}))},T=(e,t,s)=>{w(a=>{const n=d({},a[e]||{}),l=(n.sections||[]).map((e,a)=>a===t?d(d({},e),s):e);return d(d({},a),{},{[e]:d(d({},n),{},{sections:l})})})},z={"getting-started":{title:"Getting Started",icon:Mj,color:"indigo",description:"Learn the basics of NexusCMS and get up and running quickly.",videoUrl:"",sections:[{title:"Welcome to NexusCMS",content:"NexusCMS is a powerful multi-tenant content management system designed for creating websites, managing newsletters, and engaging with your audience.\n\n**Key Features:**\n\u2022 Create and manage web pages with a visual editor\n\u2022 Design and send beautiful newsletters\n\u2022 Manage your media library\n\u2022 Invite team members and manage permissions\n\u2022 Customize your site theme and branding\n\u2022 Track analytics and engagement"},{title:"Your First Steps",content:'**Step 1: Explore the Dashboard**\nThe dashboard gives you an overview of your content, including pages, newsletters, and team activity.\n\n**Step 2: Create Your First Page**\nGo to Pages \u2192 Click "New Page" \u2192 Add your content using the block editor.\n\n**Step 3: Set Up Your Theme**\nVisit Site Theme to customize colors, fonts, and branding.\n\n**Step 4: Invite Your Team**\nAdd team members under the Team section to collaborate.'},{title:"Understanding the Interface",content:"**Sidebar Navigation:**\n\u2022 Dashboard - Overview and quick stats\n\u2022 Pages - Create and manage web pages\n\u2022 Newsletters - Email campaigns and subscribers\n\u2022 Media Library - Upload and organize files\n\u2022 Team - Manage team members\n\u2022 Settings - Account and preferences\n\n**Quick Actions:**\nUse the buttons in the top-right of most pages for quick access to common tasks like creating new content."}]},pages:{title:"Pages & Content",icon:qN,color:"blue",description:"Learn how to create, edit, and publish web pages.",videoUrl:"",sections:[{title:"Creating a New Page",content:'**To create a new page:**\n1. Navigate to Pages from the sidebar\n2. Click the "New Page" button\n3. Enter a title for your page\n4. Use the block editor to add content\n5. Click "Save" to save as draft or "Publish" to make it live\n\n**Page Settings:**\n\u2022 Title - The page title shown in browsers\n\u2022 Slug - The URL path for the page\
2n\u2022 Status - Draft or Published'},{title:"Using the Block Editor",content:"**Available Blocks:**\n\u2022 Text Block - Rich text content with formatting\n\u2022 Image Block - Upload or select images\n\u2022 Video Block - Embed videos from URLs\n\u2022 Button Block - Add call-to-action buttons\n\u2022 Spacer Block - Add vertical spacing\n\u2022 Divider Block - Add horizontal lines\n\n**Tips:**\n\u2022 Drag blocks to reorder them\n\u2022 Click on a block to edit its content\n\u2022 Use the delete icon to remove blocks"},{title:"Publishing & Preview",content:'**Preview Mode:**\nClick the "Preview" button to see how your page will look to visitors.\n\n**Publishing:**\n1. Make sure all content is complete\n2. Click "Publish" to make the page live\n3. Published pages are accessible via their URL slug\n\n**Unpublishing:**\nChange the status back to "Draft" to hide a page from visitors.'}]},newsletters:{title:"Newsletters",icon:Yl,color:"emerald",description:"Create and send email newsletters to your subscribers.",videoUrl:"",sections:[{title:"Creating a Newsletter",content:'**To create a newsletter:**\n1. Go to Newsletters from the sidebar\n2. Click "New Newsletter"\n3. Enter a subject line\n4. Use the editor to design your content\n5. Preview before sending\n\n**Newsletter Editor:**\nThe newsletter editor works similarly to the page editor, with blocks optimized for email.'},{title:"Managing Subscribers",content:"**Adding Subscribers:**\n\u2022 Individual: Add subscribers one by one\n\u2022 Bulk Import: Upload a CSV file with email addresses\n\u2022 Forms: Use embedded forms to collect signups\n\n**Subscriber Groups:**\nOrganize subscribers into groups for targeted campaigns.\n\n**Managing Preferences:**\nSubscribers can update their preferences or unsubscribe via links in your emails."},{title:"Sending & Analytics",content:"**Sending Options:**\n\u2022 Send Now - Immediately send to all subscribers\n\u2022 Send Test - Send a test email to yourself first\n\n**Analytics:**\nTrack your newsletter performance:\n\u2022 Open Rate - How many recipients opened the email\n\u2022 Click Rate - Links clicked within the email\n\u2022 Bounces - Emails that couldn't be delivered\n\u2022 Unsubscribes - People who opted out"}]},subscribers:{title:"Subscriber Management",icon:Bj,color:"purple",description:"Manage your newsletter subscribers and groups.",videoUrl:"",sections:[{title:"Adding Subscribers",content:'**Manual Addition:**\n1. Go to Newsletters \u2192 Subscribers tab\n2. Click "Add Subscriber"\n3. Enter email and optional name\n4. Assign to groups if needed\n\n**Bulk Import:**\n1. Prepare a CSV file with columns: email, name (optional)\n2. Click "Import" and upload your file\n3. Review and confirm the import'},{title:"Subscriber Groups",content:'**Creating Groups:**\nGroups help you segment your audience for targeted campaigns.\n\n1. Go to the Groups tab\n2. Click "New Group"\n3. Name your group (e.g., "VIP Customers", "New Signups")\n4. Add subscribers to the group\n\n**Using Groups:**\nWhen sending newsletters, you can choose to send to specific groups instead of all subscribers.'},{title:"Managing Subscriber Data",content:"**Viewing Details:**\nClick on any subscriber to see their full profile, including subscription date and engagement history.\n\n**Editing Subscribers:**\n\u2022 Update email addresses\n\u2022 Change group memberships\n\u2022 Add notes or tags\n\n**Removing Subscribers:**\nDelete subscribers who request removal or mark them as unsubscribed to maintain your list hygiene."}]},forms:{title:"Forms & Articles",icon:yw,color:"amber",description:"Create forms and write articles for your site.",videoUrl:"",sections:[{title:"Building Forms",content:'**Creating a Form:**\n1. Navigate to Forms\n2. Click "New Form"\n3. Add fields using the form builder\n4. Configure submission settings\n5. Save and embed on your pages\n\n**Field Types:**\n\u2022 Text Input - Single line text\n\u2022 Text Area - Multi-line text\n\u2022 Email - Email validation included\n\u2022 Number - Numeric input\n\u2022 Dropdown - Select from options\n\u2022 Checkbox - Yes/no options'}
2,{title:"Form Submissions",content:"**Viewing Submissions:**\nAll form submissions are collected and viewable in the Forms section.\n\n**Export Options:**\nDownload submissions as CSV for further analysis.\n\n**Notifications:**\nSet up email notifications to receive alerts when forms are submitted."},{title:"Writing Articles",content:'**Creating Articles:**\n1. Go to Articles\n2. Click "New Article"\n3. Write your content using the rich text editor\n4. Add featured image and tags\n5. Publish when ready\n\n**Article Features:**\n\u2022 Categories and tags for organization\n\u2022 Featured images\n\u2022 SEO-friendly URLs\n\u2022 Draft and publish states'}]},team:{title:"Team Management",icon:Bj,color:"cyan",description:"Invite team members and manage permissions.",videoUrl:"",sections:[{title:"Inviting Team Members",content:'**To invite someone:**\n1. Go to Team from the sidebar\n2. Click "Invite Member"\n3. Enter their email address\n4. Select their role\n5. Send the invitation\n\n**The invitee will receive an email with instructions to join your workspace.**'},{title:"Roles & Permissions",content:"**Available Roles:**\n\n\u2022 **Admin** - Full access to all features\n\u2022 **Editor** - Can create and edit content\n\u2022 **Author** - Can create content but limited editing\n\u2022 **Viewer** - Read-only access\n\n**Note:** Only Admins can invite new members and manage settings."},{title:"Managing Team",content:"**Changing Roles:**\nClick on a team member to change their role or permissions.\n\n**Removing Members:**\nAdmins can remove team members who no longer need access.\n\n**Activity Tracking:**\nView team activity in the audit log (Security Settings) to see who made changes."}]},security:{title:"Security Settings",icon:Kl,color:"red",description:"Secure your account with 2FA and review audit logs.",videoUrl:"",sections:[{title:"Two-Factor Authentication",content:'**Enabling 2FA:**\n1. Go to Security Settings\n2. Click "Enable 2FA"\n3. Scan the QR code with an authenticator app (Google Authenticator, Authy, etc.)\n4. Enter the verification code\n5. Save your backup codes securely\n\n**Why Use 2FA?**\nTwo-factor authentication adds an extra layer of security by requiring a code from your phone in addition to your password.'},{title:"Backup Codes",content:"**About Backup Codes:**\nBackup codes are one-time use codes that let you log in if you lose access to your authenticator app.\n\n**Important:**\n\u2022 Store backup codes in a safe place\n\u2022 Each code can only be used once\n\u2022 Generate new codes if you run out\n\u2022 Never share your backup codes"},{title:"Audit Logs",content:"**What's Tracked:**\n\u2022 Login attempts (successful and failed)\n\u2022 Password changes\n\u2022 2FA setup/removal\n\u2022 Team member changes\n\u2022 Critical settings modifications\n\n**Viewing Logs:**\nGo to Security Settings \u2192 Audit Logs tab to review all security-related activity."}]}},M=Object.fromEntries(Object.entries(z).map(e=>{let[t,s]=e;const a=null===x||void 0===x?void 0:x[t];return a?[t,d(d({},s),{},{title:a.title||s.title,description:a.description||s.description,sections:Array.isArray(a.sections)&&a.sections.length?a.sections:s.sections})]:[t,s]})),P=Object.entries(M).filter(e=>{let[t,s]=e;if(!a)return!0;const n=a.toLowerCase();return s.title.toLowerCase().includes(n)||s.description.toLowerCase().includes(n)||s.sections.some(e=>e.title.toLowerCase().includes(n)||e.content.toLowerCase().includes(n))});return(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,ea.jsx)("div",{className:"mb-8",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(Uj,{className:"text-indigo-600",size:32}),"Help & Tutorials"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-2",children:"Learn how to use NexusCMS with guides, tutorials, and FAQs"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[S&&(0,ea.jsxs)(sg,{onClick:E,variant:"outline",className:"gap-2 border-indigo-200 text-indigo-700 hover:bg-indigo-50","data-testid":"help-master-edit-btn",children:[(0,ea.jsx)(BQ,{size:16}),"Edit Content"]}),(0,ea.jsxs)(sg,{onClick:()=>r(!0),className:"gap-2",children:[(0,ea.jsx)(YQ,{size:18}),"Start Interactive Tour"]})]})]})}),(0,ea.jsxs)("div",{className:"relative mb-8",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400",size:20}),(0,ea.jsx)(BN,{placeholder:"Search tutorials and guides...",value:a,onChange:e=>n(e.target.value),className:"pl-10 bg-white"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[(0,ea.jsxs)("div",{onClick:()=>r(!0),className:"bg-gradient-to-br from-indigo-500 to-purple-600 text-white rounded-xl p-6 cursor-pointer hover:shadow-lg transition-all",children:[(0,ea.jsx)(YQ,{size:32,className:"mb-3"}),(0,ea.jsx)("h3",{className:"font-semibold text-lg",children:"Interactive Tour"}),(0,ea.jsx)("p",{className:"text-indigo-100 text-sm mt-1",children:"Get a guided walkthrough of the platform"})]}),(0,ea.jsxs)("div",{onClick:()=>s("getting-started"),className:"bg-white border border-slate-200 rounded-xl p-6 cursor-pointer hover:shadow-lg transition-all",children:[(0,ea.jsx)(Mj,{size:32,className:"mb-3 text-emerald-600"}),(0,ea.jsx)("h3",{className:"font-semibold text-lg",children:"Getting Started"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"New here? Start with the basics"})]}),(0,ea.jsxs)("div",{onClick:()=>s("video-tutorials"),className:"bg-white border border-slate-200 rounded-xl p-6 cursor-pointer hover:shadow-lg transition-all",children:[(0,ea.jsx)(JQ,{size:32,className:"mb-3 text-red-500"}),(0,ea.jsx)("h3",{className:"font-semibold text-lg",children:"Video Tutorials"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Watch step-by-step video guides"})]})]}),(0,ea.jsxs)(nJ,{value:e,onValueChange:s,children:[(0,ea.jsxs)(lJ,{className:"mb-6 flex-wrap h-auto gap-1",children:[Object.entries(M).map(e=>{let[t,s]=e;const a=s.icon;return(0,ea.jsxs)(rJ,{value:t,className:"gap-2",children:[(0,ea.jsx)(a,{size:16}),s.title]},t)}),(0,ea.jsxs)(rJ,{value:"video-tutorials",className:"gap-2",children:[(0,ea.jsx)(JQ,{size:16}),"Videos"]}),(0,ea.jsxs)(rJ,{value:"faq",className:"gap-2",children:[(0,ea.jsx)(Aw,{size:16}),"FAQ"]})]}),P.map(e=>{let[t,s]=e;const a=s.icon;return(0,ea.jsx)(iJ,{value:t,children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:[(0,ea.jsx)("div",{className:"bg-".concat(s.color,"-50 border-b border-").concat(s.color,"-100 p-6"),
2children:(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-14 h-14 rounded-xl bg-".concat(s.color,"-100 flex items-center justify-center"),children:(0,ea.jsx)(a,{className:"text-".concat(s.color,"-600"),size:28})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h2",{className:"text-2xl font-bold",children:s.title}),(0,ea.jsx)("p",{className:"text-slate-600 mt-1",children:s.description})]})]})}),s.videoUrl&&(0,ea.jsx)("div",{className:"p-6 border-b border-slate-200",children:(0,ea.jsx)("div",{className:"aspect-video bg-slate-900 rounded-lg flex items-center justify-center",children:(0,ea.jsxs)("div",{className:"text-center text-white",children:[(0,ea.jsx)(YQ,{size:48,className:"mx-auto mb-2 opacity-80"}),(0,ea.jsx)("p",{children:"Video Tutorial"})]})})}),(0,ea.jsx)("div",{className:"p-6",children:(0,ea.jsx)(UX,{type:"single",collapsible:!0,className:"w-full",children:s.sections.map((e,t)=>(0,ea.jsxs)(HX,{value:"section-".concat(t),children:[(0,ea.jsx)(WX,{className:"text-left",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-8 h-8 rounded-full bg-slate-100 flex items-center justify-center text-sm font-medium",children:t+1}),(0,ea.jsx)("span",{className:"font-medium",children:e.title})]})}),(0,ea.jsx)(VX,{children:(0,ea.jsx)("div",{className:"pl-11 prose prose-slate max-w-none",children:e.content.split("\n").map((e,t)=>e.startsWith("**")&&e.endsWith("**")?(0,ea.jsx)("h4",{className:"font-semibold text-slate-900 mt-4 mb-2",children:e.replace(/\*\*/g,"")},t):e.startsWith("\u2022 ")?(0,ea.jsx)("li",{className:"text-slate-600 ml-4",children:e.substring(2)},t):""===e.trim()?(0,ea.jsx)("br",{},t):(0,ea.jsx)("p",{className:"text-slate-600 mb-2",children:e},t))})})]},t))})})]})},t)}),(0,ea.jsx)(iJ,{value:"video-tutorials",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ea.jsx)("div",{className:"w-14 h-14 rounded-xl bg-red-100 flex items-center justify-center",children:(0,ea.jsx)(JQ,{className:"text-red-600",size:28})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h2",{className:"text-2xl font-bold",children:"Video Tutorials"}),(0,ea.jsx)("p",{className:"text-slate-600 mt-1",children:"Watch step-by-step video guides"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(m||[]).map((e,t)=>{const s=!!e.url;return(0,ea.jsxs)("div",{onClick:s?()=>f(e):void 0,className:"border border-slate-200 rounded-lg overflow-hidden transition-all ".concat(s?"cursor-pointer hover:shadow-md hover:border-indigo-300":"opacity-80"),"data-testid":"help-video-card-".concat(t),children:[(0,ea.jsxs)("div",{className:"aspect-video bg-slate-900 flex items-center justify-center relative group",children:[(0,ea.jsx)(YQ,{size:48,className:"text-white transition-opacity ".concat(s?"opacity-80 group-hover:opacity-100":"opacity-40")}),e.duration&&(0,ea.jsx)("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-2 py-1 rounded",children:e.duration}),!s&&(0,ea.jsx)("span",{className:"absolute top-2 left-2 bg-amber-500/90 text-white text-[10px] font-semibold px-2 py-0.5 rounded uppercase tracking-wide",children:"Coming soon"})]}),(0,ea.jsxs)("div",{className:"p-4",children:[e.category&&(0,ea.jsx)("span",{className:"text-xs bg-slate-100 text-slate-600 px-2 py-1 rounded",children:e.category}),(0,ea.jsx)("h3",{className:"font-medium mt-2",children:e.title})]})]},e.id||t)}),m&&0===m.length&&(0,ea.jsxs)("div",{className:"col-span-2 p-8 text-center text-slate-500 border-2 border-dashed border-slate-200 rounded-lg",children:["No videos yet.",S&&(0,ea.jsx)("div",{className:"mt-2",children:(0,ea.jsxs)(sg,{size:"sm",onClick:E,"data-testid":"help-videos-add-first",children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add your first video"]})})]})]})]})}),(0,ea.jsx)(iJ,{value:"faq",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ea.jsx)("div",{className:"w-14 h-14 roun
2ded-xl bg-amber-100 flex items-center justify-center",children:(0,ea.jsx)(Aw,{className:"text-amber-600",size:28})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h2",{className:"text-2xl font-bold",children:"Frequently Asked Questions"}),(0,ea.jsx)("p",{className:"text-slate-600 mt-1",children:"Quick answers to common questions"})]})]}),(0,ea.jsx)(UX,{type:"single",collapsible:!0,className:"w-full",children:[{question:"How do I reset my password?",answer:'Go to Settings \u2192 Account and click "Change Password". You\'ll need to enter your current password and then your new password twice to confirm.'},{question:"Can I use my own domain?",answer:"Yes! Go to Custom Domain settings (available for Admin users) to configure your own domain. You'll need to update your DNS settings to point to our servers."},{question:"How many team members can I add?",answer:"The number of team members depends on your plan. Free plans allow up to 3 members, Starter allows 10, Pro allows 25, and Enterprise has unlimited team members."},{question:"Is my data secure?",answer:"Yes! We use AES-256 encryption for data at rest, TLS 1.3 for data in transit, and offer Two-Factor Authentication. We're GDPR compliant and follow industry best practices."},{question:"How do I export my data?",answer:"You can export pages as HTML, subscribers as CSV, and form submissions as CSV. Go to each respective section and look for the Export option."},{question:"What email providers do you support for newsletters?",answer:"We use SendGrid for reliable email delivery. Your newsletters will be sent from your configured sender address with proper authentication (SPF, DKIM)."}].map((e,t)=>(0,ea.jsxs)(HX,{value:"faq-".concat(t),children:[(0,ea.jsx)(WX,{className:"text-left",children:(0,ea.jsx)("span",{className:"font-medium",children:e.question})}),(0,ea.jsx)(VX,{children:(0,ea.jsx)("p",{className:"text-slate-600",children:e.answer})})]},t))}),(0,ea.jsx)("div",{className:"mt-6 p-4 bg-indigo-50 rounded-lg border border-indigo-200",children:(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)(Aw,{className:"text-indigo-500 flex-shrink-0 mt-0.5",size:20}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-indigo-900",children:"Still have questions?"}),(0,ea.jsxs)("p",{className:"text-sm text-indigo-700 mt-1",children:["Contact our support team at ",(0,ea.jsx)("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"})]})]})]})})]})})]})]})}),l&&(0,ea.jsx)(qX,{onClose:()=>r(!1)}),(0,ea.jsx)(Ok,{open:!!g,onOpenChange:e=>!e&&f(null),children:(0,ea.jsxs)(Wk,{className:"max-w-4xl p-0 overflow-hidden bg-black",children:[(0,ea.jsx)(Vk,{className:"p-4 bg-slate-900 text-white flex-row items-center justify-between space-y-0",children:(0,ea.jsx)($k,{className:"text-white text-base",children:null===g||void 0===g?void 0:g.title})}),g&&(0,ea.jsx)("div",{className:"aspect-video bg-black",children:(B=g.url,/\.(mp4|webm|ogg)(\?|#|$)/i.test(B||"")?(0,ea.jsx)("video",{src:g.url,controls:!0,autoPlay:!0,className:"w-full h-full","data-testid":"help-video-player"}):(0,ea.jsx)("iframe",{src:(e=>{if(!e)return"";try{const t=new URL(e);if(t.hostname.includes("youtube.com")){const e=t.searchParams.get("v");if(e)return"https://www.youtube.com/embed/".concat(e,"?autoplay=1")}if("youtu.be"===t.hostname)return"https://www.youtube.com/embed".concat(t.pathname,"?autoplay=1");if(t.hostname.includes("vimeo.com")){const e=t.pathname.match(/(\d+)/);if(e)return"https://player.vimeo.com/video/".concat(e[1],"?autoplay=1")}return t.hostname.includes("loom.com")&&t.pathname.includes("/share/")?e.replace("/share/","/embed/"):e}catch(t){return e}})(g.url),title:g.title,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"w-full h-full","data-testid":"help-video-iframe"}))})]})}),(0,ea.jsx)(Ok,{open:v,onOpenChange:b,children:(0,ea.jsxs)(Wk,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(BQ,{size:18,className:"text-indigo-600"}),"Edit Help & Tutorials Content"]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Master Admin only. Update Videos and Articles for the platform's Help & Tutorials page."})]}),(0,ea.jsxs)(nJ,{value:C,onValueChange:k,className:"mt-3",children:[(0,ea.jsxs)(lJ,{className:"grid w-full grid-cols-2",children:[(0,ea.jsxs)(rJ,{value:"videos","data-testid":"editor-tab-videos",children:[(0,ea.jsx)(JQ,{size:14,className:"mr-2"})," Videos (",j.length,")"]}),(0,ea.jsxs)(rJ,{value:"articles","data-testid":"editor-tab-articles",children:[(0,ea.jsx)(qN,{size:14,className:"mr-2"})," Articles (",Object.keys(N).length,")"]})]}),(0,ea.jsxs)(iJ,{value:"videos",className:"space-y-3 mt-4",children:[j.map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-3 space-y-2 bg-slate-50","data-testid":"help-video-edit-row-".concat(t),children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("span",{className:"text-xs font-semibold text-slate-500",children:["Video #",t+1
2]}),(0,ea.jsx)("button",{onClick:()=>(e=>{y(t=>t.filter((t,s)=>s!==e))})(t),className:"text-slate-400 hover:text-red-500 p-1","data-testid":"help-video-delete-".concat(t),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{placeholder:"Title",value:e.title||"",onChange:e=>A(t,{title:e.target.value}),"data-testid":"help-video-title-".concat(t)}),(0,ea.jsx)(BN,{placeholder:"Video URL (YouTube / Vimeo / Loom / .mp4)",value:e.url||"",onChange:e=>A(t,{url:e.target.value}),"data-testid":"help-video-url-".concat(t)}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{placeholder:"Duration (e.g. 5:30)",value:e.duration||"",onChange:e=>A(t,{duration:e.target.value}),"data-testid":"help-video-duration-".concat(t)}),(0,ea.jsx)(BN,{placeholder:"Category (e.g. Pages)",value:e.category||"",onChange:e=>A(t,{category:e.target.value}),"data-testid":"help-video-category-".concat(t)})]})]},e.id||t)),(0,ea.jsxs)(sg,{onClick:()=>{y(e=>[...e,{id:"v".concat(Date.now()),title:"New Video",url:"",duration:"",category:""}])},variant:"outline",className:"w-full gap-2","data-testid":"help-video-add",children:[(0,ea.jsx)(Vj,{size:16}),"Add Video"]})]}),(0,ea.jsxs)(iJ,{value:"articles",className:"space-y-4 mt-4",children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Formatting: use ",(0,ea.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:"**bold**"})," for bold text and lines starting with ",(0,ea.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:"\u2022 "})," for bullet points. Blank lines separate paragraphs. Icons and colours are set in code and stay as they are."]}),(0,ea.jsx)(UX,{type:"multiple",className:"space-y-2",children:Object.entries(N).map(e=>{let[t,s]=e;return(0,ea.jsxs)(HX,{value:t,className:"border border-slate-200 rounded-lg bg-slate-50 px-3",children:[(0,ea.jsx)(WX,{className:"hover:no-underline py-3","data-testid":"article-topic-".concat(t),children:(0,ea.jsx)("span",{className:"text-sm font-semibold",children:s.title||t})}),(0,ea.jsxs)(VX,{className:"space-y-3 pb-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)("label",{className:"text-xs font-semibold text-slate-600",children:"Topic Title"}),(0,ea.jsx)(BN,{value:s.title||"",onChange:e=>F(t,{title:e.target.value}),"data-testid":"article-topic-title-".concat(t)})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)("label",{className:"text-xs font-semibold text-slate-600",children:"Topic Description"}),(0,ea.jsx)(BN,{value:s.description||"",onChange:e=>F(t,{description:e.target.value}),"data-testid":"article-topic-desc-".concat(t)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("label",{className:"text-xs font-semibold text-slate-600",children:"Sections"}),(s.sections||[]).map((e,s)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-md p-2 bg-white space-y-2","data-testid":"article-section-".concat(t,"-").concat(s),children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("span",{className:"text-xs font-medium text-slate-500",children:["Section #",s+1]}),(0,ea.jsx)("button",{onClick:()=>((e,t)=>{w(s=>{const a=d({},s[e]||{}),n=(a.sections||[]).filter((e,s)=>s!==t);return d(d({},s),{},{[e]:d(d({},a),{},{sections:n})})})})(t,s),className:"text-slate-400 hover:text-red-500 p-1","data-testid":"article-section-delete-".concat(t,"-").concat(s),children:(0,ea.jsx)(wD,{size:12})})]}),(0,ea.jsx)(BN,{placeholder:"Section title",value:e.title||"",onChange:e=>T(t,s,{title:e.target.value}),"data-testid":"article-section-title-".concat(t,"-").concat(s)}),(0,ea.jsx)("textarea",{placeholder:"Section body \u2014 use **bold** and \u2022 bullets",value:e.content||"",onChange:e=>T(t,s,{content:e.target.value}),rows:8,className:"w-full text-sm rounded-md border border-slate-200 p-2 font-mono resize-y","data-testid":"article-section-content-".concat(t,"-").concat(s)})]},s)),(0,ea.jsxs)(sg,{onClick:()=>(e=>{w(t=>{const s=d({},t[e]||{}),a=[...s.sections||[],{title:"New Section",content:""}];return d(d({},t),{},{[e]:d(d({},s),{},{sections:a})})})})(t),variant:"outline",size:"sm",className:"gap-1","data-testid":"article-section-add-".concat(t),children:[(0,ea.jsx)(Vj,{size:14})," Add Section"]})]})]})]},t)})})]})]}),(0,ea.jsxs)(qk,{className:"mt-4 gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>b(!1),"data-testid":"help-editor-cancel",children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:async()=>{_(!0);try{var e,t;const s=localStorage.getItem("token"),a={videos:j,tutorials:N},n=await kl.put("".concat($X,"/help/content"),a,{headers:{Authorization:"Bearer ".concat(s)}});h(Array.isArray(null===(e=n.data)||void 0===e?void 0:e.videos)?n.data.videos:j),p(null!==(t=n.data)&&void 0!==t&&t.tutorials&&"object"===typeof n.data.tutorials?n.data.tutorials:N),b(!1),qs.success("Help & Tutorials updated")}catch(G2){var s,a;qs.error((null===G2||void 0===G2||null===(s=G2.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Failed to save. Master Admin only.")}finally{_(!1)}},disabled:D,className:"gap-2","data-testid":"help-editor-save",children:[(0,ea.jsx)(BD,{size:16}),D?"Saving\u2026":"Save Changes"]})]})]})})]});var B},KX=Vl("layout-list",[["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"}]]),YX=Vl("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),JX=Vl("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"}]]),QX={randomUUID:"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let XX;const ZX=new Uint8Array(16);const eZ=[];for(let s=0;s<256;++s)eZ.push((s+256).toString(16).slice(1));function tZ(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(eZ[e[t+0]]+eZ[e[t+1]]+eZ[e[t+2]]+eZ[e[t+3]]+"-"+eZ[e[t+4]]+eZ[e[t+5]]+"-"+eZ[e[t+6]]+eZ[e[t+7]]+"-"+eZ[e[t+8]]+eZ[e[t+9]]+"-"+eZ[e[t+10]]+eZ[e[t+11]]+eZ[e[t+12]]+eZ[e[t+13]]+eZ[e[t+14]]+eZ[e[t+15]]).toLowerCase()}function sZ(e,t,s){var a,n,l,r;const i=null!==(a=null!==(n=(e=e||{}).random)&&void 0!==n?n:null===(l=(r=e).rng)||void 0===l?void 0:l.call(r))&&void 0!==a?a:function(){if(!XX){if("undefined"===typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");XX=crypto.getRandomValues.bind(crypto)}return XX(ZX)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");
2if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){if((s=s||0)<0||s+16>t.length)throw new RangeError("UUID byte range ".concat(s,":").concat(s+15," is out of buffer bounds"));for(let e=0;e<16;++e)t[s+e]=i[e];return t}return tZ(i)}const aZ=function(e,t,s){return!QX.randomUUID||t||e?sZ(e,t,s):QX.randomUUID()},nZ=e=>{let{menu:s,pages:a,anchors:n=[],onUpdate:l}=e;const[r,i]=(0,t.useState)({}),[o,c]=(0,t.useState)(null),u=e=>{i(t=>d(d({},t),{},{[e]:!t[e]}))},m=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={item_id:aZ(),label:"New Item",link_type:"internal",link_value:"",target:"_self",order:t?t.length:(null===(e=s.items)||void 0===e?void 0:e.length)||0,children:[]};let r;r=0===a.length?[...s.items||[],n]:h([...s.items||[]],a,n),l(d(d({},s),{},{items:r})),c(n.item_id)},h=(e,t,s)=>0===t.length?[...e,s]:e.map(e=>e.item_id===t[0]?1===t.length?d(d({},e),{},{children:[...e.children||[],s]}):d(d({},e),{},{children:h(e.children||[],t.slice(1),s)}):e),x=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.items;const n=a.map(s=>{var a;return s.item_id===e?d(d({},s),t):(null===(a=s.children)||void 0===a?void 0:a.length)>0?d(d({},s),{},{children:x(e,t,s.children)}):s});return a===s.items&&l(d(d({},s),{},{items:n})),n},p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.items;const a=t.filter(t=>t.item_id!==e).map(t=>d(d({},t),{},{children:t.children?p(e,t.children):[]}));return t===s.items&&l(d(d({},s),{},{items:a})),a},g=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.items,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r=a.findIndex(t=>t.item_id===e);if(-1===r){const r=a.map(s=>{var n;return(null===(n=s.children)||void 0===n?void 0:n.length)>0?d(d({},s),{},{children:g(e,t,s.children,a)}):s});return null===n&&l(d(d({},s),{},{items:r})),r}const i="up"===t?r-1:r+1;if(i<0||i>=a.length)return a;const o=[...a];return[o[r],o[i]]=[o[i],o[r]],o.forEach((e,t)=>{e.order=t}),null===n&&l(d(d({},s),{},{items:o})),o},f=function(e){var t,s,l,i;let d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const v=r[e.item_id],b=(null===(t=e.children)||void 0===t?void 0:t.length)>0,j=o===e.item_id,y=h<2;return(0,ea.jsxs)("div",{className:"mb-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-3 rounded-lg border ".concat(j?"border-indigo-300 bg-indigo-50":"border-slate-200 bg-white hover:bg-slate-50"),style:{marginLeft:24*h},children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1 text-slate-400",children:[(0,ea.jsx)(yE,{size:16,className:"cursor-grab"}),(0,ea.jsxs)("div",{className:"flex flex-col",children:[(0,ea.jsx)("button",{onClick:()=>g(e.item_id,"up"),className:"hover:text-slate-600 p-0.5",children:(0,ea.jsx)(bG,{size:12})}),(0,ea.jsx)("button",{onClick:()=>g(e.item_id,"down"),className:"hover:text-slate-600 p-0.5",children:(0,ea.jsx)(jG,{size:12})})]})]}),b&&(0,ea.jsx)("button",{onClick:()=>u(e.item_id),className:"p-1 hover:bg-slate-200 rounded",children:v?(0,ea.jsx)(tr,{size:16}):(0,ea.jsx)(ax,{size:16})}),(0,ea.jsx)("div",{className:"flex-1 min-w-0",children:j?(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Label"}),(0,ea.jsx)(BN,{value:e.label,onChange:t=>x(e.item_id,{label:t.target.value}),placeholder:"Menu item label",className:"h-8"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Link Type"}),(0,ea.jsxs)(eb,{value:e.link_type,onValueChange:t=>x(e.item_id,{link_type:t,link_value:""}),children:[(0,ea.jsx)(sb,{className:"h-8",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"internal",children:(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(qN,{size:14})," Internal Page"]})}),(0,ea.jsx)(rb,{value:"external",children:(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(bj,{size:14})," External URL"]})}),(0,ea.jsx)(rb,{value:"anchor",children:(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Tq,{size:14})," Anchor Link"]})})]})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"internal"===e.link_type?"Select Page":"anch
2or"===e.link_type?"Anchor ID":"External URL"}),"internal"===e.link_type?(0,ea.jsxs)(eb,{value:e.link_value,onValueChange:t=>x(e.item_id,{link_value:t}),children:[(0,ea.jsx)(sb,{className:"h-8",children:(0,ea.jsx)(tb,{placeholder:"Select a page"})}),(0,ea.jsx)(lb,{children:a.map(e=>(0,ea.jsx)(rb,{value:e.page_id,children:e.title||e.slug},e.page_id))})]}):"anchor"===e.link_type?(0,ea.jsxs)("div",{className:"space-y-2",children:[n.length>0?(0,ea.jsxs)(eb,{value:(null===(s=e.link_value)||void 0===s?void 0:s.replace(/^#/,"").replace(/^[^#]*#/,""))||"",onValueChange:t=>{const s=n.find(e=>e.id===t),a=null!==s&&void 0!==s&&s.pageSlug?"".concat(s.pageSlug,"#").concat(t):t;x(e.item_id,{link_value:a})},children:[(0,ea.jsx)(sb,{className:"h-8",children:(0,ea.jsx)(tb,{placeholder:"Select an anchor"})}),(0,ea.jsx)(lb,{children:n.map((e,t)=>(0,ea.jsx)(rb,{value:e.id,children:(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Tq,{size:14,className:"text-indigo-500"}),(0,ea.jsx)("span",{className:"truncate max-w-[150px]",children:e.name}),(0,ea.jsxs)("span",{className:"text-slate-400 text-xs",children:["#",e.id]}),e.source&&(0,ea.jsxs)("span",{className:"text-indigo-400 text-[10px] ml-1",children:["(",e.source,")"]})]})},"".concat(e.id,"-").concat(t)))})]}):(0,ea.jsxs)("div",{className:"flex",children:[(0,ea.jsx)("span",{className:"inline-flex items-center px-3 text-sm text-slate-500 bg-slate-100 border border-r-0 border-slate-300 rounded-l-md",children:"#"}),(0,ea.jsx)(BN,{value:(null===(l=e.link_value)||void 0===l?void 0:l.replace(/^#/,""))||"",onChange:t=>x(e.item_id,{link_value:t.target.value.replace(/^#/,"")}),placeholder:"page-slug#section-id or just section-id",className:"h-8 rounded-l-none"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:n.length>0?"Select a section to link to. The link will include the page so it works from any page.":'Enter "page-slug#section-id" to link to a specific page, or just "section-id" for current page'})]}):(0,ea.jsx)(BN,{value:e.link_value,onChange:t=>x(e.item_id,{link_value:t.target.value}),placeholder:"https://example.com",className:"h-8"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Open in"}),(0,ea.jsxs)(eb,{value:e.target,onValueChange:t=>x(e.item_id,{target:t}),children:[(0,ea.jsx)(sb,{className:"h-8",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"_self",children:"Same Tab"}),(0,ea.jsx)(rb,{value:"_blank",children:"New Tab"})]})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 p-2.5 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsx)(wb,{checked:e.is_button||!1,onCheckedChange:t=>x(e.item_id,{is_button:t}),"data-testid":"nav-item-button-toggle-".concat(e.item_id)}),(0,ea.jsx)(tf,{className:"text-xs font-medium cursor-pointer",children:"Display as Button"})]}),e.is_button&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3 p-2.5 bg-indigo-50 rounded-lg border border-indigo-200",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button Style"}),(0,ea.jsxs)(eb,{value:e.button_style||"solid",onValueChange:t=>x(e.item_id,{button_style:t}),children:[(0,ea.jsx)(sb,{className:"h-8",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid (filled)"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline (bordered)"}),(0,ea.jsx)(rb,{value:"ghost",children:"Ghost (subtle)"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Corner Radius"}),(0,ea.jsxs)(eb,{value:e.button_border_radius||"rounded",onValueChange:t=>x(e.item_id,{button_border_radius:t}),children:[(0,ea.jsx)(sb,{className:"h-8",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"square",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-1",children:[(0,ea.jsx)("input",{type:"color",value:e.button_bg_color||"#4f46e5",onChange:t=>x(e.item_id,{button_bg_color:t.target.value}),className:"w-8 h-8 rounded cursor-pointer border border-slate-300"}),(0,ea.jsx)(BN,{value:e.button_bg_color||"",onChange:t=>x(e.item_id,{button_bg_color:t.target.value}),placeholder:"Accent color",className:"h-8 text-xs"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-1",children:[(0,ea.jsx)("input",{type:"color",value:e.button_text_color||"#ffffff",onChange:t=>x(e.item_id,{button_text_color:t.target.value}),className:"w-8 h-8 rounded cursor-pointer border border-slate-300"}),(0,ea.jsx)(BN,{value:e.button_text_color||"",onChange:t=>x(e.item_id,{button_text_color:t.target.value}),placeholder:"#ffffff",className:"h-8 text-xs"})]})]})]}),(0,ea.jsx)("div",{className:"flex justify-end",children:(0,ea.jsx)(sg,{size:"sm",onClick:()=>c(null),children:"Done"})})]}):(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:["external"===e.link_type?(0,ea.jsx)(bj,{size:14,className:"text-slate-400"}):"anchor"===e.link_type?(0,ea.jsx)(Tq,{size:14,className:"text-slate-400"}):(0,ea.jsx)(qN,{size:14,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"font-medium truncate",children:e.label}),e.is_button&&(0,ea.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 bg-indigo-100 text-indigo-600 rounded font-medium uppercase tracking-wide",children:"Button"}),"internal"===e.link_type&&e.link_value&&(0,ea.jsxs)("span",{className:"text-xs text-slate-400 truncate",children:["\u2192 ",(null===(i=a.find(t=>t.page_id===e.link_value))||void 0===i?void 0:i.slug)||"Unknown page"]}),"external"===e.link_type&&e.link_value&&(0,ea.jsxs)("span",{className:"text-xs text-slate-400 truncate",children:["\u2192 ",e.link_value]}),"anchor"===e.link_type&&e.link_value&&(0,ea.jsxs)("span",{className:"text-xs text-slate-400 truncate",children:["\u2192 ",e.link_value.includes("#")?"/".concat(e.link_value):"#".concat(e.link_value)]})]})}),!j&&(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[y&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{u(e.item_id),m(e.children,[...d,e.item_id])},className:"h-7 px-2 text-slate-500",title:"Add sub-item",children:(0,ea.jsx)(Vj,{size:14})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>c(e.item_id),className:"h-7 px-2 text-slate-500",children:"Edit"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>p(e.item_id),className:"h-7 px-2 text-red-500 hover:text-red-600 hover:bg-red-50",children:(0,ea.jsx)(wD,{size:14})})]})]}),b&&v&&(0,ea.jsx)("div",{className:"mt-1",children:e.children.map(t=>f(t,[...d,e.item_id],h+1))})]},e.item_id)};return(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"font-semibold",children:"Menu Items"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Drag to reorder, supports up to 3 levels of nesting"})]}),(0,ea.jsxs)(sg,{onClick:()=>m(),size:"sm",className:"gap-1",children:[(0,ea.jsx)(Vj,{size:16}),"Add Item"]})]}),(0,ea.jsx)("div",{className:"min-h-[200px]",children:s.items&&0!==s.items.length?(0,ea.jsx)("div",{children:s.items.map(e=>f(e))}):(0,ea.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center border-2 border-dashed border-slate-200 rounded-lg",children:[(0,ea.jsx)(CV,{size:32,className:"text-slate-300 mb-2"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No menu items yet"}),(0,ea.jsx)("p",{className:"text-sm text-slate-400 mb-3",children:'Click "Add Item" to create your first menu item'}),(0,ea.jsxs)(sg,{onClick:()=>m(),size:"sm",variant:"outline",children:[(0,ea.jsx)(Vj,{size:16,className:"mr-1"}),"Add Item"]})]})})]})})},lZ=e=>{let{platform:t,size:s=20,color:a="currentColor"}=e;const n=()=>(0,ea.jsx)("svg",{viewBox:"0 0 600 530",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M135.72 44.03C202.216 93.951 273.74 195.17 300 249.49c26.262-54.316 97.782-155.54 164.28-205.46C512.26 8.009 590-19.862 590 68.825c0 17.712-10.155 148.79-16.111 170.07-20.703 73.984-96.144 92.854-163.25 81.433 117.3 19.964 147.14 86.092 82.697 152.22-122.39 125.59-175.91-31.511-189.63-71.766-2.514-7.38-3.69-10.832-3.708-7.896-.017-2.936-1.193.516-3.707 7.896-13.714 40.255-67.233 197.36-189.63 71.766-64.444-66.128-34.605-132.26 82.697-152.22-67.108 11.421-142.55-7.449-163.25-81.433C20.15 217.613 10 86.536 10 68.824c0-88.687 77.742-60.816 125.72-24.795z"})}),l=()=>(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08
2-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"})}),r=()=>(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z"})}),i=()=>(0,ea.jsx)("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:a,children:(0,ea.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})});return{facebook:(0,ea.jsx)(nr,{size:s,color:a}),twitter:(0,ea.jsx)(lr,{size:s,color:a}),instagram:(0,ea.jsx)(rr,{size:s,color:a}),linkedin:(0,ea.jsx)(ir,{size:s,color:a}),youtube:(0,ea.jsx)(or,{size:s,color:a}),bluesky:(0,ea.jsx)(n,{}),tiktok:(0,ea.jsx)(l,{}),pinterest:(0,ea.jsx)(r,{}),github:(0,ea.jsx)(i,{}),email:(0,ea.jsx)(Yl,{size:s,color:a}),website:(0,ea.jsx)(hr,{size:s,color:a})}[t]||(0,ea.jsx)(hr,{size:s,color:a})},rZ=e=>{var s,a,n,l,r;let{menu:i,siteTheme:o,pages:c}=e;const[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)({}),p=(e,t)=>i.theme_override&&i.theme_override[e]?i.theme_override[e]:o&&o[e]?o[e]:t,g=p("backgroundColor",p("background_color","#ffffff")),f=p("textColor",p("body_color","#475569")),v=p("accentColor",p("primary_color","#6366f1")),b=p("hoverColor",p("link_hover_color","#4f46e5")),j=e=>{return"external"===e.link_type?e.link_value||"#":"anchor"===e.link_type?"#".concat((null===(t=e.link_value)||void 0===t?void 0:t.replace(/^#/,""))||""):e.link_value?(e=>{const t=null===c||void 0===c?void 0:c.find(t=>t.page_id===e);return t?"/".concat(t.slug):"#"})(e.link_value):"#";var t},y=e=>{x(t=>d(d({},t),{},{[e]:!t[e]}))},N=()=>{var e;const t=(e,t)=>{var s;const a=(null===(s=e.children)||void 0===s?void 0:s.length)>0,n=h[e.item_id];return(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsxs)("a",{href:j(e),target:e.target,onClick:t=>{a&&(t.preventDefault(),y(e.item_id))},className:"flex items-center justify-between px-4 py-2 transition-colors hover:bg-black/5",style:{color:f},onMouseEnter:e=>e.target.style.color=b,onMouseLeave:e=>e.target.style.color=f,children:[(0,ea.jsx)("span",{children:e.label}),a&&(0,ea.jsx)(ax,{size:14})]}),a&&n&&(0,ea.jsx)("div",{className:"absolute left-full top-0 ml-1 py-2 min-w-[180px] rounded-lg shadow-lg border z-50",style:{backgroundColor:g,borderColor:"rgba(0,0,0,0.1)"},children:e.children.map(e=>(0,ea.jsx)("a",{href:j(e),target:e.target,className:"block px-4 py-2 transition-colors hover:bg-black/5",style:{color:f},onMouseEnter:e=>e.target.style.color=b,onMouseLeave:e=>e.target.style.color=f,children:e.label},e.item_id))})]},e.item_id)};return(0,ea.jsx)("nav",{className:"flex items-center gap-1 px-4 py-3 rounded-lg ".concat((()=>{switch(i.items_align){case"center":return"justify-center";case"right":return"justify-end";default:return"justify-start"}})()),style:{backgroundColor:g},children:null===(e=i.items)||void 0===e?void 0:e.map(e=>function(e){var s;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(null===(s=e.children)||void 0===s?void 0:s.length)>0,l=h[e.item_id];if(e.is_button){const t=e.button_bg_color||v,s=e.button_text_color||"#ffffff",a=e.button_style||"solid",n="pill"===e.button_border_radius?"9999px":"square"===e.button_border_radius?"2px":"6px";let l;return l="outline"===a?{background:"transparent",color:t,border:"1.5px solid ".concat(t),borderRadius:n}:"ghost"===a?{background:"".concat(t,"18"),color:t,borderRadius:n}:{backgroundColor:t,color:s,borderRadius:n},(0,ea.jsx)("div",{className:"flex items-center",children:(0,ea.jsx)("a",{href:j(e),target:e.target,className:"inline-flex items-center gap-1 px-4 py-1.5 text-sm font-semibold transition-all hover:opacity-80",style:l,children:e.label})},e.item_id)}return(0,ea.jsxs)("div",{className:"relative group",children:[(0,ea.jsxs)("a",{href:j(e),target:e.target,onClick:t=>{n&&(t.preventDefault(),y(e.item_id))},className:"flex items-center gap-1 px-4 py-2 rounded-md transition-colors hover:bg-black/5",style:{color:f},onMouseEnter:e=>e.target.style.color=b,onMouseLeave:e=>e.target.style.color=f,children:[(0,ea.jsx)("span",{children:e.label}),n&&(0,ea.jsx)(tr,{size:14}),"external"===e.link_type&&(0,ea.jsx)(bj,{size:12,className:"ml-1 opacity-50"}),"anchor"===e.link_type&&(0,ea.jsx)(Tq,{size:12,className:"ml-1 opacity-50"})]}),n&&l&&(0,ea.jsx)("div",{className:"absolute top-full left-0 mt-1 py-2 min-w-[200px] rounded-lg shadow-lg border z-50",style:{backgroundColor:g,borderColor:"rgba(0,0,0,0.1)"},children:e.children.map(e=>t(e,a+1))})]},e.item_id)}(e))})};return(0,ea.jsxs)("div",{className:"border rounded-xl p-6 bg-slate-100",children:[(0,ea.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,ea.jsxs)("span",{className:"text-sm font-medium text-slate-600",children:["Preview: ","footer"===i.location?"footer":i.style," menu"]}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:"footer"===i.location?"Footer preview with all settings":"Click items to test dropdowns"})]}),(0,ea.jsx)("div",{className:"".concat("footer"===i.location?"w-full":"flex justify-center"),children:(null===(s=i.items)||void 0===s?void 0:s.length)>0||"footer"===i.location&&((null===(a=i.footer_settings)||void 0===a||null===(n=a.sections)||void 0===n?void 0:n.length)>0||(null===(l=i.footer_settings)||void 0===l||null===(r=l.social_links)||void 0===r?void 0:r.length)>0)?(()=>{if("footer"===i.location)return(()=>{var e,t,s,a,n,l;const r=i.footer_settings||{},o=r.layout||"simple",c=r.sections||[],u=!1!==r.show_copyright,m=r.copyright_text||"\xa9 ".concat((new Date).getFullYear()," All rights reserved"),h=r.social_links||[],x=r.padding_top||48,p=r.padding_bottom||32,v=null!==(e=r.margin_top)&&void 0!==e?e:48,b=r.section_title_color||f,y=r.copyright_color||f,N=r.link_color||f,w=r.content_align||("columns"===o?"left":"center"),C="right"===w?"text-right":"left"===w?"text-left":"text-center",k="right"===w?"items-end":"left"
2===w?"items-start":"items-center",D="right"===w?"justify-end":"left"===w?"justify-start":"justify-center";return(0,ea.jsx)("footer",{className:"w-full rounded-lg",style:{backgroundColor:g,paddingTop:"".concat(x,"px"),paddingBottom:"".concat(p,"px"),marginTop:"".concat(v,"px")},children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto px-4",children:["columns"===o&&c.length>0&&(0,ea.jsxs)("div",{className:"grid gap-6 mb-6 ".concat(1===c.length?"grid-cols-1 md:grid-cols-2":2===c.length?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-4"),children:[(null===(t=i.logo)||void 0===t?void 0:t.url)&&(0,ea.jsx)("div",{className:"space-y-4",children:(0,ea.jsx)("img",{src:i.logo.url,alt:"Logo",style:d(d({height:"".concat(i.logo.height||40,"px"),width:"auto"},i.logo.maxWidth?{maxWidth:"".concat(i.logo.maxWidth,"px")}:{}),{},{objectFit:"contain"})})}),c.map(e=>(0,ea.jsxs)("div",{className:"space-y-2 ".concat(C),children:[e.title&&(0,ea.jsx)("h4",{className:"font-semibold text-sm uppercase tracking-wide",style:{color:b},children:e.title}),e.content_html&&(0,ea.jsx)("div",{className:"text-sm space-y-1",style:{color:f,opacity:.9},dangerouslySetInnerHTML:{__html:e.content_html}}),e.links&&e.links.length>0&&(0,ea.jsx)("nav",{className:"flex flex-col gap-1 mt-2 ".concat(k),children:e.links.map(e=>(0,ea.jsx)("a",{href:"#",className:"text-sm hover:underline",style:{color:N,opacity:r.link_color?1:.9},children:e.label},e.link_id))})]},e.section_id)),(null===(s=i.items)||void 0===s?void 0:s.length)>0&&(0,ea.jsxs)("div",{className:"space-y-2 ".concat(C),children:[(0,ea.jsx)("h4",{className:"font-semibold text-sm uppercase tracking-wide",style:{color:b},children:"Quick Links"}),(0,ea.jsx)("nav",{className:"flex flex-col gap-1 ".concat(k),children:i.items.map(e=>(0,ea.jsx)("a",{href:j(e),target:e.target||("external"===e.link_type?"_blank":void 0),rel:"external"===e.link_type?"noopener noreferrer":void 0,className:"text-sm hover:underline",style:{color:N,opacity:r.link_color?1:.9},children:e.label},e.item_id))})]})]}),"stacked"===o&&c.length>0&&(0,ea.jsxs)("div",{className:"mb-6 space-y-4",children:[(null===(a=i.logo)||void 0===a?void 0:a.url)&&(0,ea.jsx)("div",{className:"flex justify-center",children:(0,ea.jsx)("img",{src:i.logo.url,alt:"Logo",style:d(d({height:"".concat(i.logo.height||40,"px"),width:"auto"},i.logo.maxWidth?{maxWidth:"".concat(i.logo.maxWidth,"px")}:{}),{},{objectFit:"contain"})})}),(0,ea.jsx)("div",{className:"grid gap-4 ".concat(1===c.length?"grid-cols-1":2===c.length?"grid-cols-1 md:grid-cols-2":"grid-cols-1 md:grid-cols-3"),children:c.map(e=>(0,ea.jsxs)("div",{className:C,children:[e.title&&(0,ea.jsx)("h4",{className:"font-semibold text-sm uppercase tracking-wide mb-2",style:{color:b},children:e.title}),e.content_html&&(0,ea.jsx)("div",{className:"text-sm",style:{color:f,opacity:.9},dangerouslySetInnerHTML:{__html:e.content_html}}),e.links&&e.links.length>0&&(0,ea.jsx)("nav",{className:"flex flex-col gap-1 mt-2 ".concat(k),children:e.links.map(e=>(0,ea.jsx)("a",{href:"#",className:"text-sm hover:underline",style:{color:N,opacity:r.link_color?1:.9},children:e.label},e.link_id))})]},e.section_id))})]}),("simple"===o||0===c.length)&&(0,ea.jsx)(ea.Fragment,{children:(null===(n=i.logo)||void 0===n?void 0:n.url)&&(0,ea.jsx)("div",{className:"flex justify-center mb-4",children:(0,ea.jsx)("img",{src:i.logo.url,alt:"Logo",style:d(d({height:"".concat(i.logo.height||40,"px"),width:"auto"},i.logo.maxWidth?{maxWidth:"".concat(i.logo.maxWidth,"px")}:{}),{},{objectFit:"contain"})})})}),"columns"!==o&&(null===(l=i.items)||void 0===l?void 0:l.length)>0&&(0,ea.jsx)("nav",{className:"flex flex-wrap gap-4 mb-4 ".concat(D),children:i.items.map(e=>(0,ea.jsx)("a",{href:j(e),target:e.target||("external"===e.link_type?"_blank":void 0),rel:"external"===e.link_type?"noopener noreferrer":void 0,className:"text-sm hover:underline",style:{color:N},children:e.label},e.item_id))}),h.length>0&&(0,ea.jsx)("div",{className:"flex justify-center gap-3 mb-4",children:h.map(e=>(0,ea.jsx)("a",{href:e.url||"#",className:"hover:opacity-70 transition-opacity p-2 rounded-full hover:bg-black/5",style:{color:f},title:e.platform.charAt(0).toUpperCase()+e.platform.slice(1),children:(0,ea.jsx)(lZ,{platform:e.platform,size:18,color:f})},e.id))}),u&&(0,ea.jsx)("p",{className:"text-center text-xs pt-3 border-t border-current/10",style:{color:y,opacity:r.copyright_color?1:.6},children:m})]})})})();switch(i.style){case"hamburger":return(()=>{var e;const t=i.hamburger_align||"right",s="right"===t?"justify-end":"center"===t?"justify-center":"justify-start",a="right"===t?"justify-end":"center"===t?"justify-center":"justify-start",n=t,l=function(e){var t;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=(null===(t=e.children)||void 0===t?void 0:t.length)>0,i=h[e.item_id];return(0,ea.jsxs)("div",{style:{textAlign:n},children:[(0,ea.jsxs)("a",{href:j(e),target:e.target,onClick:t=>{r&&(t.preventDefault(),y(e.item_id))},className:"flex items-center ".concat(a," gap-2 px-4 py-3 border-b transition-colors"),style:{color:f,borderColor:"rgba(0,0,0,0.1)"},children:[(0,ea.jsx)("span",{children:e.label}),r&&(i?(0,ea.jsx)(tr,{size:16}):(0,ea.jsx)(ax,{size:16}))]}),r&&i&&(0,ea.jsx)("div",{className:"bg-black/5",style:{paddingLeft:0===s?16:0},children:e.children.map(e=>l(e,s+1))})]},e.item_id)};return(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"flex items-center ".concat(s," px-4 py-3 rounded-t-lg"),style:{backgroundColor:g},children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>m(!u),style:{color:f},"data-testid":"menu-preview-hamburger-toggle",children:u?(0,ea.jsx)(sr,{size:20}):(0,ea.jsx)(ar,{size:20})})}),u&&(0,ea.jsx)("div",{className:"rounded-b-lg border-t overflow-hidden",style:{backgroundColor:g,borderColor:"rgba(0,0,0,0.1)"},children:null===(e=i.items)||void 0===e?void 0:e.map(e=>l(e))})]})})();case"sidebar":return(()=>{var e;const t=function(e){var s;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(null===(s=e.children)||void 0===s?void 0:s.length)>0,l=h[e.item_id];return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("a",{href:j(e),target:e.target,onClick:t=>{n&&(t.preventDefault(),y(e.item_id))},className:"flex items-center justify-between px-4 py-3 rounded-lg mb-1 transition-colors",style:{color:f,paddingLeft:16+12*a,backgroundColor:a>0?"rgba(0,0,0,0.03)":"transparent"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="rgba(0,0,0,0.05)",e.currentTarget.style.color=b},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=a>0?"rgba(0,0,0,0.03)":"transparent",e.currentTarget.style.color=f},children:[(0,ea.jsx)("span",{children:e.label}),n&&(l?(0,ea.jsx)(tr,{size:16}):(0,ea.jsx)(ax,{size:16}))]}),n&&l&&(0,ea.jsx)("div",{className:"ml-2",children:e.children.map(e=>t(e,a+1))})]},e.item_id)};return(0,ea.jsxs)("nav",{className:"w-64 min-h-[300px] p-4 rounded-lg",style:{backgroundColor:g},children:[(0,ea.jsx)("div",{className:"font-semibold mb-4 px-4",style:{color:f},children:i.name}),null===(e=i.items)||void 0===e?void 0:e.map(e=>t(e))]})})();default:return N()}})():(0,ea.jsx)("div",{className:"text-slate-400 py-8 text-center",children:"footer"===i.location?"Add menu items, content sections, or social links to see the preview":"Add menu items to see the preview"})})]})},iZ=[{id:"horizontal",name:"Horizontal",icon:KX,description:"Classic top navigation bar"}
2,{id:"hamburger",name:"Hamburger",icon:ar,description:"Collapsible mobile-style menu"},{id:"sidebar",name:"Sidebar",icon:YX,description:"Vertical sidebar navigation"}],oZ=[{id:"header",name:"Header"},{id:"footer",name:"Footer"},{id:"sidebar",name:"Sidebar"}],cZ={horizontal:[{id:"left",name:"Left (before menu items)"},{id:"center",name:"Center (menu items split)"},{id:"right",name:"Right (after menu items)"}],hamburger:[{id:"left",name:"Left"},{id:"center",name:"Center"},{id:"right",name:"Right"}],sidebar:[{id:"top",name:"Top (above menu items)"},{id:"bottom",name:"Bottom (below menu items)"}]},dZ=()=>{var e,s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N,w,C,k,D,_,S,E,A,F,T,z,M;const[P,B]=(0,t.useState)([]),[R,L]=(0,t.useState)([]),[I,O]=(0,t.useState)([]),[U,H]=(0,t.useState)(!0),[W,V]=(0,t.useState)(!1),[q,$]=(0,t.useState)(null),[G,K]=(0,t.useState)(null),Y=!!q&&JSON.stringify(q)!==G,[J,Q]=(0,t.useState)(null),[X,Z]=(0,t.useState)(!1),[ee,te]=(0,t.useState)(!1),[se,ae]=(0,t.useState)({name:"",style:"horizontal",location:"header",is_global:!0,page_ids:[],items:[],theme_override:null,dropdown_trigger:"click"});(0,t.useEffect)(()=>{ne()},[]),(0,t.useEffect)(()=>{if(!Y)return;const e=e=>(e.preventDefault(),e.returnValue="","");return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[Y]);const ne=async()=>{try{var e;const[t,s,a,n]=await Promise.all([_l.get("/navigation"),_l.get("/pages"),_l.get("/theme"),_l.get("/tenant/landing-page").catch(()=>({data:null}))]);B(t.data),L(s.data),Q(a.data);let l=[];if(null!==(e=n.data)&&void 0!==e&&e.html_sections){const e=n.data.html_sections.filter(e=>!e.draft).map(e=>{var t;return{id:e.anchor_id||(null===(t=e.name)||void 0===t?void 0:t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))||e.id,name:e.name||"Unnamed Section",source:"Landing Page"}});l=[...l,...e]}s.data&&s.data.length>0&&s.data.forEach(e=>{if(e.blocks&&e.blocks.length>0){const t=e.blocks.filter(e=>{var t;return(null===(t=e.content)||void 0===t?void 0:t.anchor_id)||["heading","hero","form","gallery","article-feed"].includes(e.type)}).map(t=>{var s,a;return{id:(null===(s=t.content)||void 0===s?void 0:s.anchor_id)||tY(t),name:null!==(a=t.content)&&void 0!==a&&a.anchor_id?"#".concat(t.content.anchor_id," (").concat(t.type,")"):le(t),source:e.title||"Untitled Page",pageSlug:e.slug}});l=[...l,...t]}}),O(l)}catch(t){console.error("Failed to fetch data:",t),qs.error("Failed to load data")}finally{H(!1)}},le=e=>{var t,s,a,n,l,r;return"heading"===e.type?(null===(t=e.content)||void 0===t||null===(s=t.html)||void 0===s?void 0:s.replace(/<[^>]*>/g,"").substring(0,40))||"Heading":"hero"===e.type?(null===(a=e.content)||void 0===a||null===(n=a.headline)||void 0===n?void 0:n.substring(0,40))||"Hero Section":"form"===e.type?(null===(l=e.content)||void 0===l?void 0:l.formName)||"Form":"gallery"===e.type?"Gallery":"article-feed"===e.type?(null===(r=e.content)||void 0===r?void 0:r.heading)||"Article Feed":e.type},re=async e=>{try{const t=await _l.put("/navigation/".concat(e.menu_id),e);B(P.map(s=>s.menu_id===e.menu_id?t.data:s)),$(e=>e&&e.menu_id===t.data.menu_id?t.data:e),K(JSON.stringify(t.data)),qs.success("Menu saved!")}catch(t){console.error("Failed to update menu:",t),qs.error("Failed to save menu")}},ie=e=>{$(e)},oe=e=>{$(e),K(JSON.stringify(e))};return U?(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})})]}):(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 p-8",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900",style:{fontFamily:"Manrope, sans-serif"},children:"Navigation Menus"}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Create and manage your site navigation"})]}),(0,ea.jsxs)(sg,{onClick:()=>V(!0),className:"gap-2",children:[(0,ea.jsx)(Vj,{size:18}),"Create Menu"]})]}),q?(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>{Y&&!window.confirm("You have unsaved changes. Discard them and leave?")||($(null),K(null))},"data-testid":"nav-back-to-menus",children:"\u2190 Back to Menus"}),(0,ea.jsx)("h2",{className:"text-xl font-semibold",children:q.name}),Y&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-amber-700 bg-amber-50 border border-amber-200 px-2 py-1 rounded-full","data-testid":"nav-unsaved-indicator",children:[(0,ea.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),"Unsaved changes"]}),(0,ea.jsx)("div",{className:"flex-1"}),(0,ea.jsxs)(sg,{onClick:()=>re(q),disabled:!Y,className:"gap-2","data-testid":"nav-save-changes-btn",children:[(0,ea.jsx)(BD,{size:16}),"Save Changes"]})]}),(0,ea.jsxs)(nJ,{defaultValue:"items",className:"w-full",children:[(0,ea.jsxs)(lJ,{children:[(0,ea.jsx)(rJ,{value:"items",children:"Menu Items"}),(0,ea.jsx)(rJ,{value:"settings",children:"Settings"}),"footer"===q.location&&(0,ea.jsx)(rJ,{value:"footer",children:"Footer Content"}),(0,ea.jsx)(rJ,{value:"style",children:"Style & Theme"}),(0,ea.jsx)(rJ,{value:"preview",children:"Preview"})]}),(0,ea.jsx)(iJ,{value:"items",className:"mt-6",children:(0,ea.jsx)(nZ,{menu:q,pages:R,anchors:I,onUpdate:e=>{ie(e)}})}),(0,ea.jsx)(iJ,{value:"settings",className:"mt-6",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Menu Settings"}),(0,ea.jsx)(cD,{children:"Configure where and how your menu appears"})]}),(0,ea.jsxs)(dD,{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"grid gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Menu Name"}),(0,ea.jsx)(BN,{value:q.name,onChange:e=>ie(d(d({},q),{},{name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Menu Style"}),(0,ea.jsxs)(eb,{value:q.style,onValueChange:e=>{const t=d(d({},q),{},{style:e});ie(t)},children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:iZ.map(e=>(0,ea.jsx)(rb,{value:e.id,children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(e.icon,{size:16}),(0,ea.jsx)("span",{children:e.name})]})},e.id))})]})]}),"hamburger"===q.style&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Hamburger Alignment"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"Position of the hamburger button"}),(0,ea.jsxs)(eb,{value:q.hamburger_align||"right",onValueChange:e=>{const t=d(d({},q),{},{hamburger_align:e});ie(t)},children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),"horizontal"===q.style&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Menu Items Alignment"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"Position of menu items in the navigation bar"}),(0,ea.jsxs)(eb,{value:q.items_align||"left",onValueChange:e=>{const t=d(d({},q),{},{items_align:e});ie(t)},children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]}),"header"===q.location&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Header Content Width"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:'How wide the logo/menu area stretches. Use "Full width" to push the logo to the screen edge.'}),(0,ea.jsxs)(eb,{value:q.content_width||"contained",onValueChange:e=>ie(d(d({},q),{},{content_width:e})),children:[(0,ea.jsx)(sb,{"data-testid":"header-content-width-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"contained",children:"Contained (1280px, centered)"}),(0,ea.jsx)(rb,{value:"wide",children:"Wide (1536px, centered)"}),(0,ea.jsx)(rb,{value:"full",children:"Full width (edge to edge)"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Edge Padding (px)"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"Space between the logo/menu and the left & right edges. Lower = logo closer to the edge."}),(0,ea.jsx)(BN,{type:"number",min:0,max:200,value:null!==(e=q.edge_padding)&&void 0!==e?e:16,onChange:e=>{const t=parseInt(e.target.value);ie(d(d({},q),{},{edge_padding:Number.isNaN(t)?0:t}))},"data-testid":"header-edge-padding-input"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Location"}),(0,ea.jsxs)(eb,{value:q.location,onValueChange:e=>{const t=d(d({},q),{},{location:e});ie(t)},children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:oZ.map(e=>(0,ea.jsx)(rb,{value:e.id,children:e.name},e.id))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Global Menu"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Show this menu on all pages"})]}),(0,ea.jsx)(wb,{checked:q.is_global,onCheckedChange:e=>{const t=d(d({},q),{},{is_global:e});ie(t)}})]}),"header"===q.location&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Dropdown Trigger"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"How dropdown menus are opened"}),(0,ea.jsxs)(eb,{value:q.dropdown_trigger||"click",onValueChange:e=>{const t=d(d({},q),{},{dropdown_trigger:e});ie(t)},children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"click",children:"Click to open"}),(0,ea.jsx)(rb,{value:"hover",children:"Hover to open"})]})]})]}),"header"===q.location&&(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Show Search"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Display a search icon in the header"})]}),(0,ea.jsx)(wb,{checked:!0===q.show_search,onCheckedChange:e=>{const t=d(d({},q),{},{show_search:e});ie(t)}})]}),!q.is_global&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Show on Pages"}),(0,ea.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-2 space-y-1",children:R.map(e=>{var t;return(0,ea.jsxs)("label",{className:"flex items-center gap-2 p-2 hover:bg-slate-50 rounded cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:null===(t=q.page_ids)||void 0===t?void 0:t.includes(e.page_id),onChange:t=>{const s=t.target.checked?[...q.page_ids||[],e.page_id]:(q.page_ids||[]).filter(t=>t!==e.page_id);$(d(d({},q),{},{page_ids:s}))},className:"rounded"}),(0,ea.jsx)(qN,{size:14,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"text-sm",children:e.title||e.slug})]},e.page_id)})})]}),(0,ea.jsxs)("div",{className:"border-t pt-6 mt-6",children:[(0,ea.jsxs)("h3",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)($N,{size:16}),"Logo Settings"]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo Image"}),null!==(s=q.logo)&&void 0!==s&&s.url?(0,ea.jsxs)("div",{className:"flex items-center gap-4 p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("img",{src:q.logo.url,alt:"Logo",style:d({height:"".concat((null===(a=q.logo)||void 0===a?void 0:a.height)||40,"px"),width:"auto"},null!==(n=q.logo)&&void 0!==n&&n.maxWidth?{maxWidth:"".concat(q.logo.maxWidth,"px")}
2:{}),className:"object-contain"}),(0,ea.jsx)("div",{className:"flex-1",children:(0,ea.jsx)("p",{className:"text-sm text-slate-600 truncate",children:q.logo.url.split("/").pop()})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>Z(!0),children:"Change"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>$(d(d({},q),{},{logo:d(d({},q.logo),{},{url:""})})),children:(0,ea.jsx)(wD,{size:14})})]}):(0,ea.jsxs)(sg,{variant:"outline",className:"w-full justify-center gap-2 h-20 border-dashed",onClick:()=>Z(!0),children:[(0,ea.jsx)(kq,{size:18}),(0,ea.jsx)("span",{children:"Choose Logo from Media Library"})]}),(null===(l=q.logo)||void 0===l?void 0:l.url)&&(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:async()=>{var e;const t=null===q||void 0===q||null===(e=q.logo)||void 0===e?void 0:e.url;if(t){te(!0);try{const e=await _l.post("/media/trim-whitespace",{url:t});$(t=>d(d({},t),{},{logo:d(d({},t.logo),{},{url:e.data.url})}));const[s,a]=e.data.original_size||[],[n,l]=e.data.trimmed_size||[];qs.success("Whitespace trimmed (".concat(s,"\xd7").concat(a," \u2192 ").concat(n,"\xd7").concat(l,"). Remember to Save."))}catch(n){var s,a;const e=(null===n||void 0===n||null===(s=n.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Could not trim the logo.";qs.error(e)}finally{te(!1)}}},disabled:ee,"data-testid":"logo-trim-whitespace-btn",className:"gap-2",children:[(0,ea.jsx)(JX,{size:14}),ee?"Trimming\u2026":"Trim whitespace"]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Logo looks small in a tall bar? Trim the blank padding baked into the image."})]})]}),(null===(r=q.logo)||void 0===r?void 0:r.url)&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo Position"}),(0,ea.jsxs)(eb,{value:(null===(i=q.logo)||void 0===i?void 0:i.position)||"left",onValueChange:e=>$(d(d({},q),{},{logo:d(d({},q.logo),{},{position:e})})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:(cZ[q.style]||cZ.horizontal).map(e=>(0,ea.jsx)(rb,{value:e.id,children:e.name},e.id))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo Height (px)"}),(0,ea.jsx)(BN,{type:"number",min:20,max:140,value:(null===(o=q.logo)||void 0===o?void 0:o.height)||40,onChange:e=>$(d(d({},q),{},{logo:d(d({},q.logo),{},{height:parseInt(e.target.value)||40})})),"data-testid":"logo-height-input"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Recommended: 32-48px for headers. Increase for wide/landscape logos."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo Max Width (px) \u2014 optional"}),(0,ea.jsx)(BN,{type:"number",min:40,max:600,placeholder:"Auto (scales with height)",value:(null===(c=q.logo)||void 0===c?void 0:c.maxWidth)||"",onChange:e=>{const t=parseInt(e.target.value);$(d(d({},q),{},{logo:d(d({},q.logo),{},{maxWidth:Number.isNaN(t)?null:t})}))},"data-testid":"logo-maxwidth-input"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Leave blank to let the logo scale naturally with the height. Set a cap only if a wide logo gets too big."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo URL (where it links)"}),(0,ea.jsx)(BN,{placeholder:"/",value:(null===(u=q.logo)||void 0===u?void 0:u.link)||"",onChange:e=>$(d(d({},q),{},{logo:d(d({},q.logo),{},{link:e.target.value})})),"data-testid":"nav-logo-link-input"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Where clicking the logo takes visitors. Leave blank to send them to your homepage (",(0,ea.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:"/"}),"). You can also enter a full URL like ",(0,ea.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:"https://example.com"}),"."]})]})]})]})]})]}),(0,ea.jsx)(sg,{onClick:()=>re(q),children:"Save Settings"})]})]})}),(0,ea.jsx)(iJ,{value:"style",className:"mt-6",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Menu Theme"}),(0,ea.jsx)(cD,{children:"Customize the appearance of this menu"})]}),(0,ea.jsxs)(dD,{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Use Site Theme"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Inherit colors from your site theme"})]}),(0,ea.jsx)(wb,{checked:!q.theme_override,onCheckedChange:e=>{$(d(d({},q),{},e?{theme_override:null}:{theme_override:{backgroundColor:(null===J||void 0===J?void 0:J.background_color)||"#ffffff",textColor:(null===J||void 0===J?void 0:J.body_color)||"#475569",accentColor:(null===J||void 0===J?void 0:J.primary_color)||"#6366f1",hoverColor:(null===J||void 0===J?void 0:J.link_hover_color)||"#4f46e5"}}))}})]}),q.theme_override&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"color",value:q.theme_override.backgroundColor||"#ffffff",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{backgroundColor:e.target.value})})),className:"w-10 h-10 rounded cursor-pointer"}),(0,ea.jsx)(BN,{value:q.theme_override.backgroundColor||"#ffffff",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{backgroundColor:e.target.value})}))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"color",value:q.theme_override.textColor||"#475569",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{textColor:e.target.value})})),className:"w-10 h-10 rounded cursor-pointer"}),(0,ea.jsx)(BN,{value:q.theme_override.textColor||"#475569",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{textColor:e.target.value})}))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Accent Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"color",value:q.theme_override.accentColor||"#6366f1",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{accentColor:e.target.value})})),className:"w-10 h-10 rounded cursor-pointer"}),(0,ea.jsx)(BN,{value:q.theme_override.accentColor||"#6366f1",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{accentColor:e.target.value})}))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Hover Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"color",value:q.theme_override.hoverColor||"#4f46e5",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{hoverColor:e.target.value})})),className:"w-10 h-10 rounded cursor-pointer"}),(0,ea.jsx)(BN,{value:q.theme_override.hoverColor||"#4f46e5",onChange:e=>$(d(d({},q),{},{theme_override:d(d({},q.theme_override),{},{hoverColor:e.target.value})}))})]})]})]}),(0,ea.jsx)(sg,{onClick:()=>re(q),children:"Save Theme"})]})]})}),"footer"===q.location&&(0,ea.jsx)(iJ,{value:"footer",className:"mt-6",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Footer Content"}),(0,ea.jsx)(cD,{children:"Add custom content sections to your footer"})]}),(0,ea.jsxs)(dD,{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Footer Layout"}),(0,ea.jsxs)(eb,{value:(null===(m=q.footer_settings)||void 0===m?void 0:m.layout)||"simple",onValueChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{layout:e})})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"simple",children:"Simple (Links centered)"}),(0,ea.jsx)(rb,{value:"columns",children:"Columns (Links + Content sections)"}),(0,ea.jsx)(rb,{value:"stacked",children:"Stacked (Content above links)"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Content Alignment"}),(0,ea.jsxs)(eb,{value:(null===(h=q.footer_settings)||void 0===h?void 0:h.content_align)||("columns"===(null===(x=q.footer_settings)||void 0===x?void 0:x.layout)?"left":"center"),onValueChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{content_align:e})})),children:[(0,ea.jsx)(sb,{"data-testid":"footer-content-align-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left (headers track their content)"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:'Aligns each section\'s header, content and links together. Use the "Columns" layout with "Left" so headings like "Our Address" and "Quick Links" sit above their own columns.'})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{children:"Content Sections"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{var e;const t=(null===(e=q.footer_settings)||void 0===e?void 0:e.sections)||[];$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:[...t,{section_id:"section-".concat(Date.now()),title:"New Section",content_html:"<p>Add your content here...</p>"}]})}))},children:[(0,ea.jsx)(Vj,{size:16,className:"mr-1"}),"Add Section"]})]}),(0,ea.jsxs)("div",{className:"space-y-2 p-3 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Section Title Colour"}),(null===(p=q.footer_settings)||void 0===p?void 0:p.section_title_color)&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-6 text-xs text-slate-500","data-testid":"footer-section-title-color-reset",onClick:()=>{const e=d({},q.footer_settings);delete e.section_title_color,$(d(d({},q),{},{footer_settings:e}))},children:"Reset"})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"color","data-testid":"footer-section-title-color-picker",value:(null===(g=q.footer_settings)||void 0===g?void 0:g.section_title_color)||"#475569",onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{section_title_color:e.target.value})})),className:"w-10 h-10 rounded cursor-pointer"}),(0,ea.jsx)(BN,{"data-testid":"footer-section-title-color-input",placeholder:"Inherits footer text colour",value:(null===(f=q.footer_settings)||void 0===f?void 0:f.section_title_color)||"",onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{section_title_color:e.target.value})}))})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Applies to every content-section title. Leave blank to inherit the footer text colour."})]}),(0,ea.jsxs)("div",{className:"space-y-2 p-3 bg-slate-50 rounded-lg border border-slate-200",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Footer Link Colour"}),(null===(v=q.footer_settings)||void 0===v?void 0:v.link_color)&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-6 text-xs text-slate-500","data-testid":"footer-link-color-reset",onClick:()=>{const e=d({},q.footer_settings);delete e.link_color,$(d(d({},q),{},{footer_settings:e}))},children:"Reset"})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"color","data-testid":"footer-link-color-picker",value:(null===(b=q.footer_settings)||void 0===b?void 0:b.link_color)||"#475569",onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{link_color:e.target.value})})),className:"w-10 h-10 rounded cursor-pointer"}),(0,ea.jsx)(BN,{"data-testid":"footer-link-color-input",placeholder:"Inherits footer text colour",value:(null===(j=q.footer_settings)||void 0===j?void 0:j.link_color)||"",onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{link_color:e.target.value})}))})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Applies to all footer links (Quick Links and section links). Leave blank to inherit the footer text colour."})]}),0===((null===(y=q.footer_settings)||void 0===y?void 0:y.sections)||[]).length?(0,ea.jsxs)("div",{className:"p-6 bg-slate-50 border-2 border-dashed border-slate-200 rounded-lg text-center",children:[(0,ea.jsx)("p",{className:"text-slate-500 text-sm",children:"No content sections yet"}),(0,ea.jsx)("p",{className:"text-slate-400 text-xs mt-1",children:"Add sections for c
2ontact info, hours, about text, etc."})]}):(0,ea.jsx)("div",{className:"space-y-4",children:((null===(N=q.footer_settings)||void 0===N?void 0:N.sections)||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"p-4 border border-slate-200 rounded-lg bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ea.jsx)(BN,{value:e.title||"",onChange:e=>{var s;const a=[...(null===(s=q.footer_settings)||void 0===s?void 0:s.sections)||[]];a[t]=d(d({},a[t]),{},{title:e.target.value}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:a})}))},placeholder:"Section Title (e.g., Contact Us)",className:"font-medium"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{var e;const s=((null===(e=q.footer_settings)||void 0===e?void 0:e.sections)||[]).filter((e,s)=>s!==t);$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:s})}))},className:"text-red-500 hover:text-red-700 ml-2",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsx)(tf,{className:"text-xs text-slate-600 mb-1 block",children:"Content"}),(0,ea.jsx)("div",{className:"mb-4",children:(0,ea.jsx)(Cq,{content:e.content_html||"",onChange:e=>{var s,a;const n=[...(null===(s=q.footer_settings)||void 0===s?void 0:s.sections)||[]];(null===(a=n[t])||void 0===a?void 0:a.content_html)!==e&&(n[t]=d(d({},n[t]),{},{content_html:e}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:n})})))},placeholder:"Add formatted content (contact info, hours, about text, etc.)"})}),(0,ea.jsxs)("div",{className:"border-t border-slate-100 pt-3 mt-3",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsxs)(tf,{className:"text-xs text-slate-600 flex items-center gap-1",children:[(0,ea.jsx)(CV,{size:12}),"Links"]}),(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{var e;const s=[...(null===(e=q.footer_settings)||void 0===e?void 0:e.sections)||[]],a=s[t].links||[];s[t]=d(d({},s[t]),{},{links:[...a,{link_id:"link-".concat(Date.now()),label:"New Link",link_type:"external",url:""}]}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:s})}))},children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"}),"Add Link"]})]}),0===(e.links||[]).length?(0,ea.jsx)("p",{className:"text-xs text-slate-400 italic",children:"No links added yet"}):(0,ea.jsx)("div",{className:"space-y-2",children:(e.links||[]).map((e,s)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-slate-50 rounded-md",children:[(0,ea.jsxs)("div",{className:"flex-1 grid grid-cols-3 gap-2",children:[(0,ea.jsx)(BN,{value:e.label||"",onChange:e=>{var a;const n=[...(null===(a=q.footer_settings)||void 0===a?void 0:a.sections)||[]],l=[...n[t].links||[]];l[s]=d(d({},l[s]),{},{label:e.target.value}),n[t]=d(d({},n[t]),{},{links:l}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:n})}))},placeholder:"Link Label",className:"h-8 text-sm"}),(0,ea.jsxs)(eb,{value:e.link_type||"external",onValueChange:e=>{var a;const n=[...(null===(a=q.footer_settings)||void 0===a?void 0:a.sections)||[]],l=[...n[t].links||[]];l[s]=d(d({},l[s]),{},{link_type:e,url:"",page_id:""}),n[t]=d(d({},n[t]),{},{links:l}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:n})}))},children:[(0,ea.jsx)(sb,{className:"h-8 text-sm",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"external",children:(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(bj,{size:12}),"External URL"]})}),(0,ea.jsx)(rb,{value:"internal",children:(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(qN,{size:12}),"Internal Page"]})})]})]}),"internal"===e.link_type?(0,ea.jsxs)(eb,{value:e.page_id||"",onValueChange:e=>{var a;const n=[...(null===(a=q.footer_settings)||void 0===a?void 0:a.sections)||[]],l=[...n[t].links||[]],r=R.find(t=>t.page_id===e);l[s]=d(d({},l[s]),{},{page_id:e,url:r?"/".concat(r.slug):""}),n[t]=d(d({},n[t]),{},{links:l}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:n})}))},children:[(0,ea.jsx)(sb,{className:"h-8 text-sm",children:(0,ea.jsx)(tb,{placeholder:"Select page..."})}),(0,ea.jsx)(lb,{children:R.map(e=>(0,ea.jsx)(rb,{value:e.page_id,children:e.title||e.slug||"Untitled"},e.page_id))})]}):(0,ea.jsx)(BN,{value:e.url||"",onChange:e=>{var a;const n=[...(null===(a=q.footer_settings)||void 0===a?void 0:a.sections)||[]],l=[...n[t].links||[]];l[s]=d(d({},l[s]),{},{url:e.target.value}),n[t]=d(d({},n[t]),{},{links:l}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:n})}))},placeholder:"https://...",className:"h-8 text-sm"})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-red-500 hover:text-red-700",onClick:()=>{var e;const a=[...(null===(e=q.footer_settings)||void 0===e?void 0:e.sections)||[]],n=(a[t].links||[]).filter((e,t)=>
2t!==s);a[t]=d(d({},a[t]),{},{links:n}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{sections:a})}))},children:(0,ea.jsx)(wD,{size:14})})]},e.link_id))})]})]},e.section_id))})]}),(0,ea.jsxs)("div",{className:"pt-4 border-t border-slate-200 space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Show Copyright"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Display copyright text at bottom"})]}),(0,ea.jsx)(wb,{checked:!1!==(null===(w=q.footer_settings)||void 0===w?void 0:w.show_copyright),onCheckedChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{show_copyright:e})}))})]}),!1!==(null===(C=q.footer_settings)||void 0===C?void 0:C.show_copyright)&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Custom Copyright Text"}),(0,ea.jsx)(BN,{placeholder:"\xa9 ".concat((new Date).getFullYear()," Your Company. All rights reserved."),value:(null===(k=q.footer_settings)||void 0===k?void 0:k.copyright_text)||"",onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{copyright_text:e.target.value})}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Leave blank for default copyright text"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{children:"Copyright Text Colour"}),(null===(D=q.footer_settings)||void 0===D?void 0:D.copyright_color)&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"h-6 text-xs text-slate-500","data-testid":"footer-copyright-color-reset",onClick:()=>{const e=d({},q.footer_settings);delete e.copyright_color,$(d(d({},q),{},{footer_settings:e}))},children:"Reset"})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{type:"color","data-testid":"footer-copyright-color-picker",value:(null===(_=q.footer_settings)||void 0===_?void 0:_.copyright_color)||"#475569",onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{copyright_color:e.target.value})})),className:"w-10 h-10 rounded cursor-pointer"}),(0,ea.jsx)(BN,{"data-testid":"footer-copyright-color-input",placeholder:"Inherits footer text colour",value:(null===(S=q.footer_settings)||void 0===S?void 0:S.copyright_color)||"",onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{copyright_color:e.target.value})}))})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"Leave blank to inherit the footer text colour."})]})]})]}),(0,ea.jsxs)("div",{className:"pt-4 border-t border-slate-200 space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Social Links"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Add social media icons to footer"})]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{var e;const t=(null===(e=q.footer_settings)||void 0===e?void 0:e.social_links)||[];$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{social_links:[...t,{id:"social-".concat(Date.now()),platform:"facebook",url:""}]})}))},children:[(0,ea.jsx)(Vj,{size:16,className:"mr-1"}),"Add Social Link"]})]}),((null===(E=q.footer_settings)||void 0===E?void 0:E.social_links)||[]).length>0&&(0,ea.jsx)("div",{className:"space-y-3",children:((null===(A=q.footer_settings)||void 0===A?void 0:A.social_links)||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)(eb,{value:e.platform,onValueChange:e=>{var s;const a=[...(null===(s=q.footer_settings)||void 0===s?void 0:s.social_links)||[]];a[t]=d(d({},a[t]),{},{platform:e}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{social_links:a})}))},children:[(0,ea.jsx)(sb,{className:"w-36",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"facebook",children:"Facebook"}),(0,ea.jsx)(rb,{value:"twitter",children:"Twitter/X"}),(0,ea.jsx)(rb,{value:"instagram",children:"Instagram"}),(0,ea.jsx)(rb,{value:"linkedin",children:"LinkedIn"}),(0,ea.jsx)(rb,{value:"youtube",children:"YouTube"}),(0,ea.jsx)(rb,{value:"bluesky",children:"Bluesky"}),(0,ea.jsx)(rb,{value:"tiktok",children:"TikTok"}),(0,ea.jsx)(rb,{value:"pinterest",children:"Pinterest"}),(0,ea.jsx)(rb,{value:"github",children:"GitHub"}),(0,ea.jsx)(rb,{value:"email",children:"Email"}),(0,ea.jsx)(rb,{value:"website",children:"Website"})]})]}),(0,ea.jsx)(BN,{placeholder:"https://...",value:e.url||"",className:"flex-1",onChange:e=>{var s;const a=[...(null===(s=q.footer_settings)||void 0===s?void 0:s.social_links)||[]];a[t]=d(d({},a[t]),{},{url:e.target.value}),$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{social_links:a})}))}}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 hover:text-red-700",onClick:()=>{var e;const s=((null===(e=q.footer_settings)||void 0===e?void 0:e.social_links)||[]).filter((e,s)=>s!==t);$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{social_links:s})}))},children:(0,ea.jsx)(wD,{size:16})})]},e.id))})]}),(0,ea.jsxs)("div",{className:"pt-4 border-t border-slate-200 grid grid-cols-3 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Space Above (px)"}),(0,ea.jsx)(BN,{type:"number",min:0,max:200,value:null!==(F=null===(T=q.footer_settings)||void 0===T?void 0:T.margin_top)&&void 0!==F?F:48,onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{margin_top:parseInt(e.target.value)||0})})),"data-testid":"footer-margin-top-input"}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-500",children:"Set to 0 to make the last block butt against the footer."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Top Padding (px)"}),(0,ea.jsx)(BN,{type:"number",min:0,max:200,value:(null===(z=q.footer_settings)||void 0===z?void 0:z.padding_top)||48,onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{padding_top:parseInt(e.target.value)||48})}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Bottom Padding (px)"}),(0,ea.jsx)(BN,{type:"number",min:0,max:200,value:(null===(M=q.footer_settings)||void 0===M?void 0:M.padding_bottom)||32,onChange:e=>$(d(d({},q),{},{footer_settings:d(d({},q.footer_settings),{},{padding_bottom:parseInt(e.target.value)||32})}))})]})]}),(0,ea.jsx)(sg,{onClick:()=>re(q),children:"Save Footer Settings"})]})]})}),(0,ea.jsx)(iJ,{value:"preview",className:"mt-6",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Menu Preview"}),(0,ea.jsx)(cD,{children:"See how your menu will look"})]}),(0,ea.jsx)(dD,{children:(0,ea.jsx)(rZ,{menu:q,siteTheme:J,pages:R})})]})})]})]}):(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:0===P.length?(0,ea.jsx)(rD,{className:"col-span-full",children:(0,ea.jsxs)(dD,{className:"flex flex-col items-center justify-center py-12",children:[(0,ea.jsx)(ar,{size:48,className:"text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-700",children:"No menus yet"}),(0,ea.jsx)("p",{className:"text-slate-500 text-center mt-1 mb-4",children:"Create your first navigation menu to get started"}),(0,ea.jsxs)(sg,{onClick:()=>V(!0),className:"gap-2",children:[(0,ea.jsx)(Vj,{size:18}),"Create Menu"]})]})}):P.map(e=>{var t,s;const a=(e=>{const t=iZ.find(t=>
2t.id===e);return t?t.icon:ar})(e.style);return(0,ea.jsxs)(rD,{className:"hover:shadow-md transition-shadow",children:[(0,ea.jsx)(iD,{className:"pb-2",children:(0,ea.jsx)("div",{className:"flex items-start justify-between",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-indigo-100 rounded-lg",children:(0,ea.jsx)(a,{size:20,className:"text-indigo-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{className:"text-lg",children:e.name}),(0,ea.jsxs)(cD,{className:"text-xs mt-0.5",children:[e.style," \u2022 ",e.location," \u2022 ",(null===(t=e.items)||void 0===t?void 0:t.length)||0," items"]})]})]})})}),(0,ea.jsxs)(dD,{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[e.is_global?(0,ea.jsx)("span",{className:"px-2 py-1 bg-green-100 text-green-700 text-xs rounded-full",children:"Global"}):(0,ea.jsxs)("span",{className:"px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full",children:[(null===(s=e.page_ids)||void 0===s?void 0:s.length)||0," pages"]}),(0,ea.jsx)("span",{className:"px-2 py-1 bg-slate-100 text-slate-600 text-xs rounded-full capitalize",children:e.location})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>oe(e),children:[(0,ea.jsx)(ND,{size:14,className:"mr-1"}),"Edit"]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>(async e=>{try{const t=d(d({},e),{},{name:"".concat(e.name," (Copy)")});delete t.menu_id,delete t.tenant_id,delete t.created_at,delete t.updated_at;const s=await _l.post("/navigation",t);B([...P,s.data]),qs.success("Menu duplicated!")}catch(t){console.error("Failed to duplicate menu:",t),qs.error("Failed to duplicate menu")}})(e),children:(0,ea.jsx)(DD,{size:14})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this menu?"))try{await _l.delete("/navigation/".concat(e)),B(P.filter(t=>t.menu_id!==e)),(null===q||void 0===q?void 0:q.menu_id)===e&&$(null),qs.success("Menu deleted!")}catch(t){console.error("Failed to delete menu:",t),qs.error("Failed to delete menu")}})(e.menu_id),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:(0,ea.jsx)(wD,{size:14})})]})]})]},e.menu_id)})}),(0,ea.jsx)(Ok,{open:W,onOpenChange:V,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Create Navigation Menu"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Menu Name *"}),(0,ea.jsx)(BN,{placeholder:"e.g., Main Navigation",value:se.name,onChange:e=>ae(d(d({},se),{},{name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Menu Style"}),(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-2",children:iZ.map(e=>(0,ea.jsxs)("button",{onClick:()=>ae(d(d({},se),{},{style:e.id})),className:"p-3 rounded-lg border-2 transition-all text-center ".concat(se.style===e.id?"border-indigo-500 bg-indigo-50":"border-slate-200 hover:border-slate-300"),children:[(0,ea.jsx)(e.icon,{size:24,className:"mx-auto mb-1 ".concat(se.style===e.id?"text-indigo-600":"text-slate-400")}),(0,ea.jsx)("span",{className:"text-xs font-medium",children:e.name})]},e.id))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Location"}),(0,ea.jsxs)(eb,{value:se.location,onValueChange:e=>ae(d(d({},se),{},{location:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:oZ.map(e=>(0,ea.jsx)(rb,{value:e.id,children:e.name},e.id))})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Global Menu"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Show on all pages"})]}),(0,ea.jsx)(wb,{checked:se.is_global,onCheckedChange:e=>ae(d(d({},se),{},{is_global:e}))})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(se.name.trim())try{const e=await _l.post("/navigation",se);B([...P,e.data]),V(!1),ae({name:"",style:"horizontal",location:"header",is_global:!0,page_ids:[],items:[],theme_override:null,dropdown_trigger:"click"}),qs.success("Navigation menu created!"),oe(e.data)}catch(e){console.error("Failed to create menu:",e),qs.error("Failed to create menu")}else qs.error("Please enter a menu name")},children:"Create Menu"})]})]})}),(0,ea.jsx)(Dq,{open:X,onClose:()=>Z(!1),onSelect:e=>{q&&$(d(d({},q),{},{logo:d(d({},q.logo),{},{url:e.url,alt:e.alt||"Logo"})})),Z(!1)}})]})]})},uZ=e=>{let{template:s,onClose:a,onUse:n}=e;const l=(0,t.useMemo)(()=>Date.now(),[null===s||void 0===s?void 0:s.template_id]);return s?(0,ea.jsx)(Ok,{open:!0,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-6xl max-h-[90vh] overflow-hidden flex flex-col",children:[(0,ea.jsx)(Vk,{className:"flex-shrink-0",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)($k,{className:"text-xl",children:s.name}),s.description&&(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:s.description})]}),(0,ea.jsx)("div",{className:"flex items-center gap-2",children:(0,ea.jsxs)(sg,{onClick:n,className:"gap-2",children:[(0,ea.jsx)(NE,{size:16}),"Use This Template"]})})]})}),(0,ea.jsx)("div",{className:"flex-1 overflow-auto bg-slate-100 rounded-lg mt-4",children:(0,ea.jsx)("div",{className:"bg-white rounded-lg shadow-sm overflow-x-hidden",children:(0,ea.jsx)(cN,{blocks:s.blocks||[],title:s.name,pageWidth:s.page_width||"standard",theme:s.theme,isQuickPreview:!1,showNavigation:!1,refreshKey:l})})}),(0,ea.jsxs)("div",{className:"flex-shrink-0 flex justify-between items-center pt-4 border-t mt-4",children:[(0,ea.jsxs)("div",{className:"text-sm text-slate-500",children:[(0,ea.jsx)("span",{className:"px-2 py-1 bg-slate-100 rounded mr-2 capitalize",children:s.category}),(0,ea.jsxs)("span",{className:"px-2 py-1 bg-slate-100 rounded",children:[s.page_width||"standard"," width"]})]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:a,children:"Close"}),(0,ea.jsx)(sg,{onClick:n,children:"Use Template"})]})]})]})}):null},mZ=["pro","enterprise"],hZ=e=>{var s;let{open:a,onClose:n,onImported:l}=e;const[r,i]=(0,t.useState)("upload"),[o,c]=(0,t.useState)(!1),[d,u]=(0,t.useState)(null),[m,h]=(0,t.useState)(null),[x,p]=(0,t.useState)(!0),[g,f]=(0,t.useState)(""),[v,b]=(0,t.useState)(""),[j,y]=(0,t.useState)("Imported Template"),[N,w]=(0,t.useState)(""),[C,k]=(0,t.useState)(!1);(0,t.useEffect)(()=>{a&&D()},[a]);const D=async()=>{try{p(!0);const e=await _l.get("/tenant");h(e.data.plan_level||"starter")}catch(e){console.error("Failed to fetch plan:",e),h("starter")}finally{p(!1)}},_=mZ.includes(m),S=(0,t.useCallback)(e=>{e.preventDefault(),k(!0)},[]),E=(0,t.useCallback)(e=>{e.preventDefault(),k(!1)},[]),A=(0,t.useCallback)(e=>{e.preventDefault(),k(!1);const t=Array.from(e.dataTransfer.files);F(t)},[]),F=e=>{e.forEach(e=>{const t=new FileReader;t.onload=t=>{const s=t.target.result;if(e.name.endsWith(".html")||e.name.endsWith(".htm")){f(s);const t=e.name.replace(/\.(html|htm)$/,"").replace(/[-_]/g," ");y(t.charAt(0).toUpperCase()+t.slice(1))}else e.name.endsWith(".css")&&b(e=>e+"\n"+s)},t.readAsText(e)}),qs.success("Loaded ".concat(e.length," file(s)"))},T=()=>{f(""),b(""),w(""),y("Imported Template"),u(null)};return(0,ea.jsx)(Ok,{open:a,onOpenChange:()=>{T(),n()},children:(0,ea.jsxs)(Wk,{className:"max-w-3xl max-h-[90vh] overflow-hidden flex flex-col",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2 text-xl",children:[(0,ea.jsx)(OE,{className:"text-purple-600",size:24}),"Import HTML Template",(0,ea.jsx)("span",{className:"ml-2 px-2 py-0.5 bg-purple-100 text-purple-700 text-xs rounded-full font-normal",children:"Premium Feature"})]})}),x?(0,ea.jsx)("div",{className:"flex-1 flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"animate-spin text-slate-400",size:32})}):_?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(lQ,{className:"bg-amber-50 border-amber-200",children:[(0,ea.jsx)($g,{className:"h-4 w-4 text-amber-600"}),(0,ea.jsxs)(rQ,{className:"text-amber-800",children:["HTML import uses ",(0,ea.jsx)("strong",{children:"2 AI credits"})," to analyze and convert your template to editable blocks."]})]}),d?(0,ea.jsxs)("div",{className:"flex-1 overflow-auto py-4 space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-green-50 rounded-lg border border-green-200",children:[(0,ea.jsx)(Xl,{className:"text-green-600",size:24}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"font-semibold text-green-800",children:"Import Successful!"}),(0,ea.jsx)("p",{className:"text-green-700 text-sm",children:d.message})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Blocks Created"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-800",children:(null===(s=d.blocks)||void 0===s?void 0:s.length)||0})]}),(0,ea.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Credits Used"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-800",children:d.credits_used})]})]}),d.extracted_theme&&Object.keys(d.extracted_theme).length>0&&(0,ea.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-700 mb-2",children:"Extracted Theme"}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2",children:[d.extracted_theme.primaryColor&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1 bg-white rounded-full border",children:[(0,ea.jsx)("div",{className:"w-4 h-4 rounded-full border",style:{backgroundColor:d.extracted_theme.primaryColor}}),(0,ea.jsx)("span",{className:"text-xs",children:"Primary"})]}),d.extracted_theme.backgroundColor&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1 bg-white rounded-full border",children:[(0,ea.jsx)("div",{className:"w-4 h-4 rounded-full border",style:{backgroundColor:d.extracted_theme.backgroundColor}}
2),(0,ea.jsx)("span",{className:"text-xs",children:"Background"})]}),d.extracted_theme.fontFamily&&(0,ea.jsxs)("div",{className:"px-3 py-1 bg-white rounded-full border text-xs",children:["Font: ",d.extracted_theme.fontFamily]})]})]}),d.unmapped_css&&(0,ea.jsxs)("div",{className:"p-4 bg-orange-50 rounded-lg border border-orange-200",children:[(0,ea.jsxs)("p",{className:"text-sm font-medium text-orange-700 mb-2",children:[(0,ea.jsx)(WN,{className:"inline mr-1",size:14}),"Some CSS could not be mapped to block styles"]}),(0,ea.jsxs)("details",{className:"text-xs",children:[(0,ea.jsx)("summary",{className:"cursor-pointer text-orange-600",children:"View unmapped CSS"}),(0,ea.jsx)("pre",{className:"mt-2 p-2 bg-white rounded text-slate-600 overflow-auto max-h-32",children:d.unmapped_css})]})]}),(0,ea.jsxs)(qk,{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",onClick:T,children:"Import Another"}),(0,ea.jsxs)(sg,{onClick:()=>window.location.href="/pages/new?template=".concat(d.template_id),className:"gap-2",children:[(0,ea.jsx)(IN,{size:16}),"Use Template"]})]})]}):(0,ea.jsx)("div",{className:"flex-1 overflow-auto",children:(0,ea.jsxs)(nJ,{value:r,onValueChange:i,className:"w-full",children:[(0,ea.jsxs)(lJ,{className:"grid w-full grid-cols-2",children:[(0,ea.jsxs)(rJ,{value:"upload",className:"gap-2",children:[(0,ea.jsx)(kq,{size:16}),"Upload Files"]}),(0,ea.jsxs)(rJ,{value:"url",className:"gap-2",children:[(0,ea.jsx)(CV,{size:16}),"From URL"]})]}),(0,ea.jsxs)(iJ,{value:"upload",className:"space-y-4 mt-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Template Name"}),(0,ea.jsx)(BN,{value:j,onChange:e=>y(e.target.value),placeholder:"My Imported Template"})]}),(0,ea.jsxs)("div",{onDragOver:S,onDragLeave:E,onDrop:A,className:"border-2 border-dashed rounded-xl p-8 text-center transition-colors ".concat(C?"border-purple-500 bg-purple-50":"border-slate-300 hover:border-slate-400"),children:[(0,ea.jsx)(kq,{className:"mx-auto mb-3 ".concat(C?"text-purple-500":"text-slate-400"),size:32}),(0,ea.jsx)("p",{className:"font-medium text-slate-700",children:"Drag & drop HTML and CSS files here"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"or click to select files"}),(0,ea.jsx)("input",{type:"file",multiple:!0,accept:".html,.htm,.css",onChange:e=>{const t=Array.from(e.target.files);F(t)},className:"absolute inset-0 opacity-0 cursor-pointer",style:{position:"relative",marginTop:"12px"}})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsx)("div",{className:"flex-1 p-3 rounded-lg border ".concat(g?"bg-green-50 border-green-200":"bg-slate-50 border-slate-200"),children:(0,ea.jsxs)("p",{className:"text-sm font-medium flex items-center gap-2",children:[g?(0,ea.jsx)(Xl,{size:14,className:"text-green-600"}):null,"HTML ",g?"(".concat((g.length/1024).toFixed(1)," KB)"):"(not loaded)"]})}),(0,ea.jsx)("div",{className:"flex-1 p-3 rounded-lg border ".concat(v?"bg-green-50 border-green-200":"bg-slate-50 border-slate-200"),children:(0,ea.jsxs)("p",{className:"text-sm font-medium flex items-center gap-2",children:[v?(0,ea.jsx)(Xl,{size:14,className:"text-green-600"}):null,"CSS ",v?"(".concat((v.length/1024).toFixed(1)," KB)"):"(optional)"]})})]}),(0,ea.jsxs)("details",{className:"group",children:[(0,ea.jsx)("summary",{className:"cursor-pointer text-sm text-slate-600 hover:text-slate-800",children:"Or paste HTML/CSS manually"}),(0,ea.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"HTML Content"}),(0,ea.jsx)(YN,{value:g,onChange:e=>f(e.target.value),placeholder:"<html>...</html>",rows:5,className:"font-mono text-xs"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"CSS Content (optional)"}),(0,ea.jsx)(YN,{value:v,onChange:e=>b(e.target.value),placeholder:".class { ... }",rows:3,className:"font-mono text-xs"})]})]})]}),(0,ea.jsx)(sg,{onClick:async()=>{if(g.trim()){c(!0),u(null);try{var e;const t=await _l.post("/templates/import-html",{html_content:g,css_content:v||null,template_name:j,template_description:"Imported HTML template with ".concat(v?"CSS styles":"inline styles")});u(t.data),qs.success("Template imported with ".concat((null===(e=t.data.blocks)||void 0===e?void 0:e.length)||0," blocks!")),l&&l(t.data)}catch(a){var t,s;console.error("Import failed:",a),qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to import template")}finally{c(!1)}}else qs.error("Please upload or paste HTML content")},disabled:o||!g,className:"w-full gap-2",children:o?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin",size:18}),"Analyzing & Converting..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)($g,{size:18}),"Import Template (2 Credits)"]})})]}
2),(0,ea.jsxs)(iJ,{value:"url",className:"space-y-4 mt-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Template Name"}),(0,ea.jsx)(BN,{value:j,onChange:e=>y(e.target.value),placeholder:"My Imported Template"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Website URL"}),(0,ea.jsx)(BN,{value:N,onChange:e=>w(e.target.value),placeholder:"https://example.com/template.html",type:"url"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Enter the URL of a webpage to import. We will fetch the HTML and linked CSS automatically."})]}),(0,ea.jsx)(lQ,{className:"bg-blue-50 border-blue-200",children:(0,ea.jsxs)(rQ,{className:"text-blue-800 text-sm",children:[(0,ea.jsx)("strong",{children:"Note:"})," This works best with simple, static HTML pages. Complex JavaScript-rendered sites may not import correctly."]})}),(0,ea.jsx)(sg,{onClick:async()=>{if(N.trim())if(N.startsWith("http://")||N.startsWith("https://")){c(!0),u(null);try{var e;const t=await _l.post("/templates/import-url?url=".concat(encodeURIComponent(N),"&template_name=").concat(encodeURIComponent(j)));u(t.data),qs.success("Template imported with ".concat((null===(e=t.data.blocks)||void 0===e?void 0:e.length)||0," blocks!")),l&&l(t.data)}catch(a){var t,s;console.error("Import failed:",a),qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to import from URL")}finally{c(!1)}}else qs.error("Please enter a valid URL starting with http:// or https://");else qs.error("Please enter a URL")},disabled:o||!N,className:"w-full gap-2",children:o?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin",size:18}),"Fetching & Converting..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)($g,{size:18}),"Import from URL (2 Credits)"]})})]})]})})]}):(0,ea.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center py-8 text-center",children:[(0,ea.jsx)("div",{className:"w-20 h-20 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,ea.jsx)(Lj,{className:"text-purple-600",size:40})}),(0,ea.jsx)("h3",{className:"text-xl font-semibold text-slate-800 mb-2",children:"Upgrade to Pro"}),(0,ea.jsx)("p",{className:"text-slate-600 max-w-md mb-6",children:"HTML Import is a premium feature available on Pro and Enterprise plans. Upgrade your plan to convert HTML templates into editable CMS blocks using AI."}),(0,ea.jsx)("div",{className:"flex flex-col items-center gap-2 mb-6 p-4 bg-slate-50 rounded-lg",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,ea.jsx)(Fw,{className:"text-amber-500",size:16}),"Your current plan: ",(0,ea.jsx)("span",{className:"font-semibold capitalize",children:m})]})}),(0,ea.jsxs)(sg,{onClick:()=>window.location.href="/settings?tab=billing",className:"gap-2 bg-purple-600 hover:bg-purple-700",children:[(0,ea.jsx)(Fw,{size:16}),"Upgrade to Pro"]})]})]})})},xZ=["scope","children"];function pZ(){for(var e=arguments.length,s=new Array(e),a=0;a<e;a++)s[a]=arguments[a];const n=s[0];if(1===s.length)return n;const l=()=>{const e=s.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(s){const a=e.reduce((e,t)=>{let{useScope:a,scopeName:n}=t;const l=a(s)["__scope".concat(n)];return d(d({},e),l)},{});return t.useMemo(()=>({["__scope".concat(n.scopeName)]:a}),[a])}};return l.scopeName=n.scopeName,l}const gZ=["asChild"];var fZ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,s)=>{const a=qp("Primitive.".concat(s)),n=t.forwardRef((e,t)=>{const{asChild:n}=e,r=l(e,gZ),i=n?a:s;return"undefined"!==typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ea.jsx)(i,d(d({},r),{},{ref:t}))});return n.displayName="Primitive.".concat(s),d(d({},e),{},{[s]:n})},{});const vZ=["__scopeProgress","value","max","getValueLabel"],bZ=["__scopeProgress"];var jZ="Progress",yZ=100,[NZ,wZ]=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=[];const n=()=>{const s=a.map(e=>t.createContext(e));return function(a){const n=(null===a||void 0===a?void 0:a[e])||s;return t.useMemo(()=>
2({["__scope".concat(e)]:d(d({},a),{},{[e]:n})}),[a,n])}};return n.scopeName=e,[function(s,n){const r=t.createContext(n);r.displayName=s+"Context";const i=a.length;a=[...a,n];const o=s=>{var a;const{scope:n,children:o}=s,c=l(s,xZ),d=(null===n||void 0===n||null===(a=n[e])||void 0===a?void 0:a[i])||r,u=t.useMemo(()=>c,Object.values(c));return(0,ea.jsx)(d.Provider,{value:u,children:o})};return o.displayName=s+"Provider",[o,function(a,l){var o;const c=(null===l||void 0===l||null===(o=l[e])||void 0===o?void 0:o[i])||r,d=t.useContext(c);if(d)return d;if(void 0!==n)return n;throw new Error("`".concat(a,"` must be used within `").concat(s,"`"))}]},pZ(n,...s)]}(jZ),[CZ,kZ]=NZ(jZ),DZ=t.forwardRef((e,t)=>{const{__scopeProgress:s,value:a=null,max:n,getValueLabel:r=EZ}=e,i=l(e,vZ);var o,c;!n&&0!==n||TZ(n)||console.error((o="".concat(n),c="Progress","Invalid prop `max` of value `".concat(o,"` supplied to `").concat(c,"`. Only numbers greater than 0 are valid max values. Defaulting to `").concat(yZ,"`.")));const u=TZ(n)?n:yZ;null===a||zZ(a,u)||console.error(function(e,t){return"Invalid prop `value` of value `".concat(e,"` supplied to `").concat(t,"`. The `value` prop must be:\n - a positive number\n - less than the value passed to `max` (or ").concat(yZ," if no `max` prop is set)\n - `null` or `undefined` if the progress is indeterminate.\n\nDefaulting to `null`.")}("".concat(a),"Progress"));const m=zZ(a,u)?a:null,h=FZ(m)?r(m,u):void 0;return(0,ea.jsx)(CZ,{scope:s,value:m,max:u,children:(0,ea.jsx)(fZ.div,d(d({"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":FZ(m)?m:void 0,"aria-valuetext":h,role:"progressbar","data-state":AZ(m,u),"data-value":null!==m&&void 0!==m?m:void 0,"data-max":u},i),{},{ref:t}))})});DZ.displayName=jZ;var _Z="ProgressIndicator",SZ=t.forwardRef((e,t)=>{var s;const{__scopeProgress:a}=e,n=l(e,bZ),r=kZ(_Z,a);return(0,ea.jsx)(fZ.div,d(d({"data-state":AZ(r.value,r.max),"data-value":null!==(s=r.value)&&void 0!==s?s:void 0,"data-max":r.max},n),{},{ref:t}))});function EZ(e,t){return"".concat(Math.round(e/t*100),"%")}function AZ(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function FZ(e){return"number"===typeof e}function TZ(e){return FZ(e)&&!isNaN(e)&&e>0}function zZ(e,t){return FZ(e)&&!isNaN(e)&&e<=t&&e>=0}SZ.displayName=_Z;var MZ=DZ,PZ=SZ;const BZ=["className","value"],RZ=t.forwardRef((e,t)=>{let{className:s,value:a}=e,n=l(e,BZ);return(0,ea.jsx)(MZ,d(d({ref:t,className:Np("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s)},n),{},{children:(0,ea.jsx)(PZ,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(a||0),"%)")}})}))});RZ.displayName=MZ.displayName;const LZ=["pro","enterprise"],IZ=e=>{var s,a;let{isOpen:n,onClose:l,onImportComplete:r}=e;const[i,o]=(0,t.useState)(""),[c,d]=(0,t.useState)(""),[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(0),[p,g]=(0,t.useState)(""),[f,v]=(0,t.useState)(null),[b,j]=(0,t.useState)(null),[y,N]=(0,t.useState)(null),[w,C]=(0,t.useState)(!0);(0,t.useEffect)(()=>{n&&k()},[n]);const k=async()=>{try{C(!0);const e=await _l.get("/tenant");N(e.data.plan_level||"starter")}catch(b){console.error("Failed to fetch plan:",b),N("starter")}finally{C(!1)}},D=LZ.includes(y),_=()=>{o(""),d(""),m(!1),x(0),g("idle"),v(null),j(null),l()};return(0,ea.jsx)(Ok,{open:n,onOpenChange:_,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-gradient-to-br from-violet-500 to-purple-600 rounded-lg flex items-center justify-center",children:(0,ea.jsx)($g,{className:"text-white",size:20})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("span",{children:"Vision Import"}),(0,ea.jsx)("span",{className:"ml-2 text-xs bg-gradient-to-r from-violet-500 to-purple-500 text-white px-2 py-0.5 rounded-full font-normal",children:"AI-Powered"})]})]}),(0,ea.jsx)(Gk,{children:"Import any website using AI vision analysis. We'll screenshot the page, analyze the layout, and recreate it using CMS blocks."})]}),w?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"animate-spin text-slate-400",size:32})}):D?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-6 py-4",children:[!f&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"url",children:"Website URL"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)("div",{className:"relative flex-1",children:[(0,ea.jsx)(hr,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400",size:18}),(0,ea.jsx)(BN,{id:"url",type:"url",placeholder:"https://example.com",value:i,onChange:e=>o(e.target.value),className:"pl-10",disabled:u})]}),(0,ea.jsx)(sg,{variant:"outline",size:"icon",onClick:()=>window.open(i,"_blank"),disabled:!i,title:"Preview URL",children:(0,ea.jsx)(bj,{size:18})})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"name",children:"Template Name (optional)"}),(0,ea.jsx)(BN,{id:"name",placeholder:"My Imported Template",value:c,onChange:e=>d(e.target.value),disabled:u})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm text-slate-700 mb-3",children:"How Vision Import Works:"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4 text-center",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-violet-100 rounded-full flex items-center justify-center mx-auto",children:(0,ea.jsx)("span",{className:"text-violet-600 font-bold",children:"1"})}),(0,ea.jsx)("p",{className:"text-xs text-slate-600",children:"Screenshot capture of the entire page"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-violet-100 rounded-full flex items-center justify-center mx-auto",children:(0,ea.jsx)("span",{className:"text-violet-600 font-bold",children:"2"})}),(0,ea.jsx)("p",{className:"text-xs text-slate-600",children:"AI analyzes layout, sections & colors"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-violet-100 rounded-full flex items-center justify-center mx-auto",children:(0,ea.jsx)("span",{className:"text-violet-600 font-bold",children:"3"})}),(0,ea.jsx)("p",{className:"text-xs text-slate-600",children:"Generates editable CMS blocks"})]})]})]})]}),u&&(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(ql,{className:"animate-spin text-violet-600",size:24}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("p",{className:"font-medium text-slate-900",children:{idle:"",capturing:"Taking screenshot of website...",analyzing:"AI is analyzing the page layout...",generating:"Generating CMS blocks...",complete:"Import complete!",error:"Import failed"}[p]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"This may take 30-60 seconds"})]})]}),(0,ea.jsx)(RZ,{value:h,className:"h-2"}),(0,ea.jsxs)("div",{className:"text-center text-sm text-slate-500",children:[Math.round(h),"% complete"]})]}),b&&(0,ea.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 flex items-start gap-3",children:[(0,ea.jsx)(WN,{className:"text-red-500 flex-shrink-0 mt-0.5",size:20}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-red-800",children:"Import Failed"}),(0,ea.jsx)("p",{className:"text-sm text-red-600 mt-1",children:b})]})]}),f&&(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 flex items-start gap-3",children:[(0,ea.jsx)(cr,{className:"text-green-500 flex-shrink-0 mt-0.5",size:20}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("p",{className:"font-medium text-green-800",children:"Import Successful!"}),(0,ea.jsxs)("p",{className:"text-sm text-green-600 mt-1",children:["Created ",(null===(s=f.blocks)||void 0===s?void 0:s.length)||0," blocks from ",new URL(i).hostname]})]})]}),f.layout_notes&&(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm text-slate-700 mb-2",children:"Layout Analysis:"}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:f.layout_notes})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm text-slate-700 mb-3",children:"Blocks Generated:"}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2",children:null===(a=f.blocks)||void 0===a?void 0:a.reduce((e,t)=>
2{const s=t.type,a=e.find(e=>e.type===s);return a?a.count++:e.push({type:s,count:1}),e},[]).map(e=>{let{type:t,count:s}=e;return(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-white rounded border text-xs",children:[(0,ea.jsx)("span",{className:"font-medium capitalize",children:t}),(0,ea.jsxs)("span",{className:"text-slate-400",children:["\xd7",s]})]},t)})})]}),f.theme&&(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm text-slate-700 mb-3",children:"Extracted Theme:"}),(0,ea.jsx)("div",{className:"flex gap-3",children:Object.entries(f.theme).map(e=>{let[t,s]=e;return(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-8 h-8 rounded-lg border shadow-sm mx-auto",style:{backgroundColor:s},title:s}),(0,ea.jsx)("span",{className:"text-xs text-slate-500 mt-1 block",children:t.replace("Color","")})]},t)})})]}),(0,ea.jsxs)("div",{className:"text-sm text-slate-500 text-center",children:[(0,ea.jsx)("span",{className:"font-medium",children:f.credits_used})," credits used \u2022",(0,ea.jsxs)("span",{className:"font-medium",children:[" ",f.credits_remaining]})," credits remaining"]})]})]}),!f&&!u&&(0,ea.jsxs)(lQ,{className:"bg-amber-50 border-amber-200",children:[(0,ea.jsx)($g,{className:"h-4 w-4 text-amber-600"}),(0,ea.jsxs)(rQ,{className:"text-amber-800",children:["Vision import uses ",(0,ea.jsx)("strong",{children:"3 AI credits"})," to capture, analyze, and convert the page layout."]})]}),(0,ea.jsx)(qk,{children:f?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:_,children:"Close"}),(0,ea.jsxs)(sg,{onClick:()=>{f&&(r(f),_())},className:"bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-700 hover:to-purple-700",children:[(0,ea.jsx)(IN,{className:"mr-2",size:18}),"Use This Template"]})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:_,disabled:u,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(i){try{new URL(i)}catch(a){return void qs.error("Please enter a valid URL (including https://)")}m(!0),j(null),v(null),x(0),g("capturing"),x(20);try{var e;const t=setInterval(()=>{x(e=>e<30?(g("capturing"),e+2):e<60?(g("analyzing"),e+1):e<85?(g("generating"),e+.5):e)},500),s=await _l.post("/templates/import-vision",{url:i,template_name:c||"Imported from ".concat(new URL(i).hostname)});clearInterval(t),x(100),g("complete"),v(s.data),qs.success("Successfully imported ".concat((null===(e=s.data.blocks)||void 0===e?void 0:e.length)||0," blocks!"))}catch(K2){var t,s;g("error"),x(0);const a=(null===(t=K2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||K2.message||"Import failed";j(a),qs.error(a)}finally{m(!1)}}else qs.error("Please enter a URL")},disabled:u||!i,className:"bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-700 hover:to-purple-700",children:u?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"mr-2 animate-spin",size:18}),"Importing..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)($g,{className:"mr-2",size:18}),"Start Vision Import (3 Credits)"]})})]})})]}):(0,ea.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,ea.jsx)("div",{className:"w-20 h-20 bg-violet-100 rounded-full flex items-center justify-center mb-4",children:(0,ea.jsx)(Lj,{className:"text-violet-600",size:40})}),(0,ea.jsx)("h3",{className:"text-xl font-semibold text-slate-800 mb-2",children:"Upgrade to Pro"}),(0,ea.jsx)("p",{className:"text-slate-600 max-w-md mb-6",children:"Vision Import is a premium feature that uses AI to analyze screenshots of any website and recreate its layout in your CMS. Upgrade your plan to access this powerful feature."}),(0,ea.jsx)("div",{className:"flex flex-col items-center gap-2 mb-6 p-4 bg-slate-50 rounded-lg",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,ea.jsx)(Fw,{className:"text-amber-500",size:16}),"Your current plan: ",(0,ea.jsx)("span",{className:"font-semibold capitalize",children:y})]})}),(0,ea.jsxs)(sg,{onClick:()=>window.location.href="/settings?tab=billing",className:"gap-2 bg-violet-600 hover:bg-violet-700",children:[(0,ea.jsx)(Fw,{size:16}),"Upgrade to Pro"]})]})]})})},OZ={landing:NE,about:qN,contact:Jl,blog:Uj,product:FY,portfolio:TY,other:AE},UZ={landing:"Landing Page",about:"About Us",contact:"Contact",blog:"Blog Post",product:"Product/Service",portfolio:"Portfolio",other:"Other"},HZ=()=>{const{user:e}=Al(),s="super_admin"===(null===e||void 0===e?void 0:e.role)||"master_admin"===(null===e||void 0===e?void 0:e.role),a="master_admin"===(null===e||void 0===e?void 0:e.role),[n,l]=(0,t.useState)({system:[],custom:[]}),[r,i]=(0,t.useState)(!0),[o,c]=(0,t.useState)(""),[u,m]=(0,t.useState)("all"),[h,x]=(0,t.useState)(null),[p,g]=(0,t.useState)(null),[f,v]=(0,t.useState)(!1),[b,j]=(0,t.useState)(!1),[y,N]=(0,t.useState)(null),[w,C]=(0,t.useState)({name:"",description:"",category:"landing",thumbnail_url:""});(0,t.useEffect)(()=>{k()},[]);const k=async()=>{try{const e=await _l.get("/templates");l(e.data),0===e.data.system.length&&await D()}catch(e){console.error("Failed to fetch templates:",e),qs.error("Failed to load templates")}
2finally{i(!1)}},D=async()=>{try{const e=await _l.post("/templates/seed-defaults");if(e.data.seeded>0){qs.success("Loaded ".concat(e.data.seeded," default templates"));const t=await _l.get("/templates");l(t.data)}}catch(e){console.error("Failed to seed templates:",e)}},_=e=>e.filter(e=>{const t=e.name.toLowerCase().includes(o.toLowerCase())||e.description&&e.description.toLowerCase().includes(o.toLowerCase()),s="all"===u||e.category===u;return t&&s}),S=e=>{let{template:t,isSystem:r}=e;const i=OZ[t.category]||AE;return(0,ea.jsxs)(rD,{className:"group hover:shadow-lg transition-all duration-200 overflow-hidden",children:[(0,ea.jsxs)("div",{className:"relative aspect-video bg-slate-100 overflow-hidden",children:[t.thumbnail_url?(0,ea.jsx)("img",{src:t.thumbnail_url,alt:t.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):(0,ea.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-slate-100 to-slate-200",children:(0,ea.jsx)(i,{size:48,className:"text-slate-300"})}),(0,ea.jsx)("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center opacity-0 group-hover:opacity-100",children:(0,ea.jsxs)(sg,{size:"sm",variant:"secondary",onClick:()=>x(t),className:"mr-2",children:[(0,ea.jsx)(IN,{size:16,className:"mr-1"}),"Preview"]})}),r&&(0,ea.jsxs)("span",{className:"absolute top-2 left-2 px-2 py-1 bg-indigo-600 text-white text-xs rounded-full flex items-center gap-1",children:[(0,ea.jsx)(hr,{size:12}),"System"]})]}),(0,ea.jsxs)(dD,{className:"p-4",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("h3",{className:"font-semibold text-slate-900 truncate",children:t.name}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1 line-clamp-2",children:t.description})]}),(0,ea.jsx)("div",{className:"flex items-center gap-1 ml-2",children:(0,ea.jsx)("span",{className:"px-2 py-1 bg-slate-100 text-slate-600 text-xs rounded capitalize",children:UZ[t.category]||t.category})})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-4",children:[(0,ea.jsx)(sg,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>window.location.href="/pages/new?template=".concat(t.template_id),children:"Use Template"}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>(async e=>{try{const t={name:"".concat(e.name," (Copy)"),description:e.description,category:e.category,thumbnail_url:e.thumbnail_url,blocks:e.blocks,page_width:e.page_width,theme:e.theme,is_system:!1},s=await _l.post("/templates",t);l(d(d({},n),{},{custom:[...n.custom,s.data]})),qs.success("Template duplicated to your library")}catch(t){console.error("Failed to duplicate template:",t),qs.error("Failed to duplicate template")}})(t),title:"Duplicate to My Templates",children:(0,ea.jsx)(DD,{size:16})}),r&&a&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>(e=>{N(e),C({name:e.name,description:e.description||"",category:e.category||"other",thumbnail_url:e.thumbnail_url||""})})(t),title:"Edit System Template",className:"text-blue-500 hover:text-blue-600 hover:bg-blue-50",children:(0,ea.jsx)(ND,{size:16})}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>g(d(d({},t),{},{isSystem:!0})),className:"text-red-500 hover:text-red-600 hover:bg-red-50",title:"Delete System Template",children:(0,ea.jsx)(wD,{size:16})})]}),!r&&(0,ea.jsxs)(ea.Fragment,{children:[s&&(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>(async e=>{try{const t={name:e.name,description:e.description,category:e.category,thumbnail_url:e.thumbnail_url,blocks:e.blocks,page_width:e.page_width,theme:e.theme,is_system:!0},s=await _l.post("/templates",t);l(d(d({},n),{},{system:[...n.system,s.data]})),qs.success("Template promoted to System Template")}catch(a){var t,s;console.error("Failed to promote template:",a),qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to promote template")}})(t),title:"Promote to System Template",className:"text-indigo-500 hover:text-indigo-600 hover:bg-indigo-50",children:(0,ea.jsx)(hr,{size:16})}),(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>g(t),className:"text-red-500 hover:text-red-600 hover:bg-red-50",title:"Delete",children:(0,ea.jsx)(wD,{size:16})})]})]})]})]})};if(r)return(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})})]});const E=_(n.system),A=_(n.custom);return(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 p-8",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900",style:{fontFamily:"Manrope, sans-serif"},children:"Page Templates"}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Choose from pre-built templates or use your own saved designs"})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsxs)(sg,{onClick:()=>j(!0),className:"gap-2 bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-700 hover:to-purple-700",children:[(0,ea.jsx)(Hj,{size:18}),"Vision Import",(0,ea.jsx)("span",{className:"px-1.5 py-0.5 bg-white/20 text-xs rounded",children:"AI"})]}),(0,ea.jsxs)(sg,{onClick:()=>v(!0),className:"gap-2 bg-purple-600 hover:bg-purple-700",children:[(0,ea.jsx)(OE,{size:18}),"Import HTML",(0,ea.jsx)("span",{className:"px-1.5 py-0.5 bg-purple-500 text-xs rounded",children:"PRO"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ea.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search templates...",value:o,onChange:e=>c(e.target.value),className:"pl-10"})]}),(0,ea.jsxs)(eb,{value:u,onValueChange:m,children:[(0,ea.jsxs)(sb,{className:"w-48",children:[(0,ea.jsx)(kD,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Category"})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Categories"}
2),Object.entries(UZ).map(e=>{let[t,s]=e;return(0,ea.jsx)(rb,{value:t,children:s},t)})]})]})]}),(0,ea.jsxs)(nJ,{defaultValue:"all",className:"w-full",children:[(0,ea.jsxs)(lJ,{children:[(0,ea.jsxs)(rJ,{value:"all",children:["All Templates (",E.length+A.length,")"]}),(0,ea.jsxs)(rJ,{value:"system",children:["System Templates (",E.length,")"]}),(0,ea.jsxs)(rJ,{value:"custom",children:["My Templates (",A.length,")"]})]}),(0,ea.jsx)(iJ,{value:"all",className:"mt-6",children:0===E.length&&0===A.length?(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"flex flex-col items-center justify-center py-12",children:[(0,ea.jsx)(NE,{size:48,className:"text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-700",children:"No templates found"}),(0,ea.jsx)("p",{className:"text-slate-500 text-center mt-1",children:"Try adjusting your search or filters"})]})}):(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[E.map(e=>(0,ea.jsx)(S,{template:e,isSystem:!0},e.template_id)),A.map(e=>(0,ea.jsx)(S,{template:e,isSystem:!1},e.template_id))]})}),(0,ea.jsx)(iJ,{value:"system",className:"mt-6",children:0===E.length?(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"flex flex-col items-center justify-center py-12",children:[(0,ea.jsx)(NE,{size:48,className:"text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-700",children:"No system templates"}),(0,ea.jsx)("p",{className:"text-slate-500 text-center mt-1",children:"System templates will appear here"})]})}):(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:E.map(e=>(0,ea.jsx)(S,{template:e,isSystem:!0},e.template_id))})}),(0,ea.jsx)(iJ,{value:"custom",className:"mt-6",children:0===A.length?(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"flex flex-col items-center justify-center py-12",children:[(0,ea.jsx)(Vj,{size:48,className:"text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-semibold text-slate-700",children:"No custom templates yet"}),(0,ea.jsx)("p",{className:"text-slate-500 text-center mt-1 mb-4",children:"Save your pages as templates or duplicate system templates to build your library"}),(0,ea.jsx)(sg,{onClick:()=>window.location.href="/pages",children:"Go to Pages"})]})}):(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:A.map(e=>(0,ea.jsx)(S,{template:e,isSystem:!1},e.template_id))})})]}),h&&(0,ea.jsx)(uZ,{template:h,onClose:()=>x(null),onUse:()=>{window.location.href="/pages/new?template=".concat(h.template_id)}}),(0,ea.jsx)(Ok,{open:!!p,onOpenChange:()=>g(null),children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:null!==p&&void 0!==p&&p.isSystem?"Delete System Template":"Delete Template"})}),(0,ea.jsxs)("p",{className:"text-slate-600",children:['Are you sure you want to delete "',null===p||void 0===p?void 0:p.name,'"?',(null===p||void 0===p?void 0:p.isSystem)&&(0,ea.jsx)("span",{className:"block mt-2 text-amber-600 font-medium",children:"\u26a0\ufe0f This is a system template and will be removed from all accounts."}),"This action cannot be undone."]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>g(null),children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:()=>{null!==p&&void 0!==p&&p.isSystem?(async e=>{try{await _l.delete("/templates/".concat(e)),l(d(d({},n),{},{system:n.system.filter(t=>t.template_id!==e)})),qs.success("System template deleted"),g(null)}catch(a){var t,s;console.error("Failed to delete system template:",a),qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to delete system template")}})(null===p||void 0===p?void 0:p.template_id):(async e=>{try{await _l.delete("/templates/".concat(e)),l(d(d({},n),{},{custom:n.custom.filter(t=>t.template_id!==e)})),qs.success("Template deleted"),g(null)}catch(t){console.error("Failed to delete template:",t),qs.error("Failed to delete template")}})(null===p||void 0===p?void 0:p.template_id)},children:"Delete"})]})]})}),(0,ea.jsx)(Ok,{open:!!y,onOpenChange:()=>N(null),children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Kl,{className:"text-emerald-600",size:20}),"Edit System Template"]})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"template-name",children:"Template Name *"}
2),(0,ea.jsx)(BN,{id:"template-name",placeholder:"e.g., Modern Landing Page",value:w.name,onChange:e=>C(d(d({},w),{},{name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"template-description",children:"Description"}),(0,ea.jsx)(YN,{id:"template-description",placeholder:"Brief description of the template...",value:w.description,onChange:e=>C(d(d({},w),{},{description:e.target.value})),rows:3})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"template-category",children:"Category"}),(0,ea.jsxs)(eb,{value:w.category,onValueChange:e=>C(d(d({},w),{},{category:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select category"})}),(0,ea.jsx)(lb,{children:Object.entries(UZ).map(e=>{let[t,s]=e;return(0,ea.jsx)(rb,{value:t,children:s},t)})})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"template-thumbnail",children:"Thumbnail URL (optional)"}),(0,ea.jsx)(BN,{id:"template-thumbnail",placeholder:"https://example.com/thumbnail.jpg",value:w.thumbnail_url,onChange:e=>C(d(d({},w),{},{thumbnail_url:e.target.value}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Provide a preview image URL for the template"})]}),(0,ea.jsx)("div",{className:"p-3 bg-blue-50 rounded-lg border border-blue-200",children:(0,ea.jsxs)("p",{className:"text-sm text-blue-800",children:[(0,ea.jsx)("strong",{children:"Tip:"})," To edit the template content, create a page from this template, make your changes, then save it as a new system template."]})})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>N(null),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{try{if(y){const e=await _l.put("/templates/".concat(y.template_id),w);l(d(d({},n),{},{system:n.system.map(t=>t.template_id===y.template_id?e.data:t)})),qs.success("System template updated"),N(null)}}catch(s){var e,t;console.error("Failed to save system template:",s),qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save system template")}},disabled:!w.name.trim(),className:"bg-emerald-600 hover:bg-emerald-700",children:"Update Template"})]})]})}),(0,ea.jsx)(hZ,{open:f,onClose:()=>v(!1),onImported:e=>{l(d(d({},n),{},{custom:[...n.custom,{template_id:e.template_id,name:e.name,description:"Imported HTML template",category:"other",blocks:e.blocks,is_system:!1}]}))}}),(0,ea.jsx)(IZ,{isOpen:b,onClose:()=>j(!1),onImportComplete:e=>{l(d(d({},n),{},{custom:[...n.custom,{template_id:e.template_id,name:e.name,description:"Vision-imported template",category:"imported",blocks:e.blocks,is_system:!1}]})),j(!1)}})]})]})},WZ=()=>(0,ea.jsxs)("div",{className:"flex","data-testid":"api-docs-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,ea.jsxs)("div",{className:"mb-8",children:[(0,ea.jsx)("h1",{className:"text-4xl font-bold mb-4",style:{fontFamily:"Manrope, sans-serif"},children:"API Documentation"}),(0,ea.jsx)("p",{className:"text-lg text-slate-600",children:"Use the NexusCMS REST API to build custom integrations and headless applications."})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mb-8",children:[(0,ea.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Authentication"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-4",children:"All API requests require authentication using a Bearer token. Include the token in the Authorization header:"}),(0,ea.jsx)("div",{className:"bg-slate-900 text-slate-100 p-4 rounded-lg font-mono text-sm",children:"Authorization: Bearer YOUR_ACCESS_TOKEN"})]}),[{category:"Authentication",routes:[{method:"POST",path:"/api/auth/register",description:"Register new user and create tenant"},{method:"POST",path:"/api/auth/login",description:"User login"},{method:"GET",path:"/api/auth/me",description:"Get current user info"}]},{category:"Pages",routes:[{method:"GET",path:"/api/pages",description:"Get all pages for tenant"},{method:"POST",path:"/api/pages",description:"Create new page"},{method:"GET",path:"/api/pages/{page_id}
2",description:"Get page by ID"},{method:"PUT",path:"/api/pages/{page_id}",description:"Update page"},{method:"DELETE",path:"/api/pages/{page_id}",description:"Delete page"}]},{category:"Newsletters",routes:[{method:"GET",path:"/api/newsletters",description:"Get all newsletters"},{method:"POST",path:"/api/newsletters",description:"Create newsletter"},{method:"GET",path:"/api/newsletters/{id}",description:"Get newsletter by ID"},{method:"PUT",path:"/api/newsletters/{id}",description:"Update newsletter"},{method:"POST",path:"/api/newsletters/{id}/send",description:"Send newsletter to recipients"}]},{category:"Media",routes:[{method:"GET",path:"/api/media",description:"Get all media files"},{method:"POST",path:"/api/media/upload",description:"Upload media file"},{method:"DELETE",path:"/api/media/{media_id}",description:"Delete media file"}]}].map(e=>(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 mb-6",children:[(0,ea.jsx)("h2",{className:"text-2xl font-semibold mb-6",style:{fontFamily:"Manrope, sans-serif"},children:e.category}),(0,ea.jsx)("div",{className:"space-y-4",children:e.routes.map((e,t)=>(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,ea.jsx)("span",{className:"px-3 py-1 rounded text-xs font-semibold ".concat("GET"===e.method?"bg-blue-100 text-blue-700":"POST"===e.method?"bg-emerald-100 text-emerald-700":"PUT"===e.method?"bg-amber-100 text-amber-700":"bg-red-100 text-red-700"),children:e.method}),(0,ea.jsx)("code",{className:"text-sm font-mono",children:e.path})]}),(0,ea.jsx)("p",{className:"text-slate-600 text-sm",children:e.description})]},t))})]},e.category)),(0,ea.jsx)("div",{className:"bg-indigo-50 border border-indigo-200 rounded-xl p-6",children:(0,ea.jsxs)("div",{className:"flex gap-4",children:[(0,ea.jsx)(kE,{size:24,className:"text-indigo-600 flex-shrink-0"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"font-semibold text-indigo-900 mb-2",children:"Need More Details?"}),(0,ea.jsx)("p",{className:"text-indigo-700 text-sm",children:"For detailed request/response schemas, code examples, and interactive API testing, check out our full API documentation."})]})]})})]})})]}),VZ=Vl("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"}]]),qZ=()=>{const e=be(),[s,a]=(0,t.useState)([]),[n,l]=(0,t.useState)(!0),[r,i]=(0,t.useState)(""),[o,c]=(0,t.useState)("all"),[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(""),[p,g]=(0,t.useState)(""),[f,v]=(0,t.useState)(null);(0,t.useEffect)(()=>{b()},[]);const b=async()=>{try{const e=await _l.get("/forms");a(e.data)}catch(e){qs.error("Failed to fetch forms")}finally{l(!1)}},j=s.filter(e=>{const t=r.toLowerCase(),s=e.name.toLowerCase().includes(t)||e.internal_name&&e.internal_name.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t),a="all"===o||e.status===o;return s&&a});return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"p-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Form Builder"}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Create forms and capture submission data"})]}),(0,ea.jsxs)(sg,{onClick:()=>m(!0),className:"bg-indigo-600 hover:bg-indigo-700",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"})," New Form"]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ea.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search forms...",value:r,onChange:e=>i(e.target.value),className:"pl-10"})]}),(0,ea.jsxs)(eb,{value:o,onValueChange:c,children:[(0,ea.jsxs)(sb,{className:"w-40",children:[(0,ea.jsx)(kD,{size:16,className:"mr-2 text-slate-400"}),(0,ea.jsx)(tb,{placeholder:"Status"})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Status"}),(0,ea.jsx)(rb,{value:"active",children:"Active"}),(0,ea.jsx)(rb,{value:"inactive",children:"Inactive"})]})]})]}),n?(0,ea.jsx)("div",{className:"text-center py-12 text-slate-500",children:"Loading forms..."}):0===j.length?(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"flex flex-col items-center justify-center py-16",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mb-4",children:(0,ea.jsx)(VZ,{size:32,className:"text-slate-400"})}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:r||"all"!==o?"No forms found":"No forms yet"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4 text-center max-w-md",children:r||"all"!==o?"Try adjusting your search or filters":"Create your first form to start collecting data from your visitors"}),!r&&"all"===o&&(0,ea.jsxs)(sg,{onClick:()=>m(!0),children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"})," Create Your First Form"]})]})}):(0,ea.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Form Name"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Fields"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Submissions"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Created"}),(0,ea.jsx)("th",{className:"text-right px-4 py-3 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{children:j.map(t=>{var n,l;return(0,ea.jsxs)("tr",{className:"border-b border-slate-100 hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(qN,{size:20,className:"text-indigo-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"font-medium text-slate-900","data-testid":"form-list-name-".concat(t.form_id),children:t.internal_name||t.name}),t.internal_name&&(0,ea.jsxs)("div",{className:"text-xs text-slate-400",children:["Public: ",t.name]}),t.description&&(0,ea.jsx)("div",{className:"text-sm text-slate-500 truncate max-w-xs",children:t.description})]})]})}),(0,ea.jsxs)("td",{className:"px-4 py-3 text-slate-600",children:[(null===(n=t.fields)||void 0===n?void 0:n.length)||0," fields"]}),(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsxs)("button",{onClick:()=>e("/forms/".concat(t.form_id,"/submissions")),className:"text-indigo-600 hover:text-indigo-800 font-medium",children:[t.submission_count||0," submissions"]})}),(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsx)(EC,{variant:"active"===t.status?"default":"secondary",children:"active"===t.status?"Active":"Inactive"})}),(0,ea.jsx)("td",{className:"px-4 py-3 text-slate-600",children:(l=t.created_at,new Date(l).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}))}),(0,ea.jsx)("td",{className:"px-4 py-3 text-right",children:(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",children:(0,ea.jsx)(KJ,{size:16})})}),(0,ea.jsxs)(Bp,{align:"end",children:[(0,ea.jsxs)(Rp,{onClick:()=>e("/forms/".concat(t.form_id)),children:[(0,ea.jsx)(ND,{size:16,className:"mr-2"})," Edit Form"]}),(0,ea.jsxs)(Rp,{onClick:()=>e("/forms/".concat(t.form_id,"/submissions")),children:[(0,ea.jsx)(IN,{size:16,className:"mr-2"})," View Submissions"]}),(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{try{const t=await _l.post("/forms",{name:"".concat(e.name," (Copy)"),internal_name:e.internal_name?"".concat(e.internal_name,"
2(Copy)"):void 0,description:e.description,fields:e.fields,success_message:e.success_message,submit_button_text:e.submit_button_text,status:"active"});a([t.data,...s]),qs.success("Form duplicated successfully")}catch(t){qs.error("Failed to duplicate form")}})(t),children:[(0,ea.jsx)(DD,{size:16,className:"mr-2"})," Duplicate"]}),(0,ea.jsx)(Ip,{}),(0,ea.jsx)(Rp,{onClick:()=>(async e=>{const t="active"===e.status?"inactive":"active";try{await _l.put("/forms/".concat(e.form_id),{status:t}),a(s.map(s=>s.form_id===e.form_id?d(d({},s),{},{status:t}):s)),qs.success("Form ".concat("active"===t?"activated":"deactivated"))}catch(n){qs.error("Failed to update form status")}})(t),children:"active"===t.status?"Deactivate":"Activate"}),(0,ea.jsxs)(Rp,{className:"text-red-600",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this form and all its submissions?"))try{await _l.delete("/forms/".concat(e)),a(s.filter(t=>t.form_id!==e)),qs.success("Form deleted successfully")}catch(t){qs.error("Failed to delete form")}})(t.form_id),children:[(0,ea.jsx)(wD,{size:16,className:"mr-2"})," Delete"]})]})]})})]},t.form_id)})})]})}),(0,ea.jsx)(Ok,{open:u,onOpenChange:m,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Create New Form"}),(0,ea.jsx)(Gk,{children:"Give your form a name and optional description"})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"formName",children:"Form Name *"}),(0,ea.jsx)(BN,{id:"formName",placeholder:"Contact Form, Survey, Registration...",value:h,onChange:e=>x(e.target.value),className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"formDescription",children:"Description (optional)"}),(0,ea.jsx)(YN,{id:"formDescription",placeholder:"What is this form for?",value:p,onChange:e=>g(e.target.value),className:"mt-1",rows:3})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>m(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(h.trim())try{const t=await _l.post("/forms",{name:h,description:p,fields:[],status:"active"});a([t.data,...s]),m(!1),x(""),g(""),qs.success("Form created successfully"),e("/forms/".concat(t.data.form_id))}catch(t){qs.error("Failed to create form")}else qs.error("Please enter a form name")},className:"bg-indigo-600 hover:bg-indigo-700",children:"Create Form"})]})]})})]})})},$Z=[{value:"text",label:"Text Input",icon:"\ud83d\udcdd"},{value:"email",label:"Email",icon:"\ud83d\udce7"},{value:"textarea",label:"Text Area",icon:"\ud83d\udcc4"},{value:"number",label:"Number",icon:"\ud83d\udd22"},{value:"select",label:"Dropdown",icon:"\ud83d\udccb"},{value:"radio",label:"Radio Buttons",icon:"\ud83d\udd18"},{value:"checkbox",label:"Checkboxes",icon:"\u2611\ufe0f"},{value:"date",label:"Date",icon:"\ud83d\udcc5"},{value:"phone",label:"Phone",icon:"\ud83d\udcde"},{value:"recipient_select",label:"Recipient Dropdown",icon:"\ud83d\udc64"}],GZ=e=>{let{fieldId:s,options:a,onUpdate:n}=e;const[l,r]=(0,t.useState)((a||[]).join("\n"));return(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Options (one per line)"}),(0,ea.jsx)(YN,{value:l,onChange:e=>r(e.target.value),onBlur:()=>{const e=l.split("\n").filter(e=>e.trim());n(s,{options:e})},placeholder:"Option 1\nOption 2\nOption 3",className:"mt-1",rows:4,"data-testid":"field-options-".concat(s)})]})},KZ=e=>{let{field:t,index:s,onUpdate:a,onDelete:n,isExpanded:l,onToggle:r}=e;const{attributes:i,listeners:o,setNodeRef:c,transform:u,transition:m,isDragging:h}=gE({id:t.field_id}),x={transform:i_.Transform.toString(u),transition:m,opacity:h?.5:1},p=$Z.find(e=>e.value===t.type)||$Z[0];return(0,ea.jsx)("div",{ref:c,style:x,className:"bg-white border border-slate-200 rounded-lg mb-3",children:(0,ea.jsxs)(kY,{open:l,onOpenChange:r,children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 p-3 border-b border-slate-100",children:[(0,ea.jsx)("div",d(d(d({},i),o),{},{className:"cursor-grab active:cursor-grabbing p-1 hover:bg-slate-100 rounded",children:(0,ea.jsx)(yE,{size:16,className:"text-slate-400"})})),(0,ea.jsx)("span",{className:"text-lg",children:p.icon}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)("span",{className:"font-medium text-slate-900",children:t.label||"Untitled Field"}),(0,ea.jsx)(EC,{variant:"outline",className:"ml-2 text-xs",children:p.label}),t.required&&(0,ea.jsx)(EC,{className:"ml-2 text-xs bg-red-100 text-red-700",children:"Required"})]}),(0,ea.jsx)(DY,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",children:l?(0,ea.jsx)(er,{size:16}):(0,ea.jsx)(tr,{size:16})})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>n(t.field_id),className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsx)(_Y,{children:(0,ea.jsxs)("div",{className:"p-4 space-y-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Field Label *"}),(0,ea.jsx)(BN,{value:t.label,onChange:e=>a(t.field_id,{label:e.target.value}),placeholder:"Enter field label",className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Field Type"}),(0,ea.jsxs)(eb,{value:t.type,onValueChange:e=>a(t.field_id,{type:e}),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:$Z.map(e=>(0,ea.jsxs)(rb,{value:e.value,children:[(0,ea.jsx)("span",{className:"mr-2",children:e.icon})," ",e.label]},e.value))})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Placeholder Text"}),(0,ea.jsx)(BN,{value:t.placeholder||"",onChange:e=>a(t.field_id,{placeholder:e.target.value}),placeholder:"Enter placeholder text",className:"mt-1"})]}),["select","radio","checkbox"].includes(t.type)&&(0,ea.jsx)(GZ,{fieldId:t.field_id,options:t.options,onUpdate:a}),(0,ea.jsxs)("div",{className:"flex items-center gap-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:t.required,onCheckedChange:e=>a(t.field_id,{required:e})}),(0,ea.jsx)(tf,{children:"Required"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(tf,{children:"Width:"}),(0,ea.jsxs)(eb,{value:t.width||"full",onValueChange:e=>a(t.field_id,{width:e}),children:[(0,ea.jsx)(sb,{className:"w-32",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"full",children:"Full Width"}),(0,ea.jsx)(rb,{value:"half",children:"Half Width"})]})]})]})]})]})})]})})},YZ=()=>({use_site_theme:!0,background_color:"#ffffff",text_color:"#1e293b",label_color:"#374151",input_background:"#ffffff",input_border_color:"#d1d5db",input_text_color:"#1e293b",button_color:"#4f46e5",button_text_color:"#ffffff",button_hover_color:"#4338ca",border_radius:"8px",padding:"24px",font_family:"inherit"}),JZ=()=>
2{var e,s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N,w;const{id:C}=je(),k=be(),[D,_]=(0,t.useState)(null),[S,E]=(0,t.useState)(!0),[A,F]=(0,t.useState)(!1),[T,z]=(0,t.useState)(new Set),[M,P]=(0,t.useState)(!1),[B,R]=(0,t.useState)([]),L=N_(y_(pS),y_(dS,{coordinateGetter:bE}));(0,t.useEffect)(()=>{O(),I()},[C]);const I=async()=>{try{const e=await _l.get("/subscriber-groups");R(e.data||[])}catch(G2){}},O=async()=>{try{var e;const t=await _l.get("/forms/".concat(C));_(t.data),(null===(e=t.data.fields)||void 0===e?void 0:e.length)>0&&z(new Set([t.data.fields[0].field_id]))}catch(t){qs.error("Failed to load form"),k("/forms")}finally{E(!1)}},U=(e,t)=>{_(d(d({},D),{},{fields:D.fields.map(s=>s.field_id===e?d(d({},s),t):s)}))},H=e=>{_(d(d({},D),{},{fields:D.fields.filter(t=>t.field_id!==e)}))};return S?(0,ea.jsx)(PQ,{children:(0,ea.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading form..."})})}):(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"p-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)(sg,{variant:"ghost",onClick:()=>k("/forms"),children:[(0,ea.jsx)(_j,{size:18,className:"mr-2"})," Back"]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-xl font-bold text-slate-900",children:D.name}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[D.fields.length," fields \xb7 ",D.submission_count," submissions"]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>P(!M),children:[(0,ea.jsx)(IN,{size:18,className:"mr-2"})," ",M?"Edit":"Preview"]}),(0,ea.jsx)(sg,{variant:"outline",onClick:()=>k("/forms/".concat(C,"/submissions")),children:"View Submissions"}),(0,ea.jsxs)(sg,{onClick:async()=>{F(!0);try{await _l.put("/forms/".concat(C),D),qs.success("Form saved successfully")}catch(e){qs.error("Failed to save form")}finally{F(!1)}},disabled:A,className:"bg-indigo-600 hover:bg-indigo-700",children:[(0,ea.jsx)(BD,{size:18,className:"mr-2"})," ",A?"Saving...":"Save"]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-6",children:[(0,ea.jsx)("div",{className:"col-span-2",children:M?(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:D.name}),D.description&&(0,ea.jsx)("p",{className:"text-slate-500",children:D.description})]}),(0,ea.jsx)(dD,{children:(0,ea.jsxs)("div",{className:"space-y-4",children:[D.fields.map(e=>(0,ea.jsxs)("div",{className:"half"===e.width?"w-1/2 inline-block pr-2":"w-full",children:[(0,ea.jsxs)(tf,{className:"mb-1 block",children:[e.label," ",e.required&&(0,ea.jsx)("span",{className:"text-red-500",children:"*"})]}),"textarea"===e.type?(0,ea.jsx)(YN,{placeholder:e.placeholder,disabled:!0}):"select"===e.type?(0,ea.jsx)(eb,{disabled:!0,children:(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:e.placeholder||"Select..."})})}):"recipient_select"===e.type?(0,ea.jsxs)(eb,{disabled:!0,children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:e.placeholder||"Select recipient..."})}),(0,ea.jsx)(lb,{children:(D.recipients||[]).map((e,t)=>(0,ea.jsx)(rb,{value:e.name,children:e.name},t))})]}):"radio"===e.type?(0,ea.jsx)("div",{className:"space-y-2",children:(e.options||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"radio",disabled:!0})," ",(0,ea.jsx)("span",{children:e})]},t))}):"checkbox"===e.type?(0,ea.jsx)("div",{className:"space-y-2",children:(e.options||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"checkbox",disabled:!0})," ",(0,ea.jsx)("span",{children:e})]},t))}):(0,ea.jsx)(BN,{type:e.type,placeholder:e.placeholder,disabled:!0})]},e.field_id)),(0,ea.jsx)(sg,{className:"mt-4",disabled:!0,children:D.submit_button_text})]})})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(rD,{className:"mb-4",children:[(0,ea.jsx)(iD,{className:"pb-2",children:(0,ea.jsx)(oD,{className:"text-lg",children:"Form Fields"})}),(0,ea.jsx)(dD,{children:0===D.fields.length?(0,ea.jsx)("div",{className:"text-center py-8 text-slate-500",children:(0,ea.jsx)("p",{className:"mb-4",children:"No fields yet. Add your first field to get started."})}):(0,ea.jsx)(YS,{sensors:L,collisionDetection:A_,onDragEnd:e=>{const{active:t,over:s}=e;
2if(t.id!==s.id){const e=D.fields.findIndex(e=>e.field_id===t.id),a=D.fields.findIndex(e=>e.field_id===s.id);_(d(d({},D),{},{fields:tE(D.fields,e,a).map((e,t)=>d(d({},e),{},{order:t}))}))}},children:(0,ea.jsx)(cE,{items:D.fields.map(e=>e.field_id),strategy:rE,children:D.fields.map((e,t)=>(0,ea.jsx)(KZ,{field:e,index:t,onUpdate:U,onDelete:H,isExpanded:T.has(e.field_id),onToggle:()=>(e=>{const t=new Set(T);t.has(e)?t.delete(e):t.add(e),z(t)})(e.field_id)},e.field_id))})})})]}),(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{className:"pb-2",children:(0,ea.jsx)(oD,{className:"text-lg",children:"Add Field"})}),(0,ea.jsx)(dD,{children:(0,ea.jsx)("div",{className:"grid grid-cols-3 gap-2",children:$Z.map(e=>(0,ea.jsxs)(sg,{variant:"outline",className:"justify-start",onClick:()=>function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"text";const t="field_".concat(Date.now()),s={field_id:t,type:e,label:"",placeholder:"",required:!1,options:[],order:D.fields.length,width:"full"};_(d(d({},D),{},{fields:[...D.fields,s]})),z(new Set([...T,t]))}(e.value),children:[(0,ea.jsx)("span",{className:"mr-2",children:e.icon})," ",e.label]},e.value))})})]})]})}),(0,ea.jsxs)("div",{className:"col-span-1",children:[(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Oj,{size:18})," Form Settings"]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{children:["Internal Name ",(0,ea.jsx)("span",{className:"text-slate-400 font-normal",children:"(admin only)"})]}),(0,ea.jsx)(BN,{value:D.internal_name||"",onChange:e=>_(d(d({},D),{},{internal_name:e.target.value})),className:"mt-1",placeholder:"e.g. Contact Form \u2014 Homepage v2","data-testid":"form-internal-name-input"}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-500 mt-1",children:"Shown in the admin Forms list. Never displayed on the public form."})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{children:["Form Name ",(0,ea.jsx)("span",{className:"text-slate-400 font-normal",children:"(public)"})]}),(0,ea.jsx)(BN,{value:D.name,onChange:e=>_(d(d({},D),{},{name:e.target.value})),className:"mt-1","data-testid":"form-public-name-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Description"}),(0,ea.jsx)(YN,{value:D.description||"",onChange:e=>_(d(d({},D),{},{description:e.target.value})),className:"mt-1",rows:2})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Submit Button Text"}),(0,ea.jsx)(BN,{value:D.submit_button_text,onChange:e=>_(d(d({},D),{},{submit_button_text:e.target.value})),className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Success Message"}),(0,ea.jsx)(YN,{value:D.success_message,onChange:e=>_(d(d({},D),{},{success_message:e.target.value})),className:"mt-1",rows:2})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Notification Email (optional)"}),(0,ea.jsx)(BN,{type:"email",value:D.notify_email||"",onChange:e=>_(d(d({},D),{},{notify_email:e.target.value})),placeholder:"Receive email on submission",className:"mt-1"})]}),(0,ea.jsxs)("div",{className:"border-t pt-4",children:[(0,ea.jsx)(tf,{className:"text-base font-semibold",children:"Recipient Dropdown Options"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"Add people who can receive form submissions. Users can select from this list when submitting the form."}),(D.recipients||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex gap-2 mb-2",children:[(0,ea.jsx)(BN,{value:e.name,onChange:e=>{const s=[...D.recipients||[]];s[t]=d(d({},s[t]),{},{name:e.target.value}),_(d(d({},D),{},{recipients:s}))},placeholder:"Name (shown to user)",className:"flex-1"}),(0,ea.jsx)(BN,{type:"email",value:e.email,onChange:e=>{const s=[...D.recipients||[]];s[t]=d(d({},s[t]),{},{email:e.target.value}),_(d(d({},D),{},{recipients:s}))},placeholder:"Email address",className:"flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{const e=(D.recipients||[]).filter((e,s)=>s!==t);_(d(d({},D),{},{recipients:e}))},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]},t)),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{const e=[...D.recipients||[],{name:"",email:""}];_(d(d({},D),{},{recipients:e}))},className:"mt-2",children:[(0,ea.jsx)(Vj,{size:16,className:"mr-1"})," Add Recipient"]}),(D.recipients||[]).length>0&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-2",children:'Add a "Recipient Dropdown" field to let users select who to send the form to.'})]}),(0,ea.jsxs)("div",{className:"border-t pt-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-base font-semibold",children:"Add to Newsletter Subscribers"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1 max-w-xs",children:"When someone submits this form, add them to your newsletter subscriber list."})]}),(0,ea.jsx)(wb,{checked:!!D.add_to_subscriber_groups,onCheckedChange:e=>_(d(d({},D),{},{add_to_subscriber_groups:e})),"data-testid":"form-add-subscriber-toggle"})]}),D.add_to_subscriber_groups&&(0,ea.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Add subscribers to these list(s)"}),0===B.length?(0,ea.jsxs)("p",{className:"text-xs text-amber-600 mt-1",children:["No subscriber lists yet. Create one under ",(0,ea.jsx)("strong",{children:"Newsletter \u2192 Subscribers"})," first, then come back."]}):(0,ea.jsx)("div",{className:"mt-1 space-y-1.5 max-h-40 overflow-y-auto border rounded-lg p-2",children:B.map(e=>{const t=e.group_id,s=(D.subscriber_group_ids||[]).includes(t);return(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer","data-testid":"form-group-option-".concat(t),children:[(0,ea.jsx)("input",{type:"checkbox",checked:s,onChange:e=>{const s=new Set(D.subscriber_group_ids||[]);e.target.checked?s.add(t):s.delete(t),_(d(d({},D),{},{subscriber_group_ids:Array.from(s)}))}}),(0,ea.jsx)("span",{children:e.name}),"number"===typeof e.subscriber_count&&(0,ea.jsxs)("span",{className:"text-xs text-slate-400",children:["(",e.subscriber_count,")"]})]},t)})})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Which field holds the email address?"}),(0,ea.jsxs)("select",{value:D.email_field_id||"",onChange:e=>_(d(d({},D),{},{email_field_id:e.target.value||null})),className:"mt-1 w-full border border-slate-300 rounded-md px-3 py-2 text-sm","data-testid":"form-email-field-select",children:[(0,ea.jsx)("option",{value:"",children:"Auto-detect (first Email field)"}),(D.fields||[]).map(e=>(0,ea.jsxs)("option",{value:e.field_id,children:[e.label||e.field_id,"email"===e.type?" (email)":""]},e.field_id))]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:["Tip: for reliable detection, add an ",(0,ea.jsx)("strong",{children:"Email"}
2)," type field to this form."]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm",children:"Which field holds their name? (optional)"}),(0,ea.jsxs)("select",{value:D.name_field_id||"",onChange:e=>_(d(d({},D),{},{name_field_id:e.target.value||null})),className:"mt-1 w-full border border-slate-300 rounded-md px-3 py-2 text-sm","data-testid":"form-name-field-select",children:[(0,ea.jsx)("option",{value:"",children:"Auto-detect"}),(D.fields||[]).map(e=>(0,ea.jsx)("option",{value:e.field_id,children:e.label||e.field_id},e.field_id))]})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{children:"Form Status"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:"active"===D.status,onCheckedChange:e=>_(d(d({},D),{},{status:e?"active":"inactive"}))}),(0,ea.jsx)("span",{className:"text-sm text-slate-600",children:"active"===D.status?"Active":"Inactive"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between border-t pt-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Ask for preferred language"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1 max-w-xs",children:"Shows a language dropdown so subscribers choose which language to receive newsletters in."})]}),(0,ea.jsx)(wb,{checked:!!D.collect_language_preference,onCheckedChange:e=>_(d(d({},D),{},{collect_language_preference:e})),"data-testid":"form-collect-language-toggle"})]})]})]}),(0,ea.jsxs)(rD,{className:"mt-4",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(DD,{size:18})," Embed Form"]})}),(0,ea.jsxs)(dD,{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-2",children:"Use this form in your pages by adding a Form block in the page editor and selecting this form."}),(0,ea.jsxs)("div",{className:"bg-slate-100 p-2 rounded text-xs font-mono",children:["Form ID: ",D.form_id]})]})]}),(0,ea.jsxs)(rD,{className:"mt-4",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Dw,{size:18})," Form Styling"]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{children:"Use Site Theme"}),(0,ea.jsx)(wb,{checked:!1!==(null===(e=D.styles)||void 0===e?void 0:e.use_site_theme),onCheckedChange:e=>_(d(d({},D),{},{styles:d(d(d({},YZ()),D.styles),{},{use_site_theme:e})}))})]}),!1===(null===(s=D.styles)||void 0===s?void 0:s.use_site_theme)&&(0,ea.jsxs)("div",{className:"space-y-4 pt-2 border-t border-slate-100",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold text-slate-700 mb-2 block",children:"Layout"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Form Layout"}),(0,ea.jsxs)(eb,{value:(null===(a=D.styles)||void 0===a?void 0:a.layout)||"stacked",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{layout:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"stacked",children:"Stacked (1 Column)"}),(0,ea.jsx)(rb,{value:"two-column",children:"2 Columns"}),(0,ea.jsx)(rb,{value:"three-column",children:"3 Columns"}),(0,ea.jsx)(rb,{value:"inline",children:"Inline"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Form Width"}),(0,ea.jsxs)(eb,{value:(null===(n=D.styles)||void 0===n?void 0:n.formWidth)||"100",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{formWidth:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"50",children:"50%"}),(0,ea.jsx)(rb,{value:"60",children:"60%"}),(0,ea.jsx)(rb,{value:"70",children:"70%"}),(0,ea.jsx)(rb,{value:"80",children:"80%"}),(0,ea.jsx)(rb,{value:"90",children:"90%"}),(0,ea.jsx)(rb,{value:"100",children:"100%"})]})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold text-slate-700 mb-2 block",children:"Fields"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Size"}),(0,ea.jsxs)(eb,{value:(null===(l=D.styles)||void 0===l?void 0:l.fieldSize)||"md",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{fieldSize:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"sm",children:"Small"}),(0,ea.jsx)(rb,{value:"md",children:"Medium"}),(0,ea.jsx)(rb,{value:"lg",children:"Large"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Corners"}),(0,ea.jsxs)(eb,{value:(null===(r=D.styles)||void 0===r?void 0:r.fieldRadius)||"rounded",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{fieldRadius:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"Square"}),(0,ea.jsx)(rb,{value:"rounded",children:"Rounded"}),(0,ea.jsx)(rb,{value:"pill",children:"Pill"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Spacing"}),(0,ea.jsxs)(eb,{value:(null===(i=D.styles)||void 0===i?void 0:i.fieldGap)||"16",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{fieldGap:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"8",children:"Compact"}),(0,ea.jsx)(rb,{value:"16",children:"Normal"}),(0,ea.jsx)(rb,{value:"24",children:"Spacious"})]})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold text-slate-700 mb-2 block",children:"Button"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Width"}),(0,ea.jsxs)(eb,{value:(null===(o=D.styles)||void 0===o?void 0:o.buttonWidth)||"full",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{buttonWidth:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto"}),(0,ea.jsx)(rb,{value:"50",children:"50%"}),(0,ea.jsx)(rb,{value:"75",children:"75%"}),(0,ea.jsx)(rb,{value:"full",children:"Full"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Style"}),(0,ea.jsxs)(eb,{value:(null===(c=D.styles)||void 0===c?void 0:c.buttonStyle)||"solid",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{buttonStyle:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"solid",children:"Solid"}),(0,ea.jsx)(rb,{value:"outline",children:"Outline"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Align"}),(0,ea.jsxs)(eb,{value:(null===(u=D.styles)||void 0===u?void 0:u.buttonAlign)||"left",onValueChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{buttonAlign:e})})),children:[(0,ea.jsx)(sb,{className:"mt-1 h-8 text-xs",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs font-semibold text-slate-700 mb-2 block",children:"Colors"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Backgroun
2d"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("input",{type:"color",value:(null===(m=D.styles)||void 0===m?void 0:m.background_color)||"#ffffff",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{background_color:e.target.value})})),className:"w-8 h-8 rounded border cursor-pointer"}),(0,ea.jsx)(BN,{value:(null===(h=D.styles)||void 0===h?void 0:h.background_color)||"#ffffff",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{background_color:e.target.value})})),className:"flex-1 text-xs h-8"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Label Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("input",{type:"color",value:(null===(x=D.styles)||void 0===x?void 0:x.label_color)||"#374151",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{label_color:e.target.value})})),className:"w-8 h-8 rounded border cursor-pointer"}),(0,ea.jsx)(BN,{value:(null===(p=D.styles)||void 0===p?void 0:p.label_color)||"#374151",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{label_color:e.target.value})})),className:"flex-1 text-xs h-8"})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3 mt-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Button Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("input",{type:"color",value:(null===(g=D.styles)||void 0===g?void 0:g.button_color)||"#4f46e5",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{button_color:e.target.value})})),className:"w-8 h-8 rounded border cursor-pointer"}),(0,ea.jsx)(BN,{value:(null===(f=D.styles)||void 0===f?void 0:f.button_color)||"#4f46e5",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{button_color:e.target.value})})),className:"flex-1 text-xs h-8"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Button Text"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("input",{type:"color",value:(null===(v=D.styles)||void 0===v?void 0:v.button_text_color)||"#ffffff",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{button_text_color:e.target.value})})),className:"w-8 h-8 rounded border cursor-pointer"}),(0,ea.jsx)(BN,{value:(null===(b=D.styles)||void 0===b?void 0:b.button_text_color)||"#ffffff",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{button_text_color:e.target.value})})),className:"flex-1 text-xs h-8"})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3 mt-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Input Border"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("input",{type:"color",value:(null===(j=D.styles)||void 0===j?void 0:j.input_border_color)||"#d1d5db",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{input_border_color:e.target.value})})),className:"w-8 h-8 rounded border cursor-pointer"}),(0,ea.jsx)(BN,{value:(null===(y=D.styles)||void 0===y?void 0:y.input_border_color)||"#d1d5db",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{input_border_color:e.target.value})})),className:"flex-1 text-xs h-8"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)("input",{type:"color",value:(null===(N=D.styles)||void 0===N?void 0:N.text_color)||"#1e293b",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{text_color:e.target.value})})),className:"w-8 h-8 rounded border cursor-pointer"}),(0,ea.jsx)(BN,{value:(null===(w=D.styles)||void 0===w?void 0:w.text_color)||"#1e293b",onChange:e=>_(d(d({},D),{},{styles:d(d({},D.styles),{},{text_color:e.target.value})})),className:"flex-1 text-xs h-8"})]})]})]})]})]})]})]})]})]})]})})},QZ=()=>{var e,s,a,n,l;const{id:r}=je(),i=be(),[o,c]=(0,t.useState)({submissions:[],form:null,total:0,page:1,total_pages:1}),[u,m]=(0,t.useState)(!0),[h,x]=(0,t.useState)(1),[p,g]=(0,t.useState)(20),[f,v]=(0,t.useState)(""),[b,j]=(0,t.useState)(null);(0,t.useEffect)(()=>{y()},[r,h,p]);const y=async()=>{m(!0);try{const e=await _l.get("/forms/".concat(r,"/submissions?page=").concat(h,"&per_page=").concat(p));c(e.data)}catch(e){qs.error("Failed to load submissions"),i("/forms")}finally{m(!1)}},N=e=>
2new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}),w=e=>Array.isArray(e)?e.join(", "):"boolean"===typeof e?e?"Yes":"No":String(e||"-"),C=e=>{const t=e.notifications;return Array.isArray(t)&&0!==t.length?(0,ea.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,ea.jsxs)("div",{className:"flex flex-col",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,ea.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full ".concat("sent"===e.status?"bg-green-500":"bg-red-500")}),(0,ea.jsx)("span",{className:"text-slate-800 truncate max-w-[200px]",title:e.recipient,children:e.recipient})]}),(0,ea.jsx)("span",{className:"text-xs text-slate-400 ml-3",children:"sent"===e.status?N(e.sent_at):"Failed".concat(e.error?": "+e.error:"")})]},t))}):(0,ea.jsx)("span",{className:"text-slate-400",children:"Not forwarded"})},k=o.submissions.filter(e=>{if(!f)return!0;const t=f.toLowerCase();return Object.values(e.data||{}).some(e=>String(e).toLowerCase().includes(t))});return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"p-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)(sg,{variant:"ghost",onClick:()=>i("/forms"),children:[(0,ea.jsx)(_j,{size:18,className:"mr-2"})," Back"]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-xl font-bold text-slate-900",children:[(null===(e=o.form)||void 0===e?void 0:e.name)||"Form"," Submissions"]}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[o.total," total submissions"]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:y,children:[(0,ea.jsx)(gq,{size:18,className:"mr-2"})," Refresh"]}),(0,ea.jsx)(sg,{variant:"outline",onClick:()=>i("/forms/".concat(r)),children:"Edit Form"}),(0,ea.jsxs)(sg,{onClick:async()=>{try{const e=await _l.get("/forms/".concat(r,"/submissions/export")),{headers:t,rows:s,form_name:a}=e.data,n=[t.join(","),...s.map(e=>e.map(e=>'"'.concat(String(e).replace(/"/g,'""'),'"')).join(","))].join("\n"),l=new Blob([n],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(l),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download","".concat(a.replace(/\s+/g,"_"),"_submissions.csv")),document.body.appendChild(o),o.click(),document.body.removeChild(o),qs.success("Submissions exported")}catch(e){qs.error("Failed to export submissions")}},className:"bg-green-600 hover:bg-green-700",children:[(0,ea.jsx)(jj,{size:18,className:"mr-2"})," Export CSV"]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,ea.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,ea.jsx)(fj,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,ea.jsx)(BN,{placeholder:"Search submissions...",value:f,onChange:e=>v(e.target.value),className:"pl-10"})]}),(0,ea.jsxs)(eb,{value:String(p),onValueChange:e=>{g(Number(e)),x(1)},children:[(0,ea.jsx)(sb,{className:"w-32",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"10",children:"10 / page"}),(0,ea.jsx)(rb,{value:"20",children:"20 / page"}),(0,ea.jsx)(rb,{value:"50",children:"50 / page"}),(0,ea.jsx)(rb,{value:"100",children:"100 / page"})]})]})]}),u?(0,ea.jsx)("div",{className:"text-center py-12 text-slate-500",children:"Loading submissions..."}):0===k.length?(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"flex flex-col items-center justify-center py-16",children:[(0,ea.jsx)("div",{className:"text-4xl mb-4",children:"\ud83d\udced"}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:f?"No matching submissions":"No submissions yet"}),(0,ea.jsx)("p",{className:"text-slate-500 text-center max-w-md",children:f?"Try adjusting your search":"Submissions will appear here when visitors fill out your form"})]})}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden",children:(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Submitted"}),((null===(s=o.form)||void 0===s?void 0:s.fields)||[]).slice(0,4).map(e=>(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:e.label},e.field_id)),((null===(a=o.form)||void 0===a||null===(n=a.fields)||void 0===n?void 0:n.length)||0)>4&&(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"..."}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Forwarded to"}),(0,ea.jsx)("th",{className:"text-right px-4 py-3 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{children:k.map(e=>{var t,s,a;return(0,ea.jsxs)("tr",{className:"border-b border-slate-100 hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"px-4 py-3 text-sm text-slate-600",children:N(e.submitted_at)}),((null===(t=o.form)||void 0===t?void 0:t.fields)||[]).slice(0,4).map(t=>{var s;return(0,ea.jsx)("td",{className:"px-4 py-3 text-sm text-slate-900",children:(0,ea.jsx)("span",{className:"truncate max-w-xs block",children:w(null===(s=e.data)||void 0===s?void 0:s[t.field_id])})},t.field_id)}),((null===(s=o.form)||void 0===s||null===(a=s.fields)||void 0===a?void 0:a.length)||0)>4&&(0,ea.jsx)("td",{className:"px-4 py-3 text-sm text-slate-500",children:"..."}),(0,ea.jsx)("td",{className:"px-4 py-3 text-sm text-slate-600","data-testid":"submission-forwarded-".concat(e.submission_id),children:C(e)}),(0,ea.jsxs)("td",{className:"px-4 py-3 text-right",children:[(0,ea.jsxs)(sg,{variant:"ghost",size:"sm",onClick:()=>j(e),children:[(0,ea.jsx)(IN,{size:16,className:"mr-1"})," View"]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this submission?"))try{await _l.delete("/forms/".concat(r,"/submissions/").concat(e)),c(d(d({},o),{},{submissions:o.submissions.filter(t=>t.submission_id!==e),total:o.total-1})),qs.success("Submission deleted")}catch(t){qs.error("Failed to delete submission")}})(e.submission_id),children:(0,ea.jsx)(wD,{size:16})})]})]},e.submission_id)})})]})})}),o.total_pages>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-between mt-4",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Showing ",(h-1)*p+1," - ",Math.min(h*p,o.total)," of ",o.total]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",disabled:1===h,onClick:()=>x(h-1),children:[(0,ea.jsx)(vj,{size:16})," Previous"]}),(0,ea.jsxs)("span",{className:"px-3 text-sm text-slate-600",children:["Page ",h," of ",o.total_pages]}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",disabled:h===o.total_pages,onClick:()=>x(h+1),children:["Next ",(0,ea.jsx)(ax,{size:16})]})]})]})]}),(0,ea.jsx)(Ok,{open:!!b,onOpenChange:()=>j(null),children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Submission Details"})}),b&&(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"text-sm text-slate-500",children:["Submitted on ",N(b.submitted_at)]}),(0,ea.jsx)("div",{className:"divide-y divide-slate-100",children:((null===(l=o.form)||void 0===l?void 0:l.fields)||[]).map(e=>{var t;return(0,ea.jsxs)("div",{className:"py-3",children:[(0,ea.jsx)("div",{className:"text-sm font-medium text-slate-600",children:e.label}),(0,ea.jsx)("div",{className:"text-slate-900 mt-1",children:w(null===(t=b.data)||void 0===t?void 0:t[e.field_id])})]},e.field_id)})}),(0,ea.jsxs)("div",{className:"pt-2 border-t",children:[(0,ea.jsx)("div",{className:"text-sm font-medium text-slate-600 mb-2",children:"Email forwarding"}),C(b)]}),b.ip_address&&(0,ea.jsxs)("div",{className:"text-xs text-slate-400 pt-2 border-t",children:["IP: ",b.ip_address]})]})]})})]})})},XZ=(e,t)=>"nexus_popup_".concat(e,"_").concat(t);function ZZ(e){let{popup:s,onClose:a}=e;const[n,l]=(0,t.useState)({}),[r,i]=(0,t.useState)(!1),[o,c]=(0,t.useState)(!1);return o?(0,ea.jsxs)("div",{className:"text-center py-6",children:[(0,ea.jsx)("p",{className:"text-lg font-semibold text-gray-800",children:s.form_success_message||"Thank you!"}),(0,ea.jsx)("button",{onClick:a,className:"mt-4 text-sm text-gray-500 hover:text-gray-800 underline",children:"Close"})]}):(0,ea.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),i(!0);try{await fetch("".concat("","/api/public/forms/").concat(s.form_id,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fields:Object.entries(n).map(e=>{let[t,s]=e;return{label:t,value:s}})})}),c(!0)}catch(t){}finally{i(!1)}},className:"space-y-4",children:[(s.form_fields||[]).map((e,t)=>(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[e.label,e.required&&(0,ea.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),"textarea"===e.type?(0,ea.jsx)("textarea",{className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",rows:3,required:e.required,value:n[e.label]||"",onChange:t=>l(s=>d(d({},s),{},{[e.label]:t.target.value}))}):(0,ea.jsx)("input",{type:"email"===e.type?"email":"phone"===e.type?"tel":"text",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",required:e.required,value:n[e.label]||"",onChange:t=>l(s=>d(d({},s),{},{[e.label]:t.target.value}))})]},t)),(0,ea.jsx)("button",{type:"submit",disabled:r,className:"w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2.5 rounded-lg text-sm transition-colors disabled:opacity-60",children:r?"Sending\u2026":s.form_submit_text||"Submit"})]})}function e0(e){let{tenantId:s,pageId:a}=e;const[n,l]=(0,t.useState)(null),[r,i]=(0,t.useState)(!1);(0,t.useEffect)(()=>
2{if(!s)return;let e=!1;return(async()=>{try{const t=new URLSearchParams({tenant_id:s});a&&t.append("page_id",a);const n=await fetch("".concat("","/api/public/popups?").concat(t));if(!n.ok)return;const r=await n.json();if(!r.length||e)return;const o=r[0];if(!function(e){const{popup_id:t,frequency:s}=e;return"always"===s||("once"===s?!localStorage.getItem(XZ(t,"once")):!sessionStorage.getItem(XZ(t,"session")))}(o))return;l(o);const c="delayed"===o.trigger?1e3*(o.delay_seconds||3):0;setTimeout(()=>{e||(i(!0),function(e){const{popup_id:t,frequency:s}=e;"once"===s?localStorage.setItem(XZ(t,"once"),"1"):"session"===s&&sessionStorage.setItem(XZ(t,"session"),"1")}(o))},c)}catch(t){}})(),()=>{e=!0}},[s,a]);const o=()=>i(!1);return r&&n?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"fixed inset-0 bg-black/50 z-[9998] animate-fadeIn",onClick:o,"data-testid":"popup-backdrop"}),(0,ea.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4","data-testid":"page-popup-modal",children:(0,ea.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden animate-scaleIn",onClick:e=>e.stopPropagation(),children:[(0,ea.jsx)("button",{onClick:o,"data-testid":"popup-close-btn",className:"absolute top-3 right-3 z-10 w-8 h-8 flex items-center justify-center rounded-full bg-white/80 hover:bg-gray-100 text-gray-500 hover:text-gray-800 transition-colors shadow-sm",children:(0,ea.jsx)(sr,{size:16})}),"announcement"===n.type&&(0,ea.jsxs)("div",{children:[n.image_url&&(0,ea.jsx)("div",{className:"w-full aspect-video overflow-hidden",children:(0,ea.jsx)("img",{src:n.image_url,alt:n.title||"",className:"w-full h-full object-cover"})}),(0,ea.jsxs)("div",{className:"p-6",children:[n.title&&(0,ea.jsx)("h2",{className:"text-xl font-bold text-gray-900 mb-2",children:n.title}),n.body&&(0,ea.jsx)("p",{className:"text-gray-600 text-sm leading-relaxed mb-4",children:n.body}),n.cta_text&&n.cta_url&&(0,ea.jsx)("a",{href:n.cta_url,target:"_blank",rel:"noopener noreferrer","data-testid":"popup-cta-btn",className:"inline-block w-full text-center bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2.5 px-6 rounded-lg text-sm transition-colors",children:n.cta_text})]})]}),"form"===n.type&&(0,ea.jsxs)("div",{className:"p-6",children:[n.form_title&&(0,ea.jsx)("h2",{className:"text-xl font-bold text-gray-900 mb-4",children:n.form_title}),(0,ea.jsx)(ZZ,{popup:n,onClose:o})]})]})}),(0,ea.jsx)("style",{children:"\n @keyframes fadeIn { from { opacity:0 } to { opacity:1 } }\n @keyframes scaleIn { from { opacity:0; transform:scale(0.95) } to { opacity:1; transform:scale(1) } }\n .animate-fadeIn { animation: fadeIn 0.2s ease }\n .animate-scaleIn { animation: scaleIn 0.25s ease }\n "})]}):null}const t0=()=>{var e;const{token:s}=je(),[a,n]=(0,t.useState)(null),[l,r]=(0,t.useState)(!0),[i,o]=(0,t.useState)(null),[c,d]=(0,t.useState)("en"),[u,m]=(0,t.useState)(null),[h,x]=(0,t.useState)(!1);(0,t.useEffect)(()=>{s&&(async()=>{try{r(!0);const e=await kl.get("".concat("","/api/public/preview/").concat(s));n(e.data),o(null);const t=e.data.branding||{};if(t.translation_enabled){const e=lg(),s=t.default_language||"en";d(e!==s&&ag[e]?e:s)}}catch(K2){var e,t;console.error("Preview fetch error:",K2),o((null===(e=K2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Preview not found or link has expired")}finally{r(!1)}})()},[s]),(0,t.useEffect)(()=>{a&&(async()=>{var e,t,s;const n=(null===a||void 0===a?void 0:a.branding)||{},l=n.default_language||"en";if(!n.translation_enabled||c===l||null===a||void 0===a||null===(e=a.page)||void 0===e||!e.page_id)return void m(null);const r=(null===a||void 0===a||null===(t=a.site)||void 0===t?void 0:t.subdomain)||(null===a||void 0===a||null===(s=a.site)||void 0===s?void 0:s.site_slug);if(r){x(!0);try{var o;const e=await kl.get("".concat("","/api/public/").concat(r,"/page/").concat(a.page.slug,"/translated/").concat(c));e.data.translated&&null!==(o=e.data.page)&&void 0!==o&&o.blocks&&(m(e.data.page.blocks),console.log("[Translation] Preview translated to ".concat(c)))}catch(i){console.error("[Translation] Error:",i),m(null)}finally{x(!1)}}else m(null)})()},[c,a]);if(l)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)(gq,{className:"w-8 h-8 animate-spin text-indigo-600 mx-auto mb-4"}),(0,ea.jsx)("p",{className:"text-slate-600",children:"Loading preview..."})]})});if(i)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"text-center max-w-md px-4",children:[(0,ea.jsx)(AN,{className:"w-12 h-12 text-amber-500 mx-auto mb-4"}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Preview Not Available"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-4",children:i}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"This preview link may have expired or been regenerated. Please request a new preview link from the page owner."})]})});if(!a)return null;const{page:p,site_theme:g,navigation:f,site:v,is_preview:b,tenant_id:j,all_pages:y,branding:N}=a,w=!0===(null===N||void 0===N?void 0:N.translation_enabled),C=(null===N||void 0===N?void 0:N.default_language)||"en",k=y||a.pages||[],D=(null===v||void 0===v?void 0:v.subdomain)||(null===v||void 0===v?void 0:v.site_slug),_=u||p.content||[];return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("meta",{name:"robots",content:"noindex, nofollow"}),w&&(0,ea.jsx)(rg,{currentLanguage:c,onLanguageChange:e=>{d(e)},isTranslating:h,defaultLanguage:C}),(0,ea.jsxs)("div",{className:"min-h-screen bg-white",children:[b&&(0,ea.jsx)("div",{className:"bg-gradient-to-r from-amber-500 to-orange-500 text-white px-4 py-2 text-center text-sm font-medium sticky top-0 z-50 shadow-md",children:(0,ea.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,ea.jsx)(IN,{size:16}),(0,ea.jsxs)("span",{children:["Preview Mode \u2014 ","draft"===p.status?"Draft":"Published"," Version"]}),"draft"===p.status&&(0,ea.jsx)("span",{className:"bg-white/20 px-2 py-0.5 rounded text-xs ml-2",children:"Not yet published"}),u&&(0,ea.jsxs)("span",{className:"bg-white/20 px-2 py-0.5 rounded text-xs ml-2",children:["Translated to ",(null===(e=ag[c])||void 0===e?void 0:e.name)||c]})]})}),(0,ea.jsx)("div",{className:"w-full",children:(()=>{const e=(null===p||void 0===p?void 0:p.page_id)||null,t=t=>{const s=(f||[]).filter(e=>e.location===t),a=s.find(t=>{var s;return e&&(null===(s=t.page_ids)||void 0===s?void 0:s.includes(e))});return a||(s.find(e=>e.is_global)||null)};return(0,ea.jsx)(cN,{blocks:_,siteTheme:g||{},theme:p.theme,pageWidth:p.page_width,headerMenu:t("header"),footerMenu:t("footer"),isQuickPreview:!1,showNavigation:!0,previewToken:s,pages:k,tenantId:j,subdomain:D})})()}),(0,ea.jsxs)("div",{className:"border-t border-slate-200 py-4 text-center text-xs text-slate-400",children:["Preview generated by ",(null===v||void 0===v?void 0:v.name)||"NexusCMS"]})]}),(0,ea.jsx)(e0,{tenantId:j,pageId:(null===p||void 0===p?void 0:p.page_id)||null})]})},s0=()=>{const{token:e}=je(),[s,a]=(0,t.useState)(null),[n,l]=(0,t.useState)(!0),[r,i]=(0,t.useState)(null);if((0,t.useEffect)(()=>
2{if(!e)return;let t=!1;return(async()=>{try{l(!0);const s=await kl.get("".concat("","/api/public/preview-article/").concat(e));t||(a(s.data),i(null))}catch(K2){var s,n;if(!t)i((null===K2||void 0===K2||null===(s=K2.response)||void 0===s||null===(n=s.data)||void 0===n?void 0:n.detail)||"Preview not found or link has expired")}finally{t||l(!1)}})(),()=>{t=!0}},[e]),n)return(0,ea.jsxs)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50 text-slate-500",children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-indigo-600 mr-2"}),"Loading preview\u2026"]});if(r)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50 px-4",children:(0,ea.jsxs)("div",{className:"max-w-md text-center",children:[(0,ea.jsx)(AN,{className:"mx-auto mb-3 text-amber-500",size:36}),(0,ea.jsx)("p",{className:"text-slate-700",children:r})]})});if(null===s||void 0===s||!s.article)return null;const o=s.article,c=s.theme||{};return(0,ea.jsx)("div",{className:"min-h-screen bg-white",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[o.image_url&&(0,ea.jsx)("img",{src:o.image_url,alt:o.image_alt||o.title,className:"w-full h-64 md:h-96 rounded-lg mb-6 ".concat("contain"===o.image_fit?"object-contain bg-slate-100":"object-cover")}),(0,ea.jsx)("h1",{className:"text-3xl md:text-4xl font-bold text-slate-900 mb-4",children:o.title}),o.show_date&&o.date&&(0,ea.jsxs)("p",{className:"text-slate-500 mb-6",children:[new Date(o.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),(o.categories||[]).length>0&&(0,ea.jsx)("span",{className:"ml-3",children:(o.categories||[]).map(e=>(0,ea.jsx)("span",{className:"px-2 py-1 bg-slate-100 rounded text-sm mr-1",children:e},e))})]}),o.blocks&&o.blocks.length>0?(0,ea.jsx)(cN,{blocks:o.blocks,siteTheme:c,isQuickPreview:!1,showNavigation:!1}):o.content_html?(0,ea.jsx)("div",{className:"prose prose-lg max-w-none",dangerouslySetInnerHTML:{__html:o.content_html}}):(0,ea.jsx)("p",{className:"text-slate-400 italic",children:"No content yet"})]})})},a0=[10,20,50],n0=[{value:"all",label:"All Statuses"},{value:"draft",label:"Draft"},{value:"published",label:"Published"}],l0=[{value:"date",label:"Date"},{value:"title",label:"Title (A-Z)"},{value:"category",label:"Category"}],r0=()=>{const[e,s]=(0,t.useState)([]),[a,n]=(0,t.useState)([]),[l,r]=(0,t.useState)(0),[i,o]=(0,t.useState)(!0),[c,d]=(0,t.useState)(""),[u,m]=(0,t.useState)(""),[h,x]=(0,t.useState)("all"),[p,g]=(0,t.useState)("all"),[f,v]=(0,t.useState)("date"),[b,j]=(0,t.useState)("desc"),[y,N]=(0,t.useState)(1),[w,C]=(0,t.useState)(20),k=be();(0,t.useEffect)(()=>{const e=setTimeout(()=>{d(u),N(1)},300);return()=>clearTimeout(e)},[u]),(0,t.useEffect)(()=>{N(1)},[h,p,f,b,w]);const D=(0,t.useCallback)(async()=>{try{const e=await _l.get("/articles/categories/list");n(e.data||[])}catch(e){}},[]),_=(0,t.useCallback)(async()=>{o(!0);try{const e=new URLSearchParams({limit:w,offset:(y-1)*w,sort_by:f,sort_order:b});c&&e.set("search",c),"all"!==h&&e.set("status",h),"all"!==p&&e.set("category",p);const t=await _l.get("/articles?".concat(e));Array.isArray(t.data)?(s(t.data),r(t.data.length)):(s(t.data.articles||[]),r(t.data.total||0))}catch(e){qs.error("Failed to load articles")}finally{o(!1)}},[c,h,p,f,b,y,w]);(0,t.useEffect)(()=>{D()},[D]),(0,t.useEffect)(()=>{_()},[_]);const S=Math.max(1,Math.ceil(l/w));return i&&0===e.length?(0,ea.jsx)(PQ,{children:(0,ea.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})})}):(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"p-6 max-w-7xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-800",children:"Articles"}),(0,ea.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:l>0?"".concat(l," article").concat(1!==l?"s":""):"Create and manage blog articles"})]}),(0,ea.jsxs)(sg,{onClick:()=>k("/articles/new"),className:"gap-2","data-testid":"new-article-btn",children:[(0,ea.jsx)(Vj,{size:16}),"New Article"]})]}),(0,ea.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 p-4 mb-4",children:(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3 items-center",children:[(0,ea.jsxs)("div",{className:"relative flex-1 min-w-[180px] max-w-xs",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400",size:16}),(0,ea.jsx)(BN,{type:"text",placeholder:"Search articles...",value:u,onChange:e=>m(e.target.value),className:"pl-9 h-9","data-testid":"article-search-input"})]}),(0,ea.jsxs)(eb,{value:p,onValueChange:g,children:[(0,ea.jsxs)(sb,{className:"w-44 h-9","data-testid":"category-filter",children:[(0,ea.jsx)(Wj,{size:14,className:"mr-1.5 shrink-0"}),(0,ea.jsx)(tb,{placeholder:"All Categories"})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Categories"}),(0,ea.jsx)(rb,{value:"none",children:"Uncategorized"}),a.map(e=>(0,ea.jsx)(rb,{value:e,children:e},e))]})]}),(0,ea.jsxs)(eb,{value:h,onValueChange:x,children:[(0,ea.jsxs)(sb,{className:"w-40 h-9","data-testid":"status-filter",children:[(0,ea.jsx)(kD,{size:14,className:"mr-1.5 shrink-0"}),(0,ea.jsx)(tb,{placeholder:"Status"})]}),(0,ea.jsx)(lb,{children:n0.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsxs)(eb,{value:f,onValueChange:v,children:[(0,ea.jsxs)(sb,{className:"w-36 h-9","data-testid":"sort-by",children:[(0,ea.jsx)(CD,{size:14,className:"mr-1.5 shrink-0"}),(0,ea.jsx)(tb,{placeholder:"Sort by"})]}),(0,ea.jsx)(lb,{children:l0.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",className:"h-9",onClick:()=>j(e=>"asc"===e?"desc":"asc"),"data-testid":"sort-order-toggle",children:"asc"===b?"\u2191 Asc":"\u2193 Desc"}),(0,ea.jsxs)(eb,{value:String(w),onValueChange:e=>C(Number(e)),children:[(0,ea.jsx)(sb,{className:"w-24 h-9","data-testid":"page-size-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:a0.map(e=>(0,ea.jsxs)(rb,{value:String(e),children:[e," / page"]},e))})]})]})}),0!==e.length||i?(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden",children:[(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full",style:{tableLayout:"fixed"},children:[(0,ea.jsxs)("colgroup",{children:[(0,ea.jsx)("col",{style:{width:"45%"}}),(0,ea.jsx)("col",{style:{width:"20%"},className:"hidden md:table-column"}),(0,ea.jsx)("col",{style:{width:"12%"},className:"hidden sm:table-column"}),(0,ea.jsx)("col",{style:{width:"10%"}}),(0,ea.jsx)("col",{style:{width:"13%"}})]}),(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Article"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600 hidden md:table-cell",children:"Category"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600 hidden sm:table-cell",children:"Date"}),(0,ea.jsx)("th",{className:"text-left px-4 py-3 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-right px-4 py-3 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-100",children:i?Array.from({length:w}).map((e,t)=>(0,ea.jsxs)("tr",{className:"animate-pulse",children:[(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsx)("div",{className:"h-4 bg-slate-100 rounded w-3/4"})}),(0,ea.jsx)("td",{className:"px-4 py-3 hidden md:table-cell",children:(0,ea.jsx)("div",{className:"h-4 bg-slate-100 rounded w-1/2"})}),(0,ea.jsx)("td",{className:"px-4 py-3 hidden sm:table-cell",children:(0,ea.jsx)("div",{className:"h-4 bg-slate-100 rounded w-20"})}),(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsx)("div",{className:"h-4 bg-slate-100 rounded w-16"})}),(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsx)("div",{className:"h-4 bg-slate-100 rounded w-10 ml-auto"})})]},t)):e.map(e=>{const t=[];
2e.category&&t.push(e.category),e.categories&&t.push(...e.categories.filter(t=>t!==e.category));const s=t.slice(0,2),a=t.length-s.length;return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50 transition-colors",children:[(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[e.image_url?(0,ea.jsx)("img",{src:e.image_url,alt:"",className:"w-10 h-10 rounded object-cover object-top flex-shrink-0"}):(0,ea.jsx)("div",{className:"w-10 h-10 rounded bg-slate-100 flex items-center justify-center flex-shrink-0",children:(0,ea.jsx)($N,{size:16,className:"text-slate-400"})}),(0,ea.jsxs)("div",{className:"min-w-0",children:[(0,ea.jsx)(Nt,{to:"/articles/".concat(e.article_id),className:"font-medium text-slate-800 hover:text-indigo-600 block truncate","data-testid":"article-title-".concat(e.article_id),children:e.title}),t.length>0&&(0,ea.jsxs)("p",{className:"text-xs text-slate-400 truncate md:hidden mt-0.5",children:[t.slice(0,2).join(", "),t.length>2?" +".concat(t.length-2):""]})]})]})}),(0,ea.jsx)("td",{className:"px-4 py-3 hidden md:table-cell",children:(0,ea.jsx)("div",{className:"flex flex-wrap gap-1",children:0===t.length?(0,ea.jsx)("span",{className:"text-slate-400 text-sm",children:"\u2014"}):(0,ea.jsxs)(ea.Fragment,{children:[s.map(e=>(0,ea.jsx)("span",{className:"inline-block px-2 py-0.5 bg-indigo-50 text-indigo-700 text-xs rounded-full truncate max-w-[120px]",children:e},e)),a>0&&(0,ea.jsxs)("span",{className:"inline-block px-2 py-0.5 bg-slate-100 text-slate-500 text-xs rounded-full",children:["+",a]})]})})}),(0,ea.jsx)("td",{className:"px-4 py-3 hidden sm:table-cell",children:(0,ea.jsxs)("div",{className:"flex items-center gap-1 text-sm text-slate-600 whitespace-nowrap",children:[(0,ea.jsx)(yj,{size:13,className:"text-slate-400 shrink-0"}),(n=e.date||e.created_at,n?new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"")]})}),(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium whitespace-nowrap ".concat("published"===e.status?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"),children:["published"===e.status?(0,ea.jsx)(IN,{size:11}):(0,ea.jsx)(LN,{size:11}),e.status]})}),(0,ea.jsx)("td",{className:"px-4 py-3",children:(0,ea.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>k("/articles/".concat(e.article_id)),className:"h-8 w-8 p-0","data-testid":"edit-article-".concat(e.article_id),children:(0,ea.jsx)(ND,{size:15})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(async(e,t)=>{if(window.confirm('Are you sure you want to delete "'.concat(t,'"?')))try{await _l.delete("/articles/".concat(e)),qs.success("Article deleted"),_()}catch(s){qs.error("Failed to delete article")}})(e.article_id,e.title),className:"h-8 w-8 p-0 text-red-500 hover:text-red-700 hover:bg-red-50","data-testid":"delete-article-".concat(e.article_id),children:(0,ea.jsx)(wD,{size:15})})]})})]},e.article_id);var n})})]})}),l>w&&(0,ea.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-slate-200 bg-slate-50",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[(y-1)*w+1,"\u2013",Math.min(y*w,l)," of ",l," articles"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:1===y,onClick:()=>N(e=>e-1),"data-testid":"pagination-prev",children:(0,ea.jsx)(vj,{size:15})}),Array.from({length:S},(e,t)=>t+1).filter(e=>1===e||e===S||Math.abs(e-y)<=1).reduce((e,t,s,a)=>(s>0&&t-a[s-1]>1&&e.push("\u2026"),e.push(t),e),[]).map((e,t)=>"\u2026"===e?(0,ea.jsx)("span",{className:"px-1 text-slate-400 text-sm",children:"\u2026"},"ellipsis-".concat(t)):(0,ea.jsx)(sg,{variant:e===y?"default":"outline",size:"sm",className:"h-8 w-8 p-0 text-xs",onClick:()=>N(e),"data-testid":"pagination-page-".concat(e),children:e},e)),(0,ea.jsx)(sg,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:y===S,onClick:()=>N(e=>e+1),"data-testid":"pagination-next",children:(0,ea.jsx)(ax,{size:15})})]})]})]}):(0,ea.jsxs)("div",{className:"text-center py-12 bg-slate-50 rounded-lg border-2 border-dashed border-slate-200",children:[(0,ea.jsx)(qN,{className:"mx-auto h-12 w-12 text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-700 mb-2",children:0!==l||c||"all"!==h||"all"!==p?"No articles match your filters":"No articles yet"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4 text-sm",children:0!==l||c||"all"!==h||"all"!==p?"Try adjusting your search or filters":"Create your first article to get started"}),0===l&&!c&&(0,ea.jsxs)(sg,{onClick:()=>k("/articles/new"),variant:"outline",className:"gap-2",children:[(0,ea.jsx)(Vj,{size:16}),"Create Article"]})]})]})})},i0=Vl("share-2",[["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"}]]),o0=()=>{const{id:e}=je(),s=be(),a="new"===e,[n,l]=(0,t.useState)(!a),[r,i]=(0,t.useState)(!1),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)("featured"),[h,x]=(0,t.useState)([]),[p,g]=(0,t.useState)(""),[f,v]=(0,t.useState)("content"),[b,j]=(0,t.useState)(null),[y,N]=(0,t.useState)(!1),[w,C]=(0,t.useState)("desktop"),[k,D]=(0,t.useState)(null),[_,S]=(0,t.useState)(!1),[E,A]=(0,t.useState)({title:"",slug:"",image_url:"",image_alt:"",image_fit:"contain",show_image_in_feed:!0,show_in_feed:!0,date:(new Date).toISOString().split("T")[0],show_date:!0,content_html:"",blocks:[],excerpt:"",category:"",categories:[],status:"draft",meta_title:"",meta_description:"",og_image:""});(0,t.useEffect)(()=>{F(),T(),a||z()},[e,a]);const F=async()=>{try{const e=(await _l.get("/articles/categories/list")).data||[],t=["App"],s=[...t,...e.filter(e=>!t.includes(e))];x(s)}catch(e){console.error("Failed to fetch categories:",e),x(["App"])}},T=async()=>{try{const e=await _l.get("/site-theme");j(e.data)}catch(e){console.error("Failed to fetch site theme:",e)}},z=async()=>{try{const t=await _l.get("/articles/".concat(e)),s=d(d({},t.data),{},{blocks:t.data.blocks||[],categories:t.data.categories||(t.data.category?[t.data.category]:[])});A(s)}catch(t){qs.error("Failed to load article"),s("/articles")}finally{l(!1)}},M=e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),P=async()=>
2{if(E.title.trim()){i(!0);try{const t=d(d({},E),{},{slug:E.slug||M(E.title)});if(a){const e=await _l.post("/articles",t);qs.success("Article created"),s("/articles/".concat(e.data.article_id))}else await _l.put("/articles/".concat(e),t),qs.success("Article saved")}catch(r){var t,n,l;console.error("Save error:",(null===(t=r.response)||void 0===t?void 0:t.data)||r.message||r),qs.error((null===(n=r.response)||void 0===n||null===(l=n.data)||void 0===l?void 0:l.detail)||"Failed to save article")}finally{i(!1)}}else qs.error("Please enter a title")},B=(0,t.useCallback)(e=>{A("og"===u?t=>d(d({},t),{},{og_image:e.url}):t=>d(d({},t),{},{image_url:e.url,image_alt:e.filename})),c(!1)},[u]),R=()=>{if(p.trim()&&!h.includes(p.trim())){x([...h,p.trim()]);const e=[...E.categories||[]];e.includes(p.trim())||e.push(p.trim()),A(d(d({},E),{},{categories:e,category:e[0]||""})),g("")}},L=e=>{const t=E.categories||[];let s;s=t.includes(e)?t.filter(t=>t!==e):[...t,e],A(d(d({},E),{},{categories:s,category:s[0]||""}))},I=()=>{var e;for(const n of E.blocks||[])if("paragraph"===n.type||"text"===n.type){var t,s;const e=(null===(t=n.content)||void 0===t||null===(s=t.text)||void 0===s?void 0:s.replace(/<[^>]+>/g,""))||"";if(e)return e.slice(0,150)+(e.length>150?"...":"")}const a=(null===(e=E.content_html)||void 0===e?void 0:e.replace(/<[^>]+>/g,""))||"";return a.slice(0,150)+(a.length>150?"...":"")},O=async t=>{if(C(t),"desktop"!==t&&!k)if(a)qs.error("Please save the article first to use mobile preview");else{S(!0);try{await P();const t=await _l.get("/articles/".concat(e,"/preview-token"));D("".concat(window.location.origin,"/preview/article/").concat(t.data.preview_token,"?t=").concat(Date.now()))}catch(K2){console.error("Failed to build article preview URL:",K2),qs.error("Could not load mobile preview. Try saving the article first.")}finally{S(!1)}}},U=async()=>{if(a)qs.error("Please save the article first to use mobile preview");else{D(null),S(!0);try{await P();const t=await _l.get("/articles/".concat(e,"/preview-token"));D("".concat(window.location.origin,"/preview/article/").concat(t.data.preview_token,"?t=").concat(Date.now()))}catch(K2){console.error("Failed to refresh article preview:",K2),qs.error("Could not refresh preview.")}finally{S(!1)}}};if(n)return(0,ea.jsx)(PQ,{children:(0,ea.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})})});if(y){const e="mobile"===w?375:"tablet"===w?768:null,t="mobile"===w?812:1024;return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"min-h-screen bg-slate-100",children:[(0,ea.jsx)("div",{className:"bg-white border-b border-slate-200 sticky top-0 z-20",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto px-4 py-3 flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{N(!1),D(null)},children:(0,ea.jsx)(_j,{size:18})}),(0,ea.jsxs)("h1",{className:"text-lg font-semibold text-slate-800",children:["Preview: ",E.title]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsxs)("div",{className:"inline-flex items-center rounded-md border border-slate-300 bg-white p-1","data-testid":"article-viewport-switcher",children:[(0,ea.jsx)("button",{type:"button",onClick:()=>O("mobile"),title:"Mobile (375 px)","data-testid":"article-viewport-mobile",className:"p-1.5 rounded transition-colors ".concat("mobile"===w?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(RN,{size:16})}),(0,ea.jsx)("button",{type:"button",onClick:()=>O("tablet"),title:"Tablet (768 px)","data-testid":"article-viewport-tablet",className:"p-1.5 rounded transition-colors ".concat("tablet"===w?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(MD,{size:16})}),(0,ea.jsx)("button",{type:"button",onClick:()=>O("desktop"),title:"Desktop","data-testid":"article-viewport-desktop",className:"p-1.5 rounded transition-colors ".concat("desktop"===w?"bg-indigo-600 text-white":"text-slate-600 hover:bg-slate-100"),children:(0,ea.jsx)(PD,{size:16})})]}),(0,ea.jsx)(sg,{variant:"outline",onClick:()=>{N(!1),D(null)},children:"Exit Preview"})]})]})}),e?(0,ea.jsxs)("div",{className:"flex flex-col items-center py-8 px-4",children:[(0,ea.jsxs)("div",{className:"text-xs text-slate-500 mb-3 flex items-center gap-2",children:[(0,ea.jsxs)("span",{children:["mobile"===w?"iPhone":"iPad"," preview \xb7 ",e," \xd7 ",t]}),(0,ea.jsx)("button",{type:"button",onClick:U,className:"underline hover:text-indigo-600","data-testid":"article-preview-refresh",children:"refresh"})]}),(0,ea.jsx)("div",{className:"bg-white shadow-xl border-[10px] border-slate-800 rounded-[36px] overflow-hidden",style:{width:"".concat(e+20,"px"),maxWidth:"100%"},children:_||!k?(0,ea.jsxs)("div",{className:"flex items-center justify-center text-slate-400 text-sm",style:{width:"".concat(e,"px"),height:"".concat(t,"px"),maxWidth:"100%"},children:[(0,ea.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-indigo-600 mr-2"}),"Loading preview\u2026"]}):(0,ea.jsx)("iframe",{title:"Article mobile preview",src:k,style:{width:"".concat(e,"px"),height:"".concat(t,"px"),maxWidth:"100%",border:0,display:"block"},"data-testid":"article-preview-iframe"})})]}):(0,ea.jsx)("div",{className:"max-w-4xl mx-auto py-8 px-4",children:(0,ea.jsxs)("div",{className:"bg-white rounded-lg shadow-sm overflow-hidden",children:[E.image_url&&(0,ea.jsx)("img",{src:E.image_url,alt:E.image_alt,className:"w-full h-64 md:h-96 ".concat("contain"===E.image_fit?"object-contain bg-slate-100":"object-cover")}),(0,ea.jsxs)("div",{className:"p-6 md:p-10",children:[(0,ea.jsx)("h1",{className:"text-3xl md:text-4xl font-bold text-slate-900 mb-4",children:E.title}),E.show_date&&E.date&&(0,ea.jsxs)("p",{className:"text-slate-500 mb-6",children:[new Date(E.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),(E.categories||[]).length>0&&(0,ea.jsx)("span",{className:"ml-3",children:(E.categories||[]).map((e,t)=>(0,ea.jsx)("span",{className:"px-2 py-1 bg-slate-100 rounded text-sm mr-1",children:e},e))})]}),E.blocks&&E.blocks.length>0?(0,ea.jsx)(cN,{blocks:E.blocks,siteTheme:b,isQuickPreview:!1,showNavigation:!1}):E.content_html?(0,ea.jsx)("div",{className:"prose prose-lg max-w-none",dangerouslySetInnerHTML:{__html:E.content_html}}
2):(0,ea.jsx)("p",{className:"text-slate-400 italic",children:"No content yet"})]})]})})]})})}return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"min-h-screen bg-slate-50",children:[(0,ea.jsx)("div",{className:"bg-white border-b border-slate-200 sticky top-0 z-10",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto px-4 py-3 flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>s("/articles"),children:(0,ea.jsx)(_j,{size:18})}),(0,ea.jsx)("h1",{className:"text-lg font-semibold text-slate-800",children:a?"New Article":"Edit Article"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>N(!0),children:[(0,ea.jsx)(IN,{size:16,className:"mr-1"}),"Preview"]}),!a&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:async()=>{if(window.confirm("Are you sure you want to delete this article?"))try{await _l.delete("/articles/".concat(e)),qs.success("Article deleted"),s("/articles")}catch(t){qs.error("Failed to delete article")}},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})}),(0,ea.jsxs)(eb,{value:E.status,onValueChange:e=>A(d(d({},E),{},{status:e})),children:[(0,ea.jsx)(sb,{className:"w-32 h-9",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"draft",children:(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(LN,{size:14})," Draft"]})}),(0,ea.jsx)(rb,{value:"published",children:(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(IN,{size:14})," Published"]})})]})]}),(0,ea.jsxs)(sg,{onClick:P,disabled:r,className:"gap-2",children:[(0,ea.jsx)(BD,{size:16}),r?"Saving...":"Save"]})]})]})}),(0,ea.jsx)("div",{className:"max-w-7xl mx-auto px-4 py-6",children:(0,ea.jsxs)(nJ,{value:f,onValueChange:v,children:[(0,ea.jsxs)(lJ,{className:"mb-6",children:[(0,ea.jsxs)(rJ,{value:"content",className:"gap-2",children:[(0,ea.jsx)(qN,{size:16}),"Content"]}),(0,ea.jsxs)(rJ,{value:"settings",className:"gap-2",children:[(0,ea.jsx)(Oj,{size:16}),"Settings"]}),(0,ea.jsxs)(rJ,{value:"seo",className:"gap-2",children:[(0,ea.jsx)(i0,{size:16}),"SEO & Sharing"]})]}),(0,ea.jsx)(iJ,{value:"content",children:(0,ea.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[(0,ea.jsxs)("div",{className:"lg:col-span-3 space-y-6",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-2 block",children:"Title"}),(0,ea.jsx)(BN,{value:E.title,onChange:e=>{const t=e.target.value;A(e=>d(d({},e),{},{title:t,slug:e.slug&&e.slug!==M(e.title)?e.slug:M(t)}))},placeholder:"Enter article title...",className:"text-xl font-semibold","data-testid":"article-title-input"})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-3 block",children:"Content"}),(0,ea.jsx)(nY,{blocks:E.blocks||[],onChange:e=>{A(t=>d(d({},t),{},{blocks:e}))},placeholder:"Start building your article content..."})]})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsxs)(tf,{className:"text-sm font-medium text-slate-700 mb-2 block",children:[(0,ea.jsx)(gJ,{size:14,className:"inline mr-1"}),"URL Slug"]}),(0,ea.jsx)(BN,{value:E.slug,onChange:e=>{const t=e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");A(e=>d(d({},e),{},{slug:t}))},placeholder:"article-url-slug",className:"font-mono text-sm","data-testid":"article-slug-input"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:["/article/",E.slug||"your-slug"]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-3 block",children:"Featured Image"}),E.image_url?(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)("img",{src:E.image_url,alt:E.image_alt,className:"w-full h-40 rounded-lg ".concat("contain"===E.image_fit?"object-contain bg-slate-100":"object-cover object-top")}),(0,ea.jsxs)("div",{className:"absolute top-2 right-2 flex gap-1",children:[(0,ea.jsx)(sg,{variant:"secondary",size:"sm",onClick:()=>{m("featured"),c(!0)},className:"h-7 px-2 bg-white/90 hover:bg-white text-xs",children:"Change"}),(0,ea.jsx)(sg,{variant:"secondary",size:"sm",onClick:()=>A(d(d({},E),{},{image_url:"",image_alt:""})),className:"h-7 w-7 p-0 bg-white/90 hover:bg-white text-red-500",children:(0,ea.jsx)(sr,{size:14})})]})]}):(0,ea.jsxs)("button",{onClick:()=>{m("featured"),c(!0)},className:"w-full h-32 border-2 border-dashed border-slate-300 rounded-lg flex flex-col items-center justify-center gap-2 hover:border-indigo-400 hover:bg-indigo-50/50 transition-colors","data-testid":"add-featured-image-btn",children:[(0,ea.jsx)($N,{size:24,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Add featured image"})]}),E.image_url&&(0,ea.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("label",{className:"text-sm text-slate-600",children:"Display:"}),(0,ea.jsxs)("div",{className:"flex gap-1 bg-slate-100 rounded-md p-0.5",children:[(0,ea.jsx)("button",{onClick:()=>A(d(d({},E),{},{image_fit:"contain"})),className:"px-2.5 py-1 text-xs rounded transition-colors ".concat("contain"===E.image_fit?"bg-white text-slate-800 shadow-sm font-medium":"text-slate-500 hover:text-slate-700"),"data-testid":"image-fit-contain",children:"Full Image"}),(0,ea.jsx)("button",{onClick:()=>A(d(d({},E),{},{image_fit:"cover"})),className:"px-2.5 py-1 text-xs rounded transition-colors ".concat("cover"===E.image_fit?"bg-white text-slate-800 shadow-sm font-medium":"text-slate-500 hover:text-slate-700"),"data-testid":"image-fit-cover",children:"Fill / Crop"})]})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:E.show_image_in_feed,onChange:e=>A(d(d({},E),{},{show_image_in_feed:e.target.checked})),className:"rounded border-slate-300"}),"Show in feed"]}),(0,ea.jsx)(BN,{placeholder:"Image caption (optional)",value:E.image_caption||"",onChange:e=>A(d(d({},E),{},{image_caption:e.target.value})),className:"text-xs","data-testid":"featured-image-caption"})]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-3 block",children:"Card Preview"}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg overflow-hidden",children:[E.image_url&&E.show_image_in_feed&&(0,ea.jsx)("img",{src:E.image_url,alt:"",className:"w-full h-24 ".concat("contain"===E.image_fit?"object-contain bg-slate-100":"object-cover object-top")}),(0,ea.jsxs)("div",{className:"p-3",children:[(0,ea.jsx)("h3",{className:"font-medium text-slate-800 text-sm line-clamp-2",children:E.title||"Article Title"}),E.show_date&&E.date&&(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:new Date(E.date).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2 line-clamp-2",children:E.excerpt||I()||"Article excerpt..."})]})]})]})]})]})}),(0,ea.jsx)(iJ,{value:"settings",children:(0,ea.jsxs)("div",{className:"max-w-2xl space-y-6",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-2 block",children:"Article Date"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(yj,{size:16,className:"text-slate-400"}),(0,ea.jsx)(BN,{type:"date",value:E.date||"",onChange:e=>A(d(d({},E),{},{date:e.target.value})),className:"flex-1"})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 mt-3 text-sm text-slate-600",children:[(0,ea.jsx)("input",{type:"checkbox",checked:E.show_date,onChange:e=>A(d(d({},E),{},{show_date:e.target.checked})),className:"rounded border-slate-300"}),"Show date on article"]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsxs)(tf,{className:"text-sm font-medium text-slate-700 mb-2 block flex items-center gap-2",children:["App Feed",(0,ea.jsx)("span",{className:"text-xs bg-indigo-100 text-indigo-600 px-1.5 py-0.5 rounded font-medium",children:"Taptile"})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm text-slate-600 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!1!==E.show_in_feed,onChange:e=>A(d(d({},E),{},{show_in_feed:e.target.checked})),className:"rounded border-slate-300","data-testid":"article-show-in-feed"}
2),"Show in Taptile app feed"]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1.5",children:["When enabled, this article appears in the Taptile mobile app news feed. You can also control feed visibility using ",(0,ea.jsx)("strong",{children:'Category = "App"'}),"."]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsxs)(tf,{className:"text-sm font-medium text-slate-700 mb-2 block",children:["Categories",(E.categories||[]).length>0&&(0,ea.jsxs)("span",{className:"ml-2 text-xs text-slate-400",children:["(",(E.categories||[]).length," selected)"]})]}),(E.categories||[]).length>0&&(0,ea.jsx)("div",{className:"flex flex-wrap gap-1 mb-3",children:(E.categories||[]).map(e=>(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-indigo-100 text-indigo-700 rounded-full text-xs",children:[e,(0,ea.jsx)("button",{type:"button",onClick:()=>L(e),className:"hover:text-indigo-900",children:"\xd7"})]},e))}),(0,ea.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto border border-slate-100 rounded-lg p-2",children:0===h.length?(0,ea.jsx)("p",{className:"text-xs text-slate-400 py-2",children:"No categories yet. Create one below."}):h.map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between hover:bg-slate-50 p-1 rounded group",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 text-sm text-slate-600 cursor-pointer flex-1",children:[(0,ea.jsx)("input",{type:"checkbox",checked:(E.categories||[]).includes(e),onChange:()=>L(e),className:"rounded border-slate-300"}),(0,ea.jsx)("span",{children:e}),"App"===e&&(0,ea.jsx)("span",{className:"text-xs bg-indigo-100 text-indigo-600 px-1.5 py-0.5 rounded font-medium",children:"Taptile"})]}),"App"!==e&&(0,ea.jsx)("button",{type:"button",onClick:()=>(e=>{if(window.confirm('Are you sure you want to delete the category "'.concat(e,'"?\n\nThis will remove it from all articles that use this category.'))){x(h.filter(t=>t!==e));const t=(E.categories||[]).filter(t=>t!==e);A(d(d({},E),{},{categories:t,category:t[0]||""})),qs.success('Category "'.concat(e,'" deleted'))}})(e),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 p-1 transition-opacity",title:'Delete "'.concat(e,'" category'),children:(0,ea.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,ea.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]},e))}),(0,ea.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-100",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500 mb-1 block",children:"Add new category:"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:p,onChange:e=>g(e.target.value),placeholder:"New category",className:"h-8 text-sm",onKeyDown:e=>"Enter"===e.key&&R()}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:R,disabled:!p.trim(),className:"h-8",children:"Add"})]})]})]}),(0,ea.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700",children:"Article Navigation"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-0.5 mb-3",children:"When this article is shared or viewed directly, choose what navigation to display"}),(0,ea.jsxs)(eb,{value:E.article_nav_mode||(!1===E.show_site_navigation?"none":"site_nav"),onValueChange:e=>A(d(d({},E),{},{article_nav_mode:e})),children:[(0,ea.jsx)(sb,{"data-testid":"article-nav-mode-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"site_nav",children:"Use Site Navigation"}),(0,ea.jsx)(rb,{value:"back_link",children:"Back to Site Link"}),(0,ea.jsx)(rb,{value:"none",children:"Nothing"})]})]})]})}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700",children:"Excerpt (Preview Text)"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>A(d(d({},E),{},{excerpt:I()})),className:"text-xs h-7",children:"Auto-generate"})]}),(0,ea.jsx)(YN,{value:E.excerpt||"",onChange:e=>A(d(d({},E),{},{excerpt:e.target.value})),placeholder:"Enter a short excerpt or leave blank for auto-generated...",rows:3,className:"resize-none"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:[E.excerpt?E.excerpt.length:0,"/150 characters (recommended)"]})]})]})}),(0,ea.jsx)(iJ,{value:"seo",children:(0,ea.jsxs)("div",{className:"max-w-2xl space-y-6",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-2 block",children:"Meta Title"}),(0,ea.jsx)(BN,{value:E.meta_title||"",onChange:e=>A(d(d({},E),{},{meta_title:e.target.value})),placeholder:E.title||"Page title for search engines"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:[(E.meta_title||E.title||"").length,"/60 characters"]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-2 block",children:"Meta Description"}),(0,ea.jsx)(YN,{value:E.meta_description||"",onChange:e=>A(d(d({},E),{},{meta_description:e.target.value})),placeholder:E.excerpt||"Description for search engines",rows:3}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:[(E.meta_description||E.excerpt||"").length,"/160 characters"]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-3 block",children:"Social Sharing Image"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-3",children:"This image appears when sharing on Facebook, Twitter, LinkedIn, etc."}),E.og_image||E.image_url?(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)("img",{src:E.og_image||E.image_url,alt:"Social sharing preview",className:"w-full h-40 object-cover rounded-lg"}),(0,ea.jsxs)("div",{className:"absolute top-2 right-2 flex gap-1",children:[(0,ea.jsx)(sg,{variant:"secondary",size:"sm",onClick:()=>{m("og"),c(!0)},className:"h-7 px-2 bg-white/90 hover:bg-white text-xs","data-testid":"article-og-image-change-btn",children:"Change"}),E.og_image&&(0,ea.jsx)(sg,{variant:"secondary",size:"sm",onClick:()=>A(d(d({},E),{},{og_image:""})),className:"h-7 w-7 p-0 bg-white/90 hover:bg-white text-red-500","data-testid":"article-og-image-remove-btn",children:(0,ea.jsx)(sr,{size:14})})]}),!E.og_image&&E.image_url&&(0,ea.jsx)("div",{className:"absolute bottom-2 left-2 bg-black/60 text-white text-xs px-2 py-1 rounded",children:"Using featured image"})]}):(0,ea.jsxs)("button",{onClick:()=>{m("og"),c(!0)},className:"w-full h-32 border-2 border-dashed border-slate-300 rounded-lg flex flex-col items-center justify-center gap-2 hover:border-indigo-400 hover:bg-indigo-50/50 transition-colors","data-testid":"article-og-image-picker-btn",children:[(0,ea.jsx)($N,{size:24,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"Add social image (recommended: 1200x630)"})]})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium text-slate-700 mb-3 block",children:"Social Preview"}),(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg overflow-hidden bg-slate-50",children:[(E.og_image||E.image_url)&&(0,ea.jsx)("img",{src:E.og_image||E.image_url,alt:"",className:"w-full h-40 object-cover"}),(0,ea.jsxs)("div",{className:"p-3",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:"yoursite.com"}),(0,ea.jsx)("h3",{className:"font-semibold text-slate-800 text-sm",children:E.meta_title||E.title||"Article Title"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1 line-clamp-2",children:E.meta_description||E.excerpt||"Article description..."})]})]})]})]})})]})}),(0,ea.jsx)(Dq,{open:o,onSelect:B,onClose:()=>c(!1)})]})})},c0=()=>{const[e,s]=(0,t.useState)([]),[a,n]=(0,t.useState)(!0),[l,r]=(0,t.useState)(!1),[i,o]=(0,t.useState)(null),[c,u]=(0,t.useState)({source_path:"",target_path:"",redirect_type:"301",is_active:!0});(0,t.useEffect)(()=>{m()},[]);const m=async()=>{try{const e=await _l.get("/redirects");s(e.data)}catch(e){qs.error("Failed to load redirects")}finally{n(!1)}},h=()=>{u({source_path:"",target_path:"",redirect_type:"301",is_active:!0}),o(null),r(!1)};return(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 p-8",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900",style:{fontFamily:"Manrope, sans-serif"},children:"URL Redirects"}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Manage redirects to preserve SEO and fix broken links"})]}),(0,ea.jsxs)(sg,{onClick:()=>r(!l),className:"bg-indigo-600 hover:bg-indigo-700","data-testid":"add-redirect-button",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Add Redirect"]})]}),l&&(0,ea.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-6 mb-6",children:[(0,ea.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:i?"Edit Redirect":"Add New Redirect"}),(0,ea.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),c.source_path&&c.target_path)try{i?(await _l.put("/redirects/".concat(i),c),qs.success("Redirect updated")):(await _l.post("/redirects",c),qs.success("Redirect created")),m(),h()}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to save redirect")}else qs.error("Please fill in both paths")},className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"source_path",children:"Source Path (old URL)"}),(0,ea.jsxs)("div",{className:"flex items-center mt-1",children:[(0,ea.jsx)("span",{className:"text-slate-500 mr-1",children:"/"}),(0,ea.jsx)(BN,{id:"source_path",value:c.source_path.replace(/^\//,""),onChange:e=>u(d(d({},c),{},{source_path:e.target.value})),placeholder:"old-page-url","data-testid":"source-path-input"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"The URL path that should redirect"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"target_path",children:"Target Path (new URL)"}),(0,ea.jsxs)("div",{className:"flex items-center mt-1",children:[(0,ea.jsx)("span",{className:"text-slate-500 mr-1",children:"/"}),(0,ea.jsx)(BN,{id:"target_path",value:c.target_path.replace(/^\//,""),onChange:e=>u(d(d({},c),{},{target_path:e.target.value})),placeholder:"new-page-url","data-testid":"target-path-input"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Where visitors should be redirected to"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{htmlFor:"redirect_type",children:"Redirect Type"}),(0,ea.jsxs)(eb,{value:c.redirect_type,onValueChange:e=>u(d(d({},c),{},{redirect_type:e})),children:[(0,ea.jsx)(sb,{className:"mt-1",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"301",children:"301 - Permanent (recommended for SEO)"}),(0,ea.jsx)(rb,{value:"302",children:"302 - Temporary"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 pt-6",children:[(0,ea.jsx)(wb,{checked:c.is_active,onCheckedChange:e=>u(d(d({},c),{},{is_active:e}))}),(0,ea.jsx)(tf,{children:"Active"})]})]}),(0,ea.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,ea.jsx)(sg,{type:"submit",className:"bg-indigo-600 hover:bg-indigo-700",children:i?"Update Redirect":"Create Redirect"}),(0,ea.jsx)(sg,{type:"button",variant:"outline",onClick:h,children:"Cancel"})]})]})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden",children:a?(0,ea.jsx)("div",{className:"p-8 text-center text-slate-500",children:"Loading..."}):0===e.length?(0,ea.jsxs)("div",{className:"p-8 text-center",children:[(0,ea.jsx)(bj,{size:48,className:"mx-auto text-slate-300 mb-4"}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-700 mb-2",children:"No redirects yet"}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"Create redirects to preserve old URLs when you restructure your site"}),(0,ea.jsxs)(sg,{onClick:()=>r(!0),className:"bg-indigo-600 hover:bg-indigo-700",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Add Your First Redirect"]})]}):(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left p-4 text-sm font-medium text-slate-600",children:"Source"}),(0,ea.jsx)("th",{className:"text-left p-4 text-sm font-medium text-slate-600"}),(0,ea.jsx)("th",{className:"text-left p-4 text-sm font-medium text-slate-600",children:"Target"}),(0,ea.jsx)("th",{className:"text-center p-4 text-sm font-medium text-slate-600",children:"Type"}),(0,ea.jsx)("th",{className:"text-center p-4 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-right p-4 text-sm font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{children:e.map(e=>(0,ea.jsxs)("tr",{className:"border-b border-slate-100 hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"p-4",children:(0,ea.jsx)("code",{className:"text-sm bg-slate-100 px-2 py-1 rounded text-slate-700",children:e.source_path})}),(0,ea.jsx)("td",{className:"p-4",children:(0,ea.jsx)(wj,{size:16,className:"text-slate-400"})}),(0,ea.jsx)("td",{className:"p-4",children:(0,ea.jsx)("code",{className:"text-sm bg-emerald-50 px-2 py-1 rounded text-emerald-700",children:e.target_path})}),(0,ea.jsx)("td",{className:"p-4 text-center",children:(0,ea.jsx)("span",{className:"text-xs px-2 py-1 rounded-full ".concat("301"===e.redirect_type?"bg-blue-100 text-blue-700":"bg-amber-100 text-amber-700"),children:e.redirect_type})}),(0,ea.jsx)("td",{className:"p-4 text-center",children:(0,ea.jsx)("button",{onClick:()=>(async e=>{try{await _l.put("/redirects/".concat(e.redirect_id),{is_active:!e.is_active}),m()}catch(t){qs.error("Failed to update redirect")}})(e),className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs ".concat(e.is_active?"bg-green-100 text-green-700":"bg-slate-100 text-slate-500"),children:e.is_active?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Xl,{size:12}),"Active"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(sr,{size:12}),"Inactive"]})})}),(0,ea.jsx)("td",{className:"p-4 text-right",children:(0,ea.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{o(e.redirect_id),u({source_path:e.source_path,target_path:e.target_path,redirect_type:e.redirect_type,is_active:e.is_active}),r(!0)})(e),children:(0,ea.jsx)(bJ,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this redirect?"))try{await _l.delete("/redirects/".concat(e)),qs.success("Redirect deleted"),m()}catch(t){qs.error("Failed to delete redirect")}})(e.redirect_id),className:"text-red-500 hover:text-red-700 hover:bg-red-50",children:(0,ea.jsx)(wD,{size:16})})]})})]},e.redirect_id))})]})}),(0,ea.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-100",children:[(0,ea.jsx)("h3",{className:"font-medium text-blue-900 mb-2",children:"About Redirects"}),(0,ea.jsxs)("ul",{className:"text-sm text-blue-700 space-y-1",children:[(0,ea.jsxs)("li",{children:["\u2022 ",(0,ea.jsx)("strong",{children:"301 Permanent:"})," Use when a page has permanently moved. Search engines will update their index."]}),(0,ea.jsxs)("li",{children:["\u2022 ",(0,ea.jsx)("strong",{children:"302 Temporary:"})," Use for temporary redirects. Search engines keep the old URL in their index."]}),(0,ea.jsx)("li",{children
2:"\u2022 Redirects help preserve SEO value when restructuring your site."})]})]})]})})]})},d0={layout:NE,palette:Dw,globe:hr,zap:Gl,shield:Kl,mail:Yl,star:$l},u0=()=>{const[e,s]=(0,t.useState)(null),[a,n]=(0,t.useState)(!0),[l,r]=(0,t.useState)("monthly"),[i,o]=(0,t.useState)(null),[c,d]=(0,t.useState)(!1),[u]=_t();(0,t.useEffect)(()=>{m();const e=u.get("ref");e&&localStorage.setItem("nexuscms_ref",e)},[u]);const m=async()=>{try{const e=await _l.get("/public/landing-page");s(e.data)}catch(e){console.error("Failed to fetch landing page:",e)}finally{n(!1)}},h=e=>{e.contact_sales?window.location.href=e.cta_url&&"#"!==e.cta_url?e.cta_url:"mailto:[email protected]":(async e=>{o(e.tier_id);try{const t=window.location.origin,s=localStorage.getItem("nexuscms_ref")||null,a=await _l.post("/payments/create-checkout",{tier_id:e.tier_id,billing_period:l,origin_url:t,referral_code:s});if(a.data.is_free&&a.data.redirect_url)return void(window.location.href=a.data.redirect_url);a.data.checkout_url&&(window.location.href=a.data.checkout_url)}catch(t){console.error("Failed to create checkout:",t),alert("Failed to start checkout. Please try again.")}finally{o(null)}})(e)};if(a)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600"})});if(!e)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsx)("p",{className:"text-slate-600",children:"Failed to load page content"})});const{hero:x={},features:p=[],pricing_tiers:g=[],testimonials:f=[],integration_partners:v=[],enterprise_partners:b=[],cta:j={}}=e;return(0,ea.jsxs)("div",{className:"min-h-screen",children:[(0,ea.jsx)("nav",{className:"fixed top-0 left-0 right-0 z-50 px-4 py-4",style:{backgroundColor:(null===x||void 0===x?void 0:x.background_color)||"#4F46E5"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[(0,ea.jsxs)(Nt,{to:"/",className:"flex items-center gap-2",children:[(0,ea.jsx)("div",{className:"w-8 h-8 bg-white/20 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(NE,{className:"text-white",size:18})}),(0,ea.jsx)("span",{className:"text-xl font-bold",style:{color:(null===x||void 0===x?void 0:x.text_color)||"#ffffff"},children:"Nexus CMS"})]}),(0,ea.jsx)("div",{className:"flex items-center gap-4",children:(0,ea.jsx)(Nt,{to:"/login",children:(0,ea.jsxs)(sg,{variant:"outline",className:"border-white/30 text-white hover:bg-white/10 gap-2",children:[(0,ea.jsx)(QJ,{size:18}),"Login"]})})})]})}),(0,ea.jsxs)("section",{className:"relative pt-32 pb-20 md:pt-40 md:pb-32 px-4",style:{backgroundColor:x.background_color,backgroundImage:x.background_image?"url(".concat(x.background_image,")"):void 0,backgroundSize:"cover",backgroundPosition:"center"},children:[(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto text-center relative z-10",children:[(0,ea.jsx)("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-6",style:{color:x.text_color},dangerouslySetInnerHTML:{__html:(x.headline||"").replace(/ /g,"\xa0")}}),(0,ea.jsx)("p",{className:"text-lg md:text-xl mb-10 max-w-3xl mx-auto opacity-90",style:{color:x.text_color},dangerouslySetInnerHTML:{__html:(x.subheadline||"").replace(/ /g,"\xa0")}}),(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[(0,ea.jsxs)(sg,{size:"lg",className:"text-lg px-8 py-6 bg-indigo-600 hover:bg-indigo-700",onClick:()=>{var e;return null===(e=document.getElementById("pricing"))||void 0===e?void 0:e.scrollIntoView({behavior:"smooth"})},children:[x.cta_primary_text,(0,ea.jsx)(ax,{className:"ml-2",size:20})]}),x.cta_secondary_text&&(0,ea.jsxs)(sg,{size:"lg",variant:"outline",className:"text-lg px-8 py-6 border-white/30 text-white hover:bg-white/10",onClick:()=>d(!0),"data-testid":"watch-demo-btn",children:[(0,ea.jsx)(Gg,{className:"mr-2 fill-current",size:18}),x.cta_secondary_text]})]})]}),x.background_image&&(0,ea.jsx)("div",{className:"absolute inset-0 bg-black/50"})]}),e.show_features&&(null===p||void 0===p?void 0:p.length)>0&&(0,ea.jsx)("section",{className:"py-20 px-4 bg-white",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold text-center text-slate-900 mb-4",children:"Everything you need to succeed"}),(0,ea.jsx)("p",{className:"text-lg text-slate-600 text-center mb-12 max-w-2xl mx-auto",children:"Powerful features designed to help you build, manage, and grow your online presence."}),(0,ea.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:p.sort((e,t)=>
2e.order-t.order).map(e=>{const t=d0[e.icon]||$l;return(0,ea.jsxs)("div",{className:"p-6 rounded-xl bg-slate-50 hover:bg-slate-100 transition-colors",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mb-4",children:(0,ea.jsx)(t,{className:"text-indigo-600",size:24})}),(0,ea.jsx)("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:e.title}),(0,ea.jsx)("p",{className:"text-slate-600",children:e.description})]},e.feature_id)})})]})}),e.show_integrations&&(null===v||void 0===v?void 0:v.length)>0&&(0,ea.jsx)("section",{className:"py-20 px-4 bg-slate-50",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold text-center text-slate-900 mb-4",children:"Integration Partners"}),(0,ea.jsx)("p",{className:"text-lg text-slate-600 text-center mb-12 max-w-2xl mx-auto",children:"Seamlessly connected with powerful tools and services to extend your CMS capabilities"}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-6",children:v.sort((e,t)=>e.order-t.order).map(e=>(0,ea.jsxs)("a",{href:e.website_url||"#",target:"_blank",rel:"noopener noreferrer",className:"group bg-white rounded-xl p-6 shadow-sm hover:shadow-md transition-all flex flex-col items-center justify-center text-center border border-slate-100 hover:border-indigo-200",children:[(0,ea.jsxs)("div",{className:"h-12 w-full flex items-center justify-center mb-3",children:[e.logo_url?(0,ea.jsx)("img",{src:e.logo_url,alt:e.name,className:"max-h-12 max-w-full object-contain grayscale group-hover:grayscale-0 transition-all",onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="flex"}}):null,(0,ea.jsx)("div",{className:"w-12 h-12 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-xl items-center justify-center text-white font-bold text-xl",style:{display:e.logo_url?"none":"flex"},children:e.name.charAt(0).toUpperCase()})]}),(0,ea.jsx)("h3",{className:"font-semibold text-slate-900 text-sm group-hover:text-indigo-600 transition-colors",children:e.name}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:e.description})]},e.partner_id))})]})}),e.show_enterprise_partners&&(null===b||void 0===b?void 0:b.length)>0&&(0,ea.jsx)("section",{className:"py-20 px-4 bg-white",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold text-center text-slate-900 mb-4",children:"Enterprise Partners"}),(0,ea.jsx)("p",{className:"text-lg text-slate-600 text-center mb-12 max-w-2xl mx-auto",children:"Trusted by leading companies to deliver exceptional digital experiences"}),(0,ea.jsx)("div",{className:"grid md:grid-cols-3 gap-8",children:b.sort((e,t)=>e.order-t.order).map(e=>(0,ea.jsxs)("a",{href:e.website_url||"#",target:"_blank",rel:"noopener noreferrer",className:"group bg-gradient-to-br from-slate-50 to-slate-100 rounded-2xl p-8 hover:shadow-xl transition-all border border-slate-200 hover:border-indigo-300 text-center",children:[(0,ea.jsxs)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg group-hover:scale-110 transition-transform",children:[e.logo_url?(0,ea.jsx)("img",{src:e.logo_url,alt:e.name,className:"w-12 h-12 object-contain",onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="block"}}):null,(0,ea.jsx)("span",{className:"text-white font-bold text-3xl",style:{display:e.logo_url?"none":"block"},children:e.name.charAt(0).toUpperCase()})]}),(0,ea.jsx)("h3",{className:"text-xl font-bold text-slate-900 mb-2 group-hover:text-indigo-600 transition-colors",children:e.name}),(0,ea.jsx)("p",{className:"text-slate-600",children:e.description}),(0,ea.jsxs)("div",{className:"mt-4 inline-flex items-center text-indigo-600 font-medium text-sm group-hover:gap-2 transition-all",children:["Learn more",(0,ea.jsx)(ax,{size:16,className:"ml-1 group-hover:translate-x-1 transition-transform"})]})]},e.partner_id))})]})}),e.show_pricing&&(null===g||void 0===g?void 0:g.length)>0&&(0,ea.jsx)("section",{id:"pricing",className:"py-20 px-4 bg-white",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold text-center text-slate-900 mb-4",children:"Simple, transparent pricing"}),(0,ea.jsx)("p",{className:"text-lg text-slate-600 text-center mb-8",children:"Choose the plan that's right for you"}),(0,ea.jsxs)("div",{className:"flex justify-center items-center gap-4 mb-12",children:[(0,ea.jsx)("button",{onClick:()=>r("monthly"),className:"px-4 py-2 rounded-lg font-medium transition-colors ".concat("monthly"===l?"bg-indigo-600 text-white":"bg-slate-100 text-slate-600 hover:bg-slate-200"),children:"Monthly"}),(0,ea.jsxs)("button",{onClick:()=>r("yearly"),className:"px-4 py-2 rounded-lg font-medium transition-colors ".concat("yearly"===l?"bg-indigo-600 text-white":"bg-slate-100 text-slate-600 hover:bg-slate-200"),children:["Yearly",(0,ea.jsx)("span",{className:"ml-2 text-xs bg-green-100 text-green-700 px-2 py-0.5 rounded-full",children:"Save 20%"})]})]}),(0,ea.jsx)("div",{className:"grid gap-8 ".concat(1===g.length?"md:max-w-md md:mx-auto":2===g.length?"md:grid-cols-2 md:max-w-3xl md:mx-auto":3===g.length?"md:grid-cols-3":"md:grid-cols-2 lg:grid-cols-4"),children:g.sort((e,t)=>
2e.order-t.order).map(e=>{var t;const s="free"===e.tier_key||0===Number(e.price_monthly)&&0===Number(e.price_yearly);return(0,ea.jsxs)("div",{className:"relative rounded-2xl p-8 ".concat(e.is_popular?"bg-indigo-600 text-white ring-4 ring-indigo-600 ring-offset-4":"bg-white border-2 border-slate-200"),children:[e.is_popular&&(0,ea.jsx)("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2",children:(0,ea.jsx)("span",{className:"bg-gradient-to-r from-amber-400 to-orange-500 text-white text-sm font-medium px-4 py-1 rounded-full",children:"Most Popular"})}),(0,ea.jsx)("h3",{className:"text-2xl font-bold mb-2 ".concat(e.is_popular?"text-white":"text-slate-900"),children:e.name}),(0,ea.jsx)("p",{className:"mb-6 ".concat(e.is_popular?"text-indigo-100":"text-slate-600"),children:e.description}),(0,ea.jsx)("div",{className:"mb-6",children:e.contact_sales?(0,ea.jsx)("span",{className:"text-4xl font-bold ".concat(e.is_popular?"text-white":"text-slate-900"),children:"Contact us"}):s?(0,ea.jsx)("span",{className:"text-4xl font-bold ".concat(e.is_popular?"text-white":"text-slate-900"),children:"Free"}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("span",{className:"text-4xl font-bold ".concat(e.is_popular?"text-white":"text-slate-900"),children:["$","yearly"===l?e.price_yearly:e.price_monthly]}),(0,ea.jsxs)("span",{className:e.is_popular?"text-indigo-100":"text-slate-500",children:["/","yearly"===l?"year":"month"]})]})}),(0,ea.jsx)("ul",{className:"space-y-3 mb-8",children:null===(t=e.features)||void 0===t?void 0:t.map((t,s)=>(0,ea.jsxs)("li",{className:"flex items-center gap-3",children:[t.included?(0,ea.jsx)(Xl,{className:"flex-shrink-0 ".concat(e.is_popular?"text-indigo-200":"text-green-500"),size:20}):(0,ea.jsx)(sr,{className:"flex-shrink-0 ".concat(e.is_popular?"text-indigo-300":"text-slate-300"),size:20}),(0,ea.jsx)("span",{className:t.included?"":"opacity-60",children:t.text})]},s))}),(0,ea.jsx)(sg,{onClick:()=>h(e),disabled:i===e.tier_id&&!e.contact_sales,className:"w-full py-6 text-lg font-semibold ".concat(e.is_popular?"bg-white text-indigo-600 hover:bg-indigo-50":"bg-indigo-600 text-white hover:bg-indigo-700"),children:e.contact_sales?e.cta_text||"Contact Sales":i===e.tier_id?"Processing...":e.cta_text})]},e.tier_id)})}),!1!==e.show_comparison&&g.length>1&&(()=>{const t=g.slice().sort((e,t)=>e.order-t.order);let s;if("custom"===e.comparison_mode&&Array.isArray(e.comparison_rows)&&e.comparison_rows.length>0)s=e.comparison_rows.filter(e=>(e.label||"").trim()).map(e=>({label:e.label,get:t=>e.values&&null!=e.values[t.tier_id]?e.values[t.tier_id]:""}));else{const e=new Map;t.forEach(t=>{(t.features||[]).forEach(t=>{const s=(t.text||"").trim(),a=s.toLowerCase();a&&!e.has(a)&&e.set(a,s)})});const a=(e,t)=>(e.features||[]).some(e=>(e.text||"").trim().toLowerCase()===t&&e.included);s=Array.from(e.entries()).map(e=>{let[t,s]=e;return{label:s,get:e=>a(e,t)?"yes":"no"}}).filter(e=>t.some(t=>"yes"===e.get(t)))}if(0===s.length)return null;const a=e=>{const t=(null==e?"":String(e)).trim(),s=t.toLowerCase();return["yes","true","\u2713","included","y","1"].includes(s)?(0,ea.jsx)(Xl,{className:"inline text-green-500",size:18}):["no","false","-","","x","\u2717","n","0"].includes(s)?(0,ea.jsx)(sr,{className:"inline text-slate-300",size:18}):(0,ea.jsx)("span",{className:"text-slate-700 font-medium",children:t})};return(0,ea.jsxs)("div",{className:"hidden md:block mt-16",children:[(0,ea.jsx)("h3",{className:"text-2xl font-bold text-center text-slate-900 mb-2",children:"Compare plans"}),(0,ea.jsx)("p",{className:"text-center text-slate-600 mb-8",children:"All the features, side-by-side."}),(0,ea.jsx)("div",{className:"overflow-x-auto rounded-xl border border-slate-200 bg-white",children:(0,ea.jsxs)("table",{className:"w-full text-sm",children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"bg-slate-50 border-b border-slate-200",children:[(0,ea.jsx)("th",{className:"text-left py-4 px-6 font-semibold text-slate-700 w-1/3",children:"Feature"}),t.map(e=>{const t="free"===e.tier_key||0===Number(e.price_monthly)&&0===Number(e.price_yearly);return(0,ea.jsx)("th",{className:"text-center py-4 px-4 font-semibold ".concat(e.is_popular?"text-indigo-600":"text-slate-700"),
2children:(0,ea.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,ea.jsx)("span",{children:e.name}),(0,ea.jsx)("span",{className:"text-xs font-normal text-slate-500",children:e.contact_sales?"Contact us":t?"Free":"$".concat("yearly"===l?e.price_yearly:e.price_monthly,"/").concat("yearly"===l?"yr":"mo")})]})},e.tier_id)})]})}),(0,ea.jsxs)("tbody",{children:[s.map((e,s)=>(0,ea.jsxs)("tr",{className:s%2===0?"bg-white":"bg-slate-50/50",children:[(0,ea.jsx)("td",{className:"py-3 px-6 text-slate-700",children:e.label}),t.map(t=>(0,ea.jsx)("td",{className:"text-center py-3 px-4",children:a(e.get(t))},t.tier_id))]},"".concat(e.label,"-").concat(s))),(0,ea.jsxs)("tr",{className:"bg-slate-50 border-t border-slate-200",children:[(0,ea.jsx)("td",{className:"py-4 px-6 font-medium text-slate-700",children:"Get started"}),t.map(e=>(0,ea.jsx)("td",{className:"text-center py-4 px-4",children:(0,ea.jsx)(sg,{onClick:()=>h(e),disabled:i===e.tier_id&&!e.contact_sales,className:"text-xs px-3 py-1 h-auto ".concat(e.is_popular?"bg-indigo-600 text-white hover:bg-indigo-700":"bg-white border border-slate-300 text-slate-700 hover:bg-slate-50"),children:e.contact_sales?e.cta_text||"Contact Sales":i===e.tier_id?"...":e.cta_text})},e.tier_id))]})]})]})})]})})()]})}),e.show_testimonials&&(null===f||void 0===f?void 0:f.length)>0&&(0,ea.jsx)("section",{className:"py-20 px-4 bg-slate-50",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold text-center text-slate-900 mb-4",children:"Loved by teams worldwide"}),(0,ea.jsx)("p",{className:"text-lg text-slate-600 text-center mb-12",children:"See what our customers have to say"}),(0,ea.jsx)("div",{className:"grid md:grid-cols-3 gap-8",children:f.sort((e,t)=>e.order-t.order).map(e=>(0,ea.jsxs)("div",{className:"bg-white p-6 rounded-xl shadow-sm",children:[(0,ea.jsx)("div",{className:"flex gap-1 mb-4",children:[...Array(e.rating)].map((e,t)=>(0,ea.jsx)($l,{className:"text-amber-400 fill-amber-400",size:18},t))}),(0,ea.jsxs)("p",{className:"text-slate-700 mb-6 italic",children:['"',e.quote,'"']}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[e.author_image?(0,ea.jsx)("img",{src:e.author_image,alt:e.author_name,className:"w-12 h-12 rounded-full object-cover"}):(0,ea.jsx)("div",{className:"w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center",children:(0,ea.jsx)("span",{className:"text-indigo-600 font-semibold text-lg",children:e.author_name.charAt(0)})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:e.author_name}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[e.author_title,e.author_company&&", ".concat(e.author_company)]})]})]})]},e.testimonial_id))})]})}),e.show_cta&&j&&(0,ea.jsx)("section",{className:"py-20 px-4",style:{backgroundColor:j.background_color},children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto text-center",children:[(0,ea.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-4",style:{color:j.text_color},dangerouslySetInnerHTML:{__html:(j.headline||"").replace(/ /g,"\xa0")}}),(0,ea.jsx)("p",{className:"text-lg mb-8 opacity-90",style:{color:j.text_color},dangerouslySetInnerHTML:{__html:(j.subheadline||"").replace(/ /g,"\xa0")}}),(0,ea.jsxs)(sg,{size:"lg",className:"text-lg px-8 py-6 bg-white text-indigo-600 hover:bg-slate-100",onClick:()=>{var e;return null===(e=document.getElementById("pricing"))||void 0===e?void 0:e.scrollIntoView({behavior:"smooth"})},children:[j.cta_text,(0,ea.jsx)(ax,{className:"ml-2",size:20})]})]})}),(0,ea.jsx)("footer",{className:"py-8 px-4 bg-slate-900",children:(0,ea.jsx)("div",{className:"max-w-6xl mx-auto text-center",children:(0,ea.jsxs)("p",{className:"text-slate-400",children:["\xa9 ",(new Date).getFullYear()," Nexus CMS. All rights reserved."]})})}),c&&(0,ea.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm p-4 animate-in fade-in",onClick:()=>d(!1),"data-testid":"demo-video-overlay",children:(0,ea.jsxs)("div",{className:"relative w-full max-w-5xl",onClick:e=>e.stopPropagation(),children:[(0,ea.jsxs)("button",{className:"absolute -top-12 right-0 text-white/80 hover:text-white flex items-center gap-2 text-sm",onClick:()=>d(!1),"data-testid":"demo-video-close",children:["Close ",(0,ea.jsx)(sr,{size:22})]}),(0,ea.jsx)("div",{className:"rounded-xl overflow-hidden shadow-2xl ring-1 ring-white/10 bg-black",children:(0,ea.jsx)("video",{src:x.demo_video_url||"/demo/nexus-demo.mp4",poster:"/demo/nexus-demo-
2poster.png",controls:!0,autoPlay:!0,muted:!0,playsInline:!0,preload:"auto",className:"w-full h-auto block","data-testid":"demo-video-player"})})]})})]})},m0=()=>{var e,s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N,w,C,k,D;const{user:_,logout:S}=Al(),E="master_admin"===(null===_||void 0===_?void 0:_.role),[A,F]=(0,t.useState)(null),[T,z]=(0,t.useState)(!0),[M,P]=(0,t.useState)(!1),[B,R]=(0,t.useState)(!1),[L,I]=(0,t.useState)({name:"Nexus Landing Page",description:"High-quality landing page captured from the Nexus CMS landing page design.",category:"landing",thumbnail_url:"",is_system:!0}),[O,U]=(0,t.useState)(!1),[H,W]=(0,t.useState)({hero:!0,features:!1,pricing:!0,comparison:!1,testimonials:!1,integrations:!1,enterprise:!1,cta:!1});(0,t.useEffect)(()=>{V()},[]);const V=async()=>{try{const e=await _l.get("/cms/landing-page");F(e.data)}catch(e){console.error("Failed to fetch settings:",e),qs.error("Failed to load landing page settings")}finally{z(!1)}},q=async()=>{P(!0);try{await _l.put("/cms/landing-page",A),qs.success("Landing page saved successfully!")}catch(e){console.error("Failed to save:",e),qs.error("Failed to save changes")}finally{P(!1)}},$=e=>{W(t=>d(d({},t),{},{[e]:!t[e]}))},G=(e,t)=>{F(s=>d(d({},s),{},{hero:d(d({},s.hero),{},{[e]:t})}))},K=(e,t)=>{F(s=>d(d({},s),{},{cta:d(d({},s.cta),{},{[e]:t})}))},Y=(e,t,s)=>{F(a=>d(d({},a),{},{features:a.features.map(a=>a.feature_id===e?d(d({},a),{},{[t]:s}):a)}))},J=(e,t,s)=>{F(a=>d(d({},a),{},{pricing_tiers:a.pricing_tiers.map(a=>a.tier_id===e?d(d({},a),{},{[t]:s}):a)}))},Q=(e,t,s,a)=>{F(n=>d(d({},n),{},{pricing_tiers:n.pricing_tiers.map(n=>{if(n.tier_id!==e)return n;const l=[...n.features];return l[t]=d(d({},l[t]),{},{[s]:a}),d(d({},n),{},{features:l})})}))},X=(e,t)=>{F(s=>d(d({},s),{},{[e]:t}))},Z=()=>{const e=A.pricing_tiers||[],t=new Map;e.forEach(e=>(e.features||[]).forEach(e=>{const s=(e.text||"").trim(),a=s.toLowerCase();a&&!t.has(a)&&t.set(a,s)}));const s=Array.from(t.entries()).map(t=>{let[s,a]=t;const n={};return e.forEach(e=>{const t=(e.features||[]).some(e=>(e.text||"").trim().toLowerCase()===s&&e.included);n[e.tier_id]=t?"yes":"no"}),{label:a,values:n}});F(e=>d(d({},e),{},{comparison_rows:s,comparison_mode:"custom"})),qs.success("Started from auto: ".concat(s.length," rows \u2014 now edit any cell"))},ee=(e,t,s)=>{F(a=>d(d({},a),{},{testimonials:a.testimonials.map(a=>a.testimonial_id===e?d(d({},a),{},{[t]:s}):a)}))},te=(e,t,s)=>{F(a=>d(d({},a),{},{integration_partners:a.integration_partners.map(a=>a.partner_id===e?d(d({},a),{},{[t]:s}):a)}))},se=(e,t,s)=>{F(a=>d(d({},a),{},{enterprise_partners:a.enterprise_partners.map(a=>a.partner_id===e?d(d({},a),{},{[t]:s}):a)}))};return T?(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 p-8 flex items-center justify-center",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600"})})]}):(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 p-8",children:(0,ea.jsxs)("div",{className:"max-w-5xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900",children:"Landing Page Editor"}),(0,ea.jsx)("p",{className:"text-slate-600 mt-1",children:"Customize your public CMS landing page"})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsx)(sg,{variant:"outline",asChild:!0,"data-testid":"landing-preview-btn",children:(0,ea.jsxs)("a",{href:"/",target:"_blank",rel:"noopener noreferrer",children:[(0,ea.jsx)(IN,{size:18,className:"mr-2"}),"Preview"]})}),E&&(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>R(!0),"data-testid":"save-as-system-template-btn",title:"Save this landing page as a reusable Page Builder template",children:[(0,ea.jsx)(_w,{size:18,className:"mr-2"}),"Save as System Template"]}),(0,ea.jsxs)(sg,{onClick:q,disabled:M,"data-testid":"save-landing-btn",children:[(0,ea.jsx)(BD,{size:18,className:"mr-2"}),M?"Saving...":"Save Changes"]}),(0,ea.jsx)("div",{className:"w-px h-6 bg-slate-200 mx-1"}),(0,ea.jsxs)(sg,{onClick:S,variant:"ghost",className:"text-slate-500 hover:text-red-600 hover:bg-red-50","data-testid":"editor-logout-button",title:"Logout",children:[(0,ea.jsx)(zw,{size:18,className:"mr-2"}),"Logout"]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Section Visibility"}),(0,ea.jsx)(cD,{children:"Toggle which sections appear on the landing page"})]}),(0,ea.jsx)(dD,{children:(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-4",children:[{key:"show_features",label:"Features"},{key:"show_pricing",label:"Pricing"},{key:"show_comparison",label:"Compare Table"},{key:"show_testimonials",label:"Testimonials"},{key:"show_integrations",label:"Integrations"},{key:"show_enterprise_partners",label:"Enterprise"},{key:"show_cta",label:"CTA Section"}].map(e=>{var t;let{key:s,label:a}=e;return(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("span",{className:"text-sm font-medium",children:a}),(0,ea.jsx)(wb,{checked:null===(t=null===A||void 0===A?void 0:A[s])||void 0===t||t,onCheckedChange:e=>F(t=>d(d({},t),{},{[s]:e}))})]},s)})})})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("hero"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Hero Section"}),H.hero?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.hero&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-lg text-sm",children:[(0,ea.jsx)("p",{className:"font-medium text-blue-800 mb-1",children:"\ud83d\udca1 Text Formatting Tips:"}),(0,ea.jsxs)("ul",{className:"text-blue-700 space-y-1 text-xs",children:[(0,ea.jsxs)("li",{children:["\u2022 Use ",(0,ea.jsx)("code",{className:"bg-blue-100 px-1 rounded",children:"<br>"})," to add a line break"]}),(0,ea.jsxs)("li",{children:["\u2022 Use ",(0,ea.jsx)("code",{className:"bg-blue-100 px-1 rounded",children:" "})," between words to keep them together (non-breaking space)"]}),(0,ea.jsxs)("li",{children:["\u2022 Example: ",(0,ea.jsxs)("code",{className:"bg-blue-100 px-1 rounded",children:["Build Amazing","<br>","Websites with Nexus CMS"]})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Headline"}),(0,ea.jsx)(YN,{value:(null===A||void 0===A||null===(e=A.hero)||void 0===e?void 0:e.headline)||"",onChange:e=>G("headline",e.target.value),rows:2,placeholder:"Build Amazing<br>Websites with Nexus\xa0CMS",className:"font-mono text-sm"}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-800 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:"Preview:"}),(0,ea.jsx)("h3",{className:"text-xl font-bold text-white",dangerouslySetInnerHTML:{__html:((null===A||void 0===A||null===(s=A.hero)||void 0===s?void 0:s.headline)||"").replace(/ /g,"\xa0")}})]})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(a=A.hero)||void 0===a?void 0:a.background_color)||"#1e293b",onChange:e=>G("background_color",e.target.value)}),(0,ea.jsx)("input",{type:"color",value:(null===A||void 0===A||null===(n=A.hero)||void 0===n?void 0:n.background_color)||"#1e293b",onChange:e=>G("background_color",e.target.value),className:"w-10 h-10 rounded border cursor-pointer"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(l=A.hero)||void 0===l?void 0:l.text_color)||"#ffffff",onChange:e=>G("text_color",e.target.value)}),(0,ea.jsx)("input",{type:"color",value:(null===A||void 0===A||null===(r=A.hero)||void 0===r?void 0:r.text_color)||"#ffffff",onChange:e=>G("text_color",e.target.value),className:"w-10 h-10 rounded border cursor-pointer"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Subheadline"}),(0,ea.jsx)(YN,{value:(null===A||void 0===A||null===(i=A.hero)||void 0===i?void 0:i.subheadline)||"",onChange:e=>G("subheadline",e.target.value),rows:2,className:"font-mono text-sm",placeholder:"The all-in-one CMS platform<br>for modern web experiences"}),(0,ea.jsxs)("div",{className:"p-3 bg-slate-100 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:"Preview:"}),(0,ea.jsx)("p",{className:"text-sm text-slate-700",dangerouslySetInnerHTML:{__html:((null===A||void 0===A||null===(o=A.hero)||void 0===o?void 0:o.subheadline)||"").replace(/ /g,"\xa0")}})]})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Primary CTA Text"}),(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(c=A.hero)||void 0===c?void 0:c.cta_primary_text)||"",onChange:e=>G("cta_primary_text",e.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Secondary CTA Text"}),(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(u=A.hero)||void 0===u?void 0:u.cta_secondary_text)||"",onChange:e=>G("cta_secondary_text",e.target.value)})]})]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("pricing"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Pricing Tiers"}),H.pricing?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.pricing&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[null===A||void 0===A||null===(m=A.pricing_tiers)||void 0===m?void 0:m.map((e,t)=>{var s;return(0,ea.jsxs)("div",{className:"border rounded-lg p-4 bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(yE,{size:16,className:"text-slate-400"}),(0,ea.jsx)("span",{className:"font-semibold",children:e.name}),e.is_popular&&(0,ea.jsx)("span",{className:"text-xs bg-indigo-100 text-indigo-700 px-2 py-0.5 rounded-full",children:"Popular"})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.tier_id,void F(e=>d(d({},e),{},{pricing_tiers:e.pricing_tiers.filter(e=>e.tier_id!==t)}));var t},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-3 gap-4 mb-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Tier Name"}),(0,ea.jsx)(BN,{value:e.name,onChange:t=>J(e.tier_id,"name",t.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Monthly Price ($)"}),(0,ea.jsx)(BN,{type:"number",step:"0.01",value:e.price_monthly,onChange:t=>J(e.tier_id,"price_monthly",parseFloat(t.target.value)||0)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Yearly Price ($)"}),(0,ea.jsx)(BN,{type:"number",step:"0.01",value:e.price_yearly,onChange:t=>J(e.tier_id,"price_yearly",parseFloat(t.target.value)||0)})]})]}),(0,ea.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,ea.jsx)(tf,{children:"Description"}),(0,ea.jsx)(BN,{value:e.description,onChange:t=>J(e.tier_id,"description",t.target.value)})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-4 mb-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"CTA Button Text"}),(0,ea.jsx)(BN,{value:e.cta_text,onChange:t=>J(e.tier_id,"cta_text",t.target.value)})]}),(0,ea.jsxs)("div",{className:"flex flex-col gap-2 pt-6",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:e.is_popular,onChange:t=>J(e.tier_id,"is_popular",t.target.checked),className:"rounded","data-testid":"tier-popular-".concat(e.tier_id)}),(0,ea.jsx)("span",{className:"text-sm",children:"Mark as Popular"})]}),(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ea.jsx)("input",{type:"checkbox",checked:!!e.contact_sales,onChange:t=>J(e.tier_id,"contact_sales",t.target.checked),className:"rounded","data-testid":"tier-contact-sales-".concat(e.tier_id)}),(0,ea.jsx)("span",{className:"text-sm",children:'Show "Contact us" instead of price'})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{children:"Features"}),(0,ea.jsxs)(sg,{size:"sm",variant:"outline",onClick:()=>{return t=e.tier_id,void F(e=>d(d({},e),{},{pricing_tiers:e.pricing_tiers.map(e=>e.tier_id===t?d(d({},e),{},{features:[...e.features||[],{text:"New feature",included:!0}]}):e)}));var t},children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add Feature"]})]}),(0,ea.jsx)("div",{className:"space-y-2",children:null===(s=e.features)||void 0===s?void 0:s.map((t,s)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("input",{type:"checkbox",checked:t.included,onChange:t=>Q(e.tier_id,s,"included",t.target.checked),className:"rounded"}),(0,ea.jsx)(BN,{value:t.text,onChange:t=>Q(e.tier_id,s,"text",t.target.value),className:"flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>((e,t)=>{F(s=>d(d({},s),{},{pricing_tiers:s.pricing_tiers.map(s=>s.tier_id!==e?s:d(d({},s),{},{features:s.features.filter((e,s)=>s!==t)}))}))})(e.tier_id,s),className:"text-red-500",children:(0,ea.jsx)(wD,{size:14})})]},s))})]})]},e.tier_id)}),(0,ea.jsxs)(sg,{onClick:()=>{var e;const t={tier_id:aZ(),name:"New Tier",description:"Plan description",price_monthly:0,price_yearly:0,currency:"usd",features:[{text:"Feature 1",included:!0}],cta_text:"Get Started",cta_url:"#",is_popular:!1,order:(null===(e=A.pricing_tiers)||void 0===e?void 0:e.length)||0};F(e=>d(d({},e),{},{pricing_tiers:[...e.pricing_tiers||[],t]}))},variant:"outline",className:"w-full",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"})," Add Pricing Tier"]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("comparison"),"data-testid":"section-toggle-comparison",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Plan Comparison Table"}),(0,ea.jsx)(cD,{children:'The "Compare plans" table shown below your pricing cards'})]}),H.comparison?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.comparison&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("span",{className:"text-sm font-medium",children:"Show comparison table"}),(0,ea.jsx)(wb,{checked:null===(h=null===A||void 0===A?void 0:A.show_comparison)||void 0===h||h,onCheckedChange:e=>X("show_comparison",e),"data-testid":"comparison-show-toggle"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Mode"}),(0,ea.jsxs)(eb,{value:(null===A||void 0===A?void 0:A.comparison_mode)||"auto",onValueChange:e=>{"custom"!==e||((null===A||void 0===A?void 0:A.comparison_rows)||[]).length?X("comparison_mode",e):Z()},children:[(0,ea.jsx)(sb,{"data-testid":"comparison-mode-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"auto",children:"Auto \u2014 derive from each tier's feature list"}),(0,ea.jsx)(rb,{value:"custom",children:"Custom \u2014 edit the matrix below"})]})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Auto marks a feature with an \u2717 for any tier that doesn't list it (can be misleading). Custom lets you set each cell yourself \u2014 type ",(0,ea.jsx)("strong",{children:"yes"})," / ",(0,ea.jsx)("strong",{children:"no"}),' for \u2713 / \u2717, or any text (e.g. "Unlimited", "5 GB").']})]}),"custom"===(null===A||void 0===A?void 0:A.comparison_mode)&&(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-sm p-3 bg-indigo-50 rounded-lg","data-testid":"comparison-start-with-auto-label",children:[(0,ea.jsx)("input",{type:"checkbox",checked:((null===A||void 0===A?void 0:A.comparison_rows)||[]).length>0,onChange:e=>{e.target.checked&&Z()},className:"rounded","data-testid":"comparison-start-with-auto"}),(0,ea.jsxs)("span",{children:[(0,ea.jsx)("strong",{children:"Start with the auto list"})," \u2014 pre-fill rows from your tier features, then edit any cell freely"]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ea.jsx)(sg,{size:"sm",variant:"outline",onClick:Z,"data-testid":"comparison-generate-btn",children:"Reset rows from auto list"}),(0,ea.jsxs)(sg,{size:"sm",variant:"outline",onClick:()=>{F(e=>d(d({},e),{},{comparison_rows:[...e.comparison_rows||[],{label:"New feature",values:{}}]}))},"data-testid":"comparison-add-row-btn",children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add row"]})]}),0===((null===A||void 0===A?void 0:A.comparison_rows)||[]).length?(0,ea.jsx)("p",{className:"text-sm text-slate-500 italic",children:'No rows yet. Click "Generate rows from tier features" to start, then edit any cell.'}):(0,ea.jsx)("div",{className:"overflow-x-auto border rounded-lg",children:(0,ea.jsxs)("table",{className:"w-full text-sm",children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"bg-slate-50 border-b",children:[(0,ea.jsx)("th",{className:"text-left p-2 font-semibold text-slate-700 min-w-[160px]",children:"Feature"}),((null===A||void 0===A?void 0:A.pricing_tiers)||[]).map(e=>(0,ea.jsx)("th",{className:"text-center p-2 font-semibold text-slate-700 min-w-[110px]",children:e.name},e.tier_id)),(0,ea.jsx)("th",{className:"w-10"})]})}),(0,ea.jsx)("tbody",{children:((null===A||void 0===A?void 0:A.comparison_rows)||[]).map((e,t)=>(0,ea.jsxs)("tr",{className:"border-b last:border-0",children:[(0,ea.jsx)("td",{className:"p-2",children:(0,ea.jsx)(BN,{value:e.label,onChange:e=>((e,t)=>{F(s=>d(d({},s),{},{comparison_rows:(s.comparison_rows||[]).map((s,a)=>a===e?d(d({},s),{},{label:t}):s)}))})(t,e.target.value),"data-testid":"comparison-row-label-".concat(t)})}),((null===A||void 0===A?void 0:A.pricing_tiers)||[]).map(s=>(0,ea.jsx)("td",{className:"p-2",children:(0,ea.jsx)(BN,{value:e.values&&e.values[s.tier_id]||"",placeholder:"yes / no / text",onCh
2ange:e=>((e,t,s)=>{F(a=>d(d({},a),{},{comparison_rows:(a.comparison_rows||[]).map((a,n)=>n===e?d(d({},a),{},{values:d(d({},a.values||{}),{},{[t]:s})}):a)}))})(t,s.tier_id,e.target.value),className:"text-center","data-testid":"comparison-cell-".concat(t,"-").concat(s.tier_id)})},s.tier_id)),(0,ea.jsx)("td",{className:"p-2 text-center",children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(e=>{F(t=>d(d({},t),{},{comparison_rows:(t.comparison_rows||[]).filter((t,s)=>s!==e)}))})(t),className:"text-red-500","data-testid":"comparison-remove-row-".concat(t),children:(0,ea.jsx)(wD,{size:14})})})]},t))})]})})]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("features"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Features"}),H.features?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.features&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[null===A||void 0===A||null===(x=A.features)||void 0===x?void 0:x.map(e=>(0,ea.jsxs)("div",{className:"border rounded-lg p-4 bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsx)(yE,{size:16,className:"text-slate-400"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.feature_id,void F(e=>d(d({},e),{},{features:e.features.filter(e=>e.feature_id!==t)}));var t},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Y(e.feature_id,"title",t.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Icon"}),(0,ea.jsxs)(eb,{value:e.icon,onValueChange:t=>Y(e.feature_id,"icon",t),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"star",children:"Star"}),(0,ea.jsx)(rb,{value:"layout",children:"Layout"}),(0,ea.jsx)(rb,{value:"palette",children:"Palette"}),(0,ea.jsx)(rb,{value:"globe",children:"Globe"}),(0,ea.jsx)(rb,{value:"zap",children:"Zap"}),(0,ea.jsx)(rb,{value:"shield",children:"Shield"}),(0,ea.jsx)(rb,{value:"mail",children:"Mail"})]})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2 mt-4",children:[(0,ea.jsx)(tf,{children:"Description"}),(0,ea.jsx)(YN,{value:e.description,onChange:t=>Y(e.feature_id,"description",t.target.value),rows:2})]})]},e.feature_id)),(0,ea.jsxs)(sg,{onClick:()=>{var e;const t={feature_id:aZ(),icon:"star",title:"New Feature",description:"Feature description",order:(null===(e=A.features)||void 0===e?void 0:e.length)||0};F(e=>d(d({},e),{},{features:[...e.features||[],t]}))},variant:"outline",className:"w-full",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"})," Add Feature"]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("testimonials"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Testimonials"}),H.testimonials?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.testimonials&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[null===A||void 0===A||null===(p=A.testimonials)||void 0===p?void 0:p.map(e=>(0,ea.jsxs)("div",{className:"border rounded-lg p-4 bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsx)("div",{className:"flex gap-1",children:[1,2,3,4,5].map(t=>(0,ea.jsx)("button",{onClick:()=>ee(e.testimonial_id,"rating",t),className:"focus:outline-none",children:(0,ea.jsx)($l,{size:18,className:t<=e.rating?"text-amber-400 fill-amber-400":"text-slate-300"})},t))}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.testimonial_id,void F(e=>d(d({},e),{},{testimonials:e.testimonials.filter(e=>e.testimonial_id!==t)}));var t},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,ea.jsx)(tf,{children:"Quote"}),(0,ea.jsx)(YN,{value:e.quote,onChange:t=>ee(e.testimonial_id,"quote",t.target.value),rows:3})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-3 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Author Name"}),(0,ea.jsx)(BN,{value:e.author_name,onChange:t=>ee(e.testimonial_id,"author_name",t.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Title"}),(0,ea.jsx)(BN,{value:e.author_title,onChange:t=>ee(e.testimonial_id,"author_title",t.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Company"}),(0,ea.jsx)(BN,{value:e.author_company,onChange:t=>ee(e.testimonial_id,"author_company",t.target.value)})]})]})]},e.testimonial_id)),(0,ea.jsxs)(sg,{onClick:()=>{var e;const t={testimonial_id:aZ(),quote:"Customer testimonial quote",author_name:"Customer Name",author_title:"Title",author_company:"Company",author_image:null,rating:5,order:(null===(e=A.testimonials)||void 0===e?void 0:e.length)||0};F(e=>d(d({},e),{},{testimonials:[...e.testimonials||[],t]}))},variant:"outline",className:"w-full",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"})," Add Testimonial"]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("integrations"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Integration Partners"}),H.integrations?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.integrations&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[null===A||void 0===A||null===(g=A.integration_partners)||void 0===g?void 0:g.map(e=>(0,ea.jsxs)("div",{className:"border rounded-lg p-4 bg-white",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsx)("span",{className:"font-medium",children:e.name}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.partner_id,void F(e=>d(d({},e),{},{integration_partners:e.integration_partners.filter(e=>e.partner_id!==t)}));var t},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Partner Name"}),(0,ea.jsx)(BN,{value:e.name,onChange:t=>te(e.partner_id,"name",t.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo URL"}),(0,ea.jsx)(BN,{value:e.logo_url,onChange:t=>te(e.partner_id,"logo_url",t.target.value),placeholder:"https://..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Website URL"}),(0,ea.jsx)(BN,{value:e.website_url,onChange:t=>te(e.partner_id,"website_url",t.target.value),placeholder:"https://..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Description"}),(0,ea.jsx)(BN,{value:e.description,onChange:t=>te(e.partner_id,"description",t.target.value)})]})]})]},e.partner_id)),(0,ea.jsxs)(sg,{onClick:()=>{var e;const t={partner_id:aZ(),name:"Partner Name",logo_url:"",website_url:"",description:"",order:(null===(e=A.integration_partners)||void 0===e?void 0:e.length)||0};F(e=>d(d({},e),{},{integration_partners:[...e.integration_partners||[],t]}))},variant:"outline",className:"w-full",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"})," Add Integration Partner"]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("enterprise"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Enterprise Partners"}),H.enterprise?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.enterprise&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-600 mb-4",children:"Featured enterprise partners displayed prominently on the landing page"}),null===A||void 0===A||null===(f=A.enterprise_partners)||void 0===f?void 0:f.map(e=>(0,ea.jsxs)("div",{className:"border rounded-lg p-4 bg-gradient-to-r from-indigo-50 to-purple-50",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-lg flex items-center justify-center text-white font-bold",children:e.name.charAt(0).toUpperCase()}),(0,ea.jsx)("span",{className:"font-semibold text-slate-900",children:e.name})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.partner_id,void F(e=>d(d({},e),{},{enterprise_partners:e.enterprise_partners.filter(e=>e.partner_id!==t)}));var t},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Partner Name"}),(0,ea.jsx)(BN,{value:e.name,onChange:t=>se(e.partner_id,"name",t.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo URL (optional)"}),(0,ea.jsx)(BN,{value:e.logo_url,onChange:t=>se(e.partner_id,"logo_url",t.target.value),placeholder:"https://..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Website URL"}),(0,ea.jsx)(BN,{value:e.website_url,onChange:t=>se(e.partner_id,"website_url",t.target.value),placeholder:"https://..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Description"}),(0,ea.jsx)(BN,{value:e.description,onChange:t=>se(e.partner_id,"description",t.target.value),placeholder:"Brief description of the partner"})]})]})]},e.partner_id)),(0,ea.jsxs)(sg,{onClick:()=>{var e;const t={partner_id:aZ(),name:"Partner Name",logo_url:"",website_url:"",description:"",order:(null===(e=A.enterprise_partners)||void 0===e?void 0:e.length)||0};F(e=>d(d({},e),{},{enterprise_partners:[...e.enterprise_partners||[],t]}))},variant:"outline",className:"w-full",children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"})," Add Enterprise Partner"]})]})]}),(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsx)(iD,{className:"cursor-pointer",onClick:()=>$("cta"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Call to Action Section"}),H.cta?(0,ea.jsx)(er,{size:20}):(0,ea.jsx)(tr,{size:20})]})}),H.cta&&(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Headline"}),(0,ea.jsx)(YN,{value:(null===A||void 0===A||null===(v=A.cta)||void 0===v?void 0:v.headline)||"",onChange:e=>K("headline",e.target.value),rows:2,className:"font-mono text-sm",placeholder:"Ready to get started?<br>Transform your web\xa0presence"}),(0,ea.jsxs)("div",{className:"p-3 rounded-lg",style:{backgroundColor:(null===A||void 0===A||null===(b=A.cta)||void 0===b?void 0:b.background_color)||"#4f46e5"},children:[(0,ea.jsx)("p",{className:"text-xs text-white/60 mb-1",children:"Preview:"}),(0,ea.jsx)("h3",{className:"text-lg font-bold text-white",dangerouslySetInnerHTML:{__html:((null===A||void 0===A||null===(j=A.cta)||void 0===j?void 0:j.headline)||"").replace(/ /g,"\xa0")}})]})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(y=A.cta)||void 0===y?void 0:y.background_color)||"#4f46e5",onChange:e=>K("background_color",e.target.value)}),(0,ea.jsx)("input",{type:"color",value:(null===A||void 0===A||null===(N=A.cta)||void 0===N?void 0:N.background_color)||"#4f46e5",onChange:e=>K("background_color",e.target.value),className:"w-10 h-10 rounded border cursor-pointer"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(w=A.cta)||void 0===w?void 0:w.text_color)||"#ffffff",onChange:e=>K("text_color",e.target.value)}),(0,ea.jsx)("input",{type:"color",value:(null===A||void 0===A||null===(C=A.cta)||void 0===C?void 0:C.text_color)||"#ffffff",onChange:e=>K("text_color",e.target.value),className:"w-10 h-10 rounded border cursor-pointer"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Subheadline"}),(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(k=A.cta)||void 0===k?void 0:k.subheadline)||"",onChange:e=>K("subheadline",e.target.value)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Button Text"}),(0,ea.jsx)(BN,{value:(null===A||void 0===A||null===(D=A.cta)||void 0===D?void 0:D.cta_text)||"",onChange:e=>K("cta_text",e.target.value)})]})]})]}),(0,ea.jsx)("div",{className:"flex justify-end",children:(0,ea.jsxs)(sg,{onClick:q,disabled:M,size:"lg",children:[(0,ea.jsx)(BD,{size:18,className:"mr-2"}),M?"Saving...":"Save All Changes"]})})]})}),(0,ea.jsx)(Ok,{open:B,onOpenChange:R,children:(0,ea.jsxs)(Wk,{"data-testid":"save-as-template-dialog",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Save Landing Page as Template"}),(0,ea.jsx)(Gk,{children:"Convert the current CMS Landing Page into a reusable Page Builder template. All sections (Hero, Features, Pricing, Testimonials, Integrations, Enterprise Partners and CTA) will be turned into editable blocks."})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Template Name"}),(0,ea.jsx)(BN,{value:L.name,onChange:e=>I(d(d({},L),{},{name:e.target.value})),placeholder:"e.g. Nexus Landing Page","data-testid":"template-name-input"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Description"}),(0,ea.jsx)(YN,{rows:3,value:L.description,onChange:e=>I(d(d({},L),{},{description:e.target.value})),placeholder:"What this template is best for","data-testid":"template-description-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Category"}),(0,ea.jsxs)(eb,{value:L.category,onValueChange:e=>I(d(d({},L),{},{category:e})),children:[(0,ea.jsx)(sb,{"data-testid":"template-category-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"landing",children:"Landing"}),(0,ea.jsx)(rb,{value:"business",children:"Business"}),(0,ea.jsx)(rb,{value:"portfolio",children:"Portfolio"}),(0,ea.jsx)(rb,{value:"blog",children:"Blog"}),(0,ea.jsx)(rb,{value:"other",children:"Other"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Thumbnail URL (optional)"}),(0,ea.jsx)(BN,{value:L.thumbnail_url,onChange:e=>I(d(d({},L),{},{thumbnail_url:e.target.value})),placeholder:"https://...","data-testid":"template-thumbnail-input"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-amber-900",children:"Make available to all tenants"}),(0,ea.jsx)("p",{className:"text-xs text-amber-700",children:"Turn this on to save as a System Template visible to every tenant in their Templates picker."})]}),(0,ea.jsx)(wb,{checked:!!L.is_system,onCheckedChange:e=>I(d(d({},L),{},{is_system:e})),"data-testid":"template-is-system-switch"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>R(!1),disabled:O,"data-testid":"template-cancel-btn",children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(L.name.trim()){U(!0);try{var e,t,s;await _l.put("/cms/landing-page",A);const a=await _l.post("/templates/from-landing-page",{name:L.name.trim(),description:L.description.trim()||void 0,category:L.category||"landing",thumbnail_url:L.thumbnail_url.trim()||void 0,is_system:!!L.is_system}),n=((null===(e=a.data)||void 0===e?void 0:e.blocks)||[]).length,l=null!==(t=a.data)&&void 0!==t&&t.is_system?"System Template (visible to all tenants)":"Tenant Template";qs.success('Saved "'.concat(null===(s=a.data)||void 0===s?void 0:s.name,'" as ').concat(l," with ").concat(n," blocks")),R(!1)}catch(l){var a,n;console.error("Failed to save as template:",l);const e=(null===l||void 0===l||null===(a=l.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.detail)||"Failed to save as template";qs.error(e)}finally{U(!1)}}else qs.error("Please give the template a name")},disabled:O,"data-testid":"template-save-confirm-btn",children:O?"Saving...":"Save Template"})]})]})})]})},h0=e=>{let{value:s,onChange:a,label:n="Image",placeholder:l="Select or upload an image",showPreview:r=!0,className:i=""}=e;const[o,c]=(0,t.useState)(!1),[d,u]=(0,t.useState)([]),[m,h]=(0,t.useState)([]),[x,p]=(0,t.useState)(!1),[g,f]=(0,t.useState)(!1),[v,b]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),[N,w]=(0,t.useState)(""),C=async()=>{p(!0);try{const[e,t]=await Promise.all([_l.get("/media"),_l.get("/media/folders")]);u(e.data),h(t.data)}catch(e){qs.error("Failed to load media")}finally{p(!1)}};(0,t.useEffect)(()=>{o&&C()},[o]);const k=(0,t.useCallback)(async e=>{if(e&&0!==e.length){f(!0);try{const t=e[0],s=new FormData;s.append("file",t);const n=await _l.post("/media/upload",s,{headers:{"Content-Type":"multipart/form-data"}});qs.success("Image uploaded successfully"),a(n.data.url),c(!1),C()}catch(t){qs.error("Failed to upload image")}finally{f(!1)}}},[a]),D=(0,t.useCallback)(e=>{e.preventDefault(),b(!1);const t=e.dataTransfer.files;t.length>0&&k(t)},[k]),_=d.filter(e=>{var t,s,a;const n=j?e.folder_id===j:!e.folder_id,l=!N||(null===(t=e.filename)||void 0===t?void 0:t.toLowerCase().includes(N.toLowerCase())),r=(null===(s=e.type)||void 0===s?void 0:s.startsWith("image/"))||(null===(a=e.filename)||void 0===a?void 0:a.match(/\.(jpg|jpeg|png|gif|webp|svg)$/i));return n&&l&&r}),S=m.filter(e=>j?e.parent_id===j:!e.parent_id);return(0,ea.jsxs)("div",{className:i,children:[(0,ea.jsx)("div",{className:"relative border-2 border-dashed rounded-lg transition-colors ".concat(v?"border-indigo-500 bg-indigo-50":"border-slate-300 hover:border-slate-400"," ").concat(s?"p-2":"p-6"),onDrop:D,onDragOver:e=>{e.preventDefault(),b(!0)},onDragLeave:()=>{b(!1)},children:s&&r?(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)("img",{src:s,alt:"Selected",className:"max-h-40 rounded mx-auto object-contain"}),(0,ea.jsx)("button",{type:"button",onClick:()=>{a("")},className:"absolute top-1 right-1 p-1 bg-red-500 text-white rounded-full hover:bg-red-600",children:(0,ea.jsx)(sr,{size:14})})]}):(0,ea.jsx)("div",{className:"text-center",children:g?(0,ea.jsxs)("div",{className:"flex flex-col items-center",children:[(0,ea.jsx)(ql,{className:"animate-spin text-indigo-500 mb-2",size:32}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Uploading..."})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(kq,{className:"mx-auto mb-2 text-slate-400",size:32}),(0,ea.jsx)("p",{className:"text-sm text-slate-600 mb-1",children:"Drag & drop an image here"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-3",children:"or"}),(0,ea.jsxs)("div",{className:"flex gap-2 justify-center",children:[(0,ea.jsxs)(sg,{type:"button",variant:"outline",size:"sm",onClick:()=>c(!0),children:[(0,ea.jsx)(jD,{size:16,className:"mr-1"}),"Browse Media"]}),(0,ea.jsxs)("label",{children:[(0,ea.jsx)(sg,{type:"button",variant:"outline",size:"sm",asChild:!0,children:(0,ea.jsxs)("span",{children:[(0,ea.jsx)(kq,{size:16,className:"mr-1"}),"Upload"]})}),(0,ea.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:e=>k(e.target.files)})]})]})]})})}),s&&(0,ea.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,ea.jsx)(BN,{value:s,onChange:e=>a(e.target.value),placeholder:"Or enter image URL",className:"text-xs"}),(0,ea.jsx)(sg,{type:"button",variant:"outline",size:"sm",onClick:()=>c(!0),children:(0,ea.jsx)(jD,{size:14})})]}),(0,ea.jsx)(Ok,{open:o,onOpenChange:c,children:(0,ea.jsxs)(Wk,{className:"max-w-4xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)($N,{size:20}),"Select Image from Media Library"]})}),(0,ea.jsxs)("div",{className:"flex gap-2 py-2",children:[(0,ea.jsx)(BN,{placeholder:"Search images...",value:N,onChange:e=>w(e.target.value),className:"flex-1"}),(0,ea.jsxs)("label",{children:[(0,ea.jsx)(sg,{type:"button",variant:"outline",asChild:!0,disabled:g,children:(0,ea.jsxs)("span",{children:[g?(0,ea.jsx)(ql,{className:"animate-spin mr-1",size:16}):(0,ea.jsx)(kq,{size:16,className:"mr-1"}),"Upload New"]})}),(0,ea.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:e=>k(e.target.files)})]})]}),(0,ea.jsx)("div",{className:"flex items-center gap-1 text-sm py-2 border-b",children:(()=>{const e=[{id:null,name:"All Media"}];if(j){let t=m.find(e=>e.folder_id===j);const s=[];for(;t;)s.unshift({id:t.folder_id,name:t.name}),t=m.find(e=>e.folder_id===t.parent_id);e.push(...s)}return e})().map((e,s)=>(0,ea.jsxs)(t.Fragment,{children:[s>0&&(0,ea.jsx)("span",{className:"text-slate-400",children:"/"}),(0,ea.jsx)("button",{onClick:()=>y(e.id),className:"hover:text-indigo-600 ".concat(j===e.id?"text-indigo-600 font-medium":"text-slate-600"),children:e.name})]},e.id||"root"))}),(0,ea.jsx)("div",{className:"flex-1 overflow-y-auto py-4",children:x?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"animate-spin text-indigo-500",size:32})}):(0,ea.jsxs)(ea.Fragment,{children:[S.length>0&&(0,ea.jsxs)("div",{className:"mb-4",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-2",children:"Folders"}),(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-2",children:S.map(e=>(0,ea.jsxs)("button",{onClick:()=>y(e.folder_id),className:"flex items-center gap-2 p-3 border rounded-lg hover:bg-slate-50 text-left",children:[(0,ea.jsx)(jD,{size:20,className:"text-amber-500"}),(0,ea.jsx)("span",{className:"text-sm truncate",children:e.name})]},e.folder_id))})]}),_.length>0?(0,ea.jsx)("div",{className:"grid grid-cols-4 gap-3",children:_.map(e=>(0,ea.jsxs)("button",{onClick:()=>{return t=e.url,a(t),void c(!1);var t},className:"relative aspect-square border-2 rounded-lg overflow-hidden hover:border-indigo-500 transition-colors ".concat(s===e.url?"border-indigo-500 ring-2 ring-indigo-200":"border-slate-200"),children:[(0,ea.jsx)("img",{src:e.url,alt:e.filename,className:"w-full h-full object-cover"}),s===e.url&&(0,ea.jsx)("div",{className:"absolute top-1 right-1 bg-indigo-500 text-white rounded-full p-1",children:(0,ea.jsx)(Xl,{size:12})}),(0,ea.jsx)("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 text-white text-xs p-1 truncate",children:e.filename})]},e.media_id))}):(0,ea.jsxs)("div",{className:"text-center py-12 text-slate-500",children:[(0,ea.jsx)($N,{size:48,className:"mx-auto mb-2 opacity-30"}),(0,ea.jsx)("p",{children:"No images found"}),(0,ea.jsx)("p",{className:"text-xs mt-1",children:"Upload an image or try a different folder"})]})]})})]})})]})},x0=[{type:"text",name:"Text Section",icon:wE,description:"Add a text block with title and content"},{type:"image",name:"Image",icon:$N,description:"Add an image with optional caption"},{type:"gallery",name:"Image Gallery",icon:hG,description:"Display multiple images in a grid"},{type:"testimonials",name:"Testimonials",icon:RE,description:"Show customer testimonials"}
2,{type:"faq",name:"FAQ",icon:Aw,description:"Frequently asked questions section"},{type:"pricing",name:"Pricing Table",icon:bw,description:"Display pricing plans"},{type:"video",name:"Video Embed",icon:JQ,description:"Embed a YouTube or Vimeo video"},{type:"cta",name:"Call to Action",icon:NE,description:"Add a prominent CTA section"},{type:"team",name:"Team Members",icon:Bj,description:"Showcase your team"},{type:"stats",name:"Statistics",icon:$l,description:"Display key numbers and stats"},{type:"html",name:"Custom HTML",icon:kE,description:"Add raw HTML/CSS code for full design control"}],p0={enabled:!1,use_html_mode:!1,custom_html:"",custom_css:"",title:"Welcome",hero:{headline:"Build Something Amazing",subheadline:"Your one-page website to showcase your brand, product, or service.",image_url:"",image_position:"right",cta_text:"Get Started",cta_url:"#contact",background_color:"#4F46E5",text_color:"#ffffff"},about:{enabled:!0,title:"About Us",content:"Tell your story here. What makes you unique? Why should visitors care?",image_url:""},features:{enabled:!0,title:"What We Offer",items:[{id:aZ(),title:"Feature 1",description:"Describe your first key feature or benefit.",icon:"star"},{id:aZ(),title:"Feature 2",description:"Describe your second key feature or benefit.",icon:"zap"},{id:aZ(),title:"Feature 3",description:"Describe your third key feature or benefit.",icon:"shield"}]},blocks:[],contact:{enabled:!0,title:"Get in Touch",email:"",phone:"",address:"",show_form:!0},navigation:{enabled:!1,menu_id:"",sticky:!0,transparent:!1,logo_url:"",logo_text:""},footer:{enabled:!0,style:"simple",logo_url:"",company_name:"",tagline:"",copyright:"\xa9 2024 Your Company. All rights reserved.",columns:[{id:aZ(),title:"Company",links:[]},{id:aZ(),title:"Resources",links:[]}],social_links:{facebook:"",twitter:"",instagram:"",linkedin:"",youtube:"",bluesky:""},contact_info:{email:"",phone:"",address:""},background_color:"",text_color:""},theme:{primary_color:"#4F46E5",secondary_color:"#7C3AED",background_color:"#ffffff",text_color:"#1e293b"}},g0=()=>{var e,s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N,w,C,k,D,_,S,E,A,F,T,z,M,P,B,R,L,I,O,U,H,W,V,q,$,G,K,Y,J,Q,X,Z,ee,te,se,ae,ne,le,re,ie,oe,ce,de,ue,me,he,xe,pe,ge,fe,ve;const[be,je]=(0,t.useState)(null),[ye,Ne]=(0,t.useState)(!0),[we,Ce]=(0,t.useState)(!1),[ke,De]=(0,t.useState)(""),[_e,Se]=(0,t.useState)(!1),[Ee,Ae]=(0,t.useState)(!1),[Fe,Te]=(0,t.useState)(null),[ze,Me]=(0,t.useState)([]),Pe=e=>{const t=window.location.origin;return"".concat(t,"/site/").concat(e)};(0,t.useEffect)(()=>{Re(),Be()},[]);const Be=async()=>{try{const e=await _l.get("/navigation");Me(e.data||[])}catch(e){console.error("Failed to fetch menus:",e),Me([])}},Re=async()=>{try{var e;const t=await _l.get("/tenant/landing-page"),s=t.data||p0;s.blocks||(s.blocks=[]),s.navigation||(s.navigation=p0.navigation),s.footer&&s.footer.style||(s.footer=d(d({},p0.footer),s.footer)),je(s),null!==(e=t.data)&&void 0!==e&&e.tenant_id&&De(Pe(t.data.tenant_id))}catch(t){je(p0)}finally{Ne(!1)}},Le=async()=>{Ce(!0);try{var e;const t=await _l.put("/tenant/landing-page",be);qs.success("Landing page saved successfully!"),null!==(e=t.data)&&void 0!==e&&e.tenant_id&&De(Pe(t.data.tenant_id))}catch(t){console.error("Failed to save:",t),qs.error("Failed to save landing page")}finally{Ce(!1)}},Ie=e=>{var t;const s=(e=>{const t={id:aZ(),type:e,enabled:!0};switch(e){case"text":return d(d({},t),{},{title:"Section Title",content:"Add your content here...",alignment:"center"});case"image":return d(d({},t),{},{url:"",alt:"",caption:"",width:"full"});case"gallery":return d(d({},t),{},{title:"Gallery",images:[{id:aZ(),url:"",alt:""}],columns:3});case"testimonials":return d(d({},t),{},{title:"What Our Customers Say",items:[{id:aZ(),quote:"Amazing service!",author:"John Doe",role:"CEO",avatar:""}]});case"faq":return d(d({},t),{},{title:"Frequently Asked Questions",items:[{id:aZ(),question:"What is your service?",answer:"We provide..."}]});case"pricing":return d(d({},t),{},{title:"Pricing Plans",items:[{id:aZ(),name:"Basic",price:"$9",period:"/month",features:["Feature 1","Feature 2"],highlighted:!1},{id:aZ(),name:"Pro",price:"$29",period:"/month",features:["Everything in Basic","Feature 3","Feature 4"],highlighted:!0}]});case"video":return d(d({},t),{},{title:"",url:"",type:"youtube"});case"cta":return d(d({},t),{},{title:"Ready to Get Started?",subtitle:"Join thousands of satisfied customers",button_text:"Start Now",button_url:"#contact",style:"primary"});case"team":return d(d({},t),{},{title:"Meet Our Team",members:[{id:aZ(),name:"Team Member",role:"Position",image:"",bio:""}]});case"stats":return d(d({},t),{},{title:"",items:[{id:aZ(),value:"100+",label:"Customers"},{id:aZ(),value:"50+",label:"Projects"},{id:aZ(),value:"99%",label:"Satisfaction"}]});case"html":return d(d({},t),{},{html:'<div style="padding: 60px 20px; text-align: center;">\n <h2 style="font-size: 2rem; margin-bottom: 1rem;">Custom HTML Section</h2>\n <p style="color: #666;">Paste your HTML and CSS here for full design control.</p>\n</div>',css:"",full_width:!0});default:return t}})(e);je(e=>d(d({},e),{},{blocks:[...e.blocks||[],s]})),Ae(!1),Te(s.id),qs.success("".concat(null===(t=x0.find(t=>t.type===e))||void 0===t?void 0:t.name," block added"))},Oe=(e,t)=>
2{je(s=>{const a=[...s.blocks],n=a.findIndex(t=>t.id===e);return"up"===t&&n>0?[a[n-1],a[n]]=[a[n],a[n-1]]:"down"===t&&n<a.length-1&&([a[n],a[n+1]]=[a[n+1],a[n]]),d(d({},s),{},{blocks:a})})},Ue=(e,t)=>{je(s=>d(d({},s),{},{blocks:s.blocks.map(s=>s.id===e?d(d({},s),t):s)}))},He=(e,t)=>{je(s=>d(d({},s),{},{hero:d(d({},s.hero),{},{[e]:t})}))},We=(e,t)=>{je(s=>d(d({},s),{},{about:d(d({},s.about),{},{[e]:t})}))},Ve=(e,t)=>{je(s=>d(d({},s),{},{features:d(d({},s.features),{},{[e]:t})}))},qe=(e,t,s)=>{je(a=>d(d({},a),{},{features:d(d({},a.features),{},{items:a.features.items.map(a=>a.id===e?d(d({},a),{},{[t]:s}):a)})}))},$e=(e,t)=>{je(s=>d(d({},s),{},{contact:d(d({},s.contact),{},{[e]:t})}))},Ge=(e,t)=>{je(s=>d(d({},s),{},{theme:d(d({},s.theme),{},{[e]:t})}))},Ke=(e,t)=>{je(s=>d(d({},s),{},{footer:d(d({},s.footer),{},{[e]:t})}))},Ye=(e,t)=>{je(s=>d(d({},s),{},{navigation:d(d({},s.navigation),{},{[e]:t})}))},Je=(e,t)=>{je(s=>d(d({},s),{},{footer:d(d({},s.footer),{},{social_links:d(d({},s.footer.social_links),{},{[e]:t})})}))},Qe=(e,t)=>{je(s=>d(d({},s),{},{footer:d(d({},s.footer),{},{contact_info:d(d({},s.footer.contact_info),{},{[e]:t})})}))},Xe=e=>{var t,s;const a=(null===(t=x0.find(t=>t.type===e.type))||void 0===t?void 0:t.icon)||NE;return(0,ea.jsxs)(rD,{className:"mb-4 ".concat(Fe===e.id?"ring-2 ring-indigo-500":""),children:[(0,ea.jsx)(iD,{className:"py-3",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(yE,{size:16,className:"text-slate-400 cursor-grab"}),(0,ea.jsx)(a,{size:18,className:"text-indigo-600"}),(0,ea.jsx)("span",{className:"font-medium",children:null===(s=x0.find(t=>t.type===e.type))||void 0===s?void 0:s.name})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(wb,{checked:e.enabled,onCheckedChange:t=>Ue(e.id,{enabled:t})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>Oe(e.id,"up"),children:(0,ea.jsx)(er,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>Oe(e.id,"down"),children:(0,ea.jsx)(tr,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 hover:text-red-700",onClick:()=>{return t=e.id,je(e=>d(d({},e),{},{blocks:e.blocks.filter(e=>e.id!==t)})),Fe===t&&Te(null),void qs.success("Block removed");var t},children:(0,ea.jsx)(wD,{size:16})})]})]})}),(0,ea.jsx)(dD,{className:"pt-0",children:Ze(e)})]},e.id)},Ze=e=>{switch(e.type){case"text":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Content"}),(0,ea.jsx)(YN,{value:e.content,onChange:t=>Ue(e.id,{content:t.target.value}),rows:4})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Alignment"}),(0,ea.jsxs)(eb,{value:e.alignment,onValueChange:t=>Ue(e.id,{alignment:t}),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"left",children:"Left"}),(0,ea.jsx)(rb,{value:"center",children:"Center"}),(0,ea.jsx)(rb,{value:"right",children:"Right"})]})]})]})]});case"image":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Image"}),(0,ea.jsx)(h0,{value:e.url||"",onChange:t=>Ue(e.id,{url:t}),label:"Block Image"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Alt Text"}),(0,ea.jsx)(BN,{value:e.alt,onChange:t=>Ue(e.id,{alt:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Caption"}),(0,ea.jsx)(BN,{value:e.caption,onChange:t=>Ue(e.id,{caption:t.target.value})})]})]});case"gallery":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Columns"}),(0,ea.jsxs)(eb,{value:String(e.columns),onValueChange:t=>Ue(e.id,{columns:parseInt(t)}),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"2",children:"2 Columns"}),(0,ea.jsx)(rb,{value:"3",children:"3 Columns"}),(0,ea.jsx)(rb,{value:"4",children:"4 Columns"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Images"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>Ue(e.id,{images:[...e.images,{id:aZ(),url:"",alt:""}]}),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),e.images.map((t,s)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg bg-slate-50 space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Image ",s+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>Ue(e.id,{images:e.images.filter(e=>e.id!==t.id)}),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(h0,{value:t.url||"",onChange:a=>{const n=[...e.images];n[s]=d(d({},t),{},{url:a}),Ue(e.id,{images:n})},label:"Gallery Image"})]},t.id))]})]});case"testimonials":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Testimonials"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>Ue(e.id,{items:[...e.items,{id:aZ(),quote:"",author:"",role:"",avatar:""}]}),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),e.items.map((t,s)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Testimonial ",s+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>Ue(e.id,{items:e.items.filter(e=>e.id!==t.id)}),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(YN,{value:t.quote,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{quote:a.target.value}),Ue(e.id,{items:n})},placeholder:"Quote",rows:2}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:t.author,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{author:a.target.value}),Ue(e.id,{items:n})},placeholder:"Author name"}),(0,ea.jsx)(BN,{value:t.role,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{role:a.target.value}),Ue(e.id,{items:n})},placeholder:"Role/Company"})]})]},t.id))]})]});case"faq":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Questions"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>Ue(e.id,{items:[...e.items,{id:aZ(),question:"",answer:""}]}),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),e.items.map((t,s)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["FAQ ",s+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>Ue(e.id,{items:e.items.filter(e=>e.id!==t.id)}),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsx)(BN,{value:t.question,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{question:a.target.value}),Ue(e.id,{items:n})},placeholder:"Question"}),(0,ea.jsx)(YN,{value:t.answer,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{answer:a.target.value}),Ue(e.id,{items:n})},placeholder:"Answer",rows:2})]},t.id))]})]});case"pricing":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Pricing Plans"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>Ue(e.id,{items:[...e.items,{id:aZ(),name:"Plan",price:"$0",period:"/month",features:["Feature"],highlighted:!1,button_text:"Get Started",button_url:"#contact"}]}),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add Plan"]})]}),e.items.map((t,s)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 ".concat(t.highlighted?"bg-indigo-50 border-indigo-300":"bg-slate-50"),children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Plan ",s+1]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("label",{className:"text-xs flex items-center gap-1",children:[(0,ea.jsx)("input",{type:"checkbox",checked:t.highlighted,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{highlighted:a.target.checked}),Ue(e.id,{items:n})}}),"Featured"]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>Ue(e.id,{items:e.items.filter(e=>e.id!==t.id)}),children:(0,ea.jsx)(wD,{size:14})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,ea.jsx)(BN,{value:t.name,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{name:a.target.value}),Ue(e.id,{items:n})},placeholder:"Plan name"}),(0,ea.jsx)(BN,{value:t.price,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{price:a.target.value}),Ue(e.id,{items:n})},placeholder:"$29"}),(0,ea.jsx)(BN,{value:t.period,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{period:a.target.value}),Ue(e.id,{items:n})},placeholder:"/month"})]}),(0,ea.jsx)(YN,{value:t.features.join("\n"),onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{features:a.target.value.split("\n")}),Ue(e.id,{items:n})},placeholder:"Features (one per line)",rows:3}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:t.button_text||"",onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{button_text:a.target.value}),Ue(e.id,{items:n})},placeholder:"Button text (e.g. Get Started)"}),(0,ea.jsx)(BN,{value:t.button_url||"",onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{button_url:a.target.value}),Ue(e.id,{items:n})},placeholder:"https://..., /signup or #contact"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-[11px] text-slate-500",children:"Stripe Checkout / Payment Link (optional)"}),(0,ea.jsx)(BN,{value:t.checkout_url||"",onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{checkout_url:a.target.value}),Ue(e.id,{items:n})},placeholder:"https://buy.stripe.com/...","data-testid":"tenant-pricing-checkout-url-".concat(t.id)}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400",children:"Paste a Stripe Payment Link from your own Stripe dashboard. When set, this button opens checkout in a new tab (overrides the Button URL above)."})]})]},t.id))]})]});case"video":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title (optional)"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Video URL"}),(0,ea.jsx)(BN,{value:e.url,onChange:t=>Ue(e.id,{url:t.target.value}),placeholder:"YouTube or Vimeo URL"})]})]});case"cta":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Subtitle"}),(0,ea.jsx)(BN,{value:e.subtitle,onChange:t=>Ue(e.id,{subtitle:t.target.value})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button Text"}),(0,ea.jsx)(BN,{value:e.button_text,onChange:t=>Ue(e.id,{button_text:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Button URL"}),(0,ea.jsx)(BN,{value:e.button_url,onChange:t=>Ue(e.id,{button_url:t.target.value})})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Style"}),(0,ea.jsxs)(eb,{value:e.style,onValueChange:t=>Ue(e.id,{style:t}),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"primary",children:"Primary Color"}),(0,ea.jsx)(rb,{value:"secondary",children:"Secondary Color"}),(0,ea.jsx)(rb,{value:"dark",children:"Dark"})]})]})]})]});case"team":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Section Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Team Members"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>Ue(e.id,{members:[...e.members,{id:aZ(),name:"",role:"",image:"",bio:""}]}),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),e.members.map((t,s)=>(0,ea.jsxs)("div",{className:"p-3 border rounded-lg space-y-2 bg-slate-50",children:[(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-500",children:["Member ",s+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 h-6",onClick:()=>Ue(e.id,{members:e.members.filter(e=>e.id!==t.id)}),children:(0,ea.jsx)(wD,{size:14})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{value:t.name,onChange:a=>{const n=[...e.members];n[s]=d(d({},t),{},{name:a.target.value}),Ue(e.id,{members:n})},placeholder:"Name"}),(0,ea.jsx)(BN,{value:t.role,onChange:a=>{const n=[...e.members];n[s]=d(d({},t),{},{role:a.target.value}),Ue(e.id,{members:n})},placeholder:"Role"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Photo"}),(0,ea.jsx)(h0,{value:t.image||"",onChange:a=>{const n=[...e.members];n[s]=d(d({},t),{},{image:a}),Ue(e.id,{members:n})},label:"Team Photo"})]})]},t.id))]})]});case"stats":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title (optional)"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>Ue(e.id,{title:t.target.value})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Statistics"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>Ue(e.id,{items:[...e.items,{id:aZ(),value:"0",label:"Label"}]}),children:[(0,ea.jsx)(Vj,{size:14,className:"mr-1"})," Add"]})]}),e.items.map((t,s)=>(0,ea.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ea.jsx)(BN,{value:t.value,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{value:a.target.value}),Ue(e.id,{items:n})},placeholder:"100+",className:"w-24"}),(0,ea.jsx)(BN,{value:t.label,onChange:a=>{const n=[...e.items];n[s]=d(d({},t),{},{label:
2a.target.value}),Ue(e.id,{items:n})},placeholder:"Label",className:"flex-1"}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500",onClick:()=>Ue(e.id,{items:e.items.filter(e=>e.id!==t.id)}),children:(0,ea.jsx)(wD,{size:14})})]},t.id))]})]});case"html":return(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-800",children:[(0,ea.jsx)("strong",{children:"Tip:"})," Paste your HTML code below. You can include inline styles or add CSS in the separate CSS field."]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(kE,{size:14}),"HTML Code"]}),(0,ea.jsx)(YN,{value:e.html||"",onChange:t=>Ue(e.id,{html:t.target.value}),placeholder:"<div>Your HTML here...</div>",rows:12,className:"font-mono text-sm"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(OE,{size:14}),"CSS (optional)"]}),(0,ea.jsx)(YN,{value:e.css||"",onChange:t=>Ue(e.id,{css:t.target.value}),placeholder:".my-class { color: red; }",rows:6,className:"font-mono text-sm"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:e.full_width,onCheckedChange:t=>Ue(e.id,{full_width:t})}),(0,ea.jsx)(tf,{className:"text-xs",children:"Full width (remove container padding)"})]})]});default:return(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Unknown block type"})}};return ye?(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading landing page..."})})]}):(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 p-8 overflow-auto",children:(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold text-slate-900 flex items-center gap-3",style:{fontFamily:"Manrope, sans-serif"},children:[(0,ea.jsx)(hr,{className:"text-indigo-600",size:32}),"Landing Page"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Create a one-page website for your business"})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[ke&&(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>window.open(ke,"_blank"),children:[(0,ea.jsx)(IN,{size:18,className:"mr-2"}),"Preview"]}),(0,ea.jsxs)(sg,{onClick:Le,disabled:we,children:[(0,ea.jsx)(BD,{size:18,className:"mr-2"}),we?"Saving...":"Save Changes"]})]})]}),(0,ea.jsx)(rD,{className:"mb-6",children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"font-medium text-slate-900",children:"Enable Landing Page"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Make your landing page publicly accessible"})]}),(0,ea.jsx)(wb,{checked:be.enabled,onCheckedChange:e=>je(t=>d(d({},t),{},{enabled:e}))})]}),ke&&be.enabled&&(0,ea.jsxs)("div",{className:"mt-4 p-3 bg-slate-50 rounded-lg flex items-center gap-3",children:[(0,ea.jsx)(BN,{value:ke,readOnly:!0,className:"flex-1 bg-white"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>{ke&&(navigator.clipboard.writeText(ke),Se(!0),qs.success("URL copied to clipboard!"),setTimeout(()=>Se(!1),2e3))},children:_e?(0,ea.jsx)(Xl,{size:16}):(0,ea.jsx)(DD,{size:16})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>window.open(ke,"_blank"),children:(0,ea.jsx)(bj,{size:16})})]})]})}),(0,ea.jsx)(rD,{className:"mb-6 border-amber-200 bg-amber-50/50",children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h3",{className:"font-medium text-slate-900 flex items-center gap-2",children:[(0,ea.jsx)(kE,{size:18,className:"text-amber-600"}),"Full HTML Mode"]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Replace all sections with custom HTML/CSS code"})]}),(0,ea.jsx)(wb,{checked:be.use_html_mode||!1,onCheckedChange:e=>je(t=>d(d({},t),{},{use_html_mode:e,html_sections:t.html_sections||[{id:aZ(),name:"Section 1",anchor_id:"section-1",html:"",css:""}]}))})]})})}),be.use_html_mode?(0,ea.jsx)("div",{className:"space-y-6",children:(0,ea.jsxs)(nJ,{defaultValue:"navigation",className:"space-y-4",children:[(0,ea.jsxs)(lJ,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ea.jsx)(rJ,{value:"navigation",children:"Navigation"}),(0,ea.jsx)(rJ,{value:"footer",children:"Footer"}),(0,ea.jsx)(rJ,{value:"html",children:"HTML Sections"})]}),(0,ea.jsx)(iJ,{value:"navigation",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(ar,{size:20}),"Navigation Menu"]}),(0,ea.jsx)(cD,{children:"Add a navigation bar to your landing page"})]}),(0,ea.jsx)(wb,{checked:(null===(e=be.navigation)||void 0===e?void 0:e.enabled)||!1,onCheckedChange:e=>Ye("enabled",e)})]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Select Menu"}),(0,ea.jsxs)(eb,{value:(null===(s=be.navigation)||void 0===s?void 0:s.menu_id)||"",onValueChange:e=>Ye("menu_id",e),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Choose a navigation menu"})}),(0,ea.jsx)(lb,{children:ze.map(e=>(0,ea.jsx)(rb,{value:e.menu_id,children:e.name},e.menu_id))})]}),0===ze.length&&(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["No menus found. ",(0,ea.jsx)("a",{href:"/navigation",className:"text-indigo-600 hover:underline",children:"Create a menu"})," first."]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo"}),(0,ea.jsx)(h0,{value:(null===(a=be.navigation)||void 0===a?void 0:a.logo_url)||"",onChange:e=>Ye("logo_url",e),label:"Navigation Logo"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo Text (if no image)"}),(0,ea.jsx)(BN,{value:(null===(n=be.navigation)||void 0===n?void 0:n.logo_text)||"",onChange:e=>Ye("logo_text",e.target.value),placeholder:"Your Company"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:(null===(l=be.navigation)||void 0===l?void 0:l.background_color)||"#4F46E5",onChange:e=>Ye("background_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:(null===(r=be.navigation)||void 0===r?void 0:r.background_color)||"",onChange:e=>Ye("background_color",e.target.value),placeholder:"#4F46E5"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:(null===(i=be.navigation)||void 0===i?void 0:i.text_color)||"#ffffff",onChange:e=>Ye("text_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:(null===(o=be.navigation)||void 0===o?void 0:o.text_color)||"",onChange:e=>Ye("text_color",e.target.value),placeholder:"#ffffff"})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:(null===(c=be.navigation)||void 0===c?void 0:c.sticky)||!1,onCheckedChange:e=>Ye("sticky",e)}),(0,ea.jsx)(tf,{children:"Sticky Navigation"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:(null===(u=be.navigation)||void 0===u?void 0:u.transparent)||!1,onCheckedChange:e=>Ye("transparent",e)}
2),(0,ea.jsx)(tf,{children:"Transparent Background"})]})]})]})]})}),(0,ea.jsx)(iJ,{value:"footer",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Footer"}),(0,ea.jsx)(cD,{children:"Configure your landing page footer"})]}),(0,ea.jsx)(wb,{checked:!1!==(null===(m=be.footer)||void 0===m?void 0:m.enabled),onCheckedChange:e=>Ke("enabled",e)})]})}),(0,ea.jsxs)(dD,{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Footer Style"}),(0,ea.jsxs)(eb,{value:(null===(h=be.footer)||void 0===h?void 0:h.style)||"simple",onValueChange:e=>Ke("style",e),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"simple",children:"Simple - Just copyright text"}),(0,ea.jsx)(rb,{value:"centered",children:"Centered - Logo, links, social"}),(0,ea.jsx)(rb,{value:"columns",children:"Columns - Multiple link sections"})]})]})]}),"simple"!==(null===(x=be.footer)||void 0===x?void 0:x.style)&&(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm",children:"Company Info"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Footer Logo"}),(0,ea.jsx)(h0,{value:(null===(p=be.footer)||void 0===p?void 0:p.logo_url)||"",onChange:e=>Ke("logo_url",e),label:"Footer Logo"})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Company Name"}),(0,ea.jsx)(BN,{value:(null===(g=be.footer)||void 0===g?void 0:g.company_name)||"",onChange:e=>Ke("company_name",e.target.value),placeholder:"Your Company Name"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tagline"}),(0,ea.jsx)(BN,{value:(null===(f=be.footer)||void 0===f?void 0:f.tagline)||"",onChange:e=>Ke("tagline",e.target.value),placeholder:"Your company tagline"})]})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Copyright Text"}),(0,ea.jsx)(BN,{value:(null===(v=be.footer)||void 0===v?void 0:v.copyright)||"",onChange:e=>Ke("copyright",e.target.value),placeholder:"\xa9 2024 Your Company. All rights reserved."})]}),(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm",children:"Social Links"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(nr,{size:14})," Facebook"]}),(0,ea.jsx)(BN,{value:(null===(b=be.footer)||void 0===b||null===(j=b.social_links)||void 0===j?void 0:j.facebook)||"",onChange:e=>Je("facebook",e.target.value),placeholder:"https://facebook.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(lr,{size:14})," Twitter / X"]}),(0,ea.jsx)(BN,{value:(null===(y=be.footer)||void 0===y||null===(N=y.social_links)||void 0===N?void 0:N.twitter)||"",onChange:e=>Je("twitter",e.target.value),placeholder:"https://twitter.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(rr,{size:14})," Instagram"]}),(0,ea.jsx)(BN,{value:(null===(w=be.footer)||void 0===w||null===(C=w.social_links)||void 0===C?void 0:C.instagram)||"",onChange:e=>Je("instagram",e.target.value),placeholder:"https://instagram.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(ir,{size:14})," LinkedIn"]}),(0,ea.jsx)(BN,{value:(null===(k=be.footer)||void 0===k||null===(D=k.social_links)||void 0===D?void 0:D.linkedin)||"",onChange:e=>Je("linkedin",e.target.value),placeholder:"https://linkedin.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(or,{size:14})," YouTube"]}),(0,ea.jsx)(BN,{value:(null===(_=be.footer)||void 0===_||null===(S=_.social_links)||void 0===S?void 0:S.youtube)||"",onChange:e=>Je("youtube",e.target.value),placeholder:"https://youtube.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(mr,{size:14})," Bluesky"]}),(0,ea.jsx)(BN,{value:(null===(E=be.footer)||void 0===E||null===(A=E.social_links)||void 0===A?void 0:A.bluesky)||"",onChange:e=>Je("bluesky",e.target.value),placeholder:"https://bsky.app/profile/..."})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:(null===(F=be.footer)||void 0===F?void 0:F.background_color)||"#4F46E5",onChange:e=>Ke("background_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:(null===(T=be.footer)||void 0===T?void 0:T.background_color)||"",onChange:e=>Ke("background_color",e.target.value),placeholder:"#4F46E5"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:(null===(z=be.footer)||void 0===z?void 0:z.text_color)||"#ffffff",onChange:e=>Ke("text_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:(null===(M=be.footer)||void 0===M?void 0:M.text_color)||"",onChange:e=>Ke("text_color",e.target.value),placeholder:"#ffffff"})]})]})]})]})]})}),(0,ea.jsxs)(iJ,{value:"html",children:[(0,ea.jsxs)(rD,{className:"mb-6",children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Dw,{className:"text-amber-600",size:20}),"Global CSS Styles"]}),(0,ea.jsx)(cD,{children:"CSS that applies to all HTML sections below"})]}),(0,ea.jsx)(dD,{children:(0,ea.jsx)(YN,{value:be.custom_css||"",onChange:e=>je(t=>d(d({},t),{},{custom_css:e.target.value})),placeholder:"/* Global CSS styles */\nbody { font-family: 'Inter', sans-serif; }\n.container { max-width: 1200px; margin: 0 auto; }",rows:8,className:"font-mono text-sm"})})]}),(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(kE,{className:"text-amber-600",size:20}),"HTML Sections"]}),(0,ea.jsx)(cD,{children:"Add multiple HTML sections. Each renders in order from top to bottom."})]}),(0,ea.jsxs)(sg,{onClick:()=>je(e=>{var t;const s=((null===(t=e.html_sections)||void 0===t?void 0:t.length)||0)+1;return d(d({},e),{},{html_sections:[...e.html_sections||[],{id:aZ(),name:"Section ".concat(s),anchor_id:"section-".concat(s),html:"",css:""}]})}),children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Add Section"]})]})}),(0,ea.jsx)(dD,{className:"space-y-4",children:be.html_sections&&0!==be.html_sections.length?be.html_sections.map((e,t)=>{var s;return(0,ea.jsxs)(rD,{className:"border-slate-200 ".concat(e.draft?"opacity-60 border-dashed border-amber-400 bg-amber-50/30":""),children:[(0,ea.jsx)(iD,{className:"py-3 ".concat(e.draft?"bg-amber-50":"bg-slate-50"),children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(yE,{size:16,className:"text-slate-400 cursor-grab"}),(0,ea.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ea.jsx)(BN,{value:e.name,onChange:s=>{const a=[...be.html_sections],n=s.target.value,l=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");a[t]=d(d({},e),{},{name:n,anchor_id:l}),je(e=>d(d({},e),{},{html_sections:a}))},className:"w-48 h-8 text-sm font-medium"}),(0,ea.jsxs)("span",{className:"text-xs text-indigo-600 font-mono",children:["#",e.anchor_id||(null===(s=e.name)||void 0===s?void 0:s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))||"section"]})]}),e.draft&&(0,ea.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-amber-200 text-amber-800 rounded",children:"DRAFT"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-1.5 mr-2 px-2 py-1 rounded bg-white border",children:[(0,ea.jsx)(wb,{checked:!e.draft,onCheckedChange:s=>{const a=[...be.html_sections];a[t]=d(d({},e),{},{draft:!s}),je(e=>d(d({},e),{},{html_sections:a}))}}),(0,ea.jsx)("span",{className:"text-xs text-slate-600",children:e.draft?"Draft":"Live"})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",disabled:0===t,onClick:()=>{const e=[...be.html_sections];[e[t-1],e[t]]=[e[t],e[t-1]],je(t=>d(d({},t),{},{html_sections:e}))},children:(0,ea.jsx)(er,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",disabled:t===be.html_sections.length-1,onClick:()=>{const e=[...be.html_sections];[e[t],e[t+1]]=[e[t+1],e[t]],je(t=>d(d({},t),{},{html_sections:e}))},children:(0,ea.jsx)(tr,{size:16})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",className:"text-red-500 hover:text-red-700",onClick:()=>{je(t=>d(d({},t),{},{html_sections:t.html_sections.filter(t=>t.id!==e.id)}
2))},children:(0,ea.jsx)(wD,{size:16})})]})]})}),(0,ea.jsxs)(dD,{className:"pt-4 space-y-4",children:[e.draft&&(0,ea.jsxs)("div",{className:"p-3 bg-amber-100 border border-amber-300 rounded-lg text-sm text-amber-800",children:[(0,ea.jsx)("strong",{children:"Draft Mode:"}),' This section won\'t appear on the live preview until you toggle it to "Live".']}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(OE,{size:14}),"HTML Code"]}),(0,ea.jsx)(YN,{value:e.html||"",onChange:s=>{const a=[...be.html_sections];a[t]=d(d({},e),{},{html:s.target.value}),je(e=>d(d({},e),{},{html_sections:a}))},placeholder:"<section>Your HTML here...</section>",rows:12,className:"font-mono text-sm"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(Dw,{size:14}),"Section CSS (optional)"]}),(0,ea.jsx)(YN,{value:e.css||"",onChange:s=>{const a=[...be.html_sections];a[t]=d(d({},e),{},{css:s.target.value}),je(e=>d(d({},e),{},{html_sections:a}))},placeholder:"/* CSS specific to this section */",rows:4,className:"font-mono text-sm"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between pt-4 border-t mt-4",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>je(e=>{const s=e.html_sections.length+1;return d(d({},e),{},{html_sections:[...e.html_sections.slice(0,t+1),{id:aZ(),name:"Section ".concat(s),anchor_id:"section-".concat(s),html:"",css:"",draft:!1},...e.html_sections.slice(t+1)]})}),children:[(0,ea.jsx)(Vj,{size:16,className:"mr-2"}),"Add Section Below"]}),(0,ea.jsxs)(sg,{onClick:Le,disabled:we,children:[(0,ea.jsx)(BD,{size:16,className:"mr-2"}),we?"Saving...":"Save Changes"]})]})]})]},e.id)}):(0,ea.jsxs)("div",{className:"text-center py-12 border-2 border-dashed rounded-lg",children:[(0,ea.jsx)(kE,{className:"mx-auto mb-4 text-slate-300",size:48}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"No HTML sections added yet"}),(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>je(e=>d(d({},e),{},{html_sections:[{id:aZ(),name:"Section 1",anchor_id:"section-1",html:"",css:""}]})),children:[(0,ea.jsx)(Vj,{size:16,className:"mr-2"}),"Add Your First Section"]})]})})]})]})]})}):(0,ea.jsxs)(nJ,{defaultValue:"navigation",className:"space-y-6",children:[(0,ea.jsxs)(lJ,{className:"grid grid-cols-8 w-full",children:[(0,ea.jsx)(rJ,{value:"navigation",children:"Nav"}),(0,ea.jsx)(rJ,{value:"hero",children:"Hero"}),(0,ea.jsx)(rJ,{value:"about",children:"About"}),(0,ea.jsx)(rJ,{value:"features",children:"Features"}),(0,ea.jsx)(rJ,{value:"blocks",children:"Blocks"}),(0,ea.jsx)(rJ,{value:"contact",children:"Contact"}),(0,ea.jsx)(rJ,{value:"footer",children:"Footer"}),(0,ea.jsx)(rJ,{value:"theme",children:"Theme"})]}),(0,ea.jsx)(iJ,{value:"navigation",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(ar,{size:20}),"Navigation Menu"]}),(0,ea.jsx)(cD,{children:"Add a navigation bar to your landing page"})]}),(0,ea.jsx)(wb,{checked:(null===(P=be.navigation)||void 0===P?void 0:P.enabled)||!1,onCheckedChange:e=>Ye("enabled",e)})]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Select Menu"}),(0,ea.jsxs)(eb,{value:(null===(B=be.navigation)||void 0===B?void 0:B.menu_id)||"",onValueChange:e=>Ye("menu_id",e),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Choose a navigation menu"})}),(0,ea.jsx)(lb,{children:ze.map(e=>(0,ea.jsx)(rb,{value:e.menu_id,children:e.name},e.menu_id))})]}),0===ze.length&&(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["No menus found. ",(0,ea.jsx)("a",{href:"/navigation",className:"text-indigo-600 hover:underline",children:"Create a menu"})," first."]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo"}),(0,ea.jsx)(h0,{value:(null===(R=be.navigation)||void 0===R?void 0:R.logo_url)||"",onChange:e=>Ye("logo_url",e),label:"Navigation Logo"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo Text (if no image)"}),(0,ea.jsx)(BN,{value:(null===(L=be.navigation)||void 0===L?void 0:L.logo_text)||"",onChange:e=>Ye("logo_text",e.target.value),placeholder:"Your Company"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-6",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:(null===(I=be.navigation)||void 0===I?void 0:I.sticky)||!1,onCheckedChange:e=>Ye("sticky",e)}),(0,ea.jsx)(tf,{children:"Sticky Navigation"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:(null===(O=be.navigation)||void 0===O?void 0:O.transparent)||!1,onCheckedChange:e=>Ye("transparent",e)}
2),(0,ea.jsx)(tf,{children:"Transparent Background"})]})]})]})]})}),(0,ea.jsx)(iJ,{value:"hero",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Hero Section"}),(0,ea.jsx)(cD,{children:"The first thing visitors see on your landing page"})]}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Headline"}),(0,ea.jsx)(BN,{value:be.hero.headline,onChange:e=>He("headline",e.target.value),placeholder:"Your main headline"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Subheadline"}),(0,ea.jsx)(YN,{value:be.hero.subheadline,onChange:e=>He("subheadline",e.target.value),placeholder:"A brief description...",rows:3})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Hero Image (Optional)"}),(0,ea.jsx)(h0,{value:be.hero.image_url||"",onChange:e=>He("image_url",e),label:"Hero Image"})]}),be.hero.image_url&&(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Image Position"}),(0,ea.jsxs)(eb,{value:be.hero.image_position||"right",onValueChange:e=>He("image_position",e),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"right",children:"Right of Text"}),(0,ea.jsx)(rb,{value:"left",children:"Left of Text"}
2),(0,ea.jsx)(rb,{value:"background",children:"Background Image"})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Call-to-Action Text"}),(0,ea.jsx)(BN,{value:be.hero.cta_text,onChange:e=>He("cta_text",e.target.value),placeholder:"Get Started"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"CTA Link"}),(0,ea.jsx)(BN,{value:be.hero.cta_url,onChange:e=>He("cta_url",e.target.value),placeholder:"https://example.com, /signup or #contact"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"External URL (https://...), an internal page (/signup), or an anchor (#contact)."})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Background Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:be.hero.background_color,onChange:e=>He("background_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:be.hero.background_color,onChange:e=>He("background_color",e.target.value)})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:be.hero.text_color,onChange:e=>He("text_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:be.hero.text_color,onChange:e=>He("text_color",e.target.value)})]})]})]})]})]})}),(0,ea.jsx)(iJ,{value:"about",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"About Section"}),(0,ea.jsx)(cD,{children:"Tell visitors about your business"})]}),(0,ea.jsx)(wb,{checked:be.about.enabled,onCheckedChange:e=>We("enabled",e)})]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Section Title"}),(0,ea.jsx)(BN,{value:be.about.title,onChange:e=>We("title",e.target.value),placeholder:"About Us"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Content"}),(0,ea.jsx)(YN,{value:be.about.content,onChange:e=>We("content",e.target.value),placeholder:"Tell your story...",rows:5})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Image (optional)"}),(0,ea.jsx)(h0,{value:be.about.image_url||"",onChange:e=>We("image_url",e),label:"About Image"})]})]})]})}),(0,ea.jsx)(iJ,{value:"features",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Features Section"}),(0,ea.jsx)(cD,{children:"Highlight what you offer"})]}),(0,ea.jsx)(wb,{checked:be.features.enabled,onCheckedChange:e=>Ve("enabled",e)})]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Section Title"}),(0,ea.jsx)(BN,{value:be.features.title,onChange:e=>Ve("title",e.target.value),placeholder:"What We Offer"})]}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(tf,{children:"Feature Items"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>{je(e=>d(d({},e),{},{features:d(d({},e.features),{},{items:[...e.features.items,{id:aZ(),title:"New Feature",description:"Describe this feature...",icon:"star"}]})}))},children:[(0,ea.jsx)(Vj,{size:16,className:"mr-1"}),"Add Feature"]})]}),be.features.items.map((e,t)=>(0,ea.jsxs)("div",{className:"p-4 border rounded-lg bg-slate-50 space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("span",{className:"text-sm font-medium text-slate-500",children:["Feature ",t+1]}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>{return t=e.id,void je(e=>d(d({},e),{},{features:d(d({},e.features),{},{items:e.features.items.filter(e=>e.id!==t)})}
2));var t},className:"text-red-500 hover:text-red-700",children:(0,ea.jsx)(wD,{size:16})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Title"}),(0,ea.jsx)(BN,{value:e.title,onChange:t=>qe(e.id,"title",t.target.value),placeholder:"Feature title"})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Icon"}),(0,ea.jsx)(BN,{value:e.icon,onChange:t=>qe(e.id,"icon",t.target.value),placeholder:"star, zap, shield..."})]})]}),(0,ea.jsxs)("div",{className:"space-y-1",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Description"}),(0,ea.jsx)(YN,{value:e.description,onChange:t=>qe(e.id,"description",t.target.value),placeholder:"Feature description...",rows:2})]})]},e.id))]})]})]})}),(0,ea.jsx)(iJ,{value:"blocks",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Custom Blocks"}),(0,ea.jsx)(cD,{children:"Add additional sections to your landing page"})]}),(0,ea.jsxs)(sg,{onClick:()=>Ae(!0),children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Add Block"]})]})}),(0,ea.jsx)(dD,{children:0===(null===(U=be.blocks)||void 0===U?void 0:U.length)?(0,ea.jsxs)("div",{className:"text-center py-12 border-2 border-dashed rounded-lg",children:[(0,ea.jsx)(NE,{className:"mx-auto mb-4 text-slate-300",size:48}),(0,ea.jsx)("p",{className:"text-slate-500 mb-4",children:"No custom blocks added yet"}),(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>Ae(!0),children:[(0,ea.jsx)(Vj,{size:16,className:"mr-2"}),"Add Your First Block"]})]}):(0,ea.jsx)("div",{className:"space-y-4",children:be.blocks.map(e=>Xe(e))})})]})}),(0,ea.jsx)(iJ,{value:"contact",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Contact Section"}),(0,ea.jsx)(cD,{children:"Let visitors reach out to you"})]}),(0,ea.jsx)(wb,{checked:be.contact.enabled,onCheckedChange:e=>$e("enabled",e)})]})}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Section Title"}),(0,ea.jsx)(BN,{value:be.contact.title,onChange:e=>$e("title",e.target.value),placeholder:"Get in Touch"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email"}),(0,ea.jsx)(BN,{type:"email",value:be.contact.email,onChange:e=>$e("email",e.target.value),placeholder:"[email protected]"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Phone"}),(0,ea.jsx)(BN,{value:be.contact.phone,onChange:e=>$e("phone",e.target.value),placeholder:"+1 (555) 123-4567"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Address"}),(0,ea.jsx)(YN,{value:be.contact.address,onChange:e=>$e("address",e.target.value),placeholder:"123 Main St, City, State 12345",rows:2})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(wb,{checked:be.contact.show_form,onCheckedChange:e=>$e("show_form",e)}),(0,ea.jsx)(tf,{children:"Show Contact Form"})]})]})]})}),(0,ea.jsx)(iJ,{value:"footer",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"Footer"}),(0,ea.jsx)(cD,{children:"Configure your landing page footer"})]}),(0,ea.jsx)(wb,{checked:!1!==(null===(H=be.footer)||void 0===H?void 0:H.enabled),onCheckedChange:e=>Ke("enabled",e)})]})}),(0,ea.jsxs)(dD,{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Footer Style"}),(0,ea.jsxs)(eb,{value:(null===(W=be.footer)||void 0===W?void 0:W.style)||"simple",onValueChange:e=>Ke("style",e),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"simple",children:"Simple - Just copyright text"}),(0,ea.jsx)(rb,{value:"centered",children:"Centered - Logo, links, social"}),(0,ea.jsx)(rb,{value:"columns",children:"Columns - Multiple link sections"})]})]})]}),"simple"!==(null===(V=be.footer)||void 0===V?void 0:V.style)&&(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm",children:"Company Info"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Footer Logo"}),(0,ea.jsx)(h0,{value:(null===(q=be.footer)||void 0===q?void 0:q.logo_url)||"",onChange:e=>Ke("logo_url",e),label:"Footer Logo"})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Company Name"}),(0,ea.jsx)(BN,{value:(null===($=be.footer)||void 0===$?void 0:$.company_name)||"",onChange:e=>Ke("company_name",e.target.value),placeholder:"Your Company Name"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tagline"}),(0,ea.jsx)(BN,{value:(null===(G=be.footer)||void 0===G?void 0:G.tagline)||"",onChange:e=>Ke("tagline",e.target.value),placeholder:"Your company tagline"})]})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Copyright Text"}),(0,ea.jsx)(BN,{value:(null===(K=be.footer)||void 0===K?void 0:K.copyright)||"",onChange:e=>Ke("copyright",e.target.value),placeholder:"\xa9 2024 Your Company. All rights reserved."})]}),(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm",children:"Social Links"}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(nr,{size:14})," Facebook"]}),(0,ea.jsx)(BN,{value:(null===(Y=be.footer)||void 0===Y||null===(J=Y.social_links)||void 0===J?void 0:J.facebook)||"",onChange:e=>Je("facebook",e.target.value),placeholder:"https://facebook.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(lr,{size:14})," Twitter / X"]}),(0,ea.jsx)(BN,{value:(null===(Q=be.footer)||void 0===Q||null===(X=Q.social_links)||void 0===X?void 0:X.twitter)||"",onChange:e=>Je("twitter",e.target.value),placeholder:"https://twitter.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(rr,{size:14})," Instagram"]}),(0,ea.jsx)(BN,{value:(null===(Z=be.footer)||void 0===Z||null===(ee=Z.social_links)||void 0===ee?void 0:ee.instagram)||"",onChange:e=>Je("instagram",e.target.value),placeholder:"https://instagram.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(ir,{size:14})," LinkedIn"]}),(0,ea.jsx)(BN,{value:(null===(te=be.footer)||void 0===te||null===(se=te.social_links)||void 0===se?void 0:se.linkedin)||"",onChange:e=>Je("linkedin",e.target.value),placeholder:"https://linkedin.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(or,{size:14})," YouTube"]}),(0,ea.jsx)(BN,{value:(null===(ae=be.footer)||void 0===ae||null===(ne=ae.social_links)||void 0===ne?void 0:ne.youtube)||"",onChange:e=>Je("youtube",e.target.value),placeholder:"https://youtube.com/..."})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(mr,{size:14})," Bluesky"]}),(0,ea.jsx)(BN,{value:(null===(le=be.footer)||void 0===le||null===(re=le.social_links)||void 0===re?void 0:re.bluesky)||"",onChange:e=>Je("bluesky",e.target.value),placeholder:"https://bsky.app/profile/..."})]})]})]}),"simple"!==(null===(ie=be.footer)||void 0===ie?void 0:ie.style)&&(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("h4",{className:"font-medium text-sm",children:"Contact Info in Footer"}),(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(Yl,{size:14})," Email"]}),(0,ea.jsx)(BN,{value:(null===(oe=be.footer)||void 0===oe||null===(ce=oe.contact_info)||void 0===ce?void 0:ce.email)||"",onChange:e=>Qe("email",e.target.value),placeholder:"[email protected]"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(Jl,{size:14})," Phone"]}),(0,ea.jsx)(BN,{value:(null===(de=be.footer)||void 0===de||null===(ue=de.contact_info)||void 0===ue?void 0:ue.phone)||"",onChange:e=>Qe("phone",e.target.value),placeholder:"+1 (555) 123-4567"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-xs flex items-center gap-2",children:[(0,ea.jsx)(Ql,{size:14})," Address"]}),(0,ea.jsx)(BN,{value:(null===(me=be.footer)||void 0===me||null===(he=me.contact_info)||void 0===he?void 0:he.address)||"",onChange:e=>Qe("address",e.target.value),placeholder:"123 Main St, City"})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color (optional)"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:(null===(xe=be.footer)||void 0===xe?void 0:xe.background_color)||(null===(pe=be.hero)||void 0===pe?void 0:pe.background_color)||"#4F46E5",onChange:e=>Ke("background_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:(null===(ge=be.footer)||void 0===ge?void 0:ge.background_color)||"",onChange:e=>Ke("background_color",e.target.value),placeholder:"Use hero color"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color (optional)"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:(null===(fe=be.footer)||void 0===fe?void 0:fe.text_color)||"#ffffff",onChange:e=>Ke("text_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:(null===(ve=be.footer)||void 0===ve?void 0:ve.text_color)||"",onChange:e=>Ke("text_color",e.target.value),placeholder:"#ffffff"})]})]})]})]})]})}),(0,ea.jsx)(iJ,{value:"theme",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Dw,{size:20}),"Theme Settings"]}),(0,ea.jsx)(cD,{children:"Customize the look and feel of your landing page"})]}),(0,ea.jsxs)(dD,{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Primary Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:be.theme.primary_color,onChange:e=>Ge("primary_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:be.theme.primary_color,onChange:e=>Ge("primary_color",e.target.value)})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Secondary Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:be.theme.secondary_color,onChange:e=>Ge("secondary_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:be.theme.secondary_color,onChange:e=>Ge("secondary_color",e.target.value)})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Backgroun
2d Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:be.theme.background_color,onChange:e=>Ge("background_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:be.theme.background_color,onChange:e=>Ge("background_color",e.target.value)})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Text Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{type:"color",value:be.theme.text_color,onChange:e=>Ge("text_color",e.target.value),className:"w-14 h-10 p-1"}),(0,ea.jsx)(BN,{value:be.theme.text_color,onChange:e=>Ge("text_color",e.target.value)})]})]})]}),(0,ea.jsxs)("div",{className:"p-6 rounded-lg mt-4",style:{backgroundColor:be.theme.background_color,color:be.theme.text_color},children:[(0,ea.jsx)("h3",{className:"text-xl font-bold mb-2",children:"Preview"}),(0,ea.jsx)("p",{className:"mb-4",children:"This is how your text will look on the background."}),(0,ea.jsx)("button",{className:"px-4 py-2 rounded font-medium text-white",style:{backgroundColor:be.theme.primary_color},children:"Primary Button"}),(0,ea.jsx)("button",{className:"px-4 py-2 rounded font-medium text-white ml-2",style:{backgroundColor:be.theme.secondary_color},children:"Secondary Button"})]})]})]})})]})]})}),(0,ea.jsx)(Ok,{open:Ee,onOpenChange:Ae,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Add Block"}),(0,ea.jsx)(Gk,{children:"Choose a block type to add to your landing page"})]}),(0,ea.jsx)("div",{className:"grid grid-cols-2 gap-3 py-4 max-h-96 overflow-y-auto",children:x0.map(e=>{const t=e.icon;return(0,ea.jsxs)("button",{onClick:()=>Ie(e.type),className:"flex items-start gap-3 p-4 border rounded-lg hover:border-indigo-500 hover:bg-indigo-50 transition-colors text-left",children:[(0,ea.jsx)("div",{className:"p-2 rounded-lg bg-indigo-100",children:(0,ea.jsx)(t,{size:20,className:"text-indigo-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"font-medium text-slate-900",children:e.name}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:e.description})]})]},e.type)})})]})})]})},f0="",v0=()=>{let e=sessionStorage.getItem("nexus_session_id");return e||(e="sess_"+Math.random().toString(36).substr(2,9)+Date.now().toString(36),sessionStorage.setItem("nexus_session_id",e)),e},b0=new Set,j0=async(e,t)=>{try{var s,a;const n="".concat(e,":").concat(t.page_id||t.article_id||t.page_slug||"landing");if(b0.has(n))return void console.debug("Skipping duplicate tracking for:",n);b0.add(n),setTimeout(()=>b0.delete(n),5e3),await fetch("".concat(f0,"/api/public/track/pageview"),{method:"POST",headers:{"Content-Type":"application/json","X-Tenant-Subdomain":e},body:JSON.stringify(d(d({},t),{},{session_id:v0(),referrer:document.referrer||null,user_agent:navigator.userAgent,screen_width:null===(s=window.screen)||void 0===s?void 0:s.width,screen_height:null===(a=window.screen)||void 0===a?void 0:a.height,language:navigator.language||navigator.userLanguage,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}))})}catch(G2){console.debug("Tracking failed:",G2)}},y0=()=>{var e,s,a,n,l,r,i,o,c,u,m,h;const{siteSlug:x,pageSlug:p,articleSlug:g}=je(),[f]=_t(),v=be(),[b,j]=(0,t.useState)(null),[y,N]=(0,t.useState)(null),[w,C]=(0,t.useState)(null),[k,D]=(0,t.useState)(!0),[_,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(null),[F,T]=(0,t.useState)(null),[z,M]=(0,t.useState)(!1);(0,t.useEffect)(()=>{var e;const t=null===b||void 0===b||null===(e=b.branding)||void 0===e?void 0:e.favicon_url;if(t)return["icon","shortcut icon","apple-touch-icon"].forEach(e=>{let s=document.querySelector('link[rel="'.concat(e,'"]'));s||(s=document.createElement("link"),s.rel=e,document.head.appendChild(s)),s.href=t}),()=>{["icon","shortcut icon","apple-touch-icon"].forEach(e=>{const t=document.querySelector('link[rel="'.concat(e,'"]'));t&&(t.href="".concat("","/favicon.png"))})}},[null===b||void 0===b||null===(e=b.branding)||void 0===e?void 0:e.favicon_url]),(0,t.useEffect)(()=>{const e=f.get("lang");if(e)A(e),localStorage.setItem("nexus_language",e);else{const e=localStorage.getItem("nexus_language")||localStorage.getItem("nexuscms_language_preference");e&&A(e)}},[f]),(0,t.useEffect)(()=>{x&&(async()=>{D(!0),S(null);try{if(g){var e;const t=await fetch("".concat(f0,"/api/public/site/").concat(x,"/article/").concat(g));if(!t.ok){if(404===t.status)throw new Error("Article not found");throw new Error("Failed to load article")}const s=await t.json();C(s),j({tenant_name:s.tenant_name,theme:s.theme,menus:s.menus,branding:s.branding}),j0(x,{article_id:null===(e=s.article)||void 0===e?void 0:e.article_id,page_slug:g,page_type:"article"})}else if(p){var t;const e=await fetch("".concat(f0,"/api/public/site/").concat(x,"/page/").concat(p));if(!e.ok){if(404===e.status)throw new Error("Page not found");throw new Error("Failed to load page")}const s=await e.json();N(s),j({tenant_name:s.tenant_name,theme:s.theme,menus:s.menus,branding:s.branding}),j0(x,{page_id:null===(t=s.page)||void 0===t?void 0:t.page_id,page_slug:p,page_type:"page"})}else{const e=await fetch("".concat(f0,"/api/public/site/").concat(x));if(!e.ok){if(404===e.status)throw new Error("Site not found");throw new Error("Failed to load site")}const t=await e.json();j(t),j0(x,{page_type:"landing"})}}catch(K2){console.error("Error loading site data:",K2),S(K2.message)}finally{D(!1)}})()},[x,p,g]),(0,t.useEffect)(()=>{(async()=>{var e,t;const s=(null===b||void 0===b?void 0:b.branding)||{},a=s.default_language||"en";if(s.translation_enabled&&E&&E!==a){if(null!==w&&void 0!==w&&null!==(e=w.article)&&void 0!==e&&e.blocks){M(!0);try{const e=await fetch("".concat(f0,"/api/translation/translate-blocks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blocks:w.article.blocks,target_language:E,tenant_id:w.article.tenant_id})});if(e.ok){const t=await e.json();
2T(t.translated_blocks)}}catch(K2){console.error("Translation failed:",K2)}finally{M(!1)}}if(null!==y&&void 0!==y&&null!==(t=y.page)&&void 0!==t&&t.blocks){M(!0);try{const e=await fetch("".concat(f0,"/api/translation/translate-blocks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blocks:y.page.blocks,target_language:E,tenant_id:y.page.tenant_id})});if(e.ok){const t=await e.json();T(t.translated_blocks)}}catch(K2){console.error("Translation failed:",K2)}finally{M(!1)}}}else T(null)})()},[E,w,y,b]),(0,t.useEffect)(()=>{var e;null!==b&&void 0!==b&&null!==(e=b.branding)&&void 0!==e&&e.ga_measurement_id&&(e=>{if(!e||window.gtag)return;const t=document.createElement("script");t.async=!0,t.src="https://www.googletagmanager.com/gtag/js?id=".concat(e),document.head.appendChild(t),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",e)})(b.branding.ga_measurement_id)},[null===b||void 0===b||null===(s=b.branding)||void 0===s?void 0:s.ga_measurement_id]);const P=(null===b||void 0===b?void 0:b.branding)||{},B=(null===b||void 0===b?void 0:b.reseller_branding)||(null===y||void 0===y?void 0:y.reseller_branding)||(null===w||void 0===w?void 0:w.reseller_branding);if((0,t.useEffect)(()=>{const e=document.getElementById("dynatex-badge");if(e&&B){e.href=B.website_url||"#";const t=e.querySelector("span");t&&(t.textContent="Made by ".concat(B.company_name),t.style.color=B.primary_color||"#4F46E5")}return P&&!1!==P.show_platform_branding?document.body.classList.add("show-dynatex-badge"):document.body.classList.remove("show-dynatex-badge"),()=>{document.body.classList.remove("show-dynatex-badge");const e=document.getElementById("dynatex-badge");if(e){e.href="https://www.dynatexsaas.com/";const t=e.querySelector("span");t&&(t.textContent="Made by DynatexSaaS",t.style.color="#374151")}}},[P,B]),k)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)(ql,{className:"h-10 w-10 animate-spin text-indigo-600 mx-auto mb-4"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading site..."})]})});if(_)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"text-center max-w-md mx-auto px-4",children:[(0,ea.jsx)(WN,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900 mb-2",children:"Site not found"===_?"404":"Error"}),(0,ea.jsx)("p",{className:"text-xl text-slate-600 mb-2",children:_}),(0,ea.jsx)("p",{className:"text-slate-500 mb-6",children:"Site not found"===_?"The site you're looking for doesn't exist or has been removed.":"Something went wrong while loading this site."}),(0,ea.jsxs)("div",{className:"flex gap-3 justify-center",children:[(0,ea.jsxs)(sg,{onClick:()=>v(-1),variant:"outline",children:[(0,ea.jsx)(_j,{className:"w-4 h-4 mr-2"}),"Go Back"]}),(0,ea.jsx)(sg,{onClick:()=>v("/"),children:"Go to Homepage"})]})]})});const R=(null===b||void 0===b?void 0:b.theme)||{},L=null===b||void 0===b?void 0:b.landing_page,I=(null===b||void 0===b?void 0:b.pages)||[],O=(null===b||void 0===b?void 0:b.menus)||[],U=(null===y||void 0===y||null===(a=y.page)||void 0===a?void 0:a.page_id)||(null===w||void 0===w||null===(n=w.article)||void 0===n?void 0:n.article_id)||null,H=e=>{const t=O.filter(t=>t.location===e),s=t.find(e=>{var t;return U&&(null===(t=e.page_ids)||void 0===t?void 0:t.includes(U))});return s||(t.find(e=>e.is_global)||null)},W=H("header"),V=H("footer");if(w){const e=w.article,t=F||e.blocks,s=t&&t.length>0,a=e.article_nav_mode||(!1===e.show_site_navigation?"none":"site_nav"),n=(0,ea.jsxs)("article",{className:"max-w-4xl mx-auto px-4 py-12 bg-white rounded-lg my-8 shadow-sm",style:{color:R.bodyColor||"#334155"},children:[e.featured_image&&(0,ea.jsxs)("figure",{className:"mb-3",children:[(0,ea.jsx)("img",{src:e.featured_image,alt:e.title,className:"w-full rounded-xl",style:{maxHeight:"520px",objectFit:"contain"}}),e.image_caption&&(0,ea.jsx)("figcaption",{className:"text-xs text-slate-500 mt-2 text-center italic",children:e.image_caption})]}),(0,ea.jsx)("h1",{className:"text-4xl font-bold mb-4",style:{color:R.headingColor||"#1e293b"},children:e.title}),e.published_at&&(0,ea.jsx)("p",{className:"text-slate-500 mb-8",children:new Date(e.published_at).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),z&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 mb-4",children:[(0,ea.jsx)(ql,{className:"h-4 w-4 animate-spin"}),(0,ea.jsx)("span",{children:"Translating..."})]}),s?(0,ea.jsx)(cN,{blocks:t,theme:R,siteTheme:R,subdomain:x,pages:I}):(0,ea.jsx)("div",{className:"prose prose-lg max-w-none",style:{color:R.bodyColor||"#334155"},dangerouslySetInnerHTML:{__html:e.content}})]});var q;return"site_nav"===a?(0,ea.jsxs)("div",{className:"min-h-screen",style:{backgroundColor:R.backgroundColor||"#ffffff"},children:[(0,ea.jsx)("header",{className:"border-b bg-white/80 backdrop-blur-sm sticky top-0 z-50",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto px-4 py-4 flex items-center justify-between",children:[(0,ea.jsxs)(Nt,{to:"/site/".concat(x),className:"flex items-center gap-2",children:[(null===W||void 0===W||null===(q=W.logo)||void 0===q?void 0:q.url)&&(0,ea.jsx)("img",{src:W.logo.url,alt:"",className:"h-8"}),(0,ea.jsx)("span",{className:"font-semibold text-lg",children:null===b||void 0===b?void 0:b.tenant_name})]}),E&&E!==(P.default_language||"en")&&(0,ea.jsx)("span",{className:"text-sm text-slate-500 bg-slate-100 px-2 py-1 rounded",children:E.toUpperCase()})]})}),n,P.show_platform_branding&&(0,ea.jsxs)("div",{className:"text-center py-4 bg-slate-100 text-slate-500 text-sm",children:["Powered by ",(0,ea.jsx)("a",{href:"https://dynatexsaas.com",className:"text-indigo-600 hover:underline",children:"DynatexSaaS"})]})]}):(0,ea.jsxs)("div",{className:"min-h-screen",style:{backgroundColor:R.backgroundColor||"#ffffff"},children:["back_link"===a&&(0,ea.jsx)("div",{className:"bg-white/80 backdrop-blur-sm border-b sticky top-0 z-50",children:(0,ea.jsx)("div",{className:"max-w-4xl mx-auto px-4 py-3",children:(0,ea.jsxs)(Nt,{to:"/site/".concat(x),className:"inline-flex items-center text-sm font-medium hover:underline",style:{color:R.accentColor||"#4f46e5"},children:[(0,ea.jsx)(_j,{className:"w-4 h-4 mr-1.5"}),"Back to ",(null===b||void 0===b?void 0:b.tenant_name)||"Site"]})})}),n,P.show_platform_branding&&(0,ea.jsxs)("div",{className:"text-center py-4 bg-slate-100 text-slate-500 text-sm",children:["Powered by ",(0,ea.jsx)("a",{href:"https://dynatexsaas.com",className:"text-indigo-600 hover:underline",children:"DynatexSaaS"})]})]})}
2if(y){var $,G,K,Y,J,Q;const e=y.page,t=F||e.blocks||[];return(0,ea.jsxs)("div",{className:"min-h-screen",style:{backgroundColor:R.backgroundColor||"#ffffff"},children:[(0,ea.jsx)("header",{className:"border-b bg-white/80 backdrop-blur-sm sticky top-0 z-50",children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto px-4 py-4 flex items-center justify-between",children:[(0,ea.jsxs)(Nt,{to:"/site/".concat(x),className:"flex items-center gap-2",children:[(null===W||void 0===W||null===($=W.logo)||void 0===$?void 0:$.url)&&(0,ea.jsx)("img",{src:W.logo.url,alt:"",className:"h-8"}),(0,ea.jsx)("span",{className:"font-semibold text-lg",children:null===b||void 0===b?void 0:b.tenant_name})]}),E&&E!==(P.default_language||"en")&&(0,ea.jsx)("span",{className:"text-sm text-slate-500 bg-slate-100 px-2 py-1 rounded",children:E.toUpperCase()})]})}),(0,ea.jsxs)("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold mb-8",style:{color:R.headingColor||"#1e293b"},children:e.title}),z&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 mb-4",children:[(0,ea.jsx)(ql,{className:"h-4 w-4 animate-spin"}),(0,ea.jsx)("span",{children:"Translating..."})]}),(0,ea.jsx)(cN,{blocks:t,theme:e.theme||R,siteTheme:e.theme||R,tenantId:(null===b||void 0===b?void 0:b.tenant_id)||(null===y||void 0===y||null===(G=y.page)||void 0===G?void 0:G.tenant_id)||(null===w||void 0===w||null===(K=w.article)||void 0===K?void 0:K.tenant_id),subdomain:x,pages:I})]}),P.show_platform_branding&&(0,ea.jsxs)("div",{className:"text-center py-4 bg-slate-100 text-slate-500 text-sm",children:["Powered by ",(0,ea.jsx)("a",{href:"https://dynatexsaas.com",className:"text-indigo-600 hover:underline",children:"DynatexSaaS"})]}),(0,ea.jsx)(e0,{tenantId:(null===b||void 0===b?void 0:b.tenant_id)||(null===y||void 0===y||null===(Y=y.page)||void 0===Y?void 0:Y.tenant_id)||(null===w||void 0===w||null===(J=w.article)||void 0===J?void 0:J.tenant_id),pageId:(null===y||void 0===y||null===(Q=y.page)||void 0===Q?void 0:Q.page_id)||null})]})}if(!p&&!g&&null!==b&&void 0!==b&&b.landing_page)return(0,ea.jsx)(mN,{tenantData:d(d({},b),{},{landing_page:b.landing_page}),subdomain:x,isSubdomainMode:!0});const X=(null===L||void 0===L?void 0:L.blocks)||[],Z=(null===b||void 0===b?void 0:b.recent_articles)||[];return(0,ea.jsxs)("div",{className:"min-h-screen",style:{backgroundColor:R.backgroundColor||"#ffffff"},children:[(0,ea.jsx)("header",{className:"border-b bg-white/80 backdrop-blur-sm sticky top-0 z-50",children:(0,ea.jsx)("div",{className:"max-w-6xl mx-auto px-4 py-4",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(null===W||void 0===W||null===(l=W.logo)||void 0===l?void 0:l.url)&&(0,ea.jsx)("a",{href:W.logo.link||"/",className:"flex items-center hover:opacity-80 transition-opacity","aria-label":"Go to homepage","data-testid":"header-logo-link",children:(0,ea.jsx)("img",{src:W.logo.url,alt:W.logo.alt||(null===b||void 0===b?void 0:b.tenant_name)||"Logo",style:{height:"".concat(W.logo.height||40,"px")},className:"object-contain"})}),(0,ea.jsx)("span",{className:"font-semibold text-xl",style:{color:R.headingColor||"#1e293b"},children:null===b||void 0===b?void 0:b.tenant_name})]}),(0,ea.jsxs)("nav",{className:"hidden md:flex items-center gap-6",children:[null===W||void 0===W||null===(r=W.items)||void 0===r?void 0:r.map(e=>(0,ea.jsx)("a",{href:e.url||"#",className:"text-sm font-medium hover:text-indigo-600 transition-colors",style:{color:R.bodyColor||"#475569"},children:e.label},e.item_id)),I.slice(0,5).map(e=>(0,ea.jsx)(Nt,{to:"/site/".concat(x,"/page/").concat(e.slug),className:"text-sm font-medium hover:text-indigo-600 transition-colors",style:{color:R.bodyColor||"#475569"},children:e.title},e.page_id))]})]})})}),(0,ea.jsxs)("main",{children:[X.length>0?(0,ea.jsx)(cN,{blocks:X,theme:(null===L||void 0===L?void 0:L.theme)||R,siteTheme:(null===L||void 0===L?void 0:L.theme)||R,tenantId:null===b||void 0===b?void 0:b.tenant_id,subdomain:x,pages:I}):(0,ea.jsxs)("div",{className:"max-w-4xl mx-auto px-4 py-16 text-center",children:[(0,ea.jsxs)("h1",{className:"text-4xl md:text-5xl font-bold mb-6",style:{color:R.headingColor||"#1e293b"},children:["Welcome to ",null===b||void 0===b?void 0:b.tenant_name]}),(0,ea.jsx)("p",{className:"text-xl mb-8",style:{color:R.bodyColor||"#64748b"},children:"This site is being built. Check back soon!"})]}),Z.length>0&&(0,ea.jsxs)("section",{className:"max-w-6xl mx-auto px-4 py-16",children:[(0,ea.jsx)("h2",{className:"text-2xl font-bold mb-8",style:{color:R.headingColor||"#1e293b"},children:"Latest News"}),(0,ea.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:Z.map(e=>(0,ea.jsxs)(Nt,{to:"/site/".concat(x,"/article/").concat(e.slug||e.article_id),className:"group bg-white rounded-xl shadow-sm border overflow-hidden hover:shadow-md transition-shadow",children:[e.featured_image&&(0,ea.jsx)("img",{src:e.featured_image,alt:e.title,className:"w-full h-48 object-cover"}),(0,ea.jsxs)("div",{className:"p-4",children:[(0,ea.jsx)("h3",{className:"font-semibold mb-2 group-hover:text-indigo-600 transition-colors",style:{color:R.headingColor||"#1e293b"},children:e.title}),e.excerpt&&(0,ea.jsx)("p",{className:"text-sm line-clamp-2",style:{color:R.bodyColor||"#64748b"},children:e.excerpt})]})]},e.article_id))})]})]}
2),(0,ea.jsx)("footer",{className:"border-t mt-auto",style:{backgroundColor:(null===V||void 0===V||null===(i=V.footer_settings)||void 0===i?void 0:i.backgroundColor)||"#f8fafc"},children:(0,ea.jsxs)("div",{className:"max-w-6xl mx-auto px-4 py-12",children:[(0,ea.jsxs)("div",{className:"grid md:grid-cols-3 gap-8",children:[(0,ea.jsxs)("div",{children:[(null===V||void 0===V||null===(o=V.logo)||void 0===o?void 0:o.url)&&(0,ea.jsx)("img",{src:V.logo.url,alt:null===b||void 0===b?void 0:b.tenant_name,className:"h-10 mb-4"}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:null===b||void 0===b?void 0:b.tenant_name})]}),I.length>0&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"font-semibold mb-4 text-slate-900",children:"Quick Links"}),(0,ea.jsx)("ul",{className:"space-y-2",children:I.slice(0,5).map(e=>(0,ea.jsx)("li",{children:(0,ea.jsx)(Nt,{to:"/site/".concat(x,"/page/").concat(e.slug),className:"text-sm text-slate-600 hover:text-indigo-600",children:e.title})},e.page_id))})]}),(null===V||void 0===V||null===(c=V.items)||void 0===c?void 0:c.length)>0&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"font-semibold mb-4 text-slate-900",children:"Links"}),(0,ea.jsx)("ul",{className:"space-y-2",children:V.items.map(e=>(0,ea.jsx)("li",{children:(0,ea.jsx)("a",{href:e.url||"#",className:"text-sm text-slate-600 hover:text-indigo-600",children:e.label})},e.item_id))})]})]}),(0,ea.jsxs)("div",{className:"border-t mt-8 pt-8 text-center",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:(null===V||void 0===V||null===(u=V.footer_settings)||void 0===u?void 0:u.copyright_text)||"\xa9 ".concat((new Date).getFullYear()," ").concat(null===b||void 0===b?void 0:b.tenant_name,". All rights reserved.")}),P.show_platform_branding&&(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-2",children:["Powered by ",(0,ea.jsx)("a",{href:"https://dynatexsaas.com",className:"text-indigo-500 hover:underline",children:"DynatexSaaS"})]})]})]})}),(0,ea.jsx)(xN,{settings:null===b||void 0===b||null===(m=b.branding)||void 0===m?void 0:m.cookie_consent}),(0,ea.jsx)(e0,{tenantId:null===b||void 0===b?void 0:b.tenant_id,pageId:(null===y||void 0===y||null===(h=y.page)||void 0===h?void 0:h.page_id)||null})]})},N0=()=>{var e,s,a,n,l;const[r]=_t(),[i,o]=(0,t.useState)("loading"),[c,d]=(0,t.useState)(null),[u,m]=(0,t.useState)(0),[h,x]=(0,t.useState)(null),p=r.get("session_id");(0,t.useEffect)(()=>{p?g():o("failed")},[p]);const g=async()=>{if(u>=10)o("failed");
2else try{const n=(await _l.get("/payments/status/".concat(p))).data;if(d(n),"paid"===n.payment_status){var e;if("ai_generations"===(null===(e=n.metadata)||void 0===e?void 0:e.type))try{var t,s,a;const e=await _l.post("/ai/add-credits/".concat(p));x(null!==(t=null===(s=e.data)||void 0===s?void 0:s.credits_added)&&void 0!==t?t:Number(null===(a=n.metadata)||void 0===a?void 0:a.credits)||null)}catch(G2){}return void o("success")}if("expired"===n.status)return void o("expired");m(e=>e+1),setTimeout(g,2e3)}catch(n){console.error("Error checking payment status:",n),m(e=>e+1),u<9?setTimeout(g,2e3):o("failed")}};return(0,ea.jsx)("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:(0,ea.jsxs)("div",{className:"max-w-md w-full bg-white rounded-2xl shadow-lg p-8 text-center",children:["loading"===i&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,ea.jsx)(ql,{className:"w-8 h-8 text-indigo-600 animate-spin"})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Processing Payment"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"Please wait while we confirm your payment..."}),(0,ea.jsx)("div",{className:"flex justify-center",children:(0,ea.jsx)("div",{className:"flex gap-1",children:[...Array(3)].map((e,t)=>(0,ea.jsx)("div",{className:"w-2 h-2 bg-indigo-600 rounded-full animate-bounce",style:{animationDelay:"".concat(.15*t,"s")}},t))})})]}),"success"===i&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,ea.jsx)(cr,{className:"w-10 h-10 text-green-600"})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Payment Successful!"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:h?"".concat(Number(h).toLocaleString()," AI Generations have been added to your account."):"Thank you for your purchase. Your subscription is now active."}),c&&(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 mb-6 text-left",children:[(0,ea.jsx)("h3",{className:"font-semibold text-slate-900 mb-3",children:"Order Details"}),(0,ea.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Plan"}),(0,ea.jsx)("span",{className:"font-medium text-slate-900",children:(null===(e=c.metadata)||void 0===e?void 0:e.tier_name)||(null===(s=c.metadata)||void 0===s?void 0:s.plan_name)||"Subscription"})]}),(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Billing"}),(0,ea.jsx)("span",{className:"font-medium text-slate-900 capitalize",children:(null===(a=c.metadata)||void 0===a?void 0:a.billing_period)||"Monthly"})]}),(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Amount"}),(0,ea.jsxs)("span",{className:"font-medium text-slate-900",children:["$",(f=c.amount_total,(f/100).toFixed(2))," ",null===(n=c.currency)||void 0===n?void 0:n.toUpperCase()]})]}),(null===(l=c.metadata)||void 0===l?void 0:l.reseller_brand)&&(0,ea.jsxs)("div",{className:"flex justify-between",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:"Provided by"}),(0,ea.jsx)("span",{className:"font-medium text-slate-900",children:c.metadata.reseller_brand})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(sg,{asChild:!0,className:"w-full",children:(0,ea.jsxs)(Nt,{to:"/login",children:["Go to Dashboard",(0,ea.jsx)(wj,{className:"ml-2",size:18})]})}),(0,ea.jsx)(sg,{asChild:!0,variant:"outline",className:"w-full",children:(0,ea.jsx)(Nt,{to:"/",children:"Back to Home"})})]})]}),"failed"===i&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,ea.jsx)(fJ,{className:"w-10 h-10 text-red-600"})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Payment Failed"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"We couldn't process your payment. Please try again or c
2ontact support if the issue persists."}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(sg,{asChild:!0,className:"w-full",children:(0,ea.jsx)(Nt,{to:"/#pricing",children:"Try Again"})}),(0,ea.jsx)(sg,{asChild:!0,variant:"outline",className:"w-full",children:(0,ea.jsx)(Nt,{to:"/",children:"Back to Home"})})]})]}),"expired"===i&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-amber-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,ea.jsx)(fJ,{className:"w-10 h-10 text-amber-600"})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Session Expired"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"Your payment session has expired. Please start a new checkout."}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsx)(sg,{asChild:!0,className:"w-full",children:(0,ea.jsx)(Nt,{to:"/#pricing",children:"View Plans"})}),(0,ea.jsx)(sg,{asChild:!0,variant:"outline",className:"w-full",children:(0,ea.jsx)(Nt,{to:"/",children:"Back to Home"})})]})]})]})});var f},w0=Vl("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"}]]),C0=Vl("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"}]]),k0=[{min:0,max:5e3,percentage:50},{min:5001,max:2e4,percentage:55},{min:20001,max:-1,percentage:60}],D0=()=>{var e,s,a,n,l,r,i,o,c,u;const{user:m,startImpersonation:h}=Al(),x="master_admin"===(null===m||void 0===m?void 0:m.role),[p,g]=(0,t.useState)("resellers"),[f,v]=(0,t.useState)([]),[b,j]=(0,t.useState)(!0),[y,N]=(0,t.useState)(""),[w,C]=(0,t.useState)("all"),[k,D]=(0,t.useState)(1),[_,S]=(0,t.useState)(1),[E,A]=(0,t.useState)(0),[F,T]=(0,t.useState)([]),[z,M]=(0,t.useState)(!1),[P,B]=(0,t.useState)("all"),[R,L]=(0,t.useState)(0),[I,O]=(0,t.useState)(!1),[U,H]=(0,t.useState)(!1),[W,V]=(0,t.useState)(!1),[q,$]=(0,t.useState)(!1),[G,K]=(0,t.useState)(!1),[Y,J]=(0,t.useState)(!1),[Q,X]=(0,t.useState)(null),[Z,ee]=(0,t.useState)(null),[te,se]=(0,t.useState)(!1),[ae,ne]=(0,t.useState)(!1),[le,re]=(0,t.useState)(!1),[ie,oe]=(0,t.useState)(!1),[ce,de]=(0,t.useState)({revenue_tiers:k0,commission_rate:50,admin_notes:""}),[ue,me]=(0,t.useState)(""),[he,xe]=(0,t.useState)({name:"",slug:"",owner_email:"",owner_password:"",owner_name:"",company_name:"",commission_rate:50}),[pe,ge]=(0,t.useState)({name:"",commission_rate:50,revenue_tiers:k0,branding:{company_name:"",logo_url:"",primary_color:"#4F46E5",secondary_color:"#7C3AED",support_email:""}}),fe=(0,t.useCallback)(async()=>{try{j(!0);const e=new URLSearchParams({page:k,per_page:10});y&&e.append("search",y),"all"!==w&&e.append("status",w);const t=await _l.get("/resellers?".concat(e));v(t.data.resellers),S(t.data.total_pages),A(t.data.total)}catch(e){qs.error("Failed to load resellers")}finally{j(!1)}},[k,y,w]),ve=(0,t.useCallback)(async()=>{try{M(!0);const e="all"!==P?"?status=".concat(P):"",t=await _l.get("/resellers/applications".concat(e));T(t.data.applications),L(t.data.pending_count)}catch(e){qs.error("Failed to load applications")}finally{M(!1)}},[P]);(0,t.useEffect)(()=>{"resellers"===p?fe():ve()},[p,fe,ve]);const be=e=>{var t,s,a,n,l,r,i,o;ge({name:e.name||"",commission_rate:null!==(t=null!==(s=null===(a=e.plan)||void 0===a?void 0:a.commission_rate)&&void 0!==s?s:e.commission_rate)&&void 0!==t?t:50,revenue_tiers:e.revenue_tiers||k0,branding:{company_name:(null===(n=e.branding)||void 0===n?void 0:n.company_name)||"",logo_url:(null===(l=e.branding)||void 0===l?void 0:l.logo_url)||"",primary_color:(null===(r=e.branding)||void 0===r?void 0:r.primary_color)||"#4F46E5",secondary_color:(null===(i=e.branding)||void 0===i?void 0:i.secondary_color)||"#7C3AED",support_email:(null===(o=e.branding)||void 0===o?void 0:o.support_email)||""}}),X(e),V(!0),H(!1)},je=e=>{ee(e),de({revenue_tiers:k0,commission_rate:50,admin_notes:""}),K(!0),$(!1)},ye=e=>{ee(e),me(""),J(!0),$(!1)},Ne=(e,t,s)=>{const a=[...ce.revenue_tiers];a[e]=d(d({},a[e]),{},{[t]:parseInt(s)||0}),de(d(d({},ce),{},{revenue_tiers:a}))},we=(e,t,s)=>{const a=[...pe.revenue_tiers||k0];a[e]=d(d({},a[e]),{},{[t]:parseInt(s)||0}),ge(d(d({},pe),{},{revenue_tiers:a}))},Ce=e=>{switch(e){case"active":return(0,ea.jsx)(EC,{className:"bg-green-100 text-green-700",children:"Active"});case"suspended":return(0,ea.jsx)(EC,{className:"bg-red-100 text-red-700",children:"Suspended"});
2case"pending":return(0,ea.jsx)(EC,{className:"bg-yellow-100 text-yellow-700",children:"Pending"});case"approved":return(0,ea.jsx)(EC,{className:"bg-green-100 text-green-700",children:"Approved"});case"rejected":return(0,ea.jsx)(EC,{className:"bg-red-100 text-red-700",children:"Rejected"});default:return(0,ea.jsx)(EC,{variant:"outline",children:e})}};return(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 p-8",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900",style:{fontFamily:"Manrope, sans-serif"},children:"Reseller Management"}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Manage your reseller partners and applications"})]}),(0,ea.jsxs)(sg,{onClick:()=>O(!0),className:"gap-2",children:[(0,ea.jsx)(Vj,{size:18}),"Add Reseller"]})]}),(0,ea.jsxs)(nJ,{value:p,onValueChange:g,className:"space-y-6",children:[(0,ea.jsxs)(lJ,{className:"bg-white border",children:[(0,ea.jsxs)(rJ,{value:"resellers",className:"gap-2",children:[(0,ea.jsx)(Bw,{size:16}),"Resellers (",E,")"]}),(0,ea.jsxs)(rJ,{value:"applications",className:"gap-2 relative",children:[(0,ea.jsx)(qN,{size:16}),"Applications",R>0&&(0,ea.jsx)("span",{className:"ml-1 bg-red-500 text-white text-xs rounded-full px-1.5 py-0.5 min-w-[20px]",children:R})]})]}),(0,ea.jsxs)(iJ,{value:"resellers",className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-4",children:[(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Bw,{className:"text-indigo-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Total Resellers"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:E})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Xl,{className:"text-green-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Active"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:f.filter(e=>"active"===e.status).length})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Bj,{className:"text-purple-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Total Customers"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:f.reduce((e,t)=>e+(t.customer_count||0),0)})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-amber-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(bw,{className:"text-amber-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Avg. Commission"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:"35%"})]})]})})})]}),(0,ea.jsxs)("div",{className:"flex gap-4",children:[(0,ea.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400",size:18}),(0,ea.jsx)(BN,{placeholder:"Search resellers...",value:y,onChange:e=>N(e.target.value),className:"pl-10"})]}),(0,ea.jsxs)(eb,{value:w,onValueChange:C,children:[(0,ea.jsxs)(sb,{className:"w-40",children:[(0,ea.jsx)(kD,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Status"}),(0,ea.jsx)(rb,{value:"active",children:"Active"}),(0,ea.jsx)(rb,{value:"suspended",children:"Suspended"}),(0,ea.jsx)(rb,{value:"pending",children:"Pending"})]})]})]}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"p-0",children:b?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"animate-spin text-slate-400",size:32})}):0===f.length?(0,ea.jsxs)("div",{className:"text-center py-12",children:[(0,ea.jsx)(Bw,{className:"mx-auto text-slate-300 mb-4",size:48}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-600",children:"No resellers yet"}),(0,ea.jsx)("p",{className:"text-slate-400 mt-1",children:"Create your first reseller to get started"}),(0,ea.jsxs)(sg,{onClick:()=>O(!0),className:"mt-4 gap-2",children:[(0,ea.jsx)(Vj,{size:18}),"Add Reseller"]})]}):(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Reseller"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Customers"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Commission"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Created"}),(0,ea.jsx)("th",{className:"text-right py-3 px-4 font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y",children:f.map(e=>{var t,s,a;return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"py-4 px-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold",style:{backgroundColor:(null===(t=e.branding)||void 0===t?void 0:t.primary_color)||"#4F46E5"},children:e.name.charAt(0)}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-900",children:e.name}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[e.slug,".nexuscms.ai"]})]})]})}),(0,ea.jsx)("td",{className:"py-4 px-4",children:Ce(e.status)}),(0,ea.jsxs)("td",{className:"py-4 px-4",children:[(0,ea.jsx)("span",{className:"font-medium",children:e.customer_count||0}),(0,ea.jsxs)("span",{className:"text-slate-400",children:[" / ",(null===(s=e.plan)||void 0===s?void 0:s.max_customers)||50]})]}),(0,ea.jsx)("td",{className:"py-4 px-4",children:(0,ea.jsxs)("span",{className:"font-medium",children:[(null===(a=e.plan)||void 0===a?void 0:a.commission_rate)||50,"%"]})}),(0,ea.jsx)("td",{className:"py-4 px-4 text-slate-500",children:new Date(e.created_at).toLocaleDateString()}),(0,ea.jsx)("td",{className:"py-4 px-4 text-right",children:(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",children:(0,ea.jsx)(KJ,{size:16})})}),(0,ea.jsxs)(Bp,{align:"end",children:[(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{try{const t=await _l.get("/resellers/".concat(e.reseller_id));X(t.data),H(!0)}catch(t){qs.error("Failed to load reseller details")}})(e),children:[(0,ea.jsx)(IN,{size:16,className:"mr-2"}),"View Details"]}
2),(0,ea.jsxs)(Rp,{onClick:()=>be(e),children:[(0,ea.jsx)(ND,{size:16,className:"mr-2"}),"Edit"]}),(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{try{const t=await _l.post("/resellers/".concat(e.reseller_id,"/impersonate"));h(t.data.access_token,t.data.user),qs.success("Now impersonating ".concat(t.data.user.email)),window.location.href="/reseller/dashboard"}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to impersonate reseller")}})(e),"data-testid":"impersonate-reseller-".concat(e.reseller_id),children:[(0,ea.jsx)(QJ,{size:16,className:"mr-2"}),"Impersonate"]}),"active"===e.status?(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{try{await _l.post("/resellers/".concat(e,"/suspend")),qs.success("Reseller suspended"),fe()}catch(t){qs.error("Failed to suspend reseller")}})(e.reseller_id),className:"text-red-600",children:[(0,ea.jsx)(w0,{size:16,className:"mr-2"}),"Suspend"]}):(0,ea.jsxs)(Rp,{onClick:()=>(async e=>{try{await _l.post("/resellers/".concat(e,"/activate")),qs.success("Reseller activated"),fe()}catch(t){qs.error("Failed to activate reseller")}})(e.reseller_id),className:"text-green-600",children:[(0,ea.jsx)(Gg,{size:16,className:"mr-2"}),"Activate"]})]})]})})]},e.reseller_id)})})]})})}),_>1&&(0,ea.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Showing ",f.length," of ",E," resellers"]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>D(e=>Math.max(1,e-1)),disabled:1===k,children:(0,ea.jsx)(vj,{size:16})}),(0,ea.jsxs)("span",{className:"px-3 py-1 text-sm",children:["Page ",k," of ",_]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>D(e=>Math.min(_,e+1)),disabled:k===_,children:(0,ea.jsx)(ax,{size:16})})]})]})]}),(0,ea.jsxs)(iJ,{value:"applications",className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-yellow-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Kg,{className:"text-yellow-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Pending Review"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:R})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(cr,{className:"text-green-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Approved"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:F.filter(e=>"approved"===e.status).length})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-red-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(fJ,{className:"text-red-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Rejected"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:F.filter(e=>"rejected"===e.status).length})]})]})})})]}),(0,ea.jsx)("div",{className:"flex gap-4",children:(0,ea.jsxs)(eb,{value:P,onValueChange:B,children:[(0,ea.jsxs)(sb,{className:"w-48",children:[(0,ea.jsx)(kD,{size:16,className:"mr-2"}),(0,ea.jsx)(tb,{placeholder:"Filter by status"})]}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"all",children:"All Applications"}),(0,ea.jsx)(rb,{value:"pending",children:"Pending"}),(0,ea.jsx)(rb,{value:"approved",children:"Approved"}),(0,ea.jsx)(rb,{value:"rejected",children:"Rejected"})]})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"p-0",children:z?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"animate-spin text-slate-400",size:32})}):0===F.length?(0,ea.jsxs)("div",{className:"text-center py-12",children:[(0,ea.jsx)(qN,{className:"mx-auto text-slate-300 mb-4",size:48}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-600",children:"No applications yet"}),(0,ea.jsx)("p",{className:"text-slate-400 mt-1",children:"Applications will appear here when users apply to become resellers"})]}):(0,ea.jsx)("div",{className:"divide-y",children:F.map(e=>(0,ea.jsx)("div",{className:"p-4 hover:bg-slate-50 cursor-pointer",onClick:()=>(e=>{ee(e),$(!0)})(e),children:(0,ea.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(TY,{className:"text-indigo-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("h3",{className:"font-semibold text-slate-900",children:e.company_name}),Ce(e.status)]}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:e.contact_name}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-sm text-slate-500",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Yl,{size:14}),e.email]}),(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(hr,{size:14}),e.country]}),e.phone&&(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Jl,{size:14}),e.phone]}
2)]}),(0,ea.jsxs)("div",{className:"mt-2",children:[(0,ea.jsxs)("span",{className:"text-xs bg-slate-100 px-2 py-1 rounded",children:["Expected clients: ",e.expected_clients]}),(0,ea.jsxs)("span",{className:"text-xs bg-slate-100 px-2 py-1 rounded ml-2",children:["Target: ",e.target_market]})]})]})]}),(0,ea.jsxs)("div",{className:"text-right",children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:["Submitted ",new Date(e.submitted_at).toLocaleDateString()]}),"pending"===e.status&&(0,ea.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,ea.jsxs)(sg,{size:"sm",variant:"outline",className:"text-green-600 border-green-200 hover:bg-green-50",onClick:t=>{t.stopPropagation(),je(e)},children:[(0,ea.jsx)(cr,{size:14,className:"mr-1"}),"Approve"]}),(0,ea.jsxs)(sg,{size:"sm",variant:"outline",className:"text-red-600 border-red-200 hover:bg-red-50",onClick:t=>{t.stopPropagation(),ye(e)},children:[(0,ea.jsx)(fJ,{size:14,className:"mr-1"}),"Reject"]})]})]})]})},e.application_id))})})})]})]}),(0,ea.jsx)(Ok,{open:I,onOpenChange:O,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Bw,{className:"text-indigo-600",size:24}),"Create New Reseller"]})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Reseller Name *"}),(0,ea.jsx)(BN,{placeholder:"Digital Agency Pro",value:he.name,onChange:e=>{var t;xe(d(d({},he),{},{name:e.target.value,slug:(t=e.target.value,t.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/[\s]+/g,"-").replace(/-+/g,"-").trim())}))}})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Slug *"}),(0,ea.jsx)(BN,{placeholder:"digital-agency-pro",value:he.slug,onChange:e=>xe(d(d({},he),{},{slug:e.target.value}))}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:[he.slug||"slug",".nexuscms.ai"]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Display Name (White-Label)"}),(0,ea.jsx)(BN,{placeholder:"Agency Pro CMS",value:he.company_name,onChange:e=>xe(d(d({},he),{},{company_name:e.target.value}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:'Shown instead of "Nexus CMS" in their portal'})]}),(0,ea.jsxs)("div",{className:"border-t pt-4",children:[(0,ea.jsx)("p",{className:"font-medium text-slate-700 mb-3",children:"Owner Account"}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Owner Name *"}),(0,ea.jsx)(BN,{placeholder:"John Smith",value:he.owner_name,onChange:e=>xe(d(d({},he),{},{owner_name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Owner Email *"}),(0,ea.jsx)(BN,{type:"email",placeholder:"[email protected]",value:he.owner_email,onChange:e=>xe(d(d({},he),{},{owner_email:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Password *"}),(0,ea.jsx)(BN,{type:"password",placeholder:"********",value:he.owner_password,onChange:e=>xe(d(d({},he),{},{owner_password:e.target.value}))})]})]})]}),(0,ea.jsx)("div",{className:"border-t pt-4",children:(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Reseller Commission Rate"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(BN,{type:"number",min:"0",max:"100",value:he.commission_rate,onChange:e=>xe(d(d({},he),{},{commission_rate:parseFloat(e.target.value)})),className:"w-24"}),(0,ea.jsx)("span",{className:"text-slate-500",children:"%"})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Reseller keeps ",he.commission_rate,"%, platform keeps ",100-he.commission_rate,"%"]})]})})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(he.name&&he.slug&&he.owner_email&&he.owner_password&&he.owner_name)try{se(!0),await _l.post("/resellers",he),qs.success("Reseller created successfully"),O(!1),xe({name:"",slug:"",owner_email:"",owner_password:"",owner_name:"",company_name:"",commission_rate:50}),fe()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to create reseller")}finally{se(!1)}else qs.error("Please fill all required fields")},disabled:te,children:te?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin mr-2",size:16}),"Creating..."]}):"Create Reseller"})]})]})}),(0,ea.jsx)(Ok,{open:U,onOpenChange:H,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{className:"flex items-center gap-3",children:Q&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center text-white font-bold text-xl",style:{backgroundColor:(null===(e=Q.branding)||void 0===e?void 0:e.primary_color)||"#4F46E5"},children:null===(s=Q.name)||void 0===s?void 0:s.charAt(0)}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("span",{children:Q.name}),Ce(Q.status)]})]})})}),Q&&(0,ea.jsxs)("div",{className:"space-y-6 py-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Customers"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:Q.customer_count})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Commission Rate"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:[null===(a=Q.plan)||void 0===a?void 0:a.commission_rate,"%"]})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Pending Payout"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:["$",(null===(n=Q.billing)||void 0===n||null===(l=n.pending_balance)||void 0===l?void 0:l.toFixed(2))||"0.00"]})]})})]}),Q.owner&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-700 mb-2",children:"Owner"}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-4 rounded-lg",children:[(0,ea.jsx)("p",{className:"font-medium",children:Q.owner.full_name}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:Q.owner.email})]})]}),(null===(r=Q.recent_customers)||void 0===r?void 0:r.length)>0&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-700 mb-2",children:"Recent
2Customers"}),(0,ea.jsx)("div",{className:"space-y-2",children:Q.recent_customers.map(e=>(0,ea.jsxs)("div",{className:"flex justify-between items-center p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:e.name}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[e.plan_level," plan"]})]}),(0,ea.jsx)(EC,{variant:"outline",children:e.subscription_status})]},e.tenant_id))})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-700 mb-2",children:"Branding"}),(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("div",{className:"w-6 h-6 rounded border",style:{backgroundColor:null===(i=Q.branding)||void 0===i?void 0:i.primary_color}}),(0,ea.jsx)("span",{className:"text-sm",children:"Primary"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("div",{className:"w-6 h-6 rounded border",style:{backgroundColor:null===(o=Q.branding)||void 0===o?void 0:o.secondary_color}}),(0,ea.jsx)("span",{className:"text-sm",children:"Secondary"})]}),(0,ea.jsxs)("div",{className:"text-sm text-slate-500",children:["Display: ",(null===(c=Q.branding)||void 0===c?void 0:c.company_name)||"Nexus CMS"]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>H(!1),children:"Close"}),(0,ea.jsxs)(sg,{onClick:()=>be(Q),children:[(0,ea.jsx)(ND,{size:16,className:"mr-2"}),"Edit Reseller"]})]})]})}),(0,ea.jsx)(Ok,{open:W,onOpenChange:V,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(ND,{className:"text-blue-600",size:20}),"Edit Reseller"]})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Reseller Name *"}),(0,ea.jsx)(BN,{placeholder:"Agency name",value:pe.name,onChange:e=>ge(d(d({},pe),{},{name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Base Commission Rate (%)"}),(0,ea.jsx)(BN,{type:"number",min:"0",max:"100",value:pe.commission_rate,disabled:!x,onChange:e=>ge(d(d({},pe),{},{commission_rate:parseFloat(e.target.value)||0})),"data-testid":"edit-commission-rate"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:["Reseller keeps ",pe.commission_rate||0,"%, platform keeps ",100-(pe.commission_rate||0),"%. Applies when no revenue tier matches."]})]}),(0,ea.jsxs)("div",{className:"border-t pt-4 mt-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,ea.jsx)(tf,{className:"font-medium",children:"Bonus Commission Tiers"}),!x&&(0,ea.jsx)("span",{className:"text-xs text-amber-600","data-testid":"tiers-readonly-badge",children:"Read-only (Master Admin edits)"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mb-3",children:"Reseller's share % increases with their monthly recurring revenue (MRR)."}),(0,ea.jsx)("div",{className:"space-y-2","data-testid":"edit-revenue-tiers",children:(pe.revenue_tiers||k0).map((e,t)=>(0,ea.jsxs)("div",{className:"grid grid-cols-12 gap-2 items-center",children:[(0,ea.jsx)("div",{className:"col-span-4",children:(0,ea.jsx)(BN,{type:"number",value:e.min,disabled:!x,onChange:e=>we(t,"min",e.target.value),className:"h-8 text-xs",placeholder:"Min $"})}),(0,ea.jsx)("div",{className:"col-span-4",children:(0,ea.jsx)(BN,{type:"number",value:-1===e.max?"":e.max,disabled:!x,onChange:e=>we(t,"max",e.target.value||-1),className:"h-8 text-xs",placeholder:"Max $ (\u221e)"})}),(0,ea.jsxs)("div",{className:"col-span-4 flex items-center gap-1",children:[(0,ea.jsx)(BN,{type:"number",value:e.percentage,disabled:!x,onChange:e=>we(t,"percentage",e.target.value),className:"h-8 text-xs"}),(0,ea.jsx)("span",{className:"text-xs text-slate-500",children:"%"})]})]},t))}),(0,ea.jsx)("p",{className:"text-[11px] text-slate-400 mt-2",children:"MRR $0\u20135k, $5k\u201320k, $20k+ map to each tier. Leave Max blank for the top (unlimited) tier."})]}),(0,ea.jsxs)("div",{className:"border-t pt-4 mt-4",children:[(0,ea.jsx)("h4",{className:"font-medium mb-3",children:"Branding Settings"}),(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Display Name"}),(0,ea.jsx)(BN,{placeholder:"Agency CMS",value:pe.branding.company_name,onChange:e=>ge(d(d({},pe),{},{branding:d(d({},pe.branding),{},{company_name:e.target.value})}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Shown to customers instead of Nexus CMS"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo URL"}),(0,ea.jsx)(BN,{placeholder:"https://example.com/logo.png",value:pe.branding.logo_url,onChange:e=>ge(d(d({},pe),{},{branding:d(d({},pe.branding),{},{logo_url:e.target.value})}))})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Primary Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:pe.branding.primary_color,onChange:e=>ge(d(d({},pe),{},{branding:d(d({},pe.branding),{},{primary_color:e.target.value})}))}),(0,ea.jsx)("input",{type:"color",value:pe.branding.primary_color,onChange:e=>ge(d(d({},pe),{},{branding:d(d({},pe.branding),{},{primary_color:e.target.value})})),className:"w-10 h-10 rounded border cursor-pointer"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Secondary Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:pe.branding.secondary_color,onChange:e=>ge(d(d({},pe),{},{branding:d(d({},pe.branding),{},{secondary_color:e.target.value})}))}),(0,ea.jsx)("input",{type:"color",value:pe.branding.secondary_color,onChange:e=>ge(d(d({},pe),{},{branding:d(d({},pe.branding),{},{secondary_color:e.target.value})})),className:"w-10 h-10 rounded border cursor-pointer"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Support Email"}),(0,ea.jsx)(BN,{type:"email",placeholder:"[email protected]",value:pe.branding.support_email,onChange:e=>ge(d(d({},pe),{},{branding:d(d({},pe.branding),{},{support_email:e.target.value})}))})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>V(!1),disabled:ae,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(Q){ne(!0);try{const e={name:pe.name,branding:pe.branding};x&&(e.commission_rate=pe.commission_rate,e.revenue_tiers=pe.revenue_tiers),await _l.put("/resellers/".concat(Q.reseller_id),e),qs.success("Reseller updated successfully"),V(!1),fe()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to update reseller")}finally{ne(!1)}}},disabled:ae||!pe.name.trim(),children:ae?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ea.jsx)(Ok,{open:q,onOpenChange:$,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(qN,{className:"text-indigo-600",size:24}),"Application Details"]})}),Z&&(0,ea.jsxs)("div",{className:"space-y-6 py-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h2",{className:"text-xl font-semibold",children:Z.company_name}),(0,ea.jsx)("p",{className:"text-slate-500",children:Z.contact_name})]}),Ce(Z.status)]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Email"}),(0,ea.jsx)("p",{className:"font-medium",children:Z.email})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Phone"}),(0,ea.jsx)("p",{className:"font-medium",children:Z.phone||"Not provided"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Website"}),(0,ea.jsx)("p",{className:"font-medium",children:Z.website||"Not provided"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Country"}),(0,ea.jsx)("p",{className:"font-medium",children:Z.country})]})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Expected Clients"}),(0,ea.jsx)("p",{className:"font-medium",children:Z.expected_clients})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Target Market"}),(0,ea.jsx)("p",{className:"font-medium",children:Z.target_market})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Experience"}),(0,ea.jsx)("p",{className:"font-medium",children:Z.experience||"Not provided"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Submitted"}),(0,ea.jsx)("p",{className:"font-medium",children:new Date(Z.submitted_at).toLocaleString()})]})]})]}),Z.why_partner&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-slate-500",children:"Why they want to partner"}),(0,ea.jsx)("p",{className:"mt-1 p-3 bg-slate-50 rounded-lg",children:Z.why_partner})]}),"rejected"===Z.status&&Z.rejection_reason&&(0,ea.jsxs)("div",{className:"bg-red-50 p-4 rounded-lg border border-red-200",children:[(0,ea.jsx)(tf,{className:"text-red-700",children:"Rejection Reason"}),(0,ea.jsx)("p",{className:"text-red-600",children:Z.rejection_reason})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>$(!1),children:"Close"}),"pending"===(null===Z||void 0===Z?void 0:Z.status)&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(sg,{variant:"outline",className:"text-red-600 border-red-200",onClick:()=>ye(Z),children:[(0,ea.jsx)(fJ,{size:16,className:"mr-2"}),"Reject"]}),(0,ea.jsxs)(sg,{className:"bg-green-600 hover:bg-green-700",onClick:()=>je(Z),children:[(0,ea.jsx)(cr,{size:16,className:"mr-2"}),"Approve"]})]})]})]})}),(0,ea.jsx)(Ok,{open:G,onOpenChange:K,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(cr,{className:"text-green-600",size:24}),"Approve Application"]}),(0,ea.jsxs)(Gk,{children:["Configure the revenue share and settings for ",null===Z||void 0===Z?void 0:Z.company_name]})]}),(0,ea.jsxs)("div",{className:"space-y-6 py-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-base font-semibold",children:"Revenue Share Tiers"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"Set tiered revenue share based on monthly revenue"}),(0,ea.jsx)("div",{className:"space-y-3",children:ce.revenue_tiers.map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"From ($)"}),(0,ea.jsx)(BN,{type:"number",value:e.min,onChange:e=>Ne(t,"min",e.target.value),className:"h-8"})]}),(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"To ($)"}),(0,ea.jsx)(BN,{type:"number",value:-1===e.max?"":e.max,placeholder:"Unlimited",onChange:e=>Ne(t,"max",e.target.value||-1),className:"h-8"})]}),(0,ea.jsxs)("div",{className:"w-24",children:[(0,ea.jsx)(tf,{className:"text-xs text-slate-500",children:"Share (%)"}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ea.jsx)(BN,{type:"number",min:"0",max:"100",value:e.percentage,onChange:e=>Ne(t,"percentage",e.target.value),className:"h-8"}),(0,ea.jsx)(C0,{size:14,className:"text-slate-400"})]})]})]},t))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2",children:"Higher tiers = higher revenue share for successful resellers"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Base Commission Rate (Legacy)"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ea.jsx)(BN,{type:"number",min:"0",max:"100",value:ce.commission_rate,onChange:e=>de(d(d({},ce),{},{commission_rate:parseInt(e.target.value)||0})),className:"w-24"}),(0,ea.jsx)("span",{className:"text-slate-500",children:"%"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Fallback rate if tier calculation fails"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Admin Notes (Internal)"}),(0,ea.jsx)(YN,{placeholder:"Notes about this reseller...",value:ce.admin_notes,onChange:e=>de(d(d({},ce),{},{admin_notes:e.target.value})),rows:3})]}),(0,ea.jsxs)("div",{className:"bg-green-50 p-4 rounded-lg border border-green-200",children:[(0,ea.jsx)("h4",{className:"font-medium text-green-800 mb-2",children:"What happens on approval:"}),(0,ea.jsxs)("ul",{className:"text-sm text-green-700 space-y-1",children:[(0,ea.jsx)("li",{children:"- A new reseller account will be created"}),(0,ea.jsx)("li",{children:"- The applicant will receive login credentials"}),(0,ea.jsx)("li",{children:"- They can start adding customers immediately"}),(0,ea.jsxs)("li",{children:["- Revenue share: ",null===(u=ce.revenue_tiers[0])||void 0===u?void 0:u.percentage,"% starting tier"]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>K(!1),disabled:le,children:"Cancel"}),(0,ea.jsx)(sg,{className:"bg-green-600 hover:bg-green-700",onClick:async()=>
2{if(Z){re(!0);try{const e=(await _l.post("/resellers/applications/".concat(Z.application_id,"/approve"),ce)).data;e.temp_password?qs.success("Approved! Temp login: ".concat(Z.email," / ").concat(e.temp_password),{duration:15e3}):qs.success("Application approved! ".concat(Z.company_name," is now a reseller.")),K(!1),ve()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to approve application")}finally{re(!1)}}},disabled:le,children:le?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin mr-2",size:16}),"Approving..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(cr,{size:16,className:"mr-2"}),"Approve Application"]})})]})]})}),(0,ea.jsx)(Ok,{open:Y,onOpenChange:J,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(fJ,{className:"text-red-600",size:24}),"Reject Application"]}),(0,ea.jsxs)(Gk,{children:["Provide a reason for rejecting ",null===Z||void 0===Z?void 0:Z.company_name,"'s application"]})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Rejection Reason"}),(0,ea.jsx)(YN,{placeholder:"Enter the reason for rejection...",value:ue,onChange:e=>me(e.target.value),rows:4}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"This will be sent to the applicant"})]}),(0,ea.jsx)("div",{className:"bg-amber-50 p-4 rounded-lg border border-amber-200",children:(0,ea.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ea.jsx)(WN,{className:"text-amber-600 mt-0.5",size:16}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h4",{className:"font-medium text-amber-800",children:"This action cannot be undone"}),(0,ea.jsx)("p",{className:"text-sm text-amber-700",children:"The applicant will be notified of the rejection."})]})]})})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>J(!1),disabled:ie,children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:async()=>{if(Z){oe(!0);try{await _l.post("/resellers/applications/".concat(Z.application_id,"/reject"),{reason:ue||"Application did not meet our requirements"}),qs.success("Application rejected"),J(!1),ve()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to reject application")}finally{oe(!1)}}},disabled:ie,children:ie?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin mr-2",size:16}),"Rejecting..."]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(fJ,{size:16,className:"mr-2"}),"Reject Application"]})})]})]})})]})]})},_0=e=>{let{open:s,onClose:a,customer:n}=e;const[l,r]=(0,t.useState)(!1),[i,o]=(0,t.useState)(!1),[c,u]=(0,t.useState)(!1),[m,h]=(0,t.useState)(null),[x,p]=(0,t.useState)(!1),[g,f]=(0,t.useState)({plan_name:"Pro",amount:"",billing_period:"monthly"});t.useEffect(()=>{var e;s&&n&&(h(null),p(!1),u(!1),f({plan_name:"Pro",amount:(null===(e=n.reseller_settings)||void 0===e?void 0:e.custom_price)||"",billing_period:"monthly"}))},[s,n]);return(0,ea.jsx)(Ok,{open:s,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Aj,{className:"text-indigo-600",size:24}),"Create Checkout"]}),(0,ea.jsxs)(Gk,{children:["Generate a Stripe payment link for ",(0,ea.jsx)("strong",{children:null===n||void 0===n?void 0:n.name})]})]}),m?(0,ea.jsxs)("div",{className:"py-4 space-y-4",children:[(0,ea.jsxs)("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ea.jsx)(Xl,{className:"text-green-600",size:20}),(0,ea.jsx)("p",{className:"font-medium text-green-800",children:"Checkout Link Ready"})]}),(0,ea.jsx)("p",{className:"text-sm text-green-700 mb-3",children:"Send this link to your customer. They'll see your brand name on their bank statement."}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{"data-testid":"checkout-url-input",readOnly:!0,value:m.checkout_url,className:"text-xs bg-white"}),(0,ea.jsx)(sg,{variant:"outline",size:"icon",onClick:()=>{null!==m&&void 0!==m&&m.checkout_url&&(navigator.clipboard.writeText(m.checkout_url),p(!0),qs.success("Link copied!"),setTimeout(()=>p(!1),2e3))},"data-testid":"checkout-copy-btn",children:x?(0,ea.jsx)(Xl,{size:16}):(0,ea.jsx)(DD,{size:16})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsx)(sg,{"data-testid":"checkout-send-email-btn",variant:c?"outline":"default",onClick:async()=>{o(!0);
2try{await _l.post("/reseller/customers/".concat(n.tenant_id,"/send-checkout-email"),{checkout_url:m.checkout_url,plan_name:g.plan_name,amount:parseFloat(g.amount),billing_period:g.billing_period}),u(!0),qs.success("Invoice email sent to customer!")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to send email")}finally{o(!1)}},disabled:i||c,className:c?"border-green-300 text-green-700":"",children:i?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin mr-2",size:16}),"Sending..."]}):c?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Xl,{size:16,className:"mr-2"}),"Email Sent"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Yl,{size:16,className:"mr-2"}),"Send via Email"]})}),(0,ea.jsxs)(sg,{"data-testid":"checkout-open-btn",variant:"outline",onClick:()=>window.open(m.checkout_url,"_blank"),children:[(0,ea.jsx)(bj,{size:16,className:"mr-2"}),"Open Checkout"]})]}),(0,ea.jsx)("div",{className:"flex justify-end",children:(0,ea.jsx)(sg,{variant:"ghost",onClick:a,children:"Done"})})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Plan Name"}),(0,ea.jsxs)(eb,{value:g.plan_name,onValueChange:e=>f(d(d({},g),{},{plan_name:e})),children:[(0,ea.jsx)(sb,{"data-testid":"checkout-plan-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"Starter",children:"Starter"}),(0,ea.jsx)(rb,{value:"Pro",children:"Pro"}),(0,ea.jsx)(rb,{value:"Enterprise",children:"Enterprise"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Amount (USD)"}),(0,ea.jsx)(BN,{"data-testid":"checkout-amount-input",type:"number",placeholder:"99.00",value:g.amount,onChange:e=>f(d(d({},g),{},{amount:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Billing Period"}),(0,ea.jsxs)(eb,{value:g.billing_period,onValueChange:e=>f(d(d({},g),{},{billing_period:e})),children:[(0,ea.jsx)(sb,{"data-testid":"checkout-period-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"monthly",children:"Monthly"}),(0,ea.jsx)(rb,{value:"yearly",children:"Yearly"})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:a,children:"Cancel"}),(0,ea.jsx)(sg,{"data-testid":"checkout-submit-btn",onClick:async()=>{if(!g.amount||parseFloat(g.amount)<=0)qs.error("Please enter a valid amount");else{r(!0);try{const e=await _l.post("/reseller/customers/".concat(n.tenant_id,"/checkout"),{plan_name:g.plan_name,amount:parseFloat(g.amount),billing_period:g.billing_period});h(e.data),qs.success("Checkout link created!")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to create checkout")}finally{r(!1)}}},disabled:l,children:l?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin mr-2",size:16}),"Creating..."]}):"Generate Checkout Link"})]})]})]})})},S0=e=>{let{open:s,onClose:a,currentBranding:n,onSaved:l}=e;const[r,i]=(0,t.useState)(!1),[o,c]=(0,t.useState)({company_name:"",logo_url:"",favicon_url:"",primary_color:"#4F46E5",secondary_color:"#7C3AED",support_email:"",custom_domain:""});t.useEffect(()=>{s&&n&&c({company_name:n.company_name||"",logo_url:n.logo_url||"",favicon_url:n.favicon_url||"",primary_color:n.primary_color||"#4F46E5",secondary_color:n.secondary_color||"#7C3AED",support_email:n.support_email||"",custom_domain:n.custom_domain||""})},[s,n]);return(0,ea.jsx)(Ok,{open:s,onOpenChange:a,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(Dw,{className:"text-indigo-600",size:24}),"Customize Branding"]}),(0,ea.jsx)(Gk,{children:"Customize how your portal appears to your customers"})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Company Name *"}),(0,ea.jsx)(BN,{placeholder:"Your Agency CMS",value:o.company_name,onChange:e=>c(d(d({},o),{},{company_name:e.target.value}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Shown in the header and login page"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Logo URL"}),(0,ea.jsx)(BN,{placeholder:"https://example.com/logo.png",value:o.logo_url,onChange:e=>c(d(d({},o),{},{logo_url:e.target.value}))}),o.logo_url&&(0,ea.jsx)("div",{className:"mt-2 p-2 bg-slate-100 rounded",children:(0,ea.jsx)("img",{src:o.logo_url,alt:"Logo preview",className:"h-8 object-contain"})})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Favicon URL"}),(0,ea.jsx)(BN,{placeholder:"https://example.com/favicon.ico",value:o.favicon_url,onChange:e=>c(d(d({},o),{},{favicon_url:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Primary Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:o.primary_color,onChange:e=>c(d(d({},o),{},{primary_color:e.target.value}))}),(0,ea.jsx)("input",{type:"color",value:o.primary_color,onChange:e=>c(d(d({},o),{},{primary_color:e.target.value})),className:"w-10 h-10 rounded border cursor-pointer"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Secondary Color"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:o.secondary_color,onChange:e=>c(d(d({},o),{},{secondary_color:e.target.value}))}),(0,ea.jsx)("input",{type:"color",value:o.secondary_color,onChange:e=>c(d(d({},o),{},{secondary_color:e.target.value})),className:"w-10 h-10 rounded border cursor-pointer"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Support Email"}),(0,ea.jsx)(BN,{type:"email",placeholder:"[email protected]",value:o.support_email,onChange:e=>c(d(d({},o),{},{support_email:e.target.value}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Shown on login page for customer support"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Custom Domain (optional)"}),(0,ea.jsx)(BN,{placeholder:"cms.youragency.com",value:o.custom_domain,onChange:e=>c(d(d({},o),{},{custom_domain:e.target.value}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Contact support to set up DNS for custom domains"})]}),(0,ea.jsxs)("div",{className:"mt-4 p-4 bg-slate-900 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 mb-2",children:"Preview"}),(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[o.logo_url?(0,ea.jsx)("img",{src:o.logo_url,alt:"Logo",className:"h-6 object-contain"}):(0,ea.jsx)("span",{className:"text-white font-bold",style:{color:o.primary_color},children:o.company_name||"Your Brand"}),(0,ea.jsxs)("div",{className:"flex gap-1 ml-auto",children:[(0,ea.jsx)("div",{className:"w-4 h-4 rounded",style:{backgroundColor:o.primary_color}}),(0,ea.jsx)("div",{className:"w-4 h-4 rounded",style:{backgroundColor:o.secondary_color}})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:a,disabled:r,children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{i(!0);try{const e=await _l.put("/reseller/branding",o);qs.success("Branding updated successfully!"),null===l||void 0===l||l(e.data.branding),a()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to update branding")}finally{i(!1)}},disabled:r||!o.company_name,children:r?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Branding"})]})]})})},E0=()=>
2{var e,s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N,w,C,k,D,_,S,E;const[A,F]=_t(),T=A.get("tab"),z="billing"===T?"billing":"customers"===T?"customers":"overview",[M,P]=(0,t.useState)(null),[B,R]=(0,t.useState)([]),[L,I]=(0,t.useState)(!0),[O,U]=(0,t.useState)(!1),[H,W]=(0,t.useState)(1),[V,q]=(0,t.useState)(1),[$,G]=(0,t.useState)(""),[K,Y]=(0,t.useState)(null),[J,Q]=(0,t.useState)(50),[X,Z]=(0,t.useState)(""),[ee,te]=(0,t.useState)(!1),[se,ae]=(0,t.useState)(!1),[ne,le]=(0,t.useState)(!1),[re,ie]=(0,t.useState)(!1),[oe,ce]=(0,t.useState)(!1),[de,ue]=(0,t.useState)(null),[me,he]=(0,t.useState)(null),[xe,pe]=(0,t.useState)(!1),[ge,fe]=(0,t.useState)({company_name:"",admin_email:"",admin_password:"",admin_name:"",plan_level:"starter",custom_price:"",notes:""}),ve=(0,t.useCallback)(async()=>{try{const e=await _l.get("/reseller/dashboard");P(e.data)}catch(e){qs.error("Failed to load dashboard")}},[]),be=(0,t.useCallback)(async()=>{try{const e=await _l.get("/reseller/email-domain");Y(e.data.email_domain),Q(e.data.threshold||50)}catch(e){}},[]),je=(0,t.useCallback)(async()=>{try{U(!0);const e=new URLSearchParams({page:H,per_page:10});$&&e.append("search",$);const t=await _l.get("/reseller/customers?".concat(e));R(t.data.customers),q(t.data.total_pages)}catch(e){qs.error("Failed to load customers")}finally{U(!1)}},[H,$]);(0,t.useEffect)(()=>{(async()=>{I(!0),await ve(),await je(),be(),I(!1)})()},[ve,je,be]);const ye=async e=>{try{const t=await _l.post("/reseller/customers/".concat(e,"/impersonate"));localStorage.setItem("impersonation_token",t.data.access_token),localStorage.setItem("original_token",localStorage.getItem("token")),localStorage.setItem("token",t.data.access_token),qs.success("Now impersonating ".concat(t.data.user.email)),window.location.href="/pages"}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to impersonate customer")}},Ne=e=>{switch(e){case"active":return(0,ea.jsx)(EC,{className:"bg-green-100 text-green-700",children:"Active"});case"trial":return(0,ea.jsx)(EC,{className:"bg-blue-100 text-blue-700",children:"Trial"});case"cancelled":return(0,ea.jsx)(EC,{className:"bg-red-100 text-red-700",children:"Cancelled"});default:return(0,ea.jsx)(EC,{variant:"outline",children:e})}};return L?(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,ea.jsx)(ql,{className:"animate-spin text-slate-400",size:48})})]}):(0,ea.jsxs)("div",{className:"flex min-h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0 p-8",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[null!==M&&void 0!==M&&null!==(e=M.reseller)&&void 0!==e&&null!==(s=e.branding)&&void 0!==s&&s.logo_url?(0,ea.jsx)("img",{src:M.reseller.branding.logo_url,alt:"Logo",className:"h-10"}):(0,ea.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold",style:{backgroundColor:(null===M||void 0===M||null===(a=M.reseller)||void 0===a||null===(n=a.branding)||void 0===n?void 0:n.primary_color)||"#4F46E5"},children:(null===M||void 0===M||null===(l=M.reseller)||void 0===l||null===(r=l.name)||void 0===r?void 0:r.charAt(0))||"R"}),(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900",style:{fontFamily:"Manrope, sans-serif"},children:(null===M||void 0===M||null===(i=M.reseller)||void 0===i||null===(o=i.branding)||void 0===o?void 0:o.company_name)||(null===M||void 0===M||null===(c=M.reseller)||void 0===c?void 0:c.name)||"Reseller Dashboard"})]}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Manage your customers and track your earnings"})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>ie(!0),children:[(0,ea.jsx)(Dw,{size:18,className:"mr-2"}),"Branding"]}),(0,ea.jsxs)(sg,{onClick:()=>ae(!0),children:[(0,ea.jsx)(Vj,{size:18,className:"mr-2"}),"Add Customer"]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(Bj,{className:"text-indigo-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Customers"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold text-slate-900",children:[(null===M||void 0===M||null===(u=M.stats)||void 0===u?void 0:u.customer_count)||0,(0,ea.jsxs)("span",{className:"text-sm font-normal text-slate-400",children:["/",(null===M||void 0===M||null===(m=M.stats)||void 0===m?void 0:m.max_customers)||50]})]})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(GN,{className:"text-green-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Active"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:(null===M||void 0===M||null===(h=M.stats)||void 0===h?void 0:h.active_customers)||0})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-amber-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(bw,{className:"text-amber-600",
2size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Pending Payout"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold text-slate-900",children:["$",(null===M||void 0===M||null===(x=M.stats)||void 0===x||null===(p=x.pending_payout)||void 0===p?void 0:p.toFixed(2))||"0.00"]})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,ea.jsx)(bw,{className:"text-purple-600",size:24})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Total Earned"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold text-slate-900",children:["$",(null===M||void 0===M||null===(g=M.stats)||void 0===g||null===(f=g.total_earned)||void 0===f?void 0:f.toFixed(2))||"0.00"]})]})]})})})]}),(0,ea.jsxs)(nJ,{value:z,onValueChange:e=>F("overview"===e?{}:{tab:e}),children:[(0,ea.jsxs)(lJ,{children:[(0,ea.jsx)(rJ,{value:"overview","data-testid":"reseller-tab-overview",children:"Overview"}),(0,ea.jsx)(rJ,{value:"customers","data-testid":"reseller-tab-customers",children:"Customers"}),(0,ea.jsx)(rJ,{value:"billing","data-testid":"reseller-tab-billing",children:"Billing & Earnings"})]}),(0,ea.jsxs)(iJ,{value:"overview",className:"mt-6 space-y-6","data-testid":"reseller-overview",children:[(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsx)(oD,{className:"text-lg",children:"Your Commission"})}),(0,ea.jsxs)(dD,{children:[(0,ea.jsxs)("div",{className:"flex flex-wrap gap-6 mb-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Current rate (based on your MRR)"}),(0,ea.jsxs)("p",{className:"text-3xl font-bold text-slate-900","data-testid":"overview-effective-rate",children:[null!==(v=null!==(b=null===M||void 0===M||null===(j=M.stats)||void 0===j?void 0:j.effective_commission_rate)&&void 0!==b?b:null===M||void 0===M?void 0:M.base_commission_rate)&&void 0!==v?v:50,"%"]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Your MRR"}),(0,ea.jsxs)("p",{className:"text-3xl font-bold text-slate-900","data-testid":"overview-mrr",children:["$",((null===M||void 0===M||null===(y=M.stats)||void 0===y?void 0:y.mrr)||0).toFixed(2)]})]})]}),(0,ea.jsx)("p",{className:"text-xs font-medium text-slate-600 mb-2",children:"Bonus tiers (your share grows with monthly recurring revenue)"}),(0,ea.jsx)("div",{className:"space-y-1","data-testid":"overview-tiers",children:((null===M||void 0===M?void 0:M.revenue_tiers)||[]).map((e,t)=>{var s;const a=(null===M||void 0===M||null===(s=M.stats)||void 0===s?void 0:s.effective_commission_rate)===e.percentage;return(0,ea.jsxs)("div",{className:"flex items-center justify-between text-sm px-3 py-2 rounded-md ".concat(a?"bg-indigo-50 border border-indigo-200":"bg-slate-50"),children:[(0,ea.jsxs)("span",{className:"text-slate-700",children:["$",e.min.toLocaleString()," \u2013 ",-1===e.max?"\u221e":"$"+e.max.toLocaleString()," MRR"]}),(0,ea.jsxs)("span",{className:"font-semibold text-slate-900",children:[e.percentage,"%",a&&(0,ea.jsx)("span",{className:"ml-2 text-xs text-indigo-600",children:"\u25cf current"})]})]},t)})})]})]}),(0,ea.jsxs)(rD,{"data-testid":"reseller-sending-domain",children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)(oD,{className:"text-lg flex items-center gap-2",children:["Sending Domain",null!==K&&void 0!==K&&K.verified?(0,ea.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-green-100 text-green-700 font-medium","data-testid":"domain-verified-badge",children:"Verified"}):K?(0,ea.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-100 text-amber-700 font-medium","data-testid":"domain-pending-badge",children:"Pending DNS"}):(0,ea.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-slate-100 text-slate-600 font-medium",children:"Not set up"})]})}),(0,ea.jsxs)(dD,{children:[(0,ea.jsxs)("p",{className:"text-xs text-slate-500 mb-3",children:["Newsletters send from your own domain once verified. Campaigns to more than ",J," recipients require a verified sending domain."]}),!K&&(0,ea.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,ea.jsx)("input",{type:"text",value:X,onChange:e=>Z(e.target.value),placeholder:"theagency.com",className:"flex-1 text-sm px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent","data-testid":"sending-domain-in
2put"}),(0,ea.jsx)("button",{onClick:async()=>{const e=X.trim().toLowerCase();if(e&&e.includes(".")){te(!0);try{const t=await _l.post("/reseller/email-domain",{domain:e,subdomain:"mail"});Y(t.data.email_domain),qs.success("Sending domain created \u2014 add the DNS records, then verify")}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to set up sending domain")}finally{te(!1)}}else qs.error("Enter a valid domain, e.g. theagency.com")},disabled:ee,className:"px-4 py-2 text-sm font-medium rounded-lg bg-indigo-600 text-white disabled:opacity-40 hover:bg-indigo-700 transition-colors","data-testid":"setup-domain-btn",children:ee?"Setting up\u2026":"Set up domain"})]}),K&&(0,ea.jsxs)("div",{className:"space-y-3",children:[(0,ea.jsxs)("p",{className:"text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Domain:"})," ",(0,ea.jsxs)("span",{className:"font-medium",children:[K.subdomain,".",K.domain]})]}),!K.verified&&(K.records||[]).length>0&&(0,ea.jsxs)("div",{className:"border border-slate-200 rounded-lg overflow-hidden","data-testid":"domain-dns-records",children:[(0,ea.jsx)("div",{className:"bg-slate-50 px-3 py-2 text-xs font-medium text-slate-600",children:"Add these DNS records at your domain registrar"}),(0,ea.jsx)("div",{className:"divide-y text-xs",children:(K.records||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"px-3 py-2 grid grid-cols-12 gap-2 items-center",children:[(0,ea.jsx)("span",{className:"col-span-2 font-mono text-slate-500",children:e.type}),(0,ea.jsx)("span",{className:"col-span-4 font-mono break-all",children:e.host}),(0,ea.jsx)("span",{className:"col-span-5 font-mono break-all text-slate-600",children:e.data}),(0,ea.jsx)("span",{className:"col-span-1 text-right",children:e.valid?"\u2705":"\u23f3"})]},t))})]}),!K.verified&&(0,ea.jsx)("button",{onClick:async()=>{te(!0);try{const e=await _l.post("/reseller/email-domain/verify");Y(e.data.email_domain),qs[e.data.verified?"success":"error"](e.data.verified?"Sending domain verified!":"DNS records not found yet \u2014 allow time for propagation and retry")}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Verification failed")}finally{te(!1)}},disabled:ee,className:"px-4 py-2 text-sm font-medium rounded-lg bg-green-600 text-white disabled:opacity-40 hover:bg-green-700 transition-colors","data-testid":"verify-domain-btn",children:ee?"Checking\u2026":"I've added the records \u2014 Verify"}),K.verified&&(0,ea.jsxs)("p",{className:"text-sm text-green-700",children:["Your domain is verified. Newsletters now send from ",K.subdomain,".",K.domain," and large campaigns are unlocked."]})]})]})]}),(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{className:"flex flex-row items-center justify-between",children:[(0,ea.jsx)(oD,{className:"text-lg",children:"Recent Customers"}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>F({tab:"customers"}),"data-testid":"overview-view-all-customers",children:"View all"})]}),(0,ea.jsx)(dD,{children:0===((null===M||void 0===M?void 0:M.recent_customers)||[]).length?(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"No customers yet. Add your first customer from the Customers tab."}):(0,ea.jsx)("div",{className:"divide-y",children:((null===M||void 0===M?void 0:M.recent_customers)||[]).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-900",children:e.name||e.tenant_id}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:e.subdomain?"".concat(e.subdomain):""})]}),Ne(e.subscription_status)]},t))})})]})]}),(0,ea.jsxs)(iJ,{value:"customers",className:"mt-6",children:[(0,ea.jsx)("div",{className:"flex gap-4 mb-6",children:(0,ea.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400",size:18}),(0,ea.jsx)(BN,{placeholder:"Search customers...",value:$,onChange:e=>G(e.target.value),className:"pl-10"})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"p-0",children:O?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"animate-spin text-slate-400",size:32})}):0===B.length?(0,ea.jsxs)("div",{className:"text-center py-12",children:[(0,ea.jsx)(Bj,{className:"mx-auto text-slate-300 mb-4",size:48}),(0,ea.jsx)("h3",{className:"text-lg font-medium text-slate-600",children:"No customers yet"}),(0,ea.jsx)("p",{className:"text-slate-400 mt-1",children:"Create your first customer to get started"}),(0,ea.jsxs)(sg,{onClick:()=>ae(!0),className:"mt-4 gap-2",children:[(0,ea.jsx)(Vj,{size:18}),"Add Customer"]})]}):(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50 border-b",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Customer"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Plan"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Price"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Users"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Created"}),(0,ea.jsx)("th",{className:"text-right py-3 px-4 font-medium text-slate-600",children:"Actions"})]})}),(0,ea.jsx)("tbody",{className:"divide-y",children:B.map(e=>{var t,s;return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"py-4 px-4",children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-900",children:e.name}),(null===(t=e.reseller_settings)||void 0===t?void 0:t.notes)&&(0,ea.jsx)("p",{className:"text-sm text-slate-400",children:e.reseller_settings.notes})]})}),(0,ea.jsx)("td",{className:"py-4 px-4",children:Ne(e.subscription_status)}),(0,ea.jsx)("td",{className:"py-4 px-4",children:(0,ea.jsx)(EC,{variant:"outline",className:"capitalize",children:e.plan_level})}),(0,ea.jsx)("td",{className:"py-4 px-4",children:null!==(s=e.reseller_settings)&&void 0!==s&&s.custom_price?"$".concat(e.reseller_settings.custom_price,"/mo"):"-"}),(0,ea.jsx)("td",{className:"py-4 px-4",children:e.user_count||0}),(0,ea.jsx)("td",{className:"py-4 px-4 text-slate-500",children:new Date(e.created_at).toLocaleDateString()}),(0,ea.jsx)("td",{className:"py-4 px-4 text-right",children:(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",children:(0,ea.jsx)(KJ,{size:16})})}),(0,ea.jsxs)(Bp,{align:"end",children:[(0,ea.jsxs)(Rp,{onClick:()=>(async e=>
2{try{const t=await _l.get("/reseller/customers/".concat(e.tenant_id));ue(t.data),le(!0)}catch(t){qs.error("Failed to load customer details")}})(e),children:[(0,ea.jsx)(IN,{size:16,className:"mr-2"}),"View Details"]}),(0,ea.jsxs)(Rp,{onClick:()=>{he(e),ce(!0)},children:[(0,ea.jsx)(Aj,{size:16,className:"mr-2"}),"Create Checkout"]}),(0,ea.jsxs)(Rp,{onClick:()=>ye(e.tenant_id),children:[(0,ea.jsx)(QJ,{size:16,className:"mr-2"}),"Impersonate Customer"]}),(0,ea.jsxs)(Rp,{children:[(0,ea.jsx)(ND,{size:16,className:"mr-2"}),"Edit"]})]})]})})]},e.tenant_id)})})]})})}),V>1&&(0,ea.jsxs)("div",{className:"flex justify-between items-center mt-4",children:[(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:["Page ",H," of ",V]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>W(e=>Math.max(1,e-1)),disabled:1===H,children:(0,ea.jsx)(vj,{size:16})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>W(e=>Math.min(V,e+1)),disabled:H===V,children:(0,ea.jsx)(ax,{size:16})})]})]})]}),(0,ea.jsx)(iJ,{value:"billing",className:"mt-6",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)(oD,{children:"Earnings & Commissions"}),(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>window.location.href="/reseller/billing",children:["View Full Billing",(0,ea.jsx)(bj,{size:14,className:"ml-2"})]})]})}),(0,ea.jsxs)(dD,{children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Your Commission Rate"}),(0,ea.jsxs)("p",{className:"text-3xl font-bold text-green-600",children:[(null===M||void 0===M||null===(N=M.stats)||void 0===N?void 0:N.commission_rate)||40,"-60%"]}),(0,ea.jsx)("p",{className:"text-sm text-slate-400 mt-1",children:"Tiered based on total revenue"})]}),(0,ea.jsxs)("div",{className:"p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Pending Payout"}),(0,ea.jsxs)("p",{className:"text-3xl font-bold text-amber-600",children:["$",(null===M||void 0===M||null===(w=M.stats)||void 0===w||null===(C=w.pending_payout)||void 0===C?void 0:C.toFixed(2))||"0.00"]}),(0,ea.jsx)("p",{className:"text-sm text-slate-400 mt-1",children:(0,ea.jsx)("a",{href:"/reseller/billing",className:"text-indigo-600 hover:underline",children:"Request payout \u2192"})})]})]}),(!(null!==M&&void 0!==M&&null!==(k=M.stats)&&void 0!==k&&k.total_earned)||0===(null===M||void 0===M||null===(D=M.stats)||void 0===D?void 0:D.total_earned))&&(0,ea.jsxs)(lQ,{className:"mt-6",children:[(0,ea.jsx)(WN,{className:"h-4 w-4"}),(0,ea.jsx)(rQ,{children:'No earnings yet. Use "Create Checkout" from the customer menu to generate payment links for your customers.'})]})]})]})})]}),(0,ea.jsx)(Ok,{open:se,onOpenChange:ae,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(GJ,{className:"text-indigo-600",size:24}),"Add New Customer"]}),(0,ea.jsx)(Gk,{children:"Create a new customer account. They will receive their login credentials."})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Company Name *"}),(0,ea.jsx)(BN,{placeholder:"Acme Corporation",value:ge.company_name,onChange:e=>fe(d(d({},ge),{},{company_name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"border-t pt-4",children:[(0,ea.jsx)("p",{className:"font-medium text-slate-700 mb-3",children:"Admin Account"}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Admin Name *"}),(0,ea.jsx)(BN,{placeholder:"Jane Smith",value:ge.admin_name,onChange:e=>fe(d(d({},ge),{},{admin_name:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Admin Email *"}),(0,ea.jsx)(BN,{type:"email",placeholder:"[email protected]",value:ge.admin_email,onChange:e=>fe(d(d({},ge),{},{admin_email:e.target.value}))})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Password *"}),(0,ea.jsx)(BN,{type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:ge.admin_password,onChange:e=>fe(d(d({},ge),{},{admin_password:e.target.value}))})]})]})]}),(0,ea.jsxs)("div",{className:"border-t pt-4 grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Plan Level"}),(0,ea.jsxs)(eb,{value:ge.plan_level,onValueChange:e=>fe(d(d({},ge),{},{plan_level:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"starter",children:"Starter"}),(0,ea.jsx)(rb,{value:"pro",children:"Pro"}),(0,ea.jsx)(rb,{value:"enterprise",children:"Enterprise"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Custom Price ($/mo)"}),(0,ea.jsx)(BN,{type:"number",placeholder:"99.00",value:ge.custom_price,onChange:e=>fe(d(d({},ge),{},{custom_price:e.target.value}))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Internal Notes"}),(0,ea.jsx)(BN,{placeholder:"VIP customer, special support...",value:ge.notes,onChange:e=>fe(d(d({},ge),{},{notes:e.target.value}))})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>ae(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(ge.company_name&&ge.admin_email&&ge.admin_password&&ge.admin_name)try{pe(!0);const e=d(d({},ge),{},{custom_price:ge.custom_price?parseFloat(ge.custom_price):null});await _l.post("/reseller/customers",e),qs.success("Customer created successfully"),ae(!1),fe({company_name:"",admin_email:"",admin_password:"",admin_name:"",plan_level:"starter",custom_price:"",notes:""}),ve(),je()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to create customer")}finally{pe(!1)}else qs.error("Please fill all required fields")},disabled:xe,children:xe?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{className:"animate-spin mr-2",size:16}),"Creating..."]}):"Create Customer"})]})]})}),(0,ea.jsx)(Ok,{open:ne,onOpenChange:le,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:null===de||void 0===de?void 0:de.name})}),de&&(0,ea.jsxs)("div",{className:"space-y-6 py-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Pages"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:de.page_count||0})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Users"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:(null===(_=de.users)||void 0===_?void 0:_.length)||0})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Newsletters"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:de.newsletter_count||0})]})})]}),(null===(S=de.users)||void 0===S?void 0:S.length)>0&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-700 mb-2",children:"Team Members"}),(0,ea.jsx)("div",{className:"space-y-2",children:de.users.map(e=>(0,ea.jsxs)("div",{className:"flex justify-between items-center p-3 bg-slate-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:e.full_name}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:e.email})]}),(0,ea.jsx)(EC,{variant:"outline",className:"capitalize",children:e.role})]},e.user_id))})]}),de.reseller_settings&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-700 mb-2",children:"Your Settings"}),(0,ea.jsxs)("div",{className:"bg-slate-50 p-4 rounded-lg space-y-2",children:[de.reseller_settings.custom_price&&(0,ea.jsxs)("p",{className:"text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Custom Price:"})," ",(0,ea.jsxs)("span",{className:"font-medium",children:["$",de.reseller_settings.custom_price,"/mo"]})]}),de.reseller_settings.notes&&(0,ea.jsxs)("p",{className:"text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Notes:"})," ",de.reseller_settings.notes]}),(0,ea.jsxs)("p",{className:"text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-500",children:"Acquired:"})," ",new Date(de.reseller_settings.acquired_date).toLocaleDateString()]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>le(!1),children:"Close"}),(0,ea.jsxs)(sg,{onClick:()=>de&&ye(de.tenant_id),children:[(0,ea.jsx)(QJ,{size:16,className:"mr-2"}),"Impersonate Customer"]})]})]})}),(0,ea.jsx)(_0,{open:oe,onClose:()=>{ce(!1),he(null)},customer:me}),(0,ea.jsx)(S0,{open:re,onClose:()=>ie(!1),currentBranding:(null===M||void 0===M||null===(E=M.reseller)||void 0===E?void 0:E.branding)||{},onSaved:e=>{P(d(d({},M),{},{reseller:d(d({},M.reseller),{},{branding:e})}))}})]})]})},A0=()=>{var e,s,a,n;const[l,r]=(0,t.useState)(null),[i,o]=(0,t.useState)([]),[c,u]=(0,t.useState)([]),[m,h]=(0,t.useState)(!0),[x,p]=(0,t.useState)(!1),[g,f]=(0,t.useState)(!1),[v,b]=(0,t.useState)({amount:"",payout_method:"bank_transfer",notes:""}),[j,y]=(0,t.useState)({billing_email:"",payout_method:"bank_transfer",payout_details:{bank_name:"",account_number:"",routing_number:"",account_holder:""},tax_id:"",business_address:""}),[N,w]=(0,t.useState)({page:1,totalPages:1});(0,t.useEffect)(()=>{C(),k(),D()},[]);const C=async()=>{try{const e=await _l.get("/reseller/billing");r(e.data),e.data.billing_settings&&y(t=>d(d({},t),e.data.billing_settings))}catch(e){console.error("Failed to fetch billing data:",e),qs.error("Failed to load billing data")}finally{h(!1)}},k=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;try{const t=await _l.get("/reseller/commissions?page=".concat(e,"&per_page=10"));o(t.data.commissions),w({page:t.data.page,totalPages:t.data.total_pages})}catch(t){console.error("Failed to fetch commissions:",t)}},D=async()=>{try{const e=await _l.get("/reseller/payouts");u(e.data.payouts)}catch(e){console.error("Failed to fetch payouts:",e)}},_=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e||0),S=e=>e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-",E=e=>(0,ea.jsx)(EC,{className:{pending:"bg-yellow-100 text-yellow-800",processing:"bg-blue-100 text-blue-800",paid:"bg-green-100 text-green-800",completed:"bg-green-100 text-green-800",failed:"bg-red-100 text-red-800"}[e]||"bg-slate-100 text-slate-800",children:(null===e||void 0===e?void 0:e.charAt(0).toUpperCase())+(null===e||void 0===e?void 0:e.slice(1))});if(m)return(0,ea.jsxs)("div",{className:"flex h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"})})]});const A=(null===l||void 0===l?void 0:l.stats)||{};return(0,ea.jsxs)("div",{className:"flex h-screen bg-slate-50",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 overflow-auto",children:(0,ea.jsxs)("div",{className:"p-8",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Billing & Earnings"}),(0,ea.jsx)("p",{className:"text-slate-600",children:"Track your commissions, earnings, and payouts"})]}),(0,ea.jsxs)("div",{className:"flex gap-3",children:[(0,ea.jsxs)(sg,{variant:"outline",onClick:()=>f(!0),children:[(0,ea.jsx)(Aj,{size:16,className:"mr-2"}),"Billing Settings"]}),(0,ea.jsxs)(sg,{onClick:()=>p(!0),disabled:A.pending_earnings<=0,children:[(0,ea.jsx)(bw,{size:16,className:"mr-2"}),"Request Payout"]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:[(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-600",children:"Total Earnings"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:_(A.total_earnings)})]}),(0,ea.jsx)("div",{className:"p-3 bg-green-100 rounded-full",children:(0,ea.jsx)(bw,{className:"text-green-600",size:24})})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2",children:"All time earnings"})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-600",children:"Pending Earnings"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-yellow-600",children:_(A.pending_earnings)})]}),(0,ea.jsx)("div",{className:"p-3 bg-yellow-100 rounded-full",children:(0,ea.jsx)(Kg,{className:"text-yellow-600",size:24})})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2",children:"Available for payout"})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-600",children:"Monthly Revenue"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:_(A.mrr)})]}),(0,ea.jsx)("div",{className:"p-3 bg-indigo-100 rounded-full",children:(0,ea.jsx)(GN,{className:"text-indigo-600",size:24})})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2",children:"From your customers"})]})}),(0,ea.jsx)(rD,{children:(0,ea.jsxs)(dD,{className:"pt-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-600",children:"Commission Rate"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold text-slate-900",children:[A.commission_rate||20,"%"]})]}),(0,ea.jsx)("div",{className:"p-3 bg-purple-100 rounded-full",children:(0,ea.jsx)(mD,{className:"text-purple-600",size:24})})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-2",children:"Your earnings rate"})]})})]}),A.projected_monthly_earnings>0&&(0,ea.jsx)(rD,{className:"mb-8 bg-gradient-to-r from-indigo-500 to-purple-600 text-white",children:(0,ea.jsx)(dD,{className:"py-6",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-indigo-100 text-sm",children:"Projected Monthly Earnings"}),(0,ea.jsx)("p",{className:"text-3xl font-bold",children:_(A.projected_monthly_earnings)}),(0,ea.jsxs)("p",{className:"text-indigo-200 text-sm mt-1",children:["Based on ",A.commission_rate,"% of ",_(A.mrr)," MRR"]})]}),(0,ea.jsx)("div",{className:"text-right",children:(0,ea.jsx)(yj,{size:48,className:"text-white/30"})})]})})}),(0,ea.jsxs)(nJ,{defaultValue:"commissions",className:"space-y-6",children:[(0,ea.jsxs)(lJ,{children:[(0,ea.jsx)(rJ,{value:"commissions",children:"Commission History"}),(0,ea.jsx)(rJ,{value:"payouts",children:"Payout History"})]}),(0,ea.jsx)(iJ,{value:"commissions",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Commission History"}),(0,ea.jsx)(cD,{children:"Your earnings from customer subscriptions"})]}),(0,ea.jsx)(dD,{children:i.length>0?(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"border-b",children:[(0,ea.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-slate-600",children:"Period"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-slate-600",children:"Customer"}),(0,ea.jsx)("th",{className:"text-right py-3 px-4 text-sm font-medium text-slate-600",children:"Revenue"}),(0,ea.jsx)("th",{className:"text-right py-3 px-4 text-sm font-medium text-slate-600",children:"Your Earnings"}),(0,ea.jsx)("th",{className:"text-center py-3 px-4 text-sm font-medium text-slate-600",children:"Status"})]})}),(0,ea.jsx)("tbody",{children:i.map(e=>(0,ea.jsxs)("tr",{className:"border-b last:border-0 hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"py-3 px-4 text-sm text-slate-900",children:e.period}),(0,ea.jsx)("td",{className:"py-3 px-4 text-sm text-slate-600",children:e.customer_name}),(0,ea.jsx)("td",{className:"py-3 px-4 text-sm text-slate-900 text-right",children:_(e.gross_revenue)}),(0,ea.jsx)("td",{className:"py-3 px-4 text-sm font-medium text-green-600 text-right",children:_(e.reseller_earnings)}),(0,ea.jsx)("td",{className:"py-3 px-4 text-center",children:E(e.status)})]},e.commission_id))})]})}):(0,ea.jsxs)("div",{className:"text-center py-12 text-slate-500",children:[(0,ea.jsx)(qN,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{children:"No commission records yet"}),(0,ea.jsx)("p",{className:"text-sm",children:"Commissions will appear here as your customers pay for subscriptions"})]})})]})}),(0,ea.jsx)(iJ,{value:"payouts",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Payout History"}),(0,ea.jsx)(cD,{children:"Your payout requests and their status"})]}),(0,ea.jsx)(dD,{children:c.length>0?(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"border-b",children:[(0,ea.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-slate-600",children:"Requested"}),(0,ea.jsx)("th",{className:"text-right py-3 px-4 text-sm font-medium text-slate-600",children:"Amount"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-slate-600",children:"Method"}),(0,ea.jsx)("th",{className:"text-center py-3 px-4 text-sm font-medium text-slate-600",children:"Status"}),(0,ea.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-slate-600",children:"Processed"})]})}),(0,ea.jsx)("tbody",{children:c.map(e=>{var t;return(0,ea.jsxs)("tr",{className:"border-b last:border-0 hover:bg-slate-50",children:[(0,ea.jsx)("td",{className:"py-3 px-4 text-sm text-slate-900",children:S(e.requested_at)}),(0,ea.jsx)("td",{className:"py-3 px-4 text-sm font-medium text-slate-900 text-right",children:_(e.amount)}),(0,ea.jsx)("td",{className:"py-3 px-4 text-sm text-slate-600 capitalize",children:null===(t=e.payout_method)||void 0===t?void 0:t.replace("_"," ")}),(0,ea.jsx)("td",{className:"py-3 px-4 text-center",children:E(e.status)}),(0,ea.jsx)("td",{className:"py-3 px-4 text-sm text-slate-600",children:S(e.processed_at)})]},e.payout_id)})})]})}):(0,ea.jsxs)("div",{className:"text-center py-12 text-slate-500",children:[(0,ea.jsx)(bw,{size:48,className:"mx-auto mb-4 text-slate-300"}),(0,ea.jsx)("p",{children:"No payout requests yet"}),(0,ea.jsx)("p",{className:"text-sm",children:"Request a payout when you have pending earnings"})]})})]})})]})]})}),(0,ea.jsx)(Ok,{open:x,onOpenChange:p,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Request Payout"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"p-4 bg-green-50 rounded-lg",children:[(0,ea.jsx)("p",{className:"text-sm text-green-800",children:"Available for payout"}),(0,ea.jsx)("p",{className:"text-2xl font-bold text-green-600",children:_(A.pending_earnings)})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Amount (leave empty for full amount)"}),(0,ea.jsx)(BN,{type:"number",placeholder:"Max: ".concat(_(A.pending_earnings)),value:v.amount,onChange:e=>b(d(d({},v),{},{amount:e.target.value}))}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Minimum payout: $50.00"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Payout Method"}),(0,ea.jsxs)(eb,{value:v.payout_method,onValueChange:e=>b(d(d({},v),{},{payout_method:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"bank_transfer",children:"Bank Transfer"}),(0,ea.jsx)(rb,{value:"paypal",children:"PayPal"}),(0,ea.jsx)(rb,{value:"stripe_connect",children:"Stripe Connect"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Notes (optional)"}),(0,ea.jsx)(BN,{placeholder:"Any special instructions...",value:v.notes,onChange:e=>b(d(d({},v),{},{notes:e.target.value}))})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{try{const e={payout_method:v.payout_method,notes:v.notes};v.amount&&(e.amount=parseFloat(v.amount));await _l.post("/reseller/payouts/request",e);qs.success("Payout request submitted successfully"),p(!1),b({amount:"",payout_method:"bank_transfer",notes:""}),C(),D()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to request payout")}},children:"Submit Request"})]})]})}),(0,ea.jsx)(Ok,{open:g,onOpenChange:f,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Billing Settings"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-4 max-h-[60vh] overflow-y-auto",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Billing Email"}),(0,ea.jsx)(BN,{type:"email",value:j.billing_email,onChange:e=>y(d(d({},j),{},{billing_email:e.target.value})),placeholder:"[email protected]"})]}),(0,ea.jsxs)("div",{className:
2"space-y-2",children:[(0,ea.jsx)(tf,{children:"Preferred Payout Method"}),(0,ea.jsxs)(eb,{value:j.payout_method,onValueChange:e=>y(d(d({},j),{},{payout_method:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"bank_transfer",children:"Bank Transfer"}),(0,ea.jsx)(rb,{value:"paypal",children:"PayPal"}),(0,ea.jsx)(rb,{value:"stripe_connect",children:"Stripe Connect"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-3 p-4 bg-slate-50 rounded-lg",children:[(0,ea.jsx)(tf,{className:"font-medium",children:"Bank Account Details"}),(0,ea.jsx)(BN,{placeholder:"Bank Name",value:(null===(e=j.payout_details)||void 0===e?void 0:e.bank_name)||"",onChange:e=>y(d(d({},j),{},{payout_details:d(d({},j.payout_details),{},{bank_name:e.target.value})}))}),(0,ea.jsx)(BN,{placeholder:"Account Holder Name",value:(null===(s=j.payout_details)||void 0===s?void 0:s.account_holder)||"",onChange:e=>y(d(d({},j),{},{payout_details:d(d({},j.payout_details),{},{account_holder:e.target.value})}))}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ea.jsx)(BN,{placeholder:"Account Number",value:(null===(a=j.payout_details)||void 0===a?void 0:a.account_number)||"",onChange:e=>y(d(d({},j),{},{payout_details:d(d({},j.payout_details),{},{account_number:e.target.value})}))}),(0,ea.jsx)(BN,{placeholder:"Routing Number",value:(null===(n=j.payout_details)||void 0===n?void 0:n.routing_number)||"",onChange:e=>y(d(d({},j),{},{payout_details:d(d({},j.payout_details),{},{routing_number:e.target.value})}))})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Tax ID / VAT Number"}),(0,ea.jsx)(BN,{value:j.tax_id,onChange:e=>y(d(d({},j),{},{tax_id:e.target.value})),placeholder:"XX-XXXXXXX"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Business Address"}),(0,ea.jsx)(BN,{value:j.business_address,onChange:e=>y(d(d({},j),{},{business_address:e.target.value})),placeholder:"123 Business St, City, State ZIP"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{try{await _l.put("/reseller/billing/settings",j),qs.success("Billing settings updated"),f(!1)}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to update settings")}},children:"Save Settings"})]})]})})]})},F0=Vl("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"}]]),T0=Vl("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"}]]),z0=()=>{const[e,s]=(0,t.useState)(!1),[a,n]=(0,t.useState)(!1),[l,r]=(0,t.useState)(null),[i,o]=(0,t.useState)({company_name:"",contact_name:"",email:"",phone:"",website:"",country:"",expected_clients:"",target_market:"",experience:"",why_partner:""}),c=[{icon:bw,title:"Generous Revenue Share",description:"Earn up to 60% of client subscriptions with our tiered revenue model"},{icon:Bw,title:"White-Label Platform",description:"Your branding, your domain - clients see you as the provider"},{icon:F0,title:"Free Enterprise Website",description:"Unlock a free enterprise site for your agency after 5 client sales"},{icon:hr,title:"Unlimited Sub-Tenants",description:"No limits on how many clients you can onboard"},{icon:T0,title:"Dedicated Support",description:"Direct access to our team for technical issues"},{icon:$g,title:"All Premium Features",description:"AI, analytics, SSO, API access - everything included"}];return e?(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900 flex items-center justify-center p-8",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl p-8 max-w-lg text-center",children:[(0,ea.jsx)("div",{className:"w-20 h-20 bg-emerald-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,ea.jsx)(cr,{className:"text-emerald-600",size:40})}),(0,ea.jsx)("h1",{className:"text-2xl font-bold mb-4",style:{fontFamily:"Manrope, sans-serif"},children:"Application Submitted!"}),(0,ea.jsx)("p",{className:"text-slate-600 mb-6",children:"Thank y
2ou for your interest in becoming a Dynatexsaas reseller partner. We'll review your application and get back to you within 2-3 business days."}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 mb-6",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Your application ID:"}),(0,ea.jsx)("code",{className:"text-indigo-600 font-mono",children:l})]}),(0,ea.jsx)(sg,{onClick:()=>window.location.href="/",children:"Return to Home"})]})}):(0,ea.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900",children:[(0,ea.jsx)("div",{className:"container mx-auto px-4 py-8",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center",children:(0,ea.jsx)("span",{className:"text-white font-bold text-xl",children:"N"})}),(0,ea.jsx)("span",{className:"text-white font-bold text-xl",children:"NexusCMS"})]}),(0,ea.jsx)(sg,{variant:"outline",className:"text-white border-white/20 hover:bg-white/10",onClick:()=>window.location.href="/login",children:"Sign In"})]})}),(0,ea.jsxs)("div",{className:"container mx-auto px-4 py-12 text-center",children:[(0,ea.jsxs)("div",{className:"inline-flex items-center gap-2 bg-white/10 rounded-full px-4 py-2 mb-6",children:[(0,ea.jsx)(Bw,{className:"text-purple-400",size:18}),(0,ea.jsx)("span",{className:"text-purple-200 text-sm",children:"Partner Program"})]}),(0,ea.jsx)("h1",{className:"text-4xl md:text-5xl font-bold text-white mb-6",style:{fontFamily:"Manrope, sans-serif"},children:"Become a Reseller Partner"}),(0,ea.jsx)("p",{className:"text-xl text-slate-300 max-w-2xl mx-auto",children:"White-label our platform, earn generous commissions, and grow your business by offering premium CMS solutions to your clients."})]}),(0,ea.jsxs)("div",{className:"container mx-auto px-4 py-8",children:[(0,ea.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12",children:c.map((e,t)=>{const s=e.icon;return(0,ea.jsxs)("div",{className:"bg-white/5 backdrop-blur border border-white/10 rounded-xl p-6",children:[(0,ea.jsx)("div",{className:"w-12 h-12 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-lg flex items-center justify-center mb-4",children:(0,ea.jsx)(s,{className:"text-white",size:24})}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-2",children:e.title}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:e.description})]},t)})}),(0,ea.jsxs)("div",{className:"bg-white/5 backdrop-blur border border-white/10 rounded-2xl p-8 mb-12",children:[(0,ea.jsx)("h2",{className:"text-2xl font-bold text-white text-center mb-8",style:{fontFamily:"Manrope, sans-serif"},children:"Revenue Share Tiers"}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,ea.jsxs)("div",{className:"text-center p-6 bg-white/5 rounded-xl",children:[(0,ea.jsx)("p",{className:"text-slate-400 mb-2",children:"Monthly Revenue $0 - $5,000"}),(0,ea.jsx)("p",{className:"text-4xl font-bold text-white mb-2",children:"40%"}),(0,ea.jsx)("p",{className:"text-purple-400 text-sm",children:"You keep"})]}),(0,ea.jsxs)("div",{className:"text-center p-6 bg-gradient-to-br from-indigo-600/20 to-purple-600/20 rounded-xl border border-purple-500/30",children:[(0,ea.jsx)("p",{className:"text-slate-300 mb-2",children:"Monthly Revenue $5,001 - $20,000"}),(0,ea.jsx)("p",{className:"text-4xl font-bold text-white mb-2",children:"50%"}),(0,ea.jsx)("p",{className:"text-purple-400 text-sm",children:"You keep"})]}),(0,ea.jsxs)("div",{className:"text-center p-6 bg-white/5 rounded-xl",children:[(0,ea.jsx)("p",{className:"text-slate-400 mb-2",children:"Monthly Revenue $20,001+"}),(0,ea.jsx)("p",{className:"text-4xl font-bold text-white mb-2",children:"60%"}),(0,ea.jsx)("p",{className:"text-purple-400 text-sm",children:"You keep"})]})]}),(0,ea.jsx)("p",{className:"text-center text-slate-400 text-sm mt-6",children:"* Custom revenue arrangements available for high-volume partners"})]}),(0,ea.jsx)("div",{className:"max-w-2xl mx-auto",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl p-8 shadow-2xl",children:[(0,ea.jsx)("h2",{className:"text-2xl font-bold mb-6 text-center",style:{fontFamily:"Manrope, sans-serif"},children:"Apply to Become a Partner"}),(0,ea.jsxs)("form",{onSubmit:async e=>{e.preventDefault();const t=["company_name","contact_name","email","country","expected_clients","target_market"];for(const s of t)if(!i[s])return void qs.error("Please fill in ".concat(s.replace("_"," ")));n(!0);try{const e=await _l.post("/public/reseller/apply",i);r(e.data.application_id),s(!0),qs.success("Application submitted successfully!")}catch(o){var a,l;qs.error((null===(a=o.response)||void 0===a||null===(l=a.data)||void 0===l?void 0:l.detail)||"Failed to submit application")}finally{n(!1)}},className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Company Name *"}),(0,ea.jsx)(BN,{value:i.company_name,onChange:e=>o(d(d({},i),{},{company_name:e.target.value})),placeholder:"Your Agency Name",required:!0})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Contact Name *"}),(0,ea.jsx)(BN,{value:i.contact_name,onChange:e=>o(d(d({},i),{},{contact_name:e.target.value})),placeholder:"Your Name",required:!0})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email *"}),(0,ea.jsx)(BN,{type:"email",value:i.email,onChange:e=>o(d(d({},i),{},{email:e.target.value})),placeholder:"[email protected]",required:!0})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Phone"}),(0,ea.jsx)(BN,{value:i.phone,onChange:e=>o(d(d({},i),{},{phone:e.target.value})),placeholder:"+1 (555) 000-0000"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Website"}),(0,ea.jsx)(BN,{value:i.website,onChange:e=>o(d(d({},i),{},{website:e.target.value})),placeholder:"https://yourcompany.com"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Country *"}),(0,ea.jsx)(BN,{value:i.country,onChange:e=>o(d(d({},i),{},{country:e.target.value})),placeholder:"United States",required:!0})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Expected Number of Clients *"}),(0,ea.jsxs)(eb,{value:i.expected_clients,onValueChange:e=>o(d(d({},i),{},{expected_clients:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select range"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"1-10",children:"1-10 clients"}),(0,ea.jsx)(rb,{value:"11-25",children:"11-25 clients"}),(0,ea.jsx)(rb,{value:"26-50",children:"26-50 clients"}),(0,ea.jsx)(rb,{value:"51-100",children:"51-100 clients"}),(0,ea.jsx)(rb,{value:"100+",children:"100+ clients"})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Target Market *"}),(0,ea.jsxs)(eb,{value:i.target_market,onValueChange:e=>o(d(d({},i),{},{target_market:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{placeholder:"Select market"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"Schools & Education",children:"Schools & Education"}),(0,ea.jsx)(rb,{value:"Small Business",children:"Small Business"}),(0,ea.jsx)(rb,{value:"Enterprise",children:"Enterprise"}),(0,ea.jsx)(rb,{value:"Non-Profit",children:"Non-Profit"}),(0,ea.jsx)(rb,{value:"Government",children:"Government"}),(0,ea.jsx)(rb,{value:"Mixed",children:"Mixed / Multiple"})]})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Relevant Experience"}),(0,ea.jsx)(YN,{value:i.experience,onChange:e=>o(d(d({},i),{},{experience:e.target.value})),placeholder:"Tell us about your experience with CMS platforms, web development, or selling SaaS products...",rows:3})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Why do you want to partner with us?"}
2),(0,ea.jsx)(YN,{value:i.why_partner,onChange:e=>o(d(d({},i),{},{why_partner:e.target.value})),placeholder:"What attracted you to NexusCMS? How do you plan to sell it to your clients?",rows:3})]}),(0,ea.jsx)(sg,{type:"submit",className:"w-full bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-700 hover:to-purple-700",disabled:a,children:a?"Submitting...":(0,ea.jsxs)(ea.Fragment,{children:["Submit Application",(0,ea.jsx)(wj,{size:18,className:"ml-2"})]})}),(0,ea.jsx)("p",{className:"text-center text-slate-500 text-sm",children:"We review all applications within 2-3 business days. You'll receive an email with the next steps."})]})]})})]}),(0,ea.jsx)("div",{className:"container mx-auto px-4 py-12 text-center",children:(0,ea.jsxs)("p",{className:"text-slate-400",children:["\xa9 ",(new Date).getFullYear()," Dynatexsaas. All rights reserved."]})})]})};let M0=0;const P0=new Map,B0=e=>{if(P0.has(e))return;const t=setTimeout(()=>{P0.delete(e),O0({type:"REMOVE_TOAST",toastId:e})},1e6);P0.set(e,t)},R0=(e,t)=>{switch(t.type){case"ADD_TOAST":return d(d({},e),{},{toasts:[t.toast,...e.toasts].slice(0,1)});case"UPDATE_TOAST":return d(d({},e),{},{toasts:e.toasts.map(e=>e.id===t.toast.id?d(d({},e),t.toast):e)});case"DISMISS_TOAST":{const{toastId:s}=t;return s?B0(s):e.toasts.forEach(e=>{B0(e.id)}),d(d({},e),{},{toasts:e.toasts.map(e=>e.id===s||void 0===s?d(d({},e),{},{open:!1}):e)})}case"REMOVE_TOAST":return void 0===t.toastId?d(d({},e),{},{toasts:[]}):d(d({},e),{},{toasts:e.toasts.filter(e=>e.id!==t.toastId)})}},L0=[];let I0={toasts:[]};function O0(e){I0=R0(I0,e),L0.forEach(e=>{e(I0)})}function U0(e){let t=Object.assign({},(Fs(e),e));const s=(M0=(M0+1)%Number.MAX_SAFE_INTEGER,M0.toString()),a=()=>O0({type:"DISMISS_TOAST",toastId:s});return O0({type:"ADD_TOAST",toast:d(d({},t),{},{id:s,open:!0,onOpenChange:e=>{e||a()}})}),{id:s,dismiss:a,update:e=>O0({type:"UPDATE_TOAST",toast:d(d({},e),{},{id:s})})}}function H0(){const[e,s]=t.useState(I0);return t.useEffect(()=>(L0.push(s),()=>{const e=L0.indexOf(s);e>-1&&L0.splice(e,1)}),[e]),d(d({},e),{},{toast:U0,dismiss:e=>O0({type:"DISMISS_TOAST",toastId:e})})}function W0(){const e=be(),{toast:s}=H0(),[a,n]=(0,t.useState)(!1),[l,r]=(0,t.useState)(!1),[i,o]=(0,t.useState)({name:"",email:"",website_url:"",portfolio_url:"",promotion_method:""});return l?(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900 flex items-center justify-center p-4",children:(0,ea.jsx)(rD,{className:"max-w-md w-full bg-white/10 backdrop-blur-lg border-white/20",children:(0,ea.jsxs)(dD,{className:"pt-8 text-center",children:[(0,ea.jsx)("div",{className:"w-16 h-16 bg-green-500/20 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(cr,{className:"w-8 h-8 text-green-400"})}),(0,ea.jsx)("h2",{className:"text-2xl font-bold text-white mb-2",children:"Application Received!"}),(0,ea.jsx)("p",{className:"text-slate-300 mb-6",children:"Thank you for applying to become a NexusCMS Affiliate Partner. We'll review your application and get back to you within 24-48 hours."}),(0,ea.jsx)(sg,{onClick:()=>e("/"),className:"bg-purple-600 hover:bg-purple-700",children:"Return to Homepage"})]})})}):(0,ea.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900",children:(0,ea.jsxs)("div",{className:"container mx-auto px-4 py-12",children:[(0,ea.jsxs)("div",{className:"text-center mb-12",children:[(0,ea.jsxs)("h1",{className:"text-4xl md:text-5xl font-bold text-white mb-4",children:["Become a NexusCMS ",(0,ea.jsx)("span",{className:"text-purple-400",children:"Affiliate Partner"})]}),(0,ea.jsx)("p",{className:"text-xl text-slate-300 max-w-2xl mx-auto",children:"Earn 20% lifetime commission on every customer you refer. No limits, no caps."})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-4 gap-6 mb-12 max-w-4xl mx-auto",children:[(0,ea.jsxs)(rD,{className:"bg-white/5 border-white/10 text-center p-6",children:[(0,ea.jsx)(bw,{className:"w-10 h-10 text-green-400 mx-auto mb-3"}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-1",children:"20% Lifetime"}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"Commission on every payment, forever"})]}),(0,ea.jsxs)(rD,{className:"bg-white/5 border-white/10 text-center p-6",children:[(0,ea.jsx)(GN,{className:"w-10 h-10 text-blue-400 mx-auto mb-3"}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-1",children:"Recurring Revenue"}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"Earn as long as they stay subscribed"})]}),(0,ea.jsxs)(rD,{className:"bg-white/5 border-white/10 text-center p-6",children:[(0,ea.jsx)(Bj,{className:"w-10 h-10 text-purple-400 mx-auto mb-3"}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-1",children:"30-Day Cookies"}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"Referrals tracked for 30 days"})]}),(0,ea.jsxs)(rD,{className:"bg-white/5 border-white/10 text-center p-6",children:[(0,ea.jsx)(zj,{className:"w-10 h-10 text-pink-400 mx-auto mb-3"}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-1",children:"Free to Join"}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"No cost, no commitment"})]})]}),(0,ea.jsx)("div",{className:"max-w-xl mx-auto",children:(0,ea.jsxs)(rD,{className:"bg-white/10 backdrop-blur-lg border-white/20",children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{className:"text-white",children:"Apply Now"}),(0,ea.jsx)(cD,{className:"text-slate-300",children:"Tell us a bit about yourself and how you plan to promote NexusCMS."})]}),(0,ea.jsx)(dD,{children:(0,ea.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),i.name&&i.email&&i.promotion_method){n(!0);try{await _l.post("/public/affiliate/apply",i),r(!0),s({title:"Ap
2plication Submitted!",description:"We'll review your application within 24-48 hours."})}catch(l){var t,a;s({title:"Submission Failed",description:(null===(t=l.response)||void 0===t||null===(a=t.data)||void 0===a?void 0:a.detail)||"Please try again later.",variant:"destructive"})}finally{n(!1)}}else s({title:"Missing Information",description:"Please fill in all required fields.",variant:"destructive"})},className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"name",className:"text-white",children:"Full Name *"}),(0,ea.jsx)(BN,{id:"name",value:i.name,onChange:e=>o(d(d({},i),{},{name:e.target.value})),placeholder:"John Smith",className:"bg-white/10 border-white/20 text-white placeholder:text-slate-400",required:!0,"data-testid":"affiliate-name-input"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"email",className:"text-white",children:"Email Address *"}),(0,ea.jsx)(BN,{id:"email",type:"email",value:i.email,onChange:e=>o(d(d({},i),{},{email:e.target.value})),placeholder:"[email protected]",className:"bg-white/10 border-white/20 text-white placeholder:text-slate-400",required:!0,"data-testid":"affiliate-email-input"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"website_url",className:"text-white",children:"Website URL"}),(0,ea.jsx)(BN,{id:"website_url",type:"url",value:i.website_url,onChange:e=>o(d(d({},i),{},{website_url:e.target.value})),placeholder:"https://yourwebsite.com",className:"bg-white/10 border-white/20 text-white placeholder:text-slate-400","data-testid":"affiliate-website-input"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"portfolio_url",className:"text-white",children:"Portfolio URL"}),(0,ea.jsx)(BN,{id:"portfolio_url",type:"url",value:i.portfolio_url,onChange:e=>o(d(d({},i),{},{portfolio_url:e.target.value})),placeholder:"https://dribbble.com/yourprofile",className:"bg-white/10 border-white/20 text-white placeholder:text-slate-400","data-testid":"affiliate-portfolio-input"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{htmlFor:"promotion_method",className:"text-white",children:"How will you promote NexusCMS? *"}),(0,ea.jsx)(YN,{id:"promotion_method",value:i.promotion_method,onChange:e=>o(d(d({},i),{},{promotion_method:e.target.value})),placeholder:"E.g., I run a design blog with 10k monthly visitors, I'll write tutorials and reviews...",className:"bg-white/10 border-white/20 text-white placeholder:text-slate-400 min-h-[100px]",required:!0,"data-testid":"affiliate-promotion-input"})]}),(0,ea.jsx)(sg,{type:"submit",className:"w-full bg-purple-600 hover:bg-purple-700 text-white",disabled:a,"data-testid":"affiliate-submit-btn",children:a?"Submitting...":"Submit Application"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 text-center mt-4",children:"By applying, you agree to our affiliate terms and conditions."})]})})]})}),(0,ea.jsxs)("div",{className:"mt-16 max-w-3xl mx-auto",children:[(0,ea.jsx)("h2",{className:"text-2xl font-bold text-white text-center mb-8",children:"How It Works"}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-3 gap-8",children:[(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-full bg-purple-600 text-white text-xl font-bold flex items-center justify-center mx-auto mb-4",children:"1"}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-2",children:"Apply & Get Approved"}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"Submit your application. We review within 24-48 hours."})]}),(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-full bg-purple-600 text-white text-xl font-bold flex items-center justify-center mx-auto mb-4",children:"2"}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-2",children:"Share Your Link"}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"Get your unique referral link and start sharing."})]}),(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-full bg-purple-600 text-white text-xl font-bold flex items-center justify-center mx-auto mb-4",children:"3"}),(0,ea.jsx)("h3",{className:"text-white font-semibold mb-2",children:"Earn Commission"}),(0,ea.jsx)("p",{className:"text-slate-400 text-sm",children:"Earn 20% of every payment, for the lifetime of the customer."})]})]})]})]})})}const V0=Vl("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"}]]);
2function q0(){const e=be(),{toast:s}=H0(),[a,n]=(0,t.useState)(!0),[l,r]=(0,t.useState)(null),[i,o]=(0,t.useState)([]),[c,d]=(0,t.useState)([]),[u,m]=(0,t.useState)([]),h=(0,t.useCallback)(async()=>{try{const e=await _l.get("/affiliate/dashboard");r(e.data)}catch(s){var t;403===(null===(t=s.response)||void 0===t?void 0:t.status)&&e("/affiliate/apply"),console.error("Failed to load dashboard:",s)}finally{n(!1)}},[e]),x=(0,t.useCallback)(async()=>{try{const e=await _l.get("/affiliate/commissions");o(e.data.commissions||[])}catch(e){console.error("Failed to load commissions:",e)}},[]),p=(0,t.useCallback)(async()=>{try{const e=await _l.get("/affiliate/referrals");d(e.data.referrals||[])}catch(e){console.error("Failed to load referrals:",e)}},[]),g=(0,t.useCallback)(async()=>{try{const e=await _l.get("/affiliate/payouts");m(e.data.payouts||[])}catch(e){console.error("Failed to load payouts:",e)}},[]);(0,t.useEffect)(()=>{h(),x(),p(),g()},[h,x,p,g]);if(a)return(0,ea.jsx)(PQ,{children:(0,ea.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,ea.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"})})});if(!l)return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"text-center py-12",children:[(0,ea.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Not an Affiliate"}),(0,ea.jsx)("p",{className:"text-gray-600 mb-4",children:"You need to apply and be approved as an affiliate first."}),(0,ea.jsx)(sg,{onClick:()=>e("/affiliate/apply"),children:"Apply Now"})]})});const{affiliate:f,stats:v,recent:b,clicks_by_day:j}=l;return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-start",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Affiliate Dashboard"}),(0,ea.jsxs)("p",{className:"text-gray-600",children:["Welcome back, ",f.name]})]}),(0,ea.jsxs)(EC,{variant:"outline",className:"text-green-600 border-green-600",children:[(0,ea.jsx)(cr,{className:"w-3 h-3 mr-1"}),"Active Partner"]})]}),(0,ea.jsxs)(rD,{className:"border-purple-200 bg-gradient-to-r from-purple-50 to-indigo-50",children:[(0,ea.jsxs)(iD,{className:"pb-2",children:[(0,ea.jsx)(oD,{className:"text-lg",children:"Your Referral Link"}),(0,ea.jsx)(cD,{children:"Share this link to earn 20% lifetime commission"})]}),(0,ea.jsxs)(dD,{children:[(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:f.referral_link,readOnly:!0,className:"bg-white font-mono text-sm","data-testid":"referral-link-input"}),(0,ea.jsx)(sg,{onClick:()=>{return e=f.referral_link,navigator.clipboard.writeText(e),void s({title:"Copied!",description:"Referral link copied to clipboard."});var e},variant:"outline","data-testid":"copy-link-btn",children:(0,ea.jsx)(DD,{className:"w-4 h-4"})})]}),(0,ea.jsxs)("div",{className:"mt-3 flex gap-4 text-sm text-gray-600",children:[(0,ea.jsxs)("span",{children:["Referral Code: ",(0,ea.jsx)("code",{className:"bg-white px-2 py-1 rounded font-mono",children:f.referral_code})]}),(0,ea.jsxs)("span",{children:["Commission Rate: ",(0,ea.jsxs)("strong",{className:"text-green-600",children:[(100*f.commission_rate).toFixed(0),"%"]})]})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-blue-100 rounded-lg",children:(0,ea.jsx)(Eq,{className:"w-5 h-5 text-blue-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Total Clicks"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:v.total_clicks.toLocaleString()})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-green-100 rounded-lg",children:(0,ea.jsx)(Bj,{className:"w-5 h-5 text-green-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Conversions"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:v.total_conversions})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-purple-100 rounded-lg",children:(0,ea.jsx)(GN,{className:"w-5 h-5 text-purple-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Conversion Rate"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:[v.conversion_rate,"%"]})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-yellow-100 rounded-lg",children:(0,ea.jsx)(bw,{className:"w-5 h-5 text-yellow-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Total Earnings"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:["$",v.total_earnings.toFixed(2)]})]})]})})})]}),(0,ea.jsxs)("div",{className:"grid md:grid-cols-3 gap-4",children:[(0,ea.jsx)(rD,{className:"bg-green-50 border-green-200",children:(0,ea.jsxs)(dD,{className:"pt-6 text-center",children:[(0,ea.jsx)(bw,{className:"w-8 h-8 text-green-600 mx-auto mb-2"}),(0,ea.jsx)("p",{className:"text-sm text-green-800",children:"Paid Earnings"}),(0,ea.jsxs)("p",{className:"text-3xl font-bold text-green-700",children:["$",v.paid_earnings.toFixed(2)]})]})}),(0,ea.jsx)(rD,{className:"bg-yellow-50 border-yellow-200",children:(0,ea.jsxs)(dD,{className:"pt-6 text-center",children:[(0,ea.jsx)(Kg,{className:"w-8 h-8 text-yellow-600 mx-auto mb-2"}),(0,ea.jsx)("p",{className:"text-sm text-yellow-800",children:"Pending Payout"}),(0,ea.jsxs)("p",{className:"text-3xl font-bold text-yellow-700",children:["$",v.pending_earnings.toFixed(2)]})]})}),(0,ea.jsx)(rD,{className:"bg-blue-50 border-blue-200",children:(0,ea.jsxs)(dD,{className:"pt-6 text-center",children:[(0,ea.jsx)(mD,{className:"w-8 h-8 text-blue-600 mx-auto mb-2"}),(0,ea.jsx)("p",{className:"text-sm text-blue-800",children:"Last 30 Days"}),(0,ea.jsxs)("p",{className:"text-3xl font-bold text-blue-700",children:["$",b.earnings_30d.toFixed(2)]})]})})]}),(0,ea.jsxs)(nJ,{defaultValue:"commissions",className:"w-full",children:[(0,ea.jsxs)(lJ,{children:[(0,ea.jsx)(rJ,{value:"commissions",children:"Commissions"}),(0,ea.jsx)(rJ,{value:"payouts","data-testid":"tab-payouts",children:"Payouts"}),(0,ea.jsx)(rJ,{value:"referrals",children:"Referred Customers"}),(0,ea.jsx)(rJ,{value:"activity",children:"Click Activity"})]}),(0,ea.jsx)(iJ,{value:"commissions",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Commission History"}),(0,ea.jsx)(cD,{children:"All your earned commissions"})]}),(0,ea.jsx)(dD,{children:0===i.length?(0,ea.jsx)("p",{className:"text-center text-gray-500 py-8",children:"No commissions yet. Share your referral link to start earning!"}):(0,ea.jsx)("div",{className:"space-y-3",children:i.map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:e.customer_email}),(0,ea.jsxs)("p",{className:"text-sm text-gray-500",children:[new Date(e.created_at).toLocaleDateString()," \u2022 $",e.payment_amount.toFixed(2)," payment"]})]}),(0,ea.jsxs)("div",{className:"text-right",children:[(0,ea.jsxs)("p",{className:"font-bold text-green-600",children:["+$",e.commission_amount.toFixed(2)]}),(0,ea.jsx)(EC,{variant:"paid"===e.status?"default":"secondary",children:e.status})]})]},e.commission_id))})})]})}),(0,ea.jsx)(iJ,{value:"payouts",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(V0,{className:"w-5 h-5"})," Payout History"]}),(0,ea.jsx)(cD,{children:"Record of all payouts you've received"})]}),(0,ea.jsx)(dD,{children:0===u.length?(0,ea.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,ea.jsx)(V0,{className:"w-10 h-10 mx-auto mb-2 text-gray-300"}),(0,ea.jsx)("p",{children:"No payouts yet"}),(0,ea.jsx)("p",{className:"text-sm",children:"Payouts are processed once you have pending earnings."})]}):(0,ea.jsx)("div",{className:"space-y-3",children:u.map(e=>{var t;return(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg","data-testid":"payout-".concat(e.payout_id),children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ea.jsx)(cr,{className:"w-4 h-4 text-green-500"}),(0,ea.jsxs)("p",{className:"font-semibold text-green-700",children:["$",(e.amount||0).toFixed(2)]}),(0,ea.jsx)(EC,{variant:"outline",className:"capitalize text-xs",children:null===(t=e.method)||void 0===t?void 0:t.replace("_"," ")})]}),(0,ea.jsxs)("p",{className:"text-sm text-gray-500",children:[e.commission_count," commission",1!==e.commission_count?"s":"",e.reference&&(0,ea.jsxs)(ea.Fragment,{children:[" \xb7 Ref: ",e.reference]})]})]}),(0,ea.jsx)("p",{className:"text-sm text-gray-400",children:e.created_at?new Date(e.created_at).toLocaleDateString():"-"})]},e.payout_id)})})})]})}),(0,ea.jsx)(iJ,{value:"referrals",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Referred Customers"}),(0,ea.jsx)(cD,{children:"Customers who signed up through your link"})]}),(0,ea.jsx)(dD,{children:0===c.length?(0,ea.jsx)("p",{className:"text-center text-gray-500 py-8",children:"No referrals yet. Share your link to get started!"}):(0,ea.jsx)("div",{className:"space-y-3",children:c.map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center",children:(0,ea.jsx)(Bj,{className:"w-5 h-5 text-purple-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:e.name}),(0,ea.jsxs)("p",{className:"text-sm text-gray-500",children:["Joined ",new Date(e.created_at).toLocaleDateString()]})]})]}),(0,ea.jsx)(EC,{children:e.plan||"Free"})]},e.tenant_id))})})]})}),(0,ea.jsx)(iJ,{value:"activity",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Click Activity (Last 30 Days)"}),(0,ea.jsx)(cD,{children:"Daily clicks on your referral link"})]}),(0,ea.jsx)(dD,{children:0===j.length?(0,ea.jsx)("p",{className:"text-center text-gray-500 py-8",children:"No clicks recorded yet."}):(0,ea.jsx)("div",{className:"space-y-2",children:j.slice(-14).map(e=>(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("span",{className:"text-sm text-gray-500 w-24",children:e.date}),(0,ea.jsx)("div",{className:"flex-1 bg-gray-100 rounded-full h-4 overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full bg-purple-500 rounded-full",style:{width:"".concat(Math.min(e.clicks/Math.max(...j.map(e=>e.clicks))*100,100),"%")}})}),(0,ea.jsx)("span",{className:"text-sm font-medium w-12 text-right",children:e.clicks})]},e.date))})})]})})]}),(0,ea.jsx)(rD,{className:"bg-gray-50",children:(0,ea.jsx)(dD,{className:"pt-6",children:(0,ea.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ea.jsx)("div",{className:"p-2 bg-purple-100 rounded-lg",children:(0,ea.jsx)(bj,{className:"w-5 h-5 text-purple-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"font-semibold mb-1",children:"Tips for Success"}),(0,ea.jsxs)("ul",{className:"text-sm text-gray-600 space-y-1",children:[(0,ea.jsx)("li",{children:"\u2022 Share your link on social media, blogs, and newsletters"}),(0,ea.jsx)("li",{children:"\u2022 Write tutorials or reviews about NexusCMS"}),(0,ea.jsx)("li",{children:"\u2022 Include your link in your email signature"}),(0,ea.jsx)("li",{children:"\u2022 Create video content showcasing NexusCMS features"})]})]})]})})})]})})}const $0=Vl("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"}]]),G0={pending:"bg-yellow-100 text-yellow-800 border-yellow-300",approved:"bg-green-100 text-green-800 border-green-300",rejected:"bg-red-100 text-red-800 border-red-300",suspended:"bg-gray-100 text-gray-800 border-gray-300"},K0={pending:Kg,approved:cr,rejected:fJ,suspended:fJ};function Y0(){var e,s;const[a,n]=(0,t.useState)("pending"),[l,r]=(0,t.useState)([]),[i,o]=(0,t.useState)([]),[c,d]=(0,t.useState)(null),[u,m]=(0,t.useState)(!0),[h,x]=(0,t.useState)(!0),[p,g]=(0,t.useState)(1),[f,v]=(0,t.useState)(1),[b,j]=(0,t.useState)(""),[y,N]=(0,t.useState)(""),[w,C]=(0,t.useState)(!1),[k,D]=(0,t.useState)(!1),[_,S]=(0,t.useState)(!1),[E,A]=(0,t.useState)(null),[F,T]=(0,t.useState)(null),[z,M]=(0,t.useState)(""),[P,B]=(0,t.useState)(!1),[R,L]=(0,t.useState)([]),[I,O]=(0,t.useState)([]),[U,H]=(0,t.useState)(!1),[W,V]=(0,t.useState)("paypal"),[q,$]=(0,t.useState)(""),[G,K]=(0,t.useState)(""),[Y,J]=(0,t.useState)(50),Q=(0,t.useCallback)(async()=>{try{const e=await _l.get("/admin/affiliates/stats");d(e.data)}catch(e){console.error("Failed to load stats:",e)}},[]),X=(0,t.useCallback)(async()=>{x(!0);try{const e=await _l.get("/admin/affiliates/pending");o(e.data.pending||[])}catch(e){console.error("Failed to load pending:",e)}finally{x(!1)}},[]),Z=(0,t.useCallback)(async()=>{m(!0);try{const e=new URLSearchParams({page:p,per_page:20});y&&e.append("status",y);const t=await _l.get("/admin/affiliates?".concat(e.toString()));r(t.data.affiliates||[]),v(t.data.total_pages||1)}catch(e){console.error("Failed to load affiliates:",e)}finally{m(!1)}},[p,y]),ee=(0,t.useCallback)(async()=>{H(!0);try{const e=await _l.get("/admin/affiliates/payouts/pending");L(e.data.affiliates||[]),e.data.minimum_payout&&J(e.data.minimum_payout)}catch(e){console.error("Failed to load pending payouts:",e)}finally{H(!1)}},[]),te=(0,t.useCallback)(async()=>{try{const e=await _l.get("/admin/affiliates/payouts/history");O(e.data.payouts||[])}catch(e){console.error("Failed to load payout history:",e)}},[]);(0,t.useEffect)(()=>{Q(),X(),ee(),te()},[Q,X,ee,te]),(0,t.useEffect)(()=>{Z()}
2,[Z]);const se=async e=>{A(e);try{const t=await _l.get("/admin/affiliates/".concat(e.affiliate_id));T(t.data)}catch(t){console.error("Failed to load detail:",t),T(null)}C(!0)},ae=async e=>{B(!0);try{await _l.put("/admin/affiliates/".concat(e.affiliate_id,"/approve")),qs.success("Approved ".concat(e.name," as an affiliate partner")),X(),Z(),Q(),C(!1)}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to approve affiliate")}finally{B(!1)}},ne=b?l.filter(e=>{var t,s,a;return(null===(t=e.name)||void 0===t?void 0:t.toLowerCase().includes(b.toLowerCase()))||(null===(s=e.email)||void 0===s?void 0:s.toLowerCase().includes(b.toLowerCase()))||(null===(a=e.referral_code)||void 0===a?void 0:a.toLowerCase().includes(b.toLowerCase()))}):l;return(0,ea.jsx)(PQ,{children:(0,ea.jsxs)("div",{className:"p-6 space-y-6","data-testid":"affiliate-management",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-2xl font-bold text-gray-900","data-testid":"affiliate-management-title",children:"Affiliate Program"}),(0,ea.jsx)("p",{className:"text-gray-600",children:"Manage affiliate partners and track program performance"})]}),c&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4","data-testid":"affiliate-stats",children:[(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-5",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-blue-100 rounded-lg",children:(0,ea.jsx)(Bj,{className:"w-5 h-5 text-blue-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Total Affiliates"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:c.overview.total_affiliates})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-5",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-yellow-100 rounded-lg",children:(0,ea.jsx)(Kg,{className:"w-5 h-5 text-yellow-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Pending"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:c.overview.pending_applications})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-5",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-green-100 rounded-lg",children:(0,ea.jsx)(Eq,{className:"w-5 h-5 text-green-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Total Clicks"}),(0,ea.jsx)("p",{className:"text-2xl font-bold",children:c.overview.total_clicks.toLocaleString()})]})]})})}),(0,ea.jsx)(rD,{children:(0,ea.jsx)(dD,{className:"pt-5",children:(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("div",{className:"p-2 bg-purple-100 rounded-lg",children:(0,ea.jsx)(bw,{className:"w-5 h-5 text-purple-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:"Pending Payouts"}),(0,ea.jsxs)("p",{className:"text-2xl font-bold",children:["$",(null===(e=c.overview.pending_payouts)||void 0===e?void 0:e.toFixed(2))||"0.00"]})]})]})})})]}),(0,ea.jsxs)(nJ,{value:a,onValueChange:n,className:"w-full",children:[(0,ea.jsxs)(lJ,{children:[(0,ea.jsxs)(rJ,{value:"pending","data-testid":"tab-pending",children:["Pending Applications ",i.length>0&&(0,ea.jsx)(EC,{variant:"destructive",className:"ml-2 h-5 w-5 p-0 flex items-center justify-center text-xs rounded-full",children:i.length})]}),(0,ea.jsx)(rJ,{value:"all","data-testid":"tab-all",children:"All Affiliates"}),(0,ea.jsxs)(rJ,{value:"payouts","data-testid":"tab-payouts",children:["Payouts ",R.length>0&&(0,ea.jsx)(EC,{className:"ml-2 bg-green-600 h-5 w-5 p-0 flex items-center justify-center text-xs rounded-full",children:R.length})]}),(0,ea.jsx)(rJ,{value:"top","data-testid":"tab-top",children:"Top Performers"})]}),(0,ea.jsx)(iJ,{value:"pending",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Pending Applications"}),(0,ea.jsx)(cD,{children:"Review and approve or reject affiliate applications"})]}),(0,ea.jsx)(dD,{children:h?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"w-6 h-6 animate-spin text-gray-400"})}):0===i.length?(0,ea.jsxs)("div",{className:"text-center py-12 text-gray-500",children:[(0,ea.jsx)(cr,{className:"w-12 h-12 mx-auto mb-3 text-green-300"}),(0,ea.jsx)("p",{className:"font-medium",children:"No pending applications"}),(0,ea.jsx)("p",{className:"text-sm",children:"All caught up!"})]}):(0,ea.jsx)("div",{className:"space-y-3",children:i.map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg hover:bg-gray-50 transition-colors","data-testid":"pending-affiliate-".concat(e.affiliate_id),children:[(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ea.jsx)("p",{className:"font-semibold text-gray-900",children:e.name}),(0,ea.jsx)(EC,{variant:"outline",className:G0.pending,children:e.status})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Yl,{className:"w-3 h-3"}),e.email]}),e.website_url&&(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(hr,{className:"w-3 h-3"}),e.website_url]})]}),(0,ea.jsxs)("p",{className:"text-sm text-gray-600 mt-1 line-clamp-1",children:[(0,ea.jsx)("span",{className:"font-medium",children:"Promotion plan:"})," ",e.promotion_method]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,ea.jsxs)(sg,{size:"sm",variant:"outline",onClick:()=>se(e),"data-testid":"view-affiliate-".concat(e.affiliate_id),children:[(0,ea.jsx)(IN,{className:"w-4 h-4 mr-1"})," View"]}),(0,ea.jsxs)(sg,{size:"sm",className:"bg-green-600 hover:bg-green-700",onClick:()=>ae(e),disabled:P,"data-testid":"approve-affiliate-".concat(e.affiliate_id),children:[(0,ea.jsx)(cr,{className:"w-4 h-4 mr-1"})," Approve"]}),(0,ea.jsxs)(sg,{size:"sm",variant:"destructive",onClick:()=>{A(e),D(!0)},disabled:P,"data-testid":"reject-affiliate-".concat(e.affiliate_id),children:[(0,ea.jsx)(fJ,{className:"w-4 h-4 mr-1"})," Reject"]})]})]},e.affiliate_id))})})]})}),(0,ea.jsx)(iJ,{value:"all",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(oD,{children:"All Affiliates"}),(0,ea.jsx)(cD,{children:"Browse and manage all affiliate partners"})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,ea.jsx)(BN,{placeholder:"Search affiliates...",value:b,onChange:e=>j(e.target.value),className:"pl-9 w-64","data-testid":"affiliate-search"})]}),(0,ea.jsxs)("select",{value:y,onChange:e=>{N(e.target.value),g(1)},className:"h-10 rounded-md border border-gray-200 px-3 text-sm","data-testid":"affiliate-status-filter",children:[(0,ea.jsx)("option",{value:"",children:"All Statuses"}),(0,ea.jsx)("option",{value:"approved",children:"Approved"}),(0,ea.jsx)("option",{value:"pending",children:"Pending"}),(0,ea.jsx)("option",{value:"rejected",children:"Rejected"}),(0,ea.jsx)("option",{value:"suspended",children:"Suspended"})]})]})]})}),(0,ea.jsx)(dD,{children:u?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"w-6 h-6 animate-spin text-gray-400"})}):0===ne.length?(0,ea.jsxs)("div",{className:"text-center py-12 text-gray-500",children:[(0,ea.jsx)(Bj,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),(0,ea.jsx)("p",{children:"No affiliates found"})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full","data-testid":"affiliates-table",children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"border-b text-left text-sm text-gray-500",children:[(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Name"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Status"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Referral Code"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Clicks"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Conversions"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Earnings"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Applied"}),(0,ea.jsx)("th",{className:"pb-3 font-medium"})]})}),(0,ea.jsx)("tbody",{children:ne.map(e=>{var t;const s=K0[e.status]||Kg;return(0,ea.jsxs)("tr",{className:"border-b last:border-0 hover:bg-gray-50",children:[(0,ea.jsxs)("td",{className:"py-3",children:[(0,ea.jsx)("p",{className:"font-medium text-gray-900",children:e.name}),(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:e.email})]}),(0,ea.jsx)("td",{className:"py-3",children:(0,ea.jsxs)(EC,{variant:"outline",className:G0[e.status]||"",children:[(0,ea.jsx)(s,{className:"w-3 h-3 mr-1"}),e.status]})}),(0,ea.jsx)("td",{className:"py-3",children:(0,ea.jsx)("code",{className:"text-sm bg-gray-100 px-2 py-1 rounded",children:e.referral_code})}),(0,ea.jsx)("td",{className:"py-3 font-medium",children:(null===(t=e.total_clicks)||void 0===t?void 0:t.toLocaleStr
2ing())||0}),(0,ea.jsx)("td",{className:"py-3 font-medium",children:e.total_conversions||0}),(0,ea.jsxs)("td",{className:"py-3 font-medium text-green-600",children:["$",(e.total_earnings||0).toFixed(2)]}),(0,ea.jsx)("td",{className:"py-3 text-sm text-gray-500",children:e.created_at?new Date(e.created_at).toLocaleDateString():"-"}),(0,ea.jsx)("td",{className:"py-3",children:(0,ea.jsx)(sg,{size:"sm",variant:"ghost",onClick:()=>se(e),"data-testid":"view-detail-".concat(e.affiliate_id),children:(0,ea.jsx)(IN,{className:"w-4 h-4"})})})]},e.affiliate_id)})})]})}),f>1&&(0,ea.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ea.jsxs)("p",{className:"text-sm text-gray-500",children:["Page ",p," of ",f]}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(sg,{size:"sm",variant:"outline",disabled:p<=1,onClick:()=>g(e=>e-1),children:(0,ea.jsx)(vj,{className:"w-4 h-4"})}),(0,ea.jsx)(sg,{size:"sm",variant:"outline",disabled:p>=f,onClick:()=>g(e=>e+1),children:(0,ea.jsx)(ax,{className:"w-4 h-4"})})]})]})]})})]})}),(0,ea.jsx)(iJ,{value:"payouts",children:(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)(rD,{children:[(0,ea.jsx)(iD,{children:(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)(V0,{className:"w-5 h-5"}),"Pending Payouts"]}),(0,ea.jsx)(cD,{children:"Affiliates with earnings ready to be paid out"})]}),(0,ea.jsxs)(EC,{variant:"outline",className:"text-sm px-3 py-1 border-amber-300 text-amber-700 bg-amber-50",children:["Minimum payout: $",Y.toFixed(2)]})]})}),(0,ea.jsx)(dD,{children:U?(0,ea.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ea.jsx)(ql,{className:"w-6 h-6 animate-spin text-gray-400"})}):0===R.length?(0,ea.jsxs)("div",{className:"text-center py-12 text-gray-500",children:[(0,ea.jsx)(cr,{className:"w-12 h-12 mx-auto mb-3 text-green-300"}),(0,ea.jsx)("p",{className:"font-medium",children:"No pending payouts"}),(0,ea.jsx)("p",{className:"text-sm",children:"All affiliates have been paid!"})]}):(0,ea.jsx)("div",{className:"space-y-3",children:R.map(e=>{const t=!1!==e.eligible_for_payout&&(e.pending_earnings||0)>=Y;return(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg transition-colors ".concat(t?"hover:bg-gray-50":"bg-gray-50/50 opacity-75"),"data-testid":"payout-affiliate-".concat(e.affiliate_id),children:[(0,ea.jsxs)("div",{className:"flex-1",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,ea.jsx)("p",{className:"font-semibold text-gray-900",children:e.name}),(0,ea.jsx)("code",{className:"text-xs bg-gray-100 px-2 py-0.5 rounded",children:e.referral_code}),!t&&(0,ea.jsxs)(EC,{variant:"outline",className:"text-xs border-amber-300 text-amber-600 bg-amber-50",children:["Below $",Y," minimum"]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Yl,{className:"w-3 h-3"}),e.email]}),e.paypal_email&&(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Aj,{className:"w-3 h-3"}),"PayPal: ",e.paypal_email]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsxs)("div",{className:"text-right mr-2",children:[(0,ea.jsxs)("p",{className:"text-2xl font-bold ".concat(t?"text-green-600":"text-amber-500"),children:["$",(e.pending_earnings||0).toFixed(2)]}),(0,ea.jsxs)("p",{className:"text-xs text-gray-500",children:["Total earned: $",(e.total_earnings||0).toFixed(2)]})]}),(0,ea.jsxs)(sg,{className:"bg-green-600 hover:bg-green-700",disabled:!t,onClick:()=>{A(e),V(e.paypal_email?"paypal":"bank_transfer"),S(!0)},"data-testid":"process-payout-".concat(e.affiliate_id),children:[(0,ea.jsx)(dr,{className:"w-4 h-4 mr-2"})," ",t?"Process Payout":"Below Minimum"]})]})]},e.affiliate_id)})})})]}),(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsxs)(oD,{className:"flex items-center gap-2",children:[(0,ea.jsx)($0,{
2className:"w-5 h-5"}),"Payout History"]}),(0,ea.jsx)(cD,{children:"Record of all processed payouts"})]}),(0,ea.jsx)(dD,{children:0===I.length?(0,ea.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,ea.jsx)($0,{className:"w-10 h-10 mx-auto mb-2 text-gray-300"}),(0,ea.jsx)("p",{children:"No payouts processed yet"})]}):(0,ea.jsx)("div",{className:"overflow-x-auto",children:(0,ea.jsxs)("table",{className:"w-full","data-testid":"payout-history-table",children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"border-b text-left text-sm text-gray-500",children:[(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Affiliate"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Amount"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Commissions"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Method"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Reference"}),(0,ea.jsx)("th",{className:"pb-3 font-medium",children:"Date"})]})}),(0,ea.jsx)("tbody",{children:I.map(e=>{var t;return(0,ea.jsxs)("tr",{className:"border-b last:border-0 hover:bg-gray-50",children:[(0,ea.jsxs)("td",{className:"py-3",children:[(0,ea.jsx)("p",{className:"font-medium",children:e.affiliate_name}),(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:e.affiliate_email})]}),(0,ea.jsxs)("td",{className:"py-3 font-bold text-green-600",children:["$",(e.amount||0).toFixed(2)]}),(0,ea.jsx)("td",{className:"py-3",children:e.commission_count}),(0,ea.jsx)("td",{className:"py-3",children:(0,ea.jsx)(EC,{variant:"outline",className:"capitalize",children:null===(t=e.method)||void 0===t?void 0:t.replace("_"," ")})}),(0,ea.jsx)("td",{className:"py-3 text-sm text-gray-600",children:e.reference||"-"}),(0,ea.jsx)("td",{className:"py-3 text-sm text-gray-500",children:e.created_at?new Date(e.created_at).toLocaleDateString():"-"})]},e.payout_id)})})]})})})]})]})}),(0,ea.jsx)(iJ,{value:"top",children:(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Top Performing Affiliates"}),(0,ea.jsx)(cD,{children:"Highest earning affiliate partners"})]}),(0,ea.jsx)(dD,{children:null!==c&&void 0!==c&&null!==(s=c.top_affiliates)&&void 0!==s&&s.length?(0,ea.jsx)("div",{className:"space-y-3",children:c.top_affiliates.map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-gray-50",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ".concat(0===t?"bg-yellow-100 text-yellow-700":1===t?"bg-gray-100 text-gray-700":2===t?"bg-orange-100 text-orange-700":"bg-gray-50 text-gray-500"),children:t+1}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold",children:e.name}),(0,ea.jsxs)("p",{className:"text-sm text-gray-500",children:["Code: ",e.referral_code]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("p",{className:"text-gray-500",children:"Conversions"}),(0,ea.jsx)("p",{className:"font-bold",children:e.total_conversions||0})]}),(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("p",{className:"text-gray-500",children:"Earnings"}),(0,ea.jsxs)("p",{className:"font-bold text-green-600",children:["$",(e.total_earnings||0).toFixed(2)]})]})]})]},e.referral_code))}):(0,ea.jsxs)("div",{className:"text-center py-12 text-gray-500",children:[(0,ea.jsx)(GN,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),(0,ea.jsx)("p",{children:"No affiliate data yet"})]})})]})})]}),(0,ea.jsx)(Ok,{open:w,onOpenChange:C,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Affiliate Details"}),(0,ea.jsx)(Gk,{children:"Review affiliate application and performance"})]}),E&&(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h3",{className:"text-lg font-semibold",children:E.name}),(0,ea.jsx)("p",{className:"text-sm text-gray-500",children:E.email})]}),(0,ea.jsx)(EC,{variant:"outline",className:G0[E.status]||"",children:E.status})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[E.website_url&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-gray-500",children:"Website"}),(0,ea.jsxs)("a",{href:E.website_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline flex items-center gap-1",children:[E.website_url," ",(0,ea.jsx)(bj,{className:"w-3 h-3"})]})]}),E.portfolio_url&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-gray-500",children:"Portfolio"}),(0,ea.jsxs)("a",{href:E.portfolio_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline flex items-center gap-1",children:[E.portfolio_url," ",(0,ea.jsx)(bj,{className:"w-3 h-3"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-gray-500",children:"Referral Code"}),(0,ea.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:E.referral_code})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-gray-500",children:"Applied"}),(0,ea.jsx)("p",{children:E.created_at?new Date(E.created_at).toLocaleDateString():"-"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm text-gray-500 mb-1",children:"Promotion Method"}),(0,ea.jsx)("p",{className:"text-sm bg-gray-50 p-3 rounded-lg",children:E.promotion_method})]}),"approved"===E.status&&(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,ea.jsx)(rD,{className:"bg-blue-50 border-blue-200",children:(0,ea.jsxs)(dD,{className:"pt-4 text-center",children:[(0,ea.jsx)("p",{className:"text-xs text-blue-600",children:"Clicks"}),(0,ea.jsx)("p",{className:"text-xl font-bold text-blue-700",children:E.total_clicks||0})]})}),(0,ea.jsx)(rD,{className:"bg-green-50 border-green-200",children:(0,ea.jsxs)(dD,{className:"pt-4 text-center",children:[(0,ea.jsx)("p",{className:"text-xs text-green-600",children:"Conversions"}),(0,ea.jsx)("p",{className:"text-xl font-bold text-green-700",children:E.total_conversions||0})]})}),(0,ea.jsx)(rD,{className:"bg-purple-50 border-purple-200",children:(0,ea.jsxs)(dD,{className:"pt-4 text-center",children:[(0,ea.jsx)("p",{className:"text-xs text-purple-600",children:"Earnings"}),(0,ea.jsxs)("p",{className:"text-xl font-bold text-purple-700",children:["$",(E.total_earnings||0).toFixed(2)]})]})})]}),(0,ea.jsxs)(qk,{className:"gap-2",children:["pending"===E.status&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)(sg,{className:"bg-green-600 hover:bg-green-700",onClick:()=>ae(E),disabled:P,"data-testid":"modal-approve-btn",children:[P?(0,ea.jsx)(ql,{className:"w-4 h-4 animate-spin mr-1"}):(0,ea.jsx)(cr,{className:"w-4 h-4 mr-1"}),"Approve"]}),(0,ea.jsxs)(sg,{variant:"destructive",onClick:()=>{D(!0)},disabled:P,"data-testid":"modal-reject-btn",children:[(0,ea.jsx)(fJ,{className:"w-4 h-4 mr-1"})," Reject"]})]}),"approved"===E.status&&(0,ea.jsx)(sg,{variant:"destructive",onClick:()=>(async e=>{B(!0);try{await _l.put("/admin/affiliates/".concat(e.affiliate_id,"/suspend")),qs.success("Suspended ".concat(e.name)),Z(),Q(),C(!1)}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to suspend affiliate")}finally{B(!1)}})(E),disabled:P,"data-testid":"modal-suspend-btn",children:"Suspend Affiliate"}),"suspended"===E.status&&(0,ea.jsx)(sg,{className:"bg-green-600 hover:bg-green-700",onClick:()=>(async e=>{B(!0);try{await _l.put("/admin/affiliates/".concat(e.affiliate_id,"/reinstate")),qs.success("Reinstated ".concat(e.name)),Z(),Q(),C(!1)}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to reinstate affiliate")}finally{B(!1)}})(E),disabled:P,"data-testid":"modal-reinstate-btn",children:"Reinstate Affiliate"})]})]})]})}),(0,ea.jsx)(Ok,{open:k,onOpenChange:D,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Reject Application"}),(0,ea.jsxs)(Gk,{children:["Provide a reason for rejecting ",null===E||void 0===E?void 0:E.name,"'s application."]})]}),(0,ea.jsx)("div",{className:"space-y-3",children:(0,ea.jsx)(YN,{placeholder:"Reason for rejection (optional)...",value:z,onChange:e=>M(e.target.value),className:"min-h-[80px]","data-testid":"rejection-reason-input"})}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),(0,ea.jsxs)(sg,{variant:"destructive",onClick:async()=>
2{if(E){B(!0);try{await _l.put("/admin/affiliates/".concat(E.affiliate_id,"/reject"),{approved:!1,rejection_reason:z}),qs.success("Rejected ".concat(E.name,"'s application")),D(!1),M(""),X(),Z(),Q(),C(!1)}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to reject affiliate")}finally{B(!1)}}},disabled:P,"data-testid":"confirm-reject-btn",children:[P?(0,ea.jsx)(ql,{className:"w-4 h-4 animate-spin mr-1"}):null,"Reject Application"]})]})]})}),(0,ea.jsx)(Ok,{open:_,onOpenChange:S,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Process Payout"}),(0,ea.jsxs)(Gk,{children:["Send payout of ",(0,ea.jsxs)("strong",{className:"text-green-600",children:["$",((null===E||void 0===E?void 0:E.pending_earnings)||0).toFixed(2)]})," to ",null===E||void 0===E?void 0:E.name]})]}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Payment Method"}),(0,ea.jsxs)(eb,{value:W,onValueChange:V,children:[(0,ea.jsx)(sb,{"data-testid":"payout-method-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"paypal",children:"PayPal"}),(0,ea.jsx)(rb,{value:"bank_transfer",children:"Bank Transfer"}),(0,ea.jsx)(rb,{value:"crypto",children:"Cryptocurrency"}),(0,ea.jsx)(rb,{value:"other",children:"Other"})]})]}),(null===E||void 0===E?void 0:E.paypal_email)&&"paypal"===W&&(0,ea.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:["PayPal: ",E.paypal_email]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Transaction Reference"}),(0,ea.jsx)(BN,{placeholder:"e.g., PayPal Transaction ID, Wire reference...",value:q,onChange:e=>$(e.target.value),"data-testid":"payout-reference-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Notes (optional)"}),(0,ea.jsx)(YN,{placeholder:"Internal notes about this payout...",value:G,onChange:e=>
2K(e.target.value),className:"min-h-[60px]","data-testid":"payout-notes-input"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),(0,ea.jsxs)(sg,{className:"bg-green-600 hover:bg-green-700",onClick:()=>(async e=>{B(!0);try{const t=await _l.post("/admin/affiliates/".concat(e.affiliate_id,"/payout"),{method:W,reference:q||null,notes:G||null});qs.success(t.data.message),S(!1),V("paypal"),$(""),K(""),A(null),ee(),te(),Q()}catch(a){var t,s;qs.error((null===(t=a.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Failed to process payout")}finally{B(!1)}})(E),disabled:P,"data-testid":"confirm-payout-btn",children:[P?(0,ea.jsx)(ql,{className:"w-4 h-4 animate-spin mr-1"}):(0,ea.jsx)(dr,{className:"w-4 h-4 mr-1"}),"Send $",((null===E||void 0===E?void 0:E.pending_earnings)||0).toFixed(2)]})]})]})})]})})}const J0=()=>{const{user:e}=Al(),[s,a]=(0,t.useState)([]),[n,l]=(0,t.useState)(!0),[r,i]=(0,t.useState)(!1),[o,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)(null),[h,x]=(0,t.useState)({email:"",role:"editor",message:""}),[p,g]=(0,t.useState)(!1),f="admin"===(null===e||void 0===e?void 0:e.role)||"super_admin"===(null===e||void 0===e?void 0:e.role),v=(0,t.useCallback)(async()=>{l(!0);try{const e=await _l.get("/tenant-memberships/members");a(e.data.members||[])}catch(e){console.error("Failed to fetch members:",e),qs.error("Failed to load team members")}finally{l(!1)}},[]);(0,t.useEffect)(()=>{v()},[v]);const b=e=>{const t={owner:"bg-purple-100 text-purple-700",admin:"bg-red-100 text-red-700",super_admin:"bg-red-100 text-red-700",editor:"bg-blue-100 text-blue-700",viewer:"bg-slate-100 text-slate-700",support:"bg-amber-100 text-amber-700"};return t[e]||t.editor},j=e=>{switch(e){case"active":return(0,ea.jsxs)(EC,{className:"bg-green-100 text-green-700",children:[(0,ea.jsx)(uD,{size:12,className:"mr-1"})," Active"]});case"pending":return(0,ea.jsxs)(EC,{className:"bg-amber-100 text-amber-700",children:[(0,ea.jsx)(Kg,{size:12,className:"mr-1"})," Pending"]});case"suspended":return(0,ea.jsxs)(EC,{className:"bg-red-100 text-red-700",children:[(0,ea.jsx)(fJ,{size:12,className:"mr-1"})," Suspended"]});default:return(0,ea.jsx)(EC,{variant:"outline",children:e})}};return f?(0,ea.jsxs)("div",{className:"p-8 max-w-6xl mx-auto",children:[(0,ea.jsxs)(Nt,{to:"/dashboard",className:"inline-flex items-center gap-2 text-slate-500 hover:text-slate-700 mb-6 transition-colors",children:[(0,ea.jsx)(_j,{size:16}),"Back to Dashboard"]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[(0,ea.jsx)(Bj,{size:32}),"Organization Members"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1",children:"Manage who has access to this organization"})]}),(0,ea.jsxs)(sg,{onClick:()=>i(!0),className:"gap-2",children:[(0,ea.jsx)(GJ,{size:18}),"Invite User"]})]}),(0,ea.jsxs)(lQ,{className:"mb-6 bg-indigo-50 border-indigo-200",children:[(0,ea.jsx)(Bw,{size:16,className:"text-indigo-600"}),(0,ea.jsxs)(rQ,{className:"text-indigo-700",children:[(0,ea.jsx)("strong",{children:"Multi-Organization Access:"})," You can invite existing NexusCMS users to access your organization. They will be able to switch between their own organization and yours using the organization switcher."]})]}),(0,ea.jsxs)(rD,{children:[(0,ea.jsxs)(iD,{children:[(0,ea.jsx)(oD,{children:"Team Members"}),(0,ea.jsxs)(cD,{children:[s.length," member",1!==s.length?"s":""," with access to this organization"]})]}),(0,ea.jsx)(dD,{children:n?(0,ea.jsx)("div",{className:"text-center py-8 text-slate-500",children:"Loading..."}):0===s.length?(0,ea.jsx)("div",{className:"text-center py-8 text-slate-500",children:"No team members yet. Invite someone to get started!"}):(0,ea.jsxs)(yQ,{children:[(0,ea.jsx)(NQ,{children:(0,ea.jsxs)(CQ,{children:[(0,ea.jsx)(kQ,{children:"User"}),(0,ea.jsx)(kQ,{children:"Role"}),(0,ea.jsx)(kQ,{children:"Type"}),(0,ea.jsx)(kQ,{children:"Status"}),(0,ea.jsx)(kQ,{children:"Last Active"}),(0,ea.jsx)(kQ,{className:"text-right",children:"Actions"})]})}),(0,ea.jsx)(wQ,{children:s.map(e=>(0,ea.jsxs)(CQ,{children:[(0,ea.jsx)(DQ,{children:(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium",children:e.full_name||"Unknown"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:e.email})]})}),(0,ea.jsx)(DQ,{children:(0,ea.jsx)(EC,{className:b(e.role),children:e.role})}),(0,ea.jsx)(DQ,{children:"primary"===e.membership_type?(0,ea.jsxs)(EC,{variant:"outline",className:"gap-1",children:[(0,ea.jsx)(Bw,{size:12}),"Primary"]}):(0,ea.jsxs)(EC,{variant:"outline",className:"gap-1 bg-slate-50",children:[(0,ea.jsx)(Bj,{size:12}),"Guest"]})}),(0,ea.jsx)(DQ,{children:j(e.status)}),(0,ea.jsx)(DQ,{children:e.last_accessed_at?(0,ea.jsx)("span",{className:"text-sm text-slate-500",children:new Date(e.last_accessed_at).toLocaleDateString()}):e.accepted_at?(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:["Joined ",new Date(e.accepted_at).toLocaleDateString()]}):(0,ea.jsx)("span",{className:"text-sm text-slate-400",children:"Never"})}),(0,ea.jsx)(DQ,{className:"text-right",children:"guest"===e.membership_type&&(0,ea.jsxs)(Fp,{children:[(0,ea.jsx)(Tp,{asChild:!0,children:(0,ea.jsx)(sg,{variant:"ghost",size:"sm",children:(0,ea.jsx)(yD,{size:16})})}),(0,ea.jsx)(Bp,{align:"end",children:(0,ea.jsxs)(Rp,{className:"text-red-600",onClick:()=>{m(e),c(!0)},children:[(0,ea.jsx)(wD,{size:14,className:"mr-2"}),"Revoke Access"]})})]})})]},e.user_id+(e.membership_id||"")))})]})})]}),(0,ea.jsx)(Ok,{open:r,onOpenChange:i,children:(0,ea.jsxs)(Wk,{className:"max-w-md",children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsxs)($k,{className:"flex items-center gap-2",children:[(0,ea.jsx)(GJ,{size:20}),"Invite User to Organization"]}),(0,ea.jsx)(Gk,{children:"Invite an existing NexusCMS user to access your organization. They will receive an invitation they can accept or decline."})]}),(0,ea.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Email Address *"}),(0,ea.jsx)(BN,{type:"email",value:h.email,onChange:e=>x(d(d({},h),{},{email:e.target.value})),placeholder:"[email protected]"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"The user must already have a NexusCMS account"})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Access Role"}),(0,ea.jsxs)(eb,{value:h.role,onValueChange:e=>x(d(d({},h),{},{role:e})),children:[(0,ea.jsx)(sb,{children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"admin",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Kl,{size:14,className:"text-red-500"}),"Admin - Full access"]})}),(0,ea.jsx)(rb,{value:"editor",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Bj,{size:14,className:"text-blue-500"}),"Editor - Create & edit content"]})}),(0,ea.jsx)(rb,{value:"viewer",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Bj,{size:14,className:"text-slate-500"}),"Viewer - Read-only access"]})}),(0,ea.jsx)(rb,{value:"support",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Bj,{size:14,className:"text-amber-500"}
2),"Support - View & limited edit"]})})]})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsx)(tf,{children:"Personal Message (Optional)"}),(0,ea.jsx)(YN,{value:h.message,onChange:e=>x(d(d({},h),{},{message:e.target.value})),placeholder:"Add a personal note to the invitation...",rows:3})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),(0,ea.jsxs)(sg,{onClick:async()=>{if(h.email){g(!0);try{await _l.post("/tenant-memberships/invite",h),qs.success("Invitation sent to ".concat(h.email)),i(!1),x({email:"",role:"editor",message:""}),v()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to send invitation")}finally{g(!1)}}else qs.error("Please enter an email address")},disabled:p,className:"gap-2",children:[(0,ea.jsx)(Yl,{size:16}),p?"Sending...":"Send Invitation"]})]})]})}),(0,ea.jsx)(Ok,{open:o,onOpenChange:c,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsxs)(Vk,{children:[(0,ea.jsx)($k,{children:"Revoke Access"}),(0,ea.jsx)(Gk,{children:"Are you sure you want to revoke access for this user?"})]}),u&&(0,ea.jsx)(lQ,{className:"bg-red-50 border-red-200",children:(0,ea.jsxs)(rQ,{className:"text-red-800",children:[(0,ea.jsx)("strong",{children:u.full_name||u.email})," will no longer be able to access this organization. They will still have access to their own organization."]})}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:async()=>{if(null!==u&&void 0!==u&&u.membership_id)try{await _l.delete("/tenant-memberships/".concat(u.membership_id)),qs.success("Access revoked successfully"),c(!1),m(null),v()}catch(s){var e,t;qs.error((null===(e=s.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to revoke access")}},children:"Revoke Access"})]})]})})]}):(0,ea.jsx)("div",{className:"p-8",children:(0,ea.jsxs)(lQ,{children:[(0,ea.jsx)(AN,{size:16}),(0,ea.jsx)(rQ,{children:"You need admin privileges to manage team members."})]})})},Q0=Vl("arrow-down-right",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]),X0=Vl("message-square",[["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"}]]),Z0=Vl("arrow-right-left",[["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"}]]),e1=Vl("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"}]]);var t1=.999,s1=/[\\\/_+.#"@\[\(\{&]/,a1=/[\\\/_+.#"@\[\(\{&]/g,n1=/[\s-]/,l1=/[\s-]/g;function r1(e,t,s,a,n,l,r){if(l===t.length)return n===e.length?1:.99;var i="".concat(n,",").concat(l);if(void 0!==r[i])return r[i];for(var o,c,d,u,m=a.charAt(l),h=s.indexOf(m,n),x=0;h>=0;)(o=r1(e,t,s,a,h+1,l+1,r))>x&&(h===n?o*=1:s1.test(e.charAt(h-1))?(o*=.8,(d=e.slice(n,h-1).match(a1))&&n>0&&(o*=Math.pow(t1,d.length))):n1.test(e.charAt(h-1))?(o*=.9,(u=e.slice(n,h-1).match(l1))&&n>0&&(o*=Math.pow(t1,u.length))):(o*=.17,n>0&&(o*=Math.pow(t1,h-n))),e.charAt(h)!==t.charAt(l)&&(o*=.9999)),(o<.1&&s.charAt(h-1)===a.charAt(l+1)||a.charAt(l+1)===a.charAt(l)&&s.charAt(h-1)!==a.charAt(l))&&(.1*(c=r1(e,t,s,a,h+1,l+2,r))>o&&(o=.1*c)),o>x&&(x=o),h=s.indexOf(m,h+1);return r[i]=x,x}function i1(e){return e.toLowerCase().replace(l1," ")}function o1(e,t,s){return r1(e=s&&s.length>0?"".concat(e+" "+s.join(" ")):e,t,i1(e),i1(t),0,0,{})}const c1=["asChild"];var d1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,s)=>{const a=qp("Primitive.".concat(s)),n=t.forwardRef((e,t)=>{const{asChild:n}=e,r=l(e,c1),i=n?a:s;return"undefined"!==typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ea.jsx)(i,d(d({},r),{},{ref:t}))});return n.displayName="Primitive.".concat(s),d(d({},e),{},{[s]:n})},{});const u1=["label","children","value","onValueChange","filter","shouldFilter","loop","disablePointerSelection","vimBindings"],m1=["disabled","value","onSelect","forceMount","keywords"],h1=["heading","children","forceMount"],x1=["alwaysRender"],p1=["onValueChange"],g1=["children","label"],f1=["open","onOpenChange","overlayClassName","contentClassName","container"],v1=["progress","children","label"];var b1='[cmdk-group=""]',j1='[cmdk-group-items=""]',y1='[cmdk-item=""]',N1="".concat(y1,':not([aria-disabled="true"])'),w1="cmdk-item-select",C1="data-value",k1=(e,t,s)=>o1(e,t,s),D1=t.createContext(void 0),_1=()=>t.useContext(D1),S1=t.createContext(void 0),E1=()=>t.useContext(S1),A1=t.createContext(void 0),F1=t.forwardRef((e,s)=>{let a=q1(()=>{var t,s;return{search:"",value:null!=(s=null!=(t=e.value)?t:e.defaultValue)?s:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=q1(()=>new Set),r=q1(()=>new Map),i=q1(()=>new Map),o=q1(()=>new Set),c=W1(e),{label:u,children:m,value:h,onValueChange:x,filter:p,shouldFilter:g,loop:f,disablePointerSelection:v=!1,vimBindings:b=!0}=e,j=l(e,u1),y=ki(),N=ki(),w=ki(),C=t.useRef(null),k=K1();V1(()=>
2{if(void 0!==h){let e=h.trim();a.current.value=e,D.emit()}},[h]),V1(()=>{k(6,T)},[]);let D=t.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>a.current,setState:(e,t,s)=>{var n,l,r,i;if(!Object.is(a.current[e],t)){if(a.current[e]=t,"search"===e)F(),E(),k(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(n=document.getElementById(y))||n.focus()}if(k(7,()=>{var e;a.current.selectedItemId=null==(e=z())?void 0:e.id,D.emit()}),s||k(5,T),void 0!==(null==(l=c.current)?void 0:l.value)){let e=null!=t?t:"";return void(null==(i=(r=c.current).onValueChange)||i.call(r,e))}}D.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),_=t.useMemo(()=>({value:(e,t,s)=>{var n;t!==(null==(n=i.current.get(e))?void 0:n.value)&&(i.current.set(e,{value:t,keywords:s}),a.current.filtered.items.set(e,S(t,s)),k(2,()=>{E(),D.emit()}))},item:(e,t)=>(n.current.add(e),t&&(r.current.has(t)?r.current.get(t).add(e):r.current.set(t,new Set([e]))),k(3,()=>{F(),E(),a.current.value||A(),D.emit()}),()=>{i.current.delete(e),n.current.delete(e),a.current.filtered.items.delete(e);let t=z();k(4,()=>{F(),(null==t?void 0:t.getAttribute("id"))===e&&A(),D.emit()})}),group:e=>(r.current.has(e)||r.current.set(e,new Set),()=>{i.current.delete(e),r.current.delete(e)}),filter:()=>c.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:y,inputId:w,labelId:N,listInnerRef:C}),[]);function S(e,t){var s,n;let l=null!=(n=null==(s=c.current)?void 0:s.filter)?n:k1;return e?l(e,a.current.search,t):0}function E(){if(!a.current.search||!1===c.current.shouldFilter)return;let e=a.current.filtered.items,t=[];a.current.filtered.groups.forEach(s=>{let a=r.current.get(s),n=0;a.forEach(t=>{let s=e.get(t);n=Math.max(s,n)}),t.push([s,n])});let s=C.current;M().sort((t,s)=>{var a,n;let l=t.getAttribute("id"),r=s.getAttribute("id");return(null!=(a=e.get(r))?a:0)-(null!=(n=e.get(l))?n:0)}).forEach(e=>{let t=e.closest(j1);t?t.appendChild(e.parentElement===t?e:e.closest("".concat(j1," > *"))):s.appendChild(e.parentElement===s?e:e.closest("".concat(j1," > *")))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let s=null==(t=C.current)?void 0:t.querySelector("".concat(b1,"[").concat(C1,'="').concat(encodeURIComponent(e[0]),'"]'));null==s||s.parentElement.appendChild(s)})}function A(){let e=M().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(C1);D.setState("value",t||void 0)}function F(){var e,t,s,l;if(!a.current.search||!1===c.current.shouldFilter)return void(a.current.filtered.count=n.current.size);a.current.filtered.groups=new Set;let o=0;for(let r of n.current){let n=S(null!=(t=null==(e=i.current.get(r))?void 0:e.value)?t:"",null!=(l=null==(s=i.current.get(r))?void 0:s.keywords)?l:[]);a.current.filtered.items.set(r,n),n>0&&o++}for(let[n,i]of r.current)for(let e of i)if(a.current.filtered.items.get(e)>0){a.current.filtered.groups.add(n);break}a.current.filtered.count=o}function T(){var e,t,s;let a=z();a&&((null==(e=a.parentElement)?void 0:e.firstChild)===a&&(null==(s=null==(t=a.closest(b1))?void 0:t.querySelector('[cmdk-group-heading=""]'))||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function z(){var e;return null==(e=C.current)?void 0:e.querySelector("".concat(y1,'[aria-selected="true"]'))}function M(){var e;return Array.from((null==(e=C.current)?void 0:e.querySelectorAll(N1))||[])}function P(e){let t=M()[e];t&&D.setState("value",t.getAttribute(C1))}function B(e){var t;let s=z(),a=M(),n=a.findIndex(e=>e===s),l=a[n+e];null!=(t=c.current)&&t.loop&&(l=n+e<0?a[a.length-1]:n+e===a.length?a[0]:a[n+e]),l&&D.setState("value",l.getAttribute(C1))}function R(e){let t,s=z(),a=null==s?void 0:s.closest(b1);for(;a&&!t;)a=e>0?U1(a,b1):H1(a,b1),t=null==a?void 0:a.querySelector(N1);t?D.setState("value",t.getAttribute(C1)):B(e)}let L=()=>P(M().length-1),I=e=>{e.preventDefault(),e.metaKey?L():e.altKey?R(1):B(1)},O=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?R(-1):B(-1)};return t.createElement(d1.div,d(d({ref:s,tabIndex:-1},j),{},{"cmdk-root":"",onKeyDown:e=>{var t;null==(t=j.onKeyDown)||t.call(j,e);let s=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!s)switch(e.key){case"n":case"j":b&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":b&&e.ctrlKey&&O(e);break;case"ArrowUp":O(e);break;case"Home":e.preventDefault(),P(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=z();if(t){let e=new Event(w1);t.dispatchEvent(e)}}}}}),t.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:J1}
2,u),Y1(e,e=>t.createElement(S1.Provider,{value:D},t.createElement(D1.Provider,{value:_},e))))}),T1=t.forwardRef((e,s)=>{var a,n;let r=ki(),i=t.useRef(null),o=t.useContext(A1),c=_1(),u=W1(e),m=null!=(n=null==(a=u.current)?void 0:a.forceMount)?n:null==o?void 0:o.forceMount;V1(()=>{if(!m)return c.item(r,null==o?void 0:o.id)},[m]);let h=G1(r,i,[e.value,e.children,i],e.keywords),x=E1(),p=$1(e=>e.value&&e.value===h.current),g=$1(e=>!(!m&&!1!==c.filter())||(!e.search||e.filtered.items.get(r)>0));function f(){var e,t;v(),null==(t=(e=u.current).onSelect)||t.call(e,h.current)}function v(){x.setState("value",h.current,!0)}if(t.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(w1,f),()=>t.removeEventListener(w1,f)},[g,e.onSelect,e.disabled]),!g)return null;let{disabled:b,value:j,onSelect:y,forceMount:N,keywords:w}=e,C=l(e,m1);return t.createElement(d1.div,d(d({ref:gr(i,s)},C),{},{id:r,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!p,"data-disabled":!!b,"data-selected":!!p,onPointerMove:b||c.getDisablePointerSelection()?void 0:v,onClick:b?void 0:f}),e.children)}),z1=t.forwardRef((e,s)=>{let{heading:a,children:n,forceMount:r}=e,i=l(e,h1),o=ki(),c=t.useRef(null),u=t.useRef(null),m=ki(),h=_1(),x=$1(e=>!(!r&&!1!==h.filter())||(!e.search||e.filtered.groups.has(o)));V1(()=>h.group(o),[]),G1(o,c,[e.value,e.heading,u]);let p=t.useMemo(()=>({id:o,forceMount:r}),[r]);return t.createElement(d1.div,d(d({ref:gr(c,s)},i),{},{"cmdk-group":"",role:"presentation",hidden:!x||void 0}),a&&t.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:m},a),Y1(e,e=>t.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?m:void 0},t.createElement(A1.Provider,{value:p},e))))}),M1=t.forwardRef((e,s)=>{let{alwaysRender:a}=e,n=l(e,x1),r=t.useRef(null),i=$1(e=>!e.search);return a||i?t.createElement(d1.div,d(d({ref:gr(r,s)},n),{},{"cmdk-separator":"",role:"separator"})):null}),P1=t.forwardRef((e,s)=>{let{onValueChange:a}=e,n=l(e,p1),r=null!=e.value,i=E1(),o=$1(e=>e.search),c=$1(e=>e.selectedItemId),u=_1();return t.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),t.createElement(d1.input,d(d({ref:s},n),{},{"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":c,id:u.inputId,type:"text",value:r?e.value:o,onChange:e=>{r||i.setState("search",e.target.value),null==a||a(e.target.value)}}))}),B1=t.forwardRef((e,s)=>{let{children:a,label:n="Suggestions"}=e,r=l(e,g1),i=t.useRef(null),o=t.useRef(null),c=$1(e=>e.selectedItemId),u=_1();return t.useEffect(()=>{if(o.current&&i.current){let e,t=o.current,s=i.current,a=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;s.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return a.observe(t),()=>{cancelAnimationFrame(e),a.unobserve(t)}}},[]),t.createElement(d1.div,d(d({ref:gr(i,s)},r),{},{"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":n,id:u.listId}),Y1(e,e=>t.createElement("div",{ref:gr(o,u.listInnerRef),"cmdk-list-sizer":""},e)))}),R1=t.forwardRef((e,s)=>{let{open:a,onOpenChange:n,overlayClassName:r,contentClassName:i,container:o}=e,c=l(e,f1);return t.createElement(Dk,{open:a,onOpenChange:n},t.createElement(Sk,{container:o},t.createElement(Ek,{"cmdk-overlay":"",className:r}),t.createElement(Ak,{"aria-label":e.label,"cmdk-dialog":"",className:i},t.createElement(F1,d({ref:s},c)))))}),L1=t.forwardRef((e,s)=>$1(e=>0===e.filtered.count)?t.createElement(d1.div,d(d({ref:s},e),{},{"cmdk-empty":"",role:"presentation"})):null),I1=t.forwardRef((e,s)=>{let{progress:a,children:n,label:r="Loading..."}=e,i=l(e,v1);return t.createElement(d1.div,d(d({ref:s},i),{},{"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r}),Y1(e,e=>t.createElement("div",{"aria-hidden":!0},e)))}),O1=Object.assign(F1,{List:B1,Item:T1,Input:P1,Group:z1,Separator:M1,Dialog:R1,Empty:L1,Loading:I1});function U1(e,t){let s=e.nextElementSibling;for(;s;){if(s.matches(t))return s;s=s.nextElementSibling}}function H1(e,t){let s=e.previousElementSibling;for(;s;){if(s.matches(t))return s;s=s.previousElementSibling}}function W1(e){let s=t.useRef(e);return V1(()=>{s.current=e}),s}var V1="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function q1(e){let s=t.useRef();return void 0===s.current&&(s.current=e()),s}function $1(e){let s=E1(),a=()=>e(s.snapshot());return t.useSyncExternalStore(s.subscribe,a,a)}function G1(e,s,a){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],l=t.useRef(),r=_1();return V1(()=>{var t;let i=(()=>{var e;
2for(let t of a){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():l.current}})(),o=n.map(e=>e.trim());r.value(e,i,o),null==(t=s.current)||t.setAttribute(C1,i),l.current=i}),l}var K1=()=>{let[e,s]=t.useState(),a=q1(()=>new Map);return V1(()=>{a.current.forEach(e=>e()),a.current=new Map},[e]),(e,t)=>{a.current.set(e,t),s({})}};function Y1(e,s){let{asChild:a,children:n}=e;return a&&t.isValidElement(n)?t.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(n),{ref:n.ref},s(n.props.children)):s(n)}var J1={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Q1=["className"],X1=["className"],Z1=["className"],e2=["className"],t2=["className"],s2=["className"],a2=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Q1);return(0,ea.jsx)(O1,d({ref:t,className:Np("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s)},a))});a2.displayName=O1.displayName;const n2=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,X1);return(0,ea.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,ea.jsx)(fj,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,ea.jsx)(O1.Input,d({ref:t,className:Np("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s)},a))]})});n2.displayName=O1.Input.displayName;const l2=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,Z1);return(0,ea.jsx)(O1.List,d({ref:t,className:Np("max-h-[300px] overflow-y-auto overflow-x-hidden",s)},a))});l2.displayName=O1.List.displayName;const r2=t.forwardRef((e,t)=>(0,ea.jsx)(O1.Empty,d({ref:t,className:"py-6 text-center text-sm"},e)));r2.displayName=O1.Empty.displayName;const i2=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,e2);return(0,ea.jsx)(O1.Group,d({ref:t,className:Np("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",s)},a))});i2.displayName=O1.Group.displayName;t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,t2);return(0,ea.jsx)(O1.Separator,d({ref:t,className:Np("-mx-1 h-px bg-border",s)},a))}).displayName=O1.Separator.displayName;const o2=t.forwardRef((e,t)=>{let{className:s}=e,a=l(e,s2);return(0,ea.jsx)(O1.Item,d({ref:t,className:Np("relative flex cursor-default gap-2 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-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",s)},a))});o2.displayName=O1.Item.displayName;const c2={en:"English",fr:"French",de:"German",es:"Spanish",it:"Italian",pt:"Portuguese",nl:"Dutch",pl:"Polish",da:"Danish",sv:"Swedish",no:"Norwegian",fi:"Finnish",ru:"Russian",uk:"Ukrainian",cs:"Czech",el:"Greek",tr:"Turkish",ar:"Arabic",zh:"Chinese",ja:"Japanese",ko:"Korean",hi:"Hindi",ro:"Romanian",hu:"Hungarian",bg:"Bulgarian"},d2=e=>{let{icon:t,label:s,value:a,subValue:n,trend:l,color:r="indigo"}=e;return(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 hover:shadow-md transition-shadow",children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-lg bg-".concat(r,"-100 flex items-center justify-center"),children:(0,ea.jsx)(t,{className:"text-".concat(r,"-600"),size:24})}),void 0!==l&&(0,ea.jsxs)("div",{className:"flex items-center gap-1 text-sm ".concat(l>=0?"text-emerald-600":"text-red-500"),children:[l>=0?(0,ea.jsx)(mD,{size:16}):(0,ea.jsx)(Q0,{size:16}),Math.abs(l),"%"]})]}),(0,ea.jsx)("p",{className:"text-3xl font-bold mt-4",children:(null===a||void 0===a?void 0:a.toLocaleString())||0}),(0,ea.jsx)("p",{className:"text-slate-600 text-sm",children:s}),n&&(0,ea.jsx)("p",{className:"text-slate-400 text-xs mt-1",children:n})]})},u2=e=>{let{data:t,height:s=100}=e;if(!t||0===t.length)return null;const a=Math.max(...t.map(e=>e.value),1);
2return(0,ea.jsx)("div",{className:"flex items-end gap-1",style:{height:s},children:t.slice(-30).map((e,t)=>(0,ea.jsx)("div",{className:"flex-1 bg-indigo-500 rounded-t hover:bg-indigo-600 transition-colors cursor-pointer group relative",style:{height:"".concat(e.value/a*100,"%"),minHeight:e.value>0?4:0},title:"".concat(e.label,": ").concat(e.value),children:(0,ea.jsxs)("div",{className:"absolute bottom-full mb-1 left-1/2 -translate-x-1/2 bg-slate-800 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 whitespace-nowrap pointer-events-none z-10",children:[e.label,": ",e.value]})},t))})},m2=e=>{let{label:t,value:s,total:a,color:n="indigo"}=e;const l=a>0?s/a*100:0;return(0,ea.jsxs)("div",{className:"mb-3",children:[(0,ea.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:t}),(0,ea.jsx)("span",{className:"font-medium",children:s.toLocaleString()})]}),(0,ea.jsx)("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full bg-".concat(n,"-500 rounded-full transition-all duration-500"),style:{width:"".concat(Math.min(l,100),"%")}})})]})},h2=()=>{var e,s,a,n,l,r,i,o,c,u,m,h,x,p,g,f,v,b,j,y,N,w,C,k,D,_,S,E,A,F,T,z,M,P,B,R,L,I,O,U,H,W,V,q,$,G,K,Y,J,Q,X,Z,ee,te,se,ae,ne,le,re,ie,oe;const[ce,de]=(0,t.useState)(!0),[ue,me]=(0,t.useState)(!1),[he,xe]=(0,t.useState)(null),[pe,ge]=(0,t.useState)(null),[fe,ve]=(0,t.useState)(null),[be,je]=(0,t.useState)(null),[ye,Ne]=(0,t.useState)(null),[we,Ce]=(0,t.useState)(null),[ke,De]=(0,t.useState)("30"),[_e,Se]=(0,t.useState)("30"),[Ee,Ae]=(0,t.useState)("30"),[Fe,Te]=(0,t.useState)(null),[ze,Me]=(0,t.useState)(null),[Pe,Be]=(0,t.useState)(!1),[Re,Le]=(0,t.useState)(!1),[Ie,Oe]=(0,t.useState)("30"),[Ue,He]=(0,t.useState)([]),[We,Ve]=(0,t.useState)([]),[qe,$e]=(0,t.useState)(!1);(0,t.useEffect)(()=>{Ge(),(async()=>{try{var e;const[t,s]=await Promise.all([_l.get("/pages").catch(()=>({data:[]})),_l.get("/articles").catch(()=>({data:[]}))]);He(Array.isArray(t.data)?t.data:[]);const a=Array.isArray(s.data)?s.data:(null===(e=s.data)||void 0===e?void 0:e.articles)||[];Ve(a)}catch(G2){}})()},[]),(0,t.useEffect)(()=>{Ke()},[ke]),(0,t.useEffect)(()=>{Ye()},[_e]),(0,t.useEffect)(()=>{Je()},[Ee]),(0,t.useEffect)(()=>{Fe&&Qe(Fe.page_id,Fe.type)},[Fe,Ie]);const Ge=async()=>{de(!0);try{const[e,t,s,a,n,l]=await Promise.all([_l.get("/analytics/overview"),_l.get("/analytics/subscribers?days=".concat(ke)),_l.get("/analytics/newsletters"),_l.get("/analytics/translation"),_l.get("/analytics/content?days=".concat(_e)),_l.get("/analytics/traffic?days=".concat(Ee))]);xe(e.data),ge(t.data),ve(s.data),je(a.data),Ne(n.data),Ce(l.data)}catch(e){console.error("Failed to fetch analytics:",e),qs.error("Failed to load analytics")}finally{de(!1)}},Ke=async()=>{try{const e=await _l.get("/analytics/subscribers?days=".concat(ke));ge(e.data)}catch(e){console.error("Failed to fetch subscriber analytics:",e)}},Ye=async()=>{try{const e=await _l.get("/analytics/content?days=".concat(_e));Ne(e.data)}catch(e){console.error("Failed to fetch content analytics:",e)}},Je=async()=>{try{const e=await _l.get("/analytics/traffic?days=".concat(Ee));Ce(e.data)}catch(e){console.error("Failed to fetch traffic analytics:",e)}},Qe=async(e,t)=>{Be(!0);try{const s="article"===t?"/analytics/article/".concat(e,"?days=").concat(Ie):"/analytics/page/".concat(e,"?days=").concat(Ie),a=await _l.get(s);Me(a.data)}catch(s){console.error("Failed to fetch page analytics:",s),qs.error("Failed to load page analytics")}finally{Be(!1)}},Xe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"page";Te(d(d({},e),{},{type:t,page_id:e.page_id||e.article_id})),Le(!0)},Ze=(null===pe||void 0===pe||null===(e=pe.growth)||void 0===e?void 0:e.map(e=>({label:e.date,value:e.new})))||[],et=(null===pe||void 0===pe||pe.total_active,Object.values((null===pe||void 0===pe?void 0:pe.by_source)||{}).reduce((e,t)=>e+t,0));return(0,ea.jsxs)("div",{className:"flex","data-testid":"analytics-page",children:[(0,ea.jsx)(Zk,{}),(0,ea.jsx)("div",{className:"flex-1 min-w-0 bg-slate-50 p-8",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h1",{className:"text-4xl font-bold mb-2",style:{fontFamily:"Manrope, sans-serif"},children:"Analytics"}),(0,ea.jsx)("p",{className:"text-slate-600",children:"Track your content performance and audience growth"})]}),(0,ea.jsxs)(sg,{variant:"outline",onClick:async()=>{me(!0),await Ge(),me(!1),qs.success("Analytics refreshed")},disabled:ue,"data-testid":"refresh-analytics",children:[(0,ea.jsx)(gq,{size:18,className:"mr-2 ".concat(ue?"animate-spin":"")}),"Refresh"]})]}),ce?(0,ea.jsxs)("div",{className:"text-center py-20",children:[(0,ea.jsx)(gq,{size:40,className:"animate-spin mx-auto text-indigo-600 mb-4"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading analytics..."})]}):(0,ea.jsxs)("div",{className:"space-y-8",children:[(0,ea.jsxs)("section",{children:[(0,ea.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Cw,{size:20,className:"text-indigo-600"}),"Overview"]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,ea.jsx)(d2,{icon:qN,label:"Total Pages",value:null===he||void 0===he||null===(s=he.content)||void 0===s?void 0:s.pages,color:"indigo"}),(0,ea.jsx)(d2,{icon:Yl,label:"Newsletters Sent",value:null===he||void 0===he||null===(a=he.email)||void 0===a?void 0:a.total_sent,subValue:"".concat((null===he||void 0===he||null===(n=he.content)||void 0===n?void 0:n.newsletters)||0," campaigns"),
2color:"emerald"}),(0,ea.jsx)(d2,{icon:Bj,label:"Active Subscribers",value:null===he||void 0===he||null===(l=he.subscribers)||void 0===l?void 0:l.total,color:"blue"}),(0,ea.jsx)(d2,{icon:X0,label:"Form Submissions",value:null===he||void 0===he||null===(r=he.subscribers)||void 0===r?void 0:r.form_submissions,subValue:"".concat((null===he||void 0===he||null===(i=he.content)||void 0===i?void 0:i.forms)||0," forms"),color:"purple"})]})]}),(0,ea.jsxs)("section",{children:[(0,ea.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Yl,{size:20,className:"text-emerald-600"}),"Email Performance"]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,ea.jsx)(d2,{icon:IN,label:"Open Rate",value:"".concat((null===he||void 0===he||null===(o=he.email)||void 0===o?void 0:o.open_rate)||0,"%"),subValue:"".concat((null===he||void 0===he||null===(c=he.email)||void 0===c||null===(u=c.total_opens)||void 0===u?void 0:u.toLocaleString())||0," total opens"),color:"emerald"}),(0,ea.jsx)(d2,{icon:Eq,label:"Click Rate",value:"".concat((null===he||void 0===he||null===(m=he.email)||void 0===m?void 0:m.click_rate)||0,"%"),subValue:"".concat((null===he||void 0===he||null===(h=he.email)||void 0===h||null===(x=h.total_clicks)||void 0===x?void 0:x.toLocaleString())||0," total clicks"),color:"blue"}),(0,ea.jsx)(d2,{icon:GN,label:"Bounce Rate",value:"".concat((null===he||void 0===he||null===(p=he.email)||void 0===p?void 0:p.bounce_rate)||0,"%"),subValue:"".concat((null===he||void 0===he||null===(g=he.email)||void 0===g||null===(f=g.total_bounces)||void 0===f?void 0:f.toLocaleString())||0," bounced"),color:"amber"}),(0,ea.jsx)(d2,{icon:jJ,label:"Unsubscribes",value:(null===he||void 0===he||null===(v=he.email)||void 0===v?void 0:v.total_unsubscribes)||0,color:"red"})]})]}),(0,ea.jsxs)("section",{children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,ea.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[(0,ea.jsx)(Bj,{size:20,className:"text-blue-600"}),"Subscriber Growth"]}),(0,ea.jsxs)(eb,{value:ke,onValueChange:De,children:[(0,ea.jsx)(sb,{className:"w-32",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"7",children:"Last 7 days"}),(0,ea.jsx)(rb,{value:"30",children:"Last 30 days"}),(0,ea.jsx)(rb,{value:"90",children:"Last 90 days"}),(0,ea.jsx)(rb,{value:"365",children:"Last year"})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,ea.jsxs)("div",{className:"lg:col-span-2 bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsx)("h3",{className:"font-medium mb-4",children:"New Subscribers"}),(0,ea.jsx)(u2,{data:Ze,height:150}),(0,ea.jsxs)("div",{className:"flex justify-between text-xs text-slate-400 mt-2",children:[(0,ea.jsx)("span",{children:(null===pe||void 0===pe||null===(b=pe.growth)||void 0===b||null===(j=b[0])||void 0===j?void 0:j.date)||""}),(0,ea.jsx)("span",{children:(null===pe||void 0===pe||null===(y=pe.growth)||void 0===y||null===(N=y[pe.growth.length-1])||void 0===N?void 0:N.date)||""})]})]}),(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsx)("h3",{className:"font-medium mb-4",children:"By Source"}),Object.entries((null===pe||void 0===pe?void 0:pe.by_source)||{}).slice(0,5).map(e=>{let[t,s]=e;return(0,ea.jsx)(m2,{label:"csv_import"===t?"CSV Import":"form"===t?"Form Signup":t||"Direct",value:s,total:et,color:"blue"},t)})]})]}),(null===pe||void 0===pe||null===(w=pe.groups)||void 0===w?void 0:w.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 mt-4",children:[(0,ea.jsx)("h3",{className:"font-medium mb-4",children:"Subscriber Groups"}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:pe.groups.map(e=>(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-indigo-600",children:e.subscriber_count||0}),(0,ea.jsx)("p",{className:"text-sm text-slate-600 truncate",title:e.name,children:e.name})]},e.group_id))})]}),Object.keys((null===pe||void 0===pe?void 0:pe.by_language)||{}).length>1&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 mt-4",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(hr,{size:18,className:"text-slate-500"}
2),"Subscribers by Language"]}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:Object.entries(pe.by_language).sort((e,t)=>t[1]-e[1]).slice(0,12).map(e=>{let[t,s]=e;return(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-blue-600",children:s}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:c2[t]||t.toUpperCase()})]},t)})})]})]}),(0,ea.jsxs)("section",{children:[(0,ea.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Yl,{size:20,className:"text-emerald-600"}),"Recent Campaigns"]}),(0,ea.jsx)("div",{className:"bg-white border border-slate-200 rounded-xl overflow-hidden",children:(0,ea.jsxs)("table",{className:"w-full",children:[(0,ea.jsx)("thead",{className:"bg-slate-50",children:(0,ea.jsxs)("tr",{children:[(0,ea.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-slate-500 uppercase",children:"Newsletter"}),(0,ea.jsx)("th",{className:"text-center px-4 py-3 text-xs font-medium text-slate-500 uppercase",children:"Sent"}),(0,ea.jsx)("th",{className:"text-center px-4 py-3 text-xs font-medium text-slate-500 uppercase",children:"Opens"}),(0,ea.jsx)("th",{className:"text-center px-4 py-3 text-xs font-medium text-slate-500 uppercase",children:"Clicks"}),(0,ea.jsx)("th",{className:"text-center px-4 py-3 text-xs font-medium text-slate-500 uppercase",children:"Open Rate"}),(0,ea.jsx)("th",{className:"text-center px-4 py-3 text-xs font-medium text-slate-500 uppercase",children:"Click Rate"})]})}),(0,ea.jsxs)("tbody",{className:"divide-y divide-slate-100",children:[null===fe||void 0===fe||null===(C=fe.campaigns)||void 0===C?void 0:C.slice(0,10).map(e=>{var t;return(0,ea.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,ea.jsxs)("td",{className:"px-6 py-4",children:[(0,ea.jsx)("p",{className:"font-medium text-slate-800",children:e.title}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:null===(t=e.sent_at)||void 0===t?void 0:t.split("T")[0]})]}),(0,ea.jsx)("td",{className:"text-center px-4 py-4 font-medium",children:e.sent_count}),(0,ea.jsx)("td",{className:"text-center px-4 py-4",children:e.opened_count}),(0,ea.jsx)("td",{className:"text-center px-4 py-4",children:e.clicked_count}),(0,ea.jsx)("td",{className:"text-center px-4 py-4",children:(0,ea.jsxs)("span",{className:"inline-flex px-2 py-1 rounded-full text-sm font-medium ".concat(e.open_rate>=30?"bg-emerald-100 text-emerald-700":e.open_rate>=20?"bg-blue-100 text-blue-700":"bg-slate-100 text-slate-600"),children:[e.open_rate,"%"]})}),(0,ea.jsx)("td",{className:"text-center px-4 py-4",children:(0,ea.jsxs)("span",{className:"inline-flex px-2 py-1 rounded-full text-sm font-medium ".concat(e.click_rate>=5?"bg-emerald-100 text-emerald-700":e.click_rate>=2?"bg-blue-100 text-blue-700":"bg-slate-100 text-slate-600"),children:[e.click_rate,"%"]})})]},e.campaign_id)}),(!(null!==fe&&void 0!==fe&&fe.campaigns)||0===fe.campaigns.length)&&(0,ea.jsx)("tr",{children:(0,ea.jsx)("td",{colSpan:6,className:"text-center py-8 text-slate-500",children:"No campaigns sent yet"})})]})]})}),(null===fe||void 0===fe?void 0:fe.averages)&&(null===(k=fe.campaigns)||void 0===k?void 0:k.length)>0&&(0,ea.jsx)("div",{className:"mt-4 p-4 bg-indigo-50 rounded-lg",children:(0,ea.jsxs)("p",{className:"text-sm text-indigo-800",children:[(0,ea.jsxs)("strong",{children:["Averages across ",fe.total_campaigns," campaigns:"]})," ",fe.averages.open_rate,"% open rate, ",fe.averages.click_rate,"% click rate"]})})]}),(null===be||void 0===be?void 0:be.enabled)&&(0,ea.jsxs)("section",{children:[(0,ea.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,ea.jsx)(ZJ,{size:20,className:"text-purple-600"}),"Translation Usage"]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,ea.jsx)(d2,{icon:hr,label:"Cached Translations",value:(null===be||void 0===be||null===(D=be.cache)||void 0===D?void 0:D.total_cached)||0,color:"purple"}),(0,ea.jsx)(d2,{icon:qN,label:"Characters Translated",value:((null===be||void 0===be||null===(_=be.cache)||void 0===_?void 0:_.total_characters)||0).toLocaleStr
2ing(),color:"indigo"}),(0,ea.jsx)(d2,{icon:GN,label:"Estimated Cost",value:"$".concat((null===be||void 0===be||null===(S=be.cache)||void 0===S?void 0:S.estimated_cost)||0),subValue:"Based on Google Translate pricing",color:"emerald"})]}),(null===be||void 0===be||null===(E=be.by_language)||void 0===E?void 0:E.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 mt-4",children:[(0,ea.jsx)("h3",{className:"font-medium mb-4",children:"Translations by Language"}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:be.by_language.slice(0,12).map(e=>{var t;return(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-xl font-bold text-purple-600",children:e.translations}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:c2[e.language]||(null===(t=e.language)||void 0===t?void 0:t.toUpperCase())}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:[(e.characters/1e3).toFixed(1),"k chars"]})]},e.language)})})]})]}),(0,ea.jsxs)("section",{children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-4 flex-wrap gap-2",children:[(0,ea.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[(0,ea.jsx)(IN,{size:20,className:"text-cyan-600"}),"Content Performance"]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,ea.jsxs)(uq,{open:qe,onOpenChange:$e,children:[(0,ea.jsx)(mq,{asChild:!0,children:(0,ea.jsxs)(sg,{variant:"outline",className:"h-9 gap-2 text-sm","data-testid":"content-drilldown-trigger","aria-expanded":qe,children:[(0,ea.jsx)(fj,{size:14}),"Drill into any page or article"]})}),(0,ea.jsx)(hq,{className:"p-0 w-[380px]",align:"end",children:(0,ea.jsxs)(a2,{filter:(e,t)=>e.toLowerCase().includes(t.toLowerCase())?1:0,children:[(0,ea.jsx)(n2,{placeholder:"Search all pages & articles\u2026","data-testid":"content-drilldown-search"}),(0,ea.jsxs)(l2,{children:[(0,ea.jsx)(r2,{children:"No matching content."}),Ue.length>0&&(0,ea.jsx)(i2,{heading:"Pages",children:Ue.map(e=>(0,ea.jsxs)(o2,{value:"".concat(e.title||""," ").concat(e.slug||""," page"),onSelect:()=>{$e(!1),Xe({page_id:e.page_id,title:e.title,slug:e.slug},"page")},"data-testid":"content-drilldown-page-".concat(e.page_id),children:[(0,ea.jsx)(qN,{size:14,className:"text-cyan-600 mr-2 shrink-0"}),(0,ea.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ea.jsx)("div",{className:"truncate text-sm",children:e.title||"(untitled)"}),(0,ea.jsxs)("div",{className:"truncate text-xs text-slate-400",children:["/",e.slug]})]})]},"page-".concat(e.page_id)))}),We.length>0&&(0,ea.jsx)(i2,{heading:"Articles",children:We.map(e=>(0,ea.jsxs)(o2,{value:"".concat(e.title||""," ").concat(e.slug||""," article"),onSelect:()=>{$e(!1),Xe({article_id:e.article_id,title:e.title,slug:e.slug},"article")},"data-testid":"content-drilldown-article-".concat(e.article_id),children:[(0,ea.jsx)(jw,{size:14,className:"text-amber-600 mr-2 shrink-0"}),(0,ea.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ea.jsx)("div",{className:"truncate text-sm",children:e.title||"(untitled)"}),e.slug&&(0,ea.jsxs)("div",{className:"truncate text-xs text-slate-400",children:["/",e.slug]})]})]},"article-".concat(e.article_id)))})]})]})})]}),(0,ea.jsxs)(eb,{value:_e,onValueChange:Se,children:[(0,ea.jsx)(sb,{className:"w-32",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"7",children:"Last 7 days"}),(0,ea.jsx)(rb,{value:"30",children:"Last 30 days"}),(0,ea.jsx)(rb,{value:"90",children:"Last 90 days"}),(0,ea.jsx)(rb,{value:"365",children:"Last year"})]})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[(0,ea.jsx)(d2,{icon:IN,label:"Total Page Views",value:(null===ye||void 0===ye||null===(A=ye.summary)||void 0===A?void 0:A.total_views)||0,color:"cyan"}),(0,ea.jsx)(d2,{icon:Bj,label:"Unique Visitors",value:(null===ye||void 0===ye||null===(F=ye.summary)||void 0===F?void 0:F.unique_visitors)||0,color:"blue"}),(0,ea.jsx)(d2,{icon:GN,label:"Avg Views/Day",value:(null===ye||void 0===ye||null===(T=ye.summary)||void 0===T?void 0:T.avg_views_per_day)||0,color:"emerald"})]}),(null===ye||void 0===ye||null===(z=ye.views_over_time)||void 0===z?void 0:z.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 mb-6",children:[(0,ea.jsx)("h3",{className:"font-medium mb-4",children:"Page Views Over Time"}),(0,ea.jsx)(u2,{data:ye.views_over_time.map(e=>({label:e.date,value:e.views})),height:150}),(0,ea.jsxs)("div",{className:"flex justify-between text-xs text-slate-400 mt-2",children:[(0,ea.jsx)("span",{children:(null===(M=ye.views_over_time[0])||void 0===M?void 0:M.date)||""}),(0,ea.jsx)("span",{children:(null===(P=ye.views_over_time[ye.views_over_time.length-1])||void 0===P?void 0:P.date)||""})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(qN,{size:18,className:"text-slate-500"}),"Top Pages",(0,ea.jsx)("span",{className:"text-xs text-slate-400 ml-auto",children:"Click for details"})]}),(null===ye||void 0===ye||null===(B=ye.top_pages)||void 0===B?void 0:B.length)>0?(0,ea.jsx)("div",{className:"space-y-3",children:ye.top_pages.map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-slate-100 last:border-0 cursor-pointer hover:bg-slate-50 rounded-lg px-2 -mx-2 transition-colors",onClick:()=>Xe(e,"page"),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("span",{className:"w-6 h-6 bg-cyan-100 text-cyan-700 rounded-full flex items-center justify-center text-sm font-medium",children:t+1}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-800 truncate max-w-[200px]",title:e.title,children:e.title}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:["/",e.slug]})]})]}),(0,ea.jsxs)("div",{className:"text-right flex items-center gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-700",children:e.views}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:[e.unique_visitors," unique"]})]}),(0,ea.jsx)(bj,{size:14,className:"text-slate-400"})]})]},e.page_id||t))}):(0,ea.jsx)("p",{className:"text-slate-400 text-sm py-8 text-center",children:"No page view data yet"})]}),(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(jw,{size:18,className:"text-slate-500"}
2),"Top Articles",(0,ea.jsx)("span",{className:"text-xs text-slate-400 ml-auto",children:"Click for details"})]}),(null===ye||void 0===ye||null===(R=ye.top_articles)||void 0===R?void 0:R.length)>0?(0,ea.jsx)("div",{className:"space-y-3",children:ye.top_articles.map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-slate-100 last:border-0 cursor-pointer hover:bg-slate-50 rounded-lg px-2 -mx-2 transition-colors",onClick:()=>Xe(e,"article"),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)("span",{className:"w-6 h-6 bg-amber-100 text-amber-700 rounded-full flex items-center justify-center text-sm font-medium",children:t+1}),(0,ea.jsx)("p",{className:"font-medium text-slate-800 truncate max-w-[200px]",title:e.title,children:e.title})]}),(0,ea.jsxs)("div",{className:"text-right flex items-center gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-700",children:e.views}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:[e.unique_visitors," unique"]})]}),(0,ea.jsx)(bj,{size:14,className:"text-slate-400"})]})]},e.article_id||t))}):(0,ea.jsx)("p",{className:"text-slate-400 text-sm py-8 text-center",children:"No article view data yet"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-6",children:[(null===ye||void 0===ye?void 0:ye.views_by_hour)&&Object.keys(ye.views_by_hour).length>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Kg,{size:18,className:"text-slate-500"}),"Views by Hour (UTC)"]}),(0,ea.jsx)("div",{className:"flex items-end gap-1",style:{height:80},children:Array.from({length:24},(e,t)=>{const s=ye.views_by_hour[t]||0,a=Math.max(...Object.values(ye.views_by_hour),1);return(0,ea.jsx)("div",{className:"flex-1 bg-cyan-400 rounded-t hover:bg-cyan-500 transition-colors cursor-pointer",style:{height:"".concat(s/a*100,"%"),minHeight:s>0?4:0},title:"".concat(t,":00 - ").concat(s," views")},t)})}),(0,ea.jsxs)("div",{className:"flex justify-between text-xs text-slate-400 mt-2",children:[(0,ea.jsx)("span",{children:"12am"}),(0,ea.jsx)("span",{children:"6am"}),(0,ea.jsx)("span",{children:"12pm"}),(0,ea.jsx)("span",{children:"6pm"}),(0,ea.jsx)("span",{children:"12am"})]})]}),(null===ye||void 0===ye||null===(L=ye.top_referrers)||void 0===L?void 0:L.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(gJ,{size:18,className:"text-slate-500"}),"Top Referrers"]}),(0,ea.jsx)("div",{className:"space-y-2",children:ye.top_referrers.slice(0,5).map((e,t)=>{const s=ye.top_referrers.reduce((e,t)=>e+t.views,0),a=s>0?e.views/s*100:0;return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,ea.jsx)("span",{className:"text-slate-600 truncate max-w-[200px]",title:e.referrer,children:e.referrer}),(0,ea.jsx)("span",{className:"font-medium",children:e.views})]}),(0,ea.jsx)("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full bg-indigo-500 rounded-full transition-all duration-500",style:{width:"".concat(a,"%")}})})]},t)})})]})]}),!(null!==ye&&void 0!==ye&&null!==(I=ye.top_pages)&&void 0!==I&&I.length)&&!(null!==ye&&void 0!==ye&&null!==(O=ye.top_articles)&&void 0!==O&&O.length)&&(0,ea.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mt-4",children:(0,ea.jsxs)("p",{className:"text-sm text-blue-800",children:[(0,ea.jsx)("strong",{children:"No page view data yet."})," Page views are tracked automatically when visitors view your public site pages and articles."]})})]}),(0,ea.jsxs)("section",{children:[(0,ea.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,ea.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[(0,ea.jsx)(PD,{size:20,className:"text-violet-600"}),"Website Traffic"]}),(0,ea.jsxs)(eb,{value:Ee,onValueChange:Ae,children:[(0,ea.jsx)(sb,{className:"w-32",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"7",children:"Last 7 days"}),(0,ea.jsx)(rb,{value:"30",children:"Last 30 days"}),(0,ea.jsx)(rb,{value:"90",children:"Last 90 days"}),(0,ea.jsx)(rb,{value:"365",children:"Last year"})]})]})]}),(null===we||void 0===we?void 0:we.engagement)&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 ga
2p-4 mb-6",children:[(0,ea.jsx)(d2,{icon:Bj,label:"Sessions",value:we.engagement.total_sessions,color:"violet"}),(0,ea.jsx)(d2,{icon:qN,label:"Pages/Session",value:we.engagement.pages_per_session,color:"blue"}),(0,ea.jsx)(d2,{icon:Z0,label:"Bounce Rate",value:"".concat(we.engagement.bounce_rate,"%"),color:"amber"}),(0,ea.jsx)(d2,{icon:GJ,label:"New Visitors",value:we.engagement.new_visitors,color:"emerald"}),(0,ea.jsx)(d2,{icon:Bj,label:"Returning",value:we.engagement.returning_visitors,color:"indigo"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[(null===we||void 0===we||null===(U=we.devices)||void 0===U?void 0:U.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(PD,{size:18,className:"text-slate-500"}),"Devices"]}),(0,ea.jsx)("div",{className:"space-y-3",children:we.devices.map((e,t)=>{const s=we.devices.reduce((e,t)=>e+t.views,0),a=s>0?e.views/s*100:0,n="mobile"===e.device?RN:"tablet"===e.device?MD:PD;return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between text-sm mb-1",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-2 text-slate-600 capitalize",children:[(0,ea.jsx)(n,{size:14}),e.device]}),(0,ea.jsxs)("span",{className:"font-medium",children:[e.views," (",a.toFixed(0),"%)"]})]}),(0,ea.jsx)("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full bg-violet-500 rounded-full",style:{width:"".concat(a,"%")}})})]},t)})})]}),(null===we||void 0===we||null===(H=we.browsers)||void 0===H?void 0:H.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(e1,{size:18,className:"text-slate-500"}),"Browsers"]}),(0,ea.jsx)("div",{className:"space-y-3",children:we.browsers.slice(0,5).map((e,t)=>{const s=we.browsers.reduce((e,t)=>e+t.views,0),a=s>0?e.views/s*100:0;return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:e.browser}),(0,ea.jsxs)("span",{className:"font-medium",children:[e.views," (",a.toFixed(0),"%)"]})]}),(0,ea.jsx)("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full bg-blue-500 rounded-full",style:{width:"".concat(a,"%")}})})]},t)})})]}),(null===we||void 0===we||null===(W=we.operating_systems)||void 0===W?void 0:W.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(PD,{size:18,className:"text-slate-500"}),"Operating Systems"]}),(0,ea.jsx)("div",{className:"space-y-3",children:we.operating_systems.slice(0,5).map((e,t)=>{const s=we.operating_systems.reduce((e,t)=>e+t.views,0),a=s>0?e.views/s*100:0;return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:e.os}),(0,ea.jsxs)("span",{className:"font-medium",children:[e.views," (",a.toFixed(0),"%)"]})]}),(0,ea.jsx)("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full bg-emerald-500 rounded-full",style:{width:"".concat(a,"%")}})})]},t)})})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-6",children:[(null===we||void 0===we||null===(V=we.traffic_sources)||void 0===V?void 0:V.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(GN,{size:18,className:"text-slate-500"}),"Traffic Sources"]}),(0,ea.jsx)("div",{className:"space-y-3",children:we.traffic_sources.map((e,t)=>{const s=we.traffic_sources.reduce((e,t)=>e+t.views,0),a=s>0?e.views/s*100:0;return(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,ea.jsx)("span",{className:"text-slate-600 capitalize",children:e.source}),(0,ea.jsxs)("span",{className:"font-medium",children:[e.views," (",a.toFixed(0),"%)"]})]}),(0,ea.jsx)("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,ea.jsx)("div",{className:"h-full rounded-full ".concat({direct:"bg-slate-500",search:"bg-emerald-500",social:"bg-pink-500",referral:"bg-indigo-500",email:"bg-amber-500"}[e.source]||"bg-slate-400"),style:{width:"".concat(a,"%")}})})]},t)})})]}),(null===we||void 0===we||null===(q=we.top_domains)||void 0===q?void 0:q.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(gJ,{size:18,className:"text-slate-500"}),"Top Referring Sites"]}),(0,ea.jsx)("div",{className:"space-y-2",children:we.top_domains.slice(0,8).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-slate-100 last:border-0",children:[(0,ea.jsx)("span",{className:"text-sm text-slate-600 truncate max-w-[200px]",title:e.domain,children:e.domain}),(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-700",children:e.views})]},t))})]})]}),(null===we||void 0===we||null===($=we.visitor_languages)||void 0===$?void 0:$.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-xl p-6 mt-6",children:[(0,ea.jsxs)("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[(0,ea.jsx)(hr,{size:18,className:"text-slate-500"}),"Visitor Languages"]}),(0,ea.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:we.visitor_languages.slice(0,12).map((e,t)=>{var s;return(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-3 text-center",children:[(0,ea.jsx)("p",{className:"text-xl font-bold text-violet-600",children:e.views}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:c2[null===(s=e.language)||void 0===s?void 0:s.split("-")[0]]||e.language})]},t)})})]}),!(null!==we&&void 0!==we&&null!==(G=we.devices)&&void 0!==G&&G.length)&&(0,ea.jsx)("div",{className:"bg-violet-50 border border-violet-200 rounded-lg p-4 mt-4",children:(0,ea.jsxs)("p",{className:"text-sm text-violet-800",children:[(0,ea.jsx)("strong",{children:"No traffic data yet."})," Traffic data is collected automatically when visitors view your public site."]})})]})]})]})}),(0,ea.jsx)(Ok,{open:Re,onOpenChange:e=>!e&&(Le(!1),Te(null),void Me(null)),children:(0,ea.jsxs)(Wk,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:["article"===(null===Fe||void 0===Fe?void 0:Fe.type)?(0,ea.jsx)(jw,{size:24,className:"text-amber-600"}):(0,ea.jsx)(qN,{size:24,className:"text-cyan-600"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h2",{className:"text-xl font-bold",children:(null===ze||void 0===ze||null===(K=ze.page)||void 0===K?void 0:K.title)||(null===ze||void 0===ze||null===(Y=ze.article)||void 0===Y?void 0:Y.title)||"Loading..."}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 font-normal",children:["/",(null===ze||void 0===ze||null===(J=ze.page)||void 0===J?void 0:J.slug)||(null===ze||void 0===ze||null===(Q=ze.article)||void 0===Q?void 0:Q.slug)]})]})]}),(0,ea.jsxs)(eb,{value:Ie,onValueChange:Oe,children:[(0,ea.jsx)(sb,{className:"w-32",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"7",children:"Last 7 days"}),(0,ea.jsx)(rb,{value:"30",children:"Last 30 days"}),(0,ea.jsx)(rb,{value:"90",children:"Last 90 days"}),(0,ea.jsx)(rb,{value:"365",children:"Last year"})]})]})]})}),Pe?(0,ea.jsxs)("div",{className:"py-12 text-center",children:[(0,ea.jsx)(gq,{size:32,className:"animate-spin mx-auto text-indigo-600 mb-4"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading analytics..."})]}):ze?(0,ea.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,ea.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-3xl font-bold text-cyan-600",children:(null===(X=ze.summary)||void 0===X?void 0:X.views)||0}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Page Views"})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-3xl font-bold text-blue-600",children:(null===(Z=ze.summary)||void 0===Z?void 0:Z.unique_visitors)||0}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Unique Visitors"})]}),(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-3xl font-bold text-emerald-600",children:(null===(ee=ze.summary)||void 0===ee?void 0:ee.avg_views_per_day)||0}),(0,ea.jsx)("p",{className:"text-sm text-slate-600",children:"Avg/Day"})]})]}),(null===(te=ze.views_over_time)||void 0===te?void 0:te.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-4",children:[(0,ea.jsx)("h4",{className:"font-medium mb-3",children:"Views Over Time"}),(0,ea.jsx)(u2,{data:ze.views_over_time.map(e=>({label:e.date,value:e.views})),height:120}),(0,ea.jsxs)("div",{className:"flex justify-between text-xs text-slate-400 mt-2",children:[(0,ea.jsx)("span",{children:null===(se=ze.views_over_time[0])||void 0===se?void 0:se.date}),(0,ea.jsx)("span",{children:null===(ae=ze.views_over_time[ze.views_over_time.length-1])||void 0===ae?void 0:ae.date})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(null===(ne=ze.devices)||void 0===ne?void 0:ne.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("h4",{className:"font-medium mb-3 flex items-center gap-2",children:[(0,ea.jsx)(PD,{size:16,className:"text-slate-500"}),"Devices"]}),(0,ea.jsx)("div",{className:"space-y-2",children:ze.devices.map((e,t)=>{const s=ze.devices.reduce((e,t)=>
2e+t.views,0),a=s>0?e.views/s*100:0;return(0,ea.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,ea.jsx)("span",{className:"capitalize text-slate-600",children:e.device}),(0,ea.jsxs)("span",{className:"font-medium",children:[e.views," (",a.toFixed(0),"%)"]})]},t)})})]}),(null===(le=ze.browsers)||void 0===le?void 0:le.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("h4",{className:"font-medium mb-3 flex items-center gap-2",children:[(0,ea.jsx)(e1,{size:16,className:"text-slate-500"}),"Browsers"]}),(0,ea.jsx)("div",{className:"space-y-2",children:ze.browsers.slice(0,5).map((e,t)=>{const s=ze.browsers.reduce((e,t)=>e+t.views,0),a=s>0?e.views/s*100:0;return(0,ea.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-600",children:e.browser}),(0,ea.jsxs)("span",{className:"font-medium",children:[e.views," (",a.toFixed(0),"%)"]})]},t)})})]}),(null===(re=ze.traffic_sources)||void 0===re?void 0:re.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("h4",{className:"font-medium mb-3 flex items-center gap-2",children:[(0,ea.jsx)(GN,{size:16,className:"text-slate-500"}),"Traffic Sources"]}),(0,ea.jsx)("div",{className:"space-y-2",children:ze.traffic_sources.map((e,t)=>{const s=ze.traffic_sources.reduce((e,t)=>e+t.views,0),a=s>0?e.views/s*100:0;return(0,ea.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,ea.jsx)("span",{className:"capitalize text-slate-600",children:e.source}),(0,ea.jsxs)("span",{className:"font-medium",children:[e.views," (",a.toFixed(0),"%)"]})]},t)})})]}),(null===(ie=ze.top_referrers)||void 0===ie?void 0:ie.length)>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("h4",{className:"font-medium mb-3 flex items-center gap-2",children:[(0,ea.jsx)(gJ,{size:16,className:"text-slate-500"}),"Top Referrers"]}),(0,ea.jsx)("div",{className:"space-y-2",children:ze.top_referrers.slice(0,5).map((e,t)=>(0,ea.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,ea.jsx)("span",{className:"text-slate-600 truncate max-w-[150px]",title:e.domain,children:e.domain}),(0,ea.jsx)("span",{className:"font-medium",children:e.views})]},t))})]})]}),ze.views_by_hour&&Object.keys(ze.views_by_hour).length>0&&(0,ea.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("h4",{className:"font-medium mb-3 flex items-center gap-2",children:[(0,ea.jsx)(Kg,{size:16,className:"text-slate-500"}),"Views by Hour (UTC)"]}),(0,ea.jsx)("div",{className:"flex items-end gap-1",style:{height:60},children:Array.from({length:24},(e,t)=>{const s=ze.views_by_hour[t]||0,a=Math.max(...Object.values(ze.views_by_hour),1);return(0,ea.jsx)("div",{className:"flex-1 bg-cyan-400 rounded-t hover:bg-cyan-500 transition-colors",style:{height:"".concat(s/a*100,"%"),minHeight:s>0?4:0},title:"".concat(t,":00 - ").concat(s," views")},t)})}),(0,ea.jsxs)("div",{className:"flex justify-between text-xs text-slate-400 mt-1",children:[(0,ea.jsx)("span",{children:"12am"}),(0,ea.jsx)("span",{children:"6am"}),(0,ea.jsx)("span",{children:"12pm"}),(0,ea.jsx)("span",{children:"6pm"}),(0,ea.jsx)("span",{children:"12am"})]})]}),!(null!==(oe=ze.views_over_time)&&void 0!==oe&&oe.length)&&(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-lg p-6 text-center",children:[(0,ea.jsx)(IN,{size:32,className:"mx-auto text-slate-300 mb-2"}),(0,ea.jsx)("p",{className:"text-slate-500",children:"No view data for this period"})]})]}):null]})})]})},x2=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],p2=[{value:"class",label:"Class"},{value:"year",label:"Year Group"},{value:"family",label:"Family"},{value:"custom",label:"Custom"}],g2=["#ef4444","#dc2626","#f87171","#ec4899","#db2777","#f472b6","#e879f9","#f97316","#ea580c","#fb923c","#f59e0b","#d97706","#fbbf24","#eab308","#84cc16","#65a30d","#22c55e","#16a34a","#10b981","#059669","#14b8a6","#0891b2","#06b6d4","#60a5fa","#3b82f6","#2563eb","#1d4ed8","#6366f1","#4f46e5","#7c3aed","#8b5cf6","#a855f7","#64748b","#475569","#78716c"],f2=[{minutes:10080,label:"1 week before"},{minutes:4320,label:"3 days before"},{minutes:1440,label:"1 day before"},{minutes:120,label:"2 hours before"}],v2=f2.map(e=>e.minutes),b2=e=>{if(!e)return"";try{const t=new Date(e),s=t.getTimezoneOffset();return new Date(t.getTime()-6e4*s).toISOString().slice(0,16)}catch(t){return""}},j2=e=>{if(!e)return null;try{return new Date(e).toISOString()}catch(t){return null}},y2=e=>{let{url:s}=e;const[a,n]=t.useState(!1),l=t.useMemo(()=>{try{const e=new URL(s),t=e.pathname.split("/"),a=t.indexOf("private");if(-1!==a&&t[a+1]){const s=t[a+1];return t[a+1]=s.slice(0,4)+"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"+s.slice(-4),e.hostname+t.join("/")}return e.hostname+"/\u2026/\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022.ics"}catch(e){return"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}},[s]);return(0,ea.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 truncate font-mono",children:a?s:l}),(0,ea.jsx)("button",{onClick:()=>n(e=>!e),className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors",title:a?"Hide URL":"Reveal URL",children:a?(0,ea.jsx)(LN,{size:12}):(0,ea.jsx)(IN,{size:12})}),(0,ea.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(s)},className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors",title:"Copy URL",children:(0,ea.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,ea.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,ea.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]})},N2=()=>{var e,s,a;const[n,l]=(0,t.useState)("calendar"),[r,i]=(0,t.useState)([]),[o,c]=(0,t.useState)([]),[u,m]=(0,t.useState)([]),[h,x]=(0,t.useState)([]),[p,g]=(0,t.useState)(!0),[f,v]=(0,t.useState)(""),[b,j]=(0,t.useState)(!1),[y,N]=(0,t.useState)(!1),[w,C]=(0,t.useState)(null),[k,D]=(0,t.useState)({title:"",description_html:"",category:"",color:"#6366f1",start:"",end:"",all_day:!1,location:"",cost:"",capacity:"",form_id:"",external_link_url:"",audience:{whole_school:!0,group_ids:[]},status:"draft",rsvp_enabled:!1,send_push:!1,waitlist_enabled:!1,waitlist_claim_hours:24,waitlist_max:"",reminderPresets:[],customReminderValue:"",customReminderUnit:"days",reminder_extra_recipients:"",event_type:"",departments:[],tags:[],ticket_enabled:!1,ticket_price:"",ticket_currency:"usd",ticket_name:"General Admission",ticket_limit_per_order:10}),[_,S]=(0,t.useState)(!1),[E,A]=(0,t.useState)(new Date),[F,T]=(0,t.useState)(!1),[z,M]=(0,t.useState)(null),[P,B]=(0,t.useState)({name:"",type:"custom",member_emails:"",taptile_group_id:""}),[R,L]=(0,t.useState)(!1),[I,O]=(0,t.useState)({name:"",type:"custom",csv_text:""}),[U,H]=(0,t.useState)({office_email:"",absentee_auto_responder:"",absentee_enabled:!0,api_auto_publish:!1}),[W,V]=(0,t.useState)(!1),[q,$]=(0,t.useState)(null),[G,K]=(0,t.useState)(null),[Y,J]=(0,t.useState)(""),[Q,X]=(0,t.useState)(null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ae,ne]=(0,t.useState)(null),[le,re]=(0,t.useState)(null),[ie,oe]=(0,t.useState)({event_types:[],departments:[],tags:[]}),[ce,de]=(0,t.useState)(""),[ue,me]=(0,t.useState)(""),[he,xe]=(0,t.useState)([]),[pe,ge]=(0,t.useState)({name:"",url:"",color:"#6366f1",sync_interval_hours:6}),[fe,ve]=(0,t.useState)(!1),[be,je]=(0,t.useState)(null),[ye,Ne]=(0,t.useState)(null),[we,Ce]=(0,t.useState)(""),[ke,De]=(0,t.useState)(""),[_e,Se]=(0,t.useState)(""),[Ee,Ae]=(0,t.useState)(""),[Fe,Te]=(0,t.useState)("calendar"),[ze,Me]=(0,t.useState)(!0),[Pe,Be]=(0,t.useState)(!0),[Re,Le]=(0,t.useState)(!0),[Ie,Oe]=(0,t.useState)("700"),[Ue,He]=(0,t.useState)(!1),[We,Ve]=(0,t.useState)(""),[qe,$e]=(0,t.useState)(""),[Ge,Ke]=(0,t.useState)(""),Ye=(0,t.useCallback)(async()=>{g(!0);try{const[e,t,s]=await Promise.all([_l.get("/events"),_l.get("/events/groups"),_l.get("/forms")]);i(e.data||[]),c(t.data||[]),m(s.data||[]),_l.get("/events/taptile-status").then(e=>{var t;return j(!(null===(t=e.data)||void 0===t||!t.connected))}).catch(()=>{}),_l.get("/events/filter-options").then(e=>oe(e.data||{event_types:[],departments:[],tags:[]})).catch(()=>{}),_l.get("/stripe-connect/status").then(e=>re(e.data)).catch(()=>{}),_l.get("/auth/me").then(async e=>{var t;const s=null===(t=e.data)||void 0===t?void 0:t.tenant_id;if(s)try{var a;const e=await _l.get("/public/events/".concat(s));v((null===(a=e.data)||void 0===a?void 0:a.site_slug)||s)}catch(n){v(s)}}).catch(()=>{})}catch(G2){qs.error("Failed to load events")}finally{g(!1)}},[]);(0,t.useEffect)(()=>{Ye()},[Ye]);const Je=(0,t.useCallback)(async()=>{try{const e=await _l.get("/events/absentees");x(e.data||[])}catch(e){}},[]),Qe=(0,t.useCallback)(async()=>{try{var e,t,s,a;const n=await _l.get("/events/settings");H({office_email:(null===(e=n.data)||void 0===e?void 0:e.office_email)||"",absentee_auto_responder:(null===(t=n.data)||void 0===t?void 0:t.absentee_auto_responder)||"",absentee_enabled:!1!==(null===(s=n.data)||void 0===s?void 0:s.absentee_enabled),api_auto_publish:!(null===(a=n.data)||void 0===a||!a.api_auto_publish)})}catch(n){}},[]),Xe=(0,t.useCallback)(async()=>{try{const e=await _l.get("/events/ical-sources");xe(e.data||[])}catch(e){}},[]),Ze=(0,t.useCallback)(async()=>{try{const e=await _l.get("/events/filter-options");oe(e.data||{event_types:[],departments:[],tags:[]})}catch(e){}},[]),et=async(e,t,s)=>{if(window.confirm('Remove "'.concat(t,'" from all ').concat(s," event(s)? This cannot be undone.")))try{await _l.delete("/events/filter-options",{params:{field:e,value:t}}),qs.success('"'.concat(t,'" removed')),await Promise.all([Ye(),Ze()])}catch(G2){var a,n;qs.error((null===(a=G2.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.detail)||"Failed to remove label")}},tt=async(e,t,s)=>{const a=t.trim();if(a)try{await _l.post("/events/filter-options",{field:e,value:a}),qs.success('"'.concat(a,'" added')),s(""),await Ze()}catch(G2){var n,l;qs.error((null===(n=G2.response)||void 0===n||null===(l=n.data)||void 0===l?void 0:l.detail)||"Failed to add label")}},st=(0,t.useCallback)(async e=>{if(e){ee(!0);try{const t=await _l.get("/event-payments/admin/".concat(e,"/tickets"));X(t.data)}catch(t){qs.error("Failed to load tickets"),X(null)}finally{ee(!1)}}else X(null)},[]);(0,t.useEffect)(()=>
2{if("absentees"===n&&Je(),"settings"===n&&(Qe(),Ze()),"ical"===n&&Xe(),"tickets"===n){const e=r.filter(e=>e.ticket_enabled);if(e.length>0){const t=Y||e[0].event_id;J(t),st(t)}}},[n,Je,Qe,st,Xe,Ze,r,Y]);const at=e=>{const t={title:"",description_html:"",category:"",color:"#6366f1",start:"",end:"",all_day:!1,location:"",cost:"",capacity:"",form_id:"",external_link_url:"",audience:{whole_school:!0,group_ids:[]},status:"draft",rsvp_enabled:!1,send_push:!1,waitlist_enabled:!1,waitlist_claim_hours:24,waitlist_max:"",reminderPresets:[],customReminderValue:"",customReminderUnit:"days",reminder_extra_recipients:"",event_type:"",departments:[],tags:[],ticket_enabled:!1,ticket_price:"",ticket_currency:"usd",ticket_name:"General Admission",ticket_limit_per_order:10};e&&(t.start="".concat(e,"T09:00"),t.end="".concat(e,"T10:00")),de(""),me(""),D(t),C(null),N(!0)},nt=e=>{var t,s,a,n,l,r;const i=e.reminders||[],o=i.map(e=>e.offset_minutes).filter(e=>v2.includes(e)),c=i.find(e=>!v2.includes(e.offset_minutes));let d="",u="days";c&&(c.offset_minutes%1440===0?(d=String(c.offset_minutes/1440),u="days"):(d=String(Math.round(c.offset_minutes/60)),u="hours")),de(""),me(""),D({title:e.title||"",description_html:e.description_html||"",category:e.category||"",color:e.color||"#6366f1",start:b2(e.start),end:b2(e.end),all_day:!!e.all_day,location:e.location||"",cost:null!==(t=e.cost)&&void 0!==t?t:"",capacity:null!==(s=e.capacity)&&void 0!==s?s:"",form_id:e.form_id||"",external_link_url:e.external_link_url||"",audience:e.audience||{whole_school:!0,group_ids:[]},status:e.status||"draft",rsvp_enabled:!!e.rsvp_enabled,send_push:!!e.send_push,waitlist_enabled:!!e.waitlist_enabled,waitlist_claim_hours:null!==(a=e.waitlist_claim_hours)&&void 0!==a?a:24,waitlist_max:null!==(n=e.waitlist_max)&&void 0!==n?n:"",reminderPresets:o,customReminderValue:d,customReminderUnit:u,reminder_extra_recipients:(e.reminder_extra_recipients||[]).join("\n"),event_type:e.event_type||"",departments:e.departments||[],tags:e.tags||[],ticket_enabled:!!e.ticket_enabled,ticket_price:null!==(l=e.ticket_price)&&void 0!==l?l:"",ticket_currency:e.ticket_currency||"usd",ticket_name:e.ticket_name||"General Admission",ticket_limit_per_order:null!==(r=e.ticket_limit_per_order)&&void 0!==r?r:10}),C(e),N(!0)},lt=e=>{const t=e.reminderPresets.map(e=>{var t;return{offset_minutes:e,label:null===(t=f2.find(t=>t.minutes===e))||void 0===t?void 0:t.label}});if(e.customReminderValue&&parseInt(e.customReminderValue,10)>0){const s=parseInt(e.customReminderValue,10),a="hours"===e.customReminderUnit?60*s:1440*s;v2.includes(a)||t.push({offset_minutes:a,label:"".concat(s," ").concat(e.customReminderUnit," before")})}return t},rt=(0,t.useMemo)(()=>{let e=r;if(we&&(e=e.filter(e=>(e.event_type||"").toLowerCase()===we.toLowerCase())),ke&&(e=e.filter(e=>(e.departments||[]).some(e=>e.toLowerCase()===ke.toLowerCase()))),Ee&&(e=e.filter(e=>e.ical_source_id===Ee)),_e){const t=_e.toLowerCase();e=e.filter(e=>(e.title||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.event_type||"").toLowerCase().includes(t)||(e.departments||[]).some(e=>e.toLowerCase().includes(t)))}return e},[r,we,ke,_e,Ee]),it=(0,t.useMemo)(()=>{const e=E.getFullYear(),t=E.getMonth(),s=new Date(e,t,1).getDay(),a=new Date(e,t+1,0).getDate(),n=[];for(let l=0;l<s;l++)n.push(null);for(let l=1;l<=a;l++)n.push(new Date(e,t,l));for(;n.length%7!==0;)n.push(null);return n},[E]),ot=(0,t.useMemo)(()=>{const e={};return rt.forEach(t=>{if(!t.start)return;const s=new Date(t.start),a=t.end?new Date(t.end):s,n=new Date(s.getFullYear(),s.getMonth(),s.getDate()),l=new Date(a.getFullYear(),a.getMonth(),a.getDate());for(let r=new Date(n);r<=l;r.setDate(r.getDate()+1)){const s=new Date(r).toDateString();(e[s]=e[s]||[]).push(t)}}),e},[rt]),ct=E.toLocaleDateString(void 0,{month:"long",year:"numeric"}),dt=e=>{const t=e.getTimezoneOffset();return new Date(e.getTime()-6e4*t).toISOString().slice(0,10)},ut=e=>{const t=e.trim();t&&(D(e=>d(d({},e),{},{departments:e.departments.includes(t)?e.departments:[...e.departments,t]})),de(""))},mt=e=>{const t=e.trim();t&&(D(e=>d(d({},e),{},{tags:e.tags.includes(t)?e.tags:[...e.tags,t]})),me(""))},ht=f?"".concat("","/api/public/events/").concat(f,"/calendar.ics"):"",xt=f?"/site/".concat(f,"/events"):"",pt=f?(()=>{const e=window.location.origin,t=new URLSearchParams({embed:"1",view:Fe});return ze||t.set("show_filters","0"),Pe||t.set("show_ical","0"),Re||t.set("show_absence","0"),"".concat(e,"/site/").concat(f,"/events?").concat(t.toString())})():"",gt=pt?'<iframe\n src="'.concat(pt,'"\n width="100%"\n height="').concat(Ie,'"\n style="border:none;border-radius:12px;"\n loading="lazy"\n title="Events Calendar"\n></iframe>'):"";return(0,ea.jsxs)(PQ,{children:[(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto px-4 py-6","data-testid":"events-page",children:[(0,ea.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-6",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("h1",{className:"text-3xl font-bold text-slate-900 flex items-center gap-2",children:[(0,ea.jsx)(yj,{className:"w-7 h-7 text-indigo-600"})," Events & Calendar"]}),(0,ea.jsx)("p",{className:"text-slate-500 mt-1 text-sm",children:"Create audience-targeted events, publish a calendar and share iCal feeds."})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[xt&&(0,ea.jsx)("a",{href:xt,target:"_blank",rel:"noreferrer",children:(0,ea.jsxs)(sg,{variant:"outline",size:"sm","data-testid":"events-view-public-btn",children:[(0,ea.jsx)(hr,{className:"w-4 h-4 mr-2"})," View public calendar"]})}),(0,ea.jsxs)(sg,{onClick:()=>at(),"data-testid":"events-new-btn",children:[(0,ea.jsx)(Vj,{className:"w-4 h-4 mr-2"})," New Event"]})]})]}),(0,ea.jsxs)(nJ,{value:n,onValueChange:l,children:[(0,ea.jsxs)(lJ,{className:"mb-6",children:[(0,ea.jsxs)(rJ,{value:"calendar","data-testid":"events-tab-calendar",children:[(0,ea.jsx)(yj,{className:"w-4 h-4 mr-1"})," Calendar"]}),(0,ea.jsxs)(rJ,{value:"list","data-testid":"events-tab-list",children:[(0,ea.jsx)(IE,{className:"w-4 h-4 mr-1"})," List"]}),(0,ea.jsxs)(rJ,{value:"groups","data-testid":"events-tab-groups",children:[(0,ea.jsx)(Bj,{className:"w-4 h-4 mr-1"})," Groups"]}),(0,ea.jsxs)(rJ,{value:"tickets","data-testid":"events-tab-tickets",children:[(0,ea.jsx)(Aj,{className:"w-4 h-4 mr-1"})," Tickets"]}),(0,ea.jsxs)(rJ,{value:"absentees","data-testid":"events-tab-absentees",children:[(0,ea.jsx)(Tw,{className:"w-4 h-4 mr-1"})," Absentees"]}),(0,ea.jsxs)(rJ,{value:"ical","data-testid":"events-tab-ical",children:[(0,ea.jsx)(gJ,{className:"w-4 h-4 mr-1"})," iCal Sync"]}),(0,ea.jsxs)(rJ,{value:"settings","data-testid":"events-tab-settings",children:[(0,ea.jsx)(Oj,{className:"w-4 h-4 mr-1"})," Settings"]}),(0,ea.jsxs)(rJ,{value:"embed","data-testid":"events-tab-embed",children:[(0,ea.jsx)(kE,{className:"w-4 h-4 mr-1"})," Embed"]})]}),(0,ea.jsx)(iJ,{value:"calendar",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3 items-center",children:[(0,ea.jsxs)("div",{className:"relative flex-1 min-w-[140px]",children:[(0,ea.jsx)(fj,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400 pointer-events-none"}),(0,ea.jsx)("input",{value:_e,onChange:e=>Se(e.target.value),placeholder:"Search events\u2026","data-testid":"admin-filter-search",className:"w-full pl-8 pr-3 py-1.5 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300"})]}),ie.event_types.length>0&&(0,ea.jsxs)("select",{value:we,onChange:e=>Ce(e.target.value),className:"py-1.5 pl-3 pr-7 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300 bg-white","data-testid":"admin-filter-type",children:[(0,ea.jsx)("option",{value:"",children:"All types"}),ie.event_types.map(e=>(0,ea.jsx)("option",{value:e,children:e},e))]}),ie.departments.length>0&&(0,ea.jsxs)("select",{value:ke,onChange:e=>De(e.target.value),className:"py-1.5 pl-3 pr-7 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300 bg-white","data-testid":"admin-filter-dept",children:[(0,ea.jsx)("option",{value:"",children:"All departments"}),ie.departments.map(e=>(0,ea.jsx)("option",{value:e,children:e},e))]}),(we||ke||_e||Ee)&&(0,ea.jsx)("button",{onClick:()=>{Ce(""),De(""),Se(""),Ae("")},className:"text-xs text-slate-500 hover:text-slate-700 px-2 py-1.5 rounded border border-slate-200 hover:bg-slate-50","data-testid":"admin-filter-clear",children:"Clear"}),(we||ke||_e||Ee)&&(0,ea.jsxs)("span",{className:"text-xs text-slate-400",children:[rt.length," of ",r.length," events"]})]}),he.filter(e=>e.events_count>0||r.some(t=>t.ical_source_id===e.source_id)).length>0&&(0,ea.jsx)("div",{className:"flex flex-wrap gap-2 mb-3","data-testid":"admin-ical-filter-pills",children:he.filter(e=>r.some(t=>t.ical_source_id===e.source_id)).map(e=>(0,ea.jsxs)("button",{onClick:()=>Ae(Ee===e.source_id?"":e.source_id),className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-colors ".concat(Ee===e.source_id?"text-white border-transparent":"bg-white text-slate-600 border-slate-200 hover:border-slate-400"),style:Ee===e.source_id?{backgroundColor:e.color,borderColor:e.color}:{},"data-testid":"admin-filter-source-".concat(e.source_id),children:[(0,ea.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:Ee===e.source_id?"rgba(255,255,255,0.7)":e.color}}),e.name]},e.source_id))}),(0,ea.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{variant:"outline",size:"icon",onClick:()=>A(new Date(E.getFullYear(),E.getMonth()-1,1)),"data-testid":"calendar-prev-btn",children:(0,ea.jsx)(vj,{className:"w-4 h-4"})}),(0,ea.jsx)("h2",{className:"text-lg font-semibold w-44 text-center",children:ct}),(0,ea.jsx)(sg,{variant:"outline",size:"icon",onClick:()=>
2A(new Date(E.getFullYear(),E.getMonth()+1,1)),"data-testid":"calendar-next-btn",children:(0,ea.jsx)(ax,{className:"w-4 h-4"})}),(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>A(new Date),"data-testid":"calendar-today-btn",children:"Today"})]})}),(0,ea.jsxs)("div",{className:"grid grid-cols-7 gap-px bg-slate-200 rounded-lg overflow-hidden border border-slate-200",children:[x2.map(e=>(0,ea.jsx)("div",{className:"bg-slate-50 text-center text-xs font-semibold text-slate-500 py-2",children:e},e)),it.map((e,t)=>{const s=e&&ot[e.toDateString()]||[],a=e&&e.toDateString()===(new Date).toDateString();return(0,ea.jsx)("div",{className:"bg-white min-h-[104px] p-1.5 ".concat(e?"cursor-pointer hover:bg-slate-50":"bg-slate-50/40"),onClick:()=>e&&at(dt(e)),"data-testid":e?"calendar-day-".concat(dt(e)):void 0,children:e&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"text-xs font-medium mb-1 ".concat(a?"bg-indigo-600 text-white rounded-full w-6 h-6 flex items-center justify-center":"text-slate-500"),children:e.getDate()}),(0,ea.jsxs)("div",{className:"space-y-1",children:[s.slice(0,3).map(e=>(0,ea.jsxs)("div",{onClick:t=>{t.stopPropagation(),nt(e)},className:"text-[11px] leading-tight px-1.5 py-0.5 rounded truncate text-white flex items-center gap-1",style:{backgroundColor:e.color||"#6366f1",o
2pacity:"published"===e.status?1:.55},title:e.title,"data-testid":"calendar-event-".concat(e.event_id),children:["published"!==e.status&&(0,ea.jsx)(LN,{className:"w-2.5 h-2.5 shrink-0"}),(0,ea.jsx)("span",{className:"truncate",children:e.title})]},e.event_id)),s.length>3&&(0,ea.jsxs)("div",{className:"text-[10px] text-slate-400 pl-1",children:["+",s.length-3," more"]})]})]})},t)})]})]})}),(0,ea.jsx)(iJ,{value:"list",children:(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 divide-y divide-slate-100",children:p?(0,ea.jsx)("div",{className:"p-8 text-center text-slate-400",children:"Loading\u2026"}):0===r.length?(0,ea.jsxs)("div",{className:"p-12 text-center text-slate-400",children:[(0,ea.jsx)(yj,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),"No events yet. Click ",(0,ea.jsx)("strong",{children:"New Event"})," to create one."]}):r.map(e=>{var t,s,a;return(0,ea.jsxs)("div",{className:"flex items-center gap-4 p-4 hover:bg-slate-50","data-testid":"event-row-".concat(e.event_id),children:[(0,ea.jsx)("div",{className:"w-1.5 h-12 rounded-full",style:{backgroundColor:e.color||"#6366f1"}}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900 truncate",children:e.title}),(0,ea.jsx)(EC,{variant:"published"===e.status?"default":"secondary",className:"text-[10px]",children:e.status}),e.form_id&&(0,ea.jsxs)(EC,{variant:"outline",className:"text-[10px]",children:[(0,ea.jsx)(yw,{className:"w-3 h-3 mr-1"}),"Form"]}),e.rsvp_enabled&&(0,ea.jsxs)(EC,{variant:"outline",className:"text-[10px]",children:[(0,ea.jsx)(Bj,{className:"w-3 h-3 mr-1"}),"RSVP"]}),e.ticket_enabled&&(0,ea.jsxs)(EC,{variant:"outline",className:"text-[10px] text-emerald-700 border-emerald-200",children:[(0,ea.jsx)(Aj,{className:"w-3 h-3 mr-1"}),"Ticketed"]}),e.reminders&&e.reminders.length>0&&(0,ea.jsxs)(EC,{variant:"outline",className:"text-[10px]",children:[(0,ea.jsx)(Kg,{className:"w-3 h-3 mr-1"}),e.reminders.length," reminder",e.reminders.length>1?"s":""]}),e.push_sent_at&&(0,ea.jsxs)(EC,{variant:"outline",className:"text-[10px] text-amber-700 border-amber-200",children:[(0,ea.jsx)(Ij,{className:"w-3 h-3 mr-1"}),"Notified"]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-slate-500 mt-1",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Kg,{className:"w-3 h-3"}),e.start?new Date(e.start).toLocaleString():"\u2014"]}),e.location&&(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Ql,{className:"w-3 h-3"}),e.location]}),(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Bj,{className:"w-3 h-3"}),null!==(t=e.audience)&&void 0!==t&&t.whole_school?"Everyone":"".concat((null===(s=e.audience)||void 0===s||null===(a=s.group_ids)||void 0===a?void 0:a.length)||0," group(s)")]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-1",children:[b&&"published"===e.status&&(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(async e=>{if(window.confirm('Send a push notification for "'.concat(e.title,'" to the Taptile app now?')))try{var t,s,a,n,l,r;const i=await _l.post("/events/".concat(e.event_id,"/send-push")),o=(null===(t=i.data)||void 0===t||null===(s=t.result)||void 0===s||null===(a=s.response)||void 0===a||a.delivery,null===(n=i.data)||void 0===n||null===(l=n.result)||void 0===l||null===(r=l.response)||void 0===r?void 0:r.audience),c=null===o||void 0===o?void 0:o.resolved_users;qs.success(null!=c?"Push sent to ~".concat(c," recipient(s) \ud83d\udd14"):"Push sent to Taptile \ud83d\udd14"),Ye()}catch(G2){var i,o;qs.error((null===(i=G2.response)||void 0===i||null===(o=i.data)||void 0===o?void 0:o.detail)||"Failed to send push")}})(e),title:"Send push to Taptile app","data-testid":"event-push-".concat(e.event_id),children:(0,ea.jsx)(Ij,{className:"w-4 h-4 text-amber-600"})}),e.rsvp_enabled&&(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(async e=>{$(e),K(null),V(!0);try{const t=await _l.get("/events/".concat(e.event_id,"/rsvps"));K(t.data)}catch(t){qs.error("Failed to load RSVPs")}})(e),title:"View RSVPs","data-testid":"event-rsvps-".concat(e.event_id),children:(0,ea.jsx)(Bj,{className:"w-4 h-4 text-indigo-600"})}),(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(async e=>{try{"published"===e.status?(await _l.post("/events/".concat(e.event_id,"/unpublish")),qs.success("Moved to draft")):(await _l.post("/events/".concat(e.event_id,"/publish")),qs.success("Event published")),Ye()}catch(t){qs.error("Failed to update status")}})(e),title:"published"===e.status?"Unpublish":"Publish","data-testid":"event-publish-".concat(e.event_id),children:"published"===e.status?(0,ea.jsx)(LN,{className:"w-4 h-4"}):(0,ea.jsx)(IN,{className:"w-4 h-4 text-emerald-600"})}),(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>nt(e),"data-testid":"event-edit-".concat(e.event_id),children:(0,ea.jsx)(ND,{className:"w-4 h-4"})}),(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(async e=>{if(window.confirm('Delete "'.concat(e.title,'"?')))try{await _l.delete("/events/".concat(e.event_id)),qs.success("Event deleted"),Ye()}catch(t){qs.error("Failed to delete")}})(e),"data-testid":"event-delete-".concat(e.event_id),children:(0,ea.jsx)(wD,{className:"w-4 h-4 text-red-500"})})]})]},e.event_id)})})}),(0,ea.jsxs)(iJ,{value:"groups",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:"Audience groups let you target events to specific classes, years or families."}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>L(!0),"data-testid":"groups-import-btn",children:[(0,ea.jsx)(kq,{className:"w-4 h-4 mr-2"}),"Import CSV"]}),(0,ea.jsxs)(sg,{size:"sm",onClick:()=>{B({name:"",type:"custom",member_emails:"",taptile_group_id:""}),M(null),T(!0)},"data-testid":"groups-new-btn",children:[(0,ea.jsx)(Vj,{className:"w-4 h-4 mr-2"}),"New Group"]})]})]}),b?(0,ea.jsxs)("div",{className:"mb-4 flex items-start gap-3 bg-indigo-50 border border-indigo-200 rounded-xl px-4 py-3 text-sm text-indigo-800","data-testid":"taptile-groups-banner",children:[(0,ea.jsx)(Ij,{className:"w-4 h-4 mt-0.5 shrink-0 text-indigo-500"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("span",{className:"font-medium",children:"Taptile push targeting is active."})," Open any group and paste its Taptile Group ID so event push notifications only reach the right people."," ",(0,ea.jsx)("span",{className:"text-indigo-500 text-xs",children:"Find IDs in your Taptile admin \u2192 Contacts \u2192 Groups \u2192 copy the UUID."})]})]}):(0,ea.jsxs)("div",{className:"mb-4 flex items-start gap-3 bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 text-sm text-slate-600","data-testid":"taptile-groups-not-connected",children:[(0,ea.jsx)(Ij,{className:"w-4 h-4 mt-0.5 shrink-0 text-slate-400"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("span",{className:"font-medium",children:"Connect Taptile to enable push targeting."})," Once connected, you can map each group to a Taptile Group ID so event pushes reach the right audience."," ",(0,ea.jsx)("a",{href:"/taptile",className:"text-indigo-600 underline font-medium",children:"Connect Taptile \u2192"})]})]}),(0,ea.jsx)("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:0===o.length?(0,ea.jsxs)("div",{className:"col-span-full p-12 text-center text-slate-400 bg-white rounded-xl border border-slate-200",children:[(0,ea.jsx)(Bj,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),"No groups yet."]}):o.map(e=>(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4","data-testid":"group-card-".concat(e.group_id),children:[(0,ea.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:e.name}),(0,ea.jsxs)("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[(0,ea.jsx)(EC,{variant:"secondary",className:"text-[10px] capitalize",children:e.type}),e.taptile_group_id?(0,ea.jsxs)(EC,{variant:"outline",className:"text-[10px] text-indigo-700 border-indigo-300 bg-indigo-50 gap-1","data-testid":"group-taptile-badge-".concat(e.group_id),children:[(0,ea.jsx)(Ij,{className:"w-2.5 h-2.5"})," Taptile linked"]}):b?(0,ea.jsxs)("span",{className:"text-[10px] text-amber-500 flex items-center gap-1","data-testid":"group-taptile-unlinked-".concat(e.group_id),children:[(0,ea.jsx)(Ij,{className:"w-2.5 h-2.5"})," No Taptile link"]}):null]})]}),(0,ea.jsxs)("div",{className:"flex gap-1",children:[(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(e=>{B({name:e.name,type:e.type,member_emails:(e.member_emails||[]).join("\n"),taptile_group_id:e.taptile_group_id||""}),M(e),T(!0)})(e),children:(0,ea.jsx)(ND,{className:"w-4 h-4"})}),(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(async e=>{if(window.confirm('Delete group "'.concat(e.name,'"?')))try{await _l.delete("/events/groups/".concat(e.group_id)),qs.success("Group deleted"),Ye()}catch(t){qs.error("Failed to delete")}})(e),children:(0,ea.jsx)(wD,{className:"w-4 h-4 text-red-500"})})]})]}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mt-3",children:[(e.member_emails||[]).length," member(s)"]})]},e.group_id))})]}),(0,ea.jsx)(iJ,{value:"tickets","data-testid":"events-tickets-tab",children:0===r.filter(e=>e.ticket_enabled).length?(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-12 text-center text-slate-400",children:[(0,ea.jsx)(Aj,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),(0,ea.jsx)("p",{className:"font-medium",children:"No events have ticketing enabled."}),(0,ea.jsx)("p",{className:"text-xs mt-1",children:'Open an event editor and toggle "Sell tickets via Stripe".'})]}):(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ea.jsx)("span",{className:"text-sm font-medium text-slate-600 shrink-0",children:"View tickets for"}),(0,ea.jsxs)(eb,{value:Y,onValueChange:e=>{J(e),st(e)},children:[(0,ea.jsx)(sb,{className:"max-w-xs","data-testid":"tickets-event-select",children:(0,ea.jsx)(tb,{placeholder:"Select event\u2026"})}),(0,ea.jsx)(lb,{children:r.filter(e=>e.ticket_enabled).map(e=>(0,ea.jsx)(rb,{value:e.event_id,children:e.title},e.event_id))})]}),Y&&(0,ea.jsx)("button",{onClick:()=>st(Y),className:"text-slate-400 hover:text-slate-600",title:"Refresh","data-testid":"tickets-refresh-btn",children:(0,ea.jsx)(gq,{className:"w-4 h-4"})})]}),Z?(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 p-8 text-center text-slate-400",children:"Loading tickets\u2026"}):Q?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 text-center","data-testid":"tickets-sold-count",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-900",children:Q.total_sold}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Tickets sold"})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-emerald-200 p-4 text-center bg-emerald-50/30","data-testid":"tickets-revenue",children:[(0,ea.jsxs)("p",{className:"text-2xl font-bold text-emerald-600",children:[(Q.currency||"usd").toUpperCase()," ",(Q.total_revenue||0).toFixed(2)]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Revenue"})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-indigo-600",children:Q.total_checked_in||0}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Checked in"})]}),(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 text-center",children:[(0,ea.jsx)("p",{className:"text-2xl font-bold text-slate-400",children:(null===(e=Q.tickets)||void 0===e?void 0:e.filter(e=>"refunded"===e.payment_status).length)||0}),(0,ea.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Refunded"})]})]}),(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden",children:(0,ea.jsxs)("table",{className:"w-full text-sm",children:[(0,ea.jsx)("thead",{children:(0,ea.jsxs)("tr",{className:"bg-slate-50 border-b border-slate-200",children:[(0,ea.jsx)("th",{className:"text-left p-3 text-xs font-semibold text-slate-500",children:"Buyer"}),(0,ea.jsx)("th",{className:"text-left p-3 text-xs font-semibold text-slate-500",children:"Qty"}),(0,ea.jsx)("th",{className:"text-left p-3 text-xs font-semibold text-slate-500",children:"Amount"}),(0,ea.jsx)("th",{className:"text-left p-3 text-xs font-semibold text-slate-500",children:"Status"}),(0,ea.jsx)("th",{className:"text-left p-3 text-xs font-semibold text-slate-500",children:"Check-In"}),(0,ea.jsx)("th",{className:"text-left p-3 text-xs font-semibold text-slate-500",children:"Date"}),(0,ea.jsx)("th",{className:"p-3 w-20"})]})}),(0,ea.jsx)("tbody",{className:"divide-y divide-slate-100",children:0===(null===(s=Q.tickets)||void 0===s?void 0:s.length)?(0,ea.jsx)("tr",{children:(0,ea.jsx)("td",{colSpan:6,className:"p-8 text-center text-slate-400",children:"No tickets purchased yet"})}):null===(a=Q.tickets)||void 0===a?void 0:a.map(e=>(0,ea.jsxs)("tr",{"data-testid":"ticket-row-".concat(e.ticket_id),children:[(0,ea.jsxs)("td",{className:"p-3",children:[(0,ea.jsx)("p",{className:"font-medium text-slate-800",children:e.buyer_name}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:e.buyer_email})]}),(0,ea.jsx)("td",{className:"p-3 text-slate-600",children:e.quantity}),(0,ea.jsxs)("td",{className:"p-3 text-slate-600",children:[(e.currency||"usd").toUpperCase()," ",(e.amount_paid||0).toFixed(2)]}),(0,ea.jsx)("td",{className:"p-3",children:(0,ea.jsx)(EC,{variant:"outline",className:"text-[10px] ".concat("paid"===e.payment_status?"bg-emerald-50 text-emerald-700 border-emerald-200":"refunded"===e.payment_status?"bg-slate-50 text-slate-500":"bg-amber-50 text-amber-600 border-amber-200"),"data-testid":"ticket-status-".concat(e.ticket_id),children:e.payment_status})}),(0,ea.jsx)("td",{className:"p-3",children:"paid"===e.payment_status?(0,ea.jsx)(sg,{variant:e.checked_in?"default":"outline",size:"sm",onClick:()=>(async e=>{ne(e.ticket_id);try{await _l.post("/event-payments/admin/tickets/".concat(e.ticket_id,"/checkin"),{}),qs.success(e.checked_in?"Check-in removed":"Checked in"),st(Y)}catch(G2){var t,s;qs.error((null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Check-in toggle failed")}finally{ne(null)}})(e),disabled:ae===e.ticket_id,className:"text-xs ".concat(e.checked_in?"bg-indigo-600 text-white hover:bg-indigo-700":"text-slate-600"),"data-testid":"ticket-checkin-".concat(e.ticket_id),children:ae===e.ticket_id?"\u2026":e.checked_in?"Checked In":"Check In"}):(0,ea.jsx)("span",{className:"text-xs text-slate-300",children:"\u2014"})}),(0,ea.jsx)("td",{className:"p-3 text-xs text-slate-400",children:new Date(e.created_at).toLocaleDateString()}),(0,ea.jsx)("td",{className:"p-3",children:"paid"===e.payment_status&&(0,ea.jsx)(sg,{variant:"ghost",size:"sm",onClick:()=>(async e=>{if(window.confirm("Issue a full refund to ".concat(e.buyer_name," for ").concat(e.quantity," ticket(s)? This cannot be undone."))){se(e.ticket_id);try{await _l.post("/event-payments/admin/tickets/".concat(e.ticket_id,"/refund"),{}),qs.success("Refund issued successfully"),st(Y)}catch(G2){var t,s;qs.error((null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Refund failed")}finally{se(null)}}})(e),disabled:te===e.ticket_id,className:"text-xs text-red-500 hover:text-red-700 hover:bg-red-50","data-testid":"ticket-refund-".concat(e.ticket_id),children:te===e.ticket_id?"Refunding\u2026":"Refund"})})]},e.ticket_id))})]})})]}):null]})}),(0,ea.jsx)(iJ,{value:"absentees",children:(0,ea.jsx)("div",{className:"bg-white rounded-xl border border-slate-200 divide-y divide-slate-100",children:0===h.length?(0,ea.jsxs)("div",{className:"p-12 text-center text-slate-400",children:[(0,ea.jsx)(Tw,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),"No absence reports yet."]}):h.map(e=>(0,ea.
2jsxs)("div",{className:"p-4","data-testid":"absentee-row-".concat(e.absentee_id),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:e.student_name}),(0,ea.jsx)("span",{className:"text-xs text-slate-400",children:new Date(e.created_at).toLocaleString()})]}),(0,ea.jsxs)("div",{className:"text-sm text-slate-500 mt-1",children:[(0,ea.jsxs)("span",{children:[e.date_from,e.date_to?" \u2192 ".concat(e.date_to):""]})," \xb7 ",(0,ea.jsx)("span",{children:e.reason}),e.parent_name&&(0,ea.jsxs)(ea.Fragment,{children:[" \xb7 Reported by ",e.parent_name,e.parent_email?" (".concat(e.parent_email,")"):""]})]}),e.notes&&(0,ea.jsx)("p",{className:"text-sm text-slate-400 mt-1",children:e.notes})]},e.absentee_id))})}),(0,ea.jsx)(iJ,{value:"settings",children:(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-6 max-w-2xl space-y-5",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between border border-slate-200 rounded-lg p-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"!mb-0",children:'Show "Report an absence" link publicly'}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Turn off if your organisation doesn't need absence reporting."})]}),(0,ea.jsx)(wb,{checked:U.absentee_enabled,onCheckedChange:e=>H(t=>d(d({},t),{},{absentee_enabled:e})),"data-testid":"settings-absentee-enabled"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Office notification email"}),(0,ea.jsx)(BN,{value:U.office_email,onChange:e=>H(t=>d(d({},t),{},{office_email:e.target.value})),placeholder:"[email protected]","data-testid":"settings-office-email"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Absence notifications from your public site are sent here."})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Absentee auto-responder message"}),(0,ea.jsx)(YN,{rows:3,value:U.absentee_auto_responder,onChange:e=>H(t=>d(d({},t),{},{absentee_auto_responder:e.target.value})),"data-testid":"settings-absentee-responder"})]}),ht&&(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Public iCal feed URL"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{readOnly:!0,value:ht,"data-testid":"settings-ical-url"}),(0,ea.jsx)(sg,{variant:"outline",onClick:()=>{navigator.clipboard.writeText(ht),qs.success("Copied")},children:"Copy"})]})]}),(0,ea.jsx)("div",{className:"border rounded-xl p-4 space-y-1 bg-slate-50/50",children:(0,ea.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-semibold text-slate-800",children:"Auto-publish inbound API events"}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500 mt-0.5",children:["When ",(0,ea.jsx)("strong",{children:"on"}),", events pushed by third-party platforms (e.g. Gametime) via the API go straight to published. When ",(0,ea.jsx)("strong",{children:"off"}),", they arrive as drafts for you to review first."]})]}),(0,ea.jsx)(wb,{checked:U.api_auto_publish,onCheckedChange:e=>H(t=>d(d({},t),{},{api_auto_publish:e})),"data-testid":"api-auto-publish-toggle"})]})}),(0,ea.jsxs)("div",{className:"border-t pt-4 space-y-4","data-testid":"manage-labels-section",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("h3",{className:"font-semibold text-slate-800",children:"Manage Filter Labels"}),(0,ea.jsxs)("button",{onClick:Ze,className:"text-xs text-indigo-600 hover:underline flex items-center gap-1",children:[(0,ea.jsx)(gq,{className:"w-3 h-3"})," Refresh"]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Remove a label to clear it from all events that use it. This cannot be undone."}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"text-xs font-semibold text-slate-600 mb-1.5 flex items-center gap-1",children:[(0,ea.jsx)(Wj,{className:"w-3 h-3"})," Event Types"]}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:0===ie.event_types.length?(0,ea.jsx)("span",{className:"text-xs text-slate-400 italic",children:"No event types yet \u2014 add one below"}):ie.event_types.map(e=>{const t=r.filter(t=>t.event_type===e).length;return(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-slate-100 text-slate-700 text-xs px-2.5 py-1 rounded-full","data-testid":"label-type-".concat(e),children:[e," ",(0,ea.jsxs)("span",{className:"text-slate-400",children:["(",t,")"]}),(0,ea.jsx)("button",{type:"button",onClick:()=>et("event_type",e,t),className:"text-slate-400 hover:text-red-500 ml-0.5",title:"Remove from all events",children:"\xd7"})]},e)})}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{value:We,onChange:e=>Ve(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),tt("event_type",We,Ve))},placeholder:"e.g. Workshop, Conference\u2026",className:"flex-1 px-3 py-1.5 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300","data-testid":"add-label-type-input"}),(0,ea.jsx)("button",{type:"button",onClick:()=>tt("event_type",We,Ve),className:"px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-xs hover:bg-indigo-700","data-testid":"add-label-type-btn",children:"+ Add"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"text-xs font-semibold text-slate-600 mb-1.5 flex items-center gap-1",children:[(0,ea.jsx)(kD,{className:"w-3 h-3"})," Departments / Teams"]}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:0===ie.departments.length?(0,ea.jsx)("span",{className:"text-xs text-slate-400 italic",children:"No departments yet \u2014 add one below"}):ie.departments.map(e=>{const t=r.filter(t=>(t.departments||[]).includes(e)).length;return(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-indigo-50 text-indigo-700 text-xs px-2.5 py-1 rounded-full","data-testid":"label-dept-".concat(e),children:[e," ",(0,ea.jsxs)("span",{className:"text-indigo-300",children:["(",t,")"]}),(0,ea.jsx)("button",{type:"button",onClick:()=>et("departments",e,t),className:"text-indigo-300 hover:text-red-500 ml-0.5",title:"Remove from all events",children:"\xd7"})]},e)})}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{value:qe,onChange:e=>$e(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),tt("departments",qe,$e))},placeholder:"e.g. Sales, Marketing, Finance\u2026",className:"flex-1 px-3 py-1.5 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300","data-testid":"add-label-dept-input"}),(0,ea.jsx)("button",{type:"button",onClick:()=>tt("departments",qe,$e),className:"px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-xs hover:bg-indigo-700","data-testid":"add-label-dept-btn",children:"+ Add"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("p",{className:"text-xs font-semibold text-slate-600 mb-1.5 flex items-center gap-1",children:[(0,ea.jsx)(Wj,{className:"w-3 h-3"})," Tags"]}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:0===ie.tags.length?(0,ea.jsx)("span",{className:"text-xs text-slate-400 italic",children:"No tags yet \u2014 add one below"}):ie.tags.map(e=>{const t=r.filter(t=>(t.tags||[]).includes(e)).length;return(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-emerald-50 text-emerald-700 text-xs px-2.5 py-1 rounded-full","data-testid":"label-tag-".concat(e),children:[e," ",(0,ea.jsxs)("span",{className:"text-emerald-300",children:["(",t,")"]}),(0,ea.jsx)("button",{type:"button",onClick:()=>et("tags",e,t),className:"text-emerald-300 hover:text-red-500 ml-0.5",title:"Remove from all events",children:"\xd7"})]},e)})}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)("input",{value:Ge,onChange:e=>Ke(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),tt("tags",Ge,Ke))},placeholder:"e.g. annual, external-speaker\u2026",className:"flex-1 px-3 py-1.5 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300","data-testid":"add-label-tag-input"}),(0,ea.jsx)("button",{type:"button",onClick:()=>tt("tags",Ge,Ke),className:"px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-xs hover:bg-indigo-700","data-testid":"add-label-tag-btn",children:"+ Add"})]})]})]}),(0,ea.jsx)(sg,{onClick:async()=>{try{await _l.put("/events/settings",U),qs.success("Settings saved")}catch(e){qs.error("Failed to save settings")}},"data-testid":"settings-save-btn",children:"Save Settings"})]})}),(0,ea.jsx)(iJ,{value:"ical",children:(0,ea.jsxs)("div",{className:"space-y-6",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h2",{className:"text-xl font-bold text-slate-800",children:"Inbound iCal Sync"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-0.5",children:"Pull events from any external
2calendar (Google Calendar, Outlook, Apple Calendar, etc.) into Nexus automatically."})]}),(0,ea.jsxs)(sg,{onClick:()=>{ge({name:"",url:"",color:"#6366f1",sync_interval_hours:6,_urlVisible:!1}),je(null),ve(!0)},"data-testid":"ical-add-btn",children:[(0,ea.jsx)(Vj,{className:"w-4 h-4 mr-1"})," Add Source"]})]}),0===he.length?(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-xl border-2 border-dashed border-slate-200 p-10 text-center text-slate-400",children:[(0,ea.jsx)(gJ,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),(0,ea.jsx)("p",{className:"font-medium",children:"No iCal sources yet"}),(0,ea.jsx)("p",{className:"text-sm mt-1",children:"Add a Google Calendar, Outlook, or any public .ics URL to automatically import events."}),(0,ea.jsx)(sg,{className:"mt-4",onClick:()=>{ge({name:"",url:"",color:"#6366f1",sync_interval_hours:6}),je(null),ve(!0)},children:"Add your first source"})]}):(0,ea.jsx)("div",{className:"space-y-3",children:he.map(e=>{var t;return(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-4 flex flex-wrap items-center gap-4","data-testid":"ical-source-".concat(e.source_id),children:[(0,ea.jsx)("div",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:e.name}),(0,ea.jsx)(y2,{url:e.url}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-slate-500",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:["ok"===e.last_sync_status?(0,ea.jsx)(uD,{className:"w-3.5 h-3.5 text-emerald-500"}):"error"===e.last_sync_status?(0,ea.jsx)(WN,{className:"w-3.5 h-3.5 text-red-400"}):(0,ea.jsx)(Kg,{className:"w-3.5 h-3.5 text-slate-400"}),e.last_synced?"Synced ".concat(new Date(e.last_synced).toLocaleString()):"Never synced"]}),(0,ea.jsxs)("span",{children:[e.events_count||0," event",1!==e.events_count?"s":""," imported"]}),"error"===e.last_sync_status&&(0,ea.jsx)("span",{className:"text-red-400 truncate max-w-xs",children:e.last_sync_error}),"error"===e.last_sync_status&&(null===(t=e.url)||void 0===t?void 0:t.includes("calendar.google.com"))&&(0,ea.jsx)("span",{className:"text-amber-600 text-xs",children:"Tip: ensure the calendar is set to public, or use the Secret address in iCal format from Google Calendar \u2192 Settings \u2192 Integrate calendar."})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,ea.jsxs)(sg,{variant:"outline",size:"sm",onClick:()=>(async e=>{Ne(e.source_id);try{const t=(await _l.post("/events/ical-sources/".concat(e.source_id,"/sync"))).data;t.ok?qs.success("Sync complete \u2014 ".concat(t.added," added, ").concat(t.updated," updated, ").concat(t.removed," removed")):qs.error("Sync failed: ".concat(t.error)),Xe(),Ye()}catch(G2){var t,s;qs.error((null===(t=G2.response)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.detail)||"Sync failed")}finally{Ne(null)}})(e),disabled:ye===e.source_id,"data-testid":"ical-sync-btn-".concat(e.source_id),children:[ye===e.source_id?(0,ea.jsx)(ql,{className:"w-4 h-4 animate-spin"}):(0,ea.jsx)(gq,{className:"w-4 h-4"})," Sync now"]}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",onClick:()=>{je(e),ge({name:e.name,url:e.url,color:e.color,sync_interval_hours:e.sync_interval_hours||6,_urlVisible:!1}),ve(!0)},children:(0,ea.jsx)(ND,{className:"w-4 h-4"})}),(0,ea.jsx)(sg,{variant:"outline",size:"sm",className:"text-red-500 hover:text-red-700",onClick:()=>(async e=>{if(window.confirm('Remove "'.concat(e.name,'" and delete all ').concat(e.events_count||0," imported event(s)?")))try{await _l.delete("/events/ical-sources/".concat(e.source_id)),qs.success("Source removed"),Xe(),Ye()}catch(t){qs.error("Failed to remove source")}})(e),"data-testid":"ical-delete-btn-".concat(e.source_id),children:(0,ea.jsx)(wD,{className:"w-4 h-4"})})]})]},e.source_id)})}),(0,ea.jsxs)("div",{className:"rounded-xl border border-blue-100 bg-blue-50 p-4 text-sm text-blue-700",children:[(0,ea.jsx)("p",{className:"font-semibold mb-1",children:"How to get your iCal URL"}),(0,ea.jsxs)("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[(0,ea.jsxs)("li",{children:[(0,ea.jsx)("strong",{children:"Google Calendar:"}),' Settings \u2192 Your calendar \u2192 Scroll to "Integrate calendar" \u2192 copy either the ',(0,ea.jsx)("strong",{children:'"Public address in iCal format"'})," (calendar must be set to public) or the ",(0,ea.jsx)("strong",{children:'"Secret address in iCal format"'})," (recommended \u2014 keeps events private and off Google search results, no public setting needed)"]}),(0,ea.jsxs)("li",{children:[(0,ea.jsx)("strong",{children:"Outlook / Microsoft 365:"})," Calendar \u2192 Shared \u2192 Publish \u2192 copy the ICS link"]}),(0,ea.jsxs)("li",{children:[(0,ea.jsx)("strong",{children:"Apple Calendar:"})," Calendar \u2192 Share Calendar \u2192 enable Public Calendar \u2192 copy URL"]}),(0,ea.jsxs)("li",{children:["Any ",(0,ea.jsx)("code",{children:".ics"})," URL works \u2014 school MIS systems, sports fixtures, booking systems, etc."]})]})]})]})}),(0,ea.jsx)(iJ,{value:"embed","data-testid":"events-tab-embed-content",children:(0,ea.jsxs)("div",{className:"space-y-6 max-w-2xl",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("h2",{className:"text-xl font-bold text-slate-800",children:"Embed Calendar on Your Website"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-0.5",children:"Copy the snippet below and paste it into any webpage to display your events calendar inside an iframe."})]}),f?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"bg-white rounded-xl border border-slate-200 p-5 space-y-5",children:[(0,ea.jsx)("h3",{className:"text-sm font-semibold text-slate-700 uppercase tracking-wide",children:"Customise snippet"}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-800",children:"Default view"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Which view opens when the page loads"})]}),(0,ea.jsxs)("div",{className:"inline-flex rounded-lg border border-slate-200 bg-slate-50 p-0.5",children:[(0,ea.jsx)("button",{onClick:()=>Te("calendar"),className:"px-3 py-1.5 text-sm rounded-md transition-colors ".concat("calendar"===Fe?"bg-indigo-600 text-white shadow-sm":"text-slate-600 hover:text-slate-900"),"data-testid":"embed-view-calendar",children:"Calendar"}),(0,ea.jsx)("button",{onClick:()=>Te("list"),className:"px-3 py-1.5 text-sm rounded-md transition-colors ".concat("list"===Fe?"bg-indigo-600 text-white shadow-sm":"text-slate-600 hover:text-slate-900"),"data-testid":"embed-view-list",children:"List"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-800",children:"Height"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Fixed pixel height of the iframe"})]}),(0,ea.jsxs)(eb,{value:Ie,onValueChange:Oe,children:[(0,ea.jsx)(sb,{className:"w-36","data-testid":"embed-height-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"400",children:"400 px"}),(0,ea.jsx)(rb,{value:"600",children:"600 px"}),(0,ea.jsx)(rb,{value:"700",children:"700 px"}),(0,ea.jsx)(rb,{value:"800",children:"800 px"}),(0,ea.jsx)(rb,{value:"900",children:"900 px"}),(0,ea.jsx)(rb,{value:"1000",children:"1000 px"})]})]})]}),(0,ea.jsx)("hr",{className:"border-slate-100"}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-800",children:"Show filter bar"}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Search box and calendar/event-type filter pills"})]}),(0,ea.jsx)(wb,{checked:ze,onCheckedChange:Me,"data-testid":"embed-toggle-filters"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-800",children:'Show "Subscribe to iCal" button'}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Lets visitors download the .ics feed"})]}),(0,ea.jsx)(wb,{checked:Pe,onCheckedChange:Be,"data-testid":"embed-toggle-ical"})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-slate-800",children:'Show "Report an absence" button'}),(0,ea.jsx)("p",{className:"text-xs text-slate-500",children:"Lets visitors submit an absence from the embedded calendar"})]}),(0,ea.jsx)(wb,{checked:Re,onCheckedChange:Le,"data-testid":"embed-toggle-absence"})]})]}),(0,ea.jsxs)("div",{className:"space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsx)("p",{className:"text-sm font-semibold text-slate-700",children:"Your embed code"}),(0,ea.jsx)(sg,{size:"sm",variant:Ue?"default":"outline",onClick:()=>{gt&&navigator.clipboard.writeText(gt).then(()=>{He(!0),setTimeout(()=>He(!1),2e3)})},className:Ue?"bg-emerald-600 hover:bg-emerald-700 text-white":"","data-testid":"embed-copy-btn",children:Ue?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(Xl,{className:"w-4 h-4 mr-1"})," Copied!"]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(DD,{className:"w-4 h-4 mr-1"})," Copy snippet"]})})]}),(0,ea.jsx)("pre",{className:"bg-slate-900 text-emerald-400 text-xs rounded-xl p-4 overflow-x-auto whitespace-pre-wrap break-all leading-relaxed font-mono select-all","data-testid":"embed-snippet-code",children:gt})]}),(0,ea.jsxs)("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 p-4 text-sm text-indigo-700 space-y-1",children:[(0,ea.jsx)("p",{className:"font-semibold",children:"How to use"}),(0,ea.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-xs text-indigo-600",children:[(0,ea.jsx)("li",{children:"Copy the snippet above."}),(0,ea.jsx)("li",{children:"Paste it into any webpage's HTML where you want the calendar to appear."}),(0,ea.jsx)("li",{children:"The calendar fills the full width of its container at the height you chose."}),(0,ea.jsx)("li",{children:"No scripts or plugins required \u2014 just plain HTML."})]})]}),(0,ea.jsxs)("div",{className:"text-xs text-slate-500",children:["Preview URL: ",(0,ea.jsx)("a",{href:pt,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-600 hover:underline break-all","data-testid":"embed-preview-link",children:pt})]})]}):(0,ea.jsx)("div",{className:"rounded-xl bg-amber-50 border border-amber-200 p-4 text-sm text-amber-800",children:"Loading your calendar URL\u2026 please wait a moment."})]})})]})]}),(0,ea.jsx)(Ok,{open:fe,onOpenChange:ve,children:(0,ea.jsxs)(Wk,{className:"max-w-lg",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:be?"Edit iCal Source":"Add iCal Source"})}),(0,ea.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Name *"}),(0,ea.jsx)(BN,{value:pe.name,onChange:e=>ge(t=>d(d({},t),{},{name:e.target.value})),placeholder:"e.g. Google Calendar \u2014 Sales Team","data-testid":"ical-form-name"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"iCal URL *"}),(0,ea.jsxs)("div",{className:"relative",children:[(0,ea.jsx)(BN,{type:pe._urlVisible?"text":"password",value:pe.url,onChange:e=>ge(t=>d(d({},t),{},{url:e.target.value})),placeholder:"https://calendar.google.com/calendar/ical/\u2026/private/secret.ics","data-testid":"ical-form-url",className:"pr-9 font-mono text-xs"}),(0,ea.jsx)("button",{type:"button",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",onClick:()=>ge(e=>d(d({},e),{},{_urlVisible:!e._urlVisible})),title:pe._urlVisible?"Hide URL":"Show URL",children:pe._urlVisible?(0,ea.jsx)(LN,{size:14}):(0,ea.jsx)(IN,{size:14})})]}),(0,ea.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:["Paste any ",(0,ea.jsx)("code",{children:".ics"})," URL. The ",(0,ea.jsx)("strong",{children:"Secret address"})," from Google Calendar is recommended to keep events off search results, but the public address also works."]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Colour"}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1.5 mt-1.5 max-w-xs",children:[g2.map(e=>(0,ea.jsx)("button",{type:"button",onClick:()=>ge(t=>d(d({},t),{},{color:e})),title:e,className:"w-6 h-6 rounded-full border-2 transition-transform hover:scale-110 ".concat(pe.color===e?"border-slate-800 scale-110 ring-2 ring-offset-1 ring-slate-400":"border-transparent"),style:{backgroundColor:e}},e)),(0,ea.jsxs)("label",{className:"relative w-6 h-6 rounded-full cursor-pointer border-2 border-dashed border-slate-300 hover:border-slate-500 transition-colors flex items-center justify-center overflow-hidden",title:"Custom colour",children:[(0,ea.jsx)("span",{className:"text-slate-400 text-xs font-bold leading-none select-none",children:"+"}),(0,ea.jsx)("input",{type:"color",value:pe.color,onChange:e=>ge(t=>d(d({},t),{},{color:e.target.value})),className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1 font-mono",children:pe.color})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Auto-sync every"}),(0,ea.jsxs)("select",{value:pe.sync_interval_hours,onChange:e=>ge(t=>d(d({},t),{}
2,{sync_interval_hours:parseInt(e.target.value)})),className:"mt-1 w-full py-2 pl-3 pr-8 text-sm border border-slate-200 rounded-lg focus:outline-none bg-white","data-testid":"ical-form-interval",children:[(0,ea.jsx)("option",{value:1,children:"1 hour"}),(0,ea.jsx)("option",{value:3,children:"3 hours"}),(0,ea.jsx)("option",{value:6,children:"6 hours"}),(0,ea.jsx)("option",{value:12,children:"12 hours"}),(0,ea.jsx)("option",{value:24,children:"24 hours"})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>{ve(!1),je(null)},children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(pe.name.trim()&&pe.url.trim())try{be?(await _l.put("/events/ical-sources/".concat(be.source_id),pe),qs.success("Source updated")):(await _l.post("/events/ical-sources",pe),qs.success("iCal source added \u2014 syncing now\u2026")),ve(!1),je(null),ge({name:"",url:"",color:"#6366f1",sync_interval_hours:6}),Xe()}catch(G2){var e,t;qs.error((null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save source")}else qs.error("Name and URL are required")},"data-testid":"ical-form-save",children:be?"Save Changes":"Add & Sync"})]})]})}),(0,ea.jsx)(Ok,{open:y,onOpenChange:N,children:(0,ea.jsxs)(Wk,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:w?"Edit Event":"New Event"})}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Title *"}),(0,ea.jsx)(BN,{value:k.title,onChange:e=>D(t=>d(d({},t),{},{title:e.target.value})),"data-testid":"event-title-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Start *"}),(0,ea.jsx)(BN,{type:"datetime-local",value:k.start,onChange:e=>D(t=>d(d({},t),{},{start:e.target.value})),"data-testid":"event-start-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"End"}),(0,ea.jsx)(BN,{type:"datetime-local",value:k.end,onChange:e=>D(t=>d(d({},t),{},{end:e.target.value})),"data-testid":"event-end-input"})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:k.all_day,onCheckedChange:e=>D(t=>d(d({},t),{},{all_day:e})),"data-testid":"event-allday-switch"}),(0,ea.jsx)(tf,{className:"!mb-0",children:"All-day event"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Location"}),(0,ea.jsx)(BN,{value:k.location,onChange:e=>D(t=>d(d({},t),{},{location:e.target.value})),"data-testid":"event-location-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Category"}),(0,ea.jsx)(BN,{value:k.category,onChange:e=>D(t=>d(d({},t),{},{category:e.target.value})),placeholder:"Sports, Academic\u2026"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Colour"}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1.5 mt-1 max-w-xs",children:[g2.map(e=>(0,ea.jsx)("button",{type:"button",onClick:()=>D(t=>d(d({},t),{},{color:e})),title:e,className:"w-6 h-6 rounded-full border-2 transition-transform hover:scale-110 ".concat(k.color===e?"border-slate-900 scale-110 ring-2 ring-offset-1 ring-slate-400":"border-transparent"),style:{backgroundColor:e},"data-testid":"event-color-".concat(e)},e)),(0,ea.jsxs)("label",{className:"relative w-6 h-6 rounded-full cursor-pointer border-2 border-dashed border-slate-300 hover:border-slate-500 transition-colors flex items-center justify-center overflow-hidden",title:"Custom colour",children:[(0,ea.jsx)("span",{className:"text-slate-400 text-xs font-bold leading-none select-none",children:"+"}),(0,ea.jsx)("input",{type:"color",value:k.color,onChange:e=>D(t=>d(d({},t),{},{color:e.target.value})),className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1 font-mono",children:k.color})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-slate-50/40 p-3 space-y-3",children:[(0,ea.jsx)("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wide",children:"Classification & Filtering"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Event Type"}
2),(0,ea.jsx)(BN,{value:k.event_type,onChange:e=>D(t=>d(d({},t),{},{event_type:e.target.value})),placeholder:"e.g. Workshop, Conference, Meeting\u2026",list:"event-type-suggestions","data-testid":"event-type-input"}),(0,ea.jsx)("datalist",{id:"event-type-suggestions",children:ie.event_types.map(e=>(0,ea.jsx)("option",{value:e},e))})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Departments / Teams"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:ce,onChange:e=>de(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ut(ce))},placeholder:"Type and press Enter\u2026",list:"dept-suggestions",className:"flex-1","data-testid":"event-dept-input"}),(0,ea.jsx)("datalist",{id:"dept-suggestions",children:ie.departments.map(e=>(0,ea.jsx)("option",{value:e},e))}),(0,ea.jsx)("button",{type:"button",onClick:()=>ut(ce),className:"px-3 py-1.5 rounded-lg bg-slate-200 text-slate-700 text-xs hover:bg-slate-300",children:"Add"})]}),k.departments.length>0&&(0,ea.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:k.departments.map(e=>(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 bg-indigo-100 text-indigo-700 text-xs px-2.5 py-1 rounded-full","data-testid":"event-dept-tag-".concat(e),children:[e,(0,ea.jsx)("button",{type:"button",onClick:()=>(e=>D(t=>d(d({},t),{},{departments:t.departments.filter(t=>t!==e)})))(e),className:"hover:text-indigo-900 ml-0.5",children:"\xd7"})]},e))})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Tags"}),(0,ea.jsxs)("div",{className:"flex gap-2",children:[(0,ea.jsx)(BN,{value:ue,onChange:e=>me(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),mt(ue))},placeholder:"Type and press Enter\u2026",list:"tag-suggestions",className:"flex-1","data-testid":"event-tag-input"}),(0,ea.jsx)("datalist",{id:"tag-suggestions",children:ie.tags.map(e=>(0,ea.jsx)("option",{value:e},e))}),(0,ea.jsx)("button",{type:"button",onClick:()=>mt(ue),className:"px-3 py-1.5 rounded-lg bg-slate-200 text-slate-700 text-xs hover:bg-slate-300",children:"Add"})]}),k.tags.length>0&&(0,ea.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:k.tags.map(e=>(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 bg-emerald-100 text-emerald-700 text-xs px-2.5 py-1 rounded-full","data-testid":"event-tag-chip-".concat(e),children:[e,(0,ea.jsx)("button",{type:"button",onClick:()=>(e=>D(t=>d(d({},t),{},{tags:t.tags.filter(t=>t!==e)})))(e),className:"hover:text-emerald-900 ml-0.5",children:"\xd7"})]},e))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Description"}),(0,ea.jsx)("div",{className:"border border-slate-200 rounded-lg overflow-hidden mt-1",children:(0,ea.jsx)(Cq,{content:k.description_html,onChange:e=>D(t=>d(d({},t),{},{description_html:e})),placeholder:"Event details\u2026"})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Cost (optional)"}),(0,ea.jsx)(BN,{type:"number",value:k.cost,onChange:e=>D(t=>d(d({},t),{},{cost:e.target.value})),placeholder:"0.00","data-testid":"event-cost-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Capacity (optional)"}),(0,ea.jsx)(BN,{type:"number",value:k.capacity,onChange:e=>D(t=>d(d({},t),{},{capacity:e.target.value})),"data-testid":"event-capacity-input"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Linked form (optional)"}),(0,ea.jsxs)(eb,{value:k.form_id||"none",onValueChange:e=>D(t=>d(d({},t),{},{form_id:"none"===e?"":e})),children:[(0,ea.jsx)(sb,{"data-testid":"event-form-select",children:(0,ea.jsx)(tb,{placeholder:"No form"})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"none",children:"No form"}),u.map(e=>(0,ea.jsx)(rb,{value:e.form_id,children:e.internal_name||e.name},e.form_id))]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Link an existing form (e.g. excursion consent, RSVP)."})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"External link URL (optional)"}),(0,ea.jsx)(BN,{type:"url",placeholder:"https://your-existing-form.com/register",value:k.external_link_url,onChange:e=>D(t=>d(d({},t),{},{external_link_url:e.target.value})),"data-testid":"event-external-link-input"}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Link to an existing page or form on any external website (shown as a button on the event listing)."})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-3 space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:k.rsvp_enabled,onCheckedChange:e=>D(t=>d(d({},t),{},{rsvp_enabled:e})),"data-testid":"event-rsvp-switch"}),(0,ea.jsx)(tf,{className:"!mb-0",children:"Enable RSVP / registration"})]}),k.rsvp_enabled&&(0,ea.jsxs)("p",{className:"text-xs text-slate-400",children:["Visitors can register with a party size. Set a ",(0,ea.jsx)("strong",{children:"Capacity"}),' above to show "spots left" and close sign-ups when full. Leave capacity empty for unlimited.']}),k.rsvp_enabled&&""!==k.capacity&&(0,ea.jsxs)("div",{className:"border-t border-slate-100 pt-3 space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(wb,{checked:k.waitlist_enabled,onCheckedChange:e=>D(t=>d(d({},t),{},{waitlist_enabled:e})),"data-testid":"event-waitlist-switch"}),(0,ea.jsx)(tf,{className:"!mb-0",children:"Enable waitlist when full"})]}),k.waitlist_enabled&&(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Claim window (hours)"}),(0,ea.jsx)(BN,{type:"number",min:"1",value:k.waitlist_claim_hours,onChange:e=>D(t=>d(d({},t),{},{waitlist_claim_hours:e.target.value})),"data-testid":"event-waitlist-hours"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Max waitlist size"}),(0,ea.jsx)(BN,{type:"number",min:"1",value:k.waitlist_max,onChange:e=>D(t=>d(d({},t),{},{waitlist_max:e.target.value})),placeholder:"Unlimited","data-testid":"event-waitlist-max"})]}),(0,ea.jsx)("p",{className:"col-span-2 text-xs text-slate-400",children:"When someone cancels, the next person on the waitlist is emailed a claim link that expires after the claim window, then rolls to the next person."})]})]})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-3 space-y-3",children:[(0,ea.jsxs)(tf,{className:"!mb-0 flex items-center gap-2",children:[(0,ea.jsx)(Kg,{className:"w-4 h-4 text-slate-400"})," Email reminders"]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 -mt-1",children:"Sent automatically to this event's audience before it starts."}),(0,ea.jsx)("div",{className:"flex flex-wrap gap-2",children:f2.map(e=>{const t=k.reminderPresets.includes(e.minutes);return(0,ea.jsx)("button",{type:"button",onClick:()=>{return t=e.minutes,void D(e=>{const s=e.reminderPresets.includes(t);return d(d({},e),{},{reminderPresets:s?e.reminderPresets.filter(e=>e!==t):[...e.reminderPresets,t]})});var t},className:"text-xs px-3 py-1.5 rounded-full border ".concat(t?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200"),"data-testid":"event-reminder-preset-".concat(e.minutes),children:e.label},e.minutes)})}),(0,ea.jsxs)("div",{className:"flex items-end gap-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Custom offset"}),(0,ea.jsx)(BN,{type:"number",min:"1",className:"w-24",value:k.customReminderValue,onChange:e=>D(t=>d(d({},t),{},{customReminderValue:e.target.value})),placeholder:"e.g. 5","data-testid":"event-reminder-custom-value"})]}),(0,ea.jsxs)(eb,{value:k.customReminderUnit,onValueChange:e=>D(t=>d(d({},t),{},{customReminderUnit:e})),children:[(0,ea.jsx)(sb,{className:"w-28","data-testid":"event-reminder-custom-unit",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"hours",children:"hours before"}),(0,ea.jsx)(rb,{value:"days",children:"days before"})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Extra recipients (one per line)"}),(0,ea.jsx)(YN,{rows:2,value:k.reminder_extra_recipients,onChange:e=>D(t=>d(d({},t),{},{reminder_extra_recipients:e.target.value})),placeholder:"[email protected]","data-testid":"event-reminder-extra"})]})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-slate-200 p-3 space-y-2",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Ij,{className:"w-4 h-4 text-slate-400"}),(0,ea.jsx)(tf,{className:"!mb-0",children:"Notify the Taptile app when published"})]}),(0,ea.jsx)(wb,{checked:k.send_push,onCheckedChange:e=>D(t=>d(d({},t),{},{send_push:e})),disabled:!b,"data-testid":"event-push-switch"})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:b?"Sends a push notification to your Taptile app the first time this event goes live. Group-targeted events use your mapped Taptile groups (whole-audience \u2192 everyone).":"Connect your Taptile account in the integrations settings to enable app push notifications."})]}),(0,ea.jsxs)("div",{className:"rounded-lg border border-indigo-100 bg-indigo-50/30 p-3 space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Aj,{className:"w-4 h-4 text-indigo-500"}),(0,ea.jsx)(tf,{className:"!mb-0",children:"Sell tickets via Stripe"})]}),(0,ea.jsx)(wb,{checked:k.ticket_enabled,onCheckedChange:e=>D(t=>d(d({},t),{},{ticket_enabled:e})),"data-testid":"event-ticket-switch"})]}),k.ticket_enabled&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Ticket name"}),(0,ea.jsx)("input",{className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm bg-white",value:k.ticket_name,onChange:e=>D(t=>d(d({},t),{},{ticket_name:e.target.value})),placeholder:"General Admission","data-testid":"event-ticket-name-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Currency"}),(0,ea.jsxs)(eb,{value:k.ticket_currency,onValueChange:e=>D(t=>d(d({},t),{},{ticket_currency:e})),children:[(0,ea.jsx)(sb,{className:"mt-1","data-testid":"event-ticket-currency",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"usd",children:"USD ($)"}),(0,ea.jsx)(rb,{value:"gbp",children:"GBP (\xa3)"}),(0,ea.jsx)(rb,{value:"eur",children:"EUR (\u20ac)"}),(0,ea.jsx)(rb,{value:"aud",children:"AUD (A$)"})]})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Price per ticket"}),(0,ea.jsx)("input",{type:"number",min:"0.50",step:"0.01",className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm bg-white",value:k.ticket_price,onChange:e=>D(t=>d(d({},t),{},{ticket_price:e.target.value})),placeholder:"0.00","data-testid":"event-ticket-price-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs",children:"Max tickets per order"}),(0,ea.jsx)("input",{type:"number",min:"1",max:"100",className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm bg-white",value:k.ticket_limit_per_order,onChange:e=>D(t=>d(d({},t),{},{ticket_limit_per_order:e.target.value})),"data-testid":"event-ticket-limit-input"})]})]}),(0,ea.jsxs)("p",{className:"text-xs text-indigo-600",children:["Buyers pay via Stripe Checkout. A confirmation email is sent on payment. View purchases and issue refunds from the ",(0,ea.jsx)("strong",{children:"Tickets"})," tab."]}),!(null!==le&&void 0!==le&&le.charges_enabled)&&(0,ea.jsxs)("div",{className:"flex items-start gap-2 bg-amber-50 border border-amber-200 rounded-lg p-2.5","data-testid":"stripe-connect-warning",children:[(0,ea.jsx)(WN,{className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5"}),(0,ea.jsxs)("p",{className:"text-xs text-amber-700",children:[(0,ea.jsx)("strong",{children:"Connect your Str
2ipe account"})," to receive ticket payouts directly to your bank. Without it, payments are held by the platform."," ",(0,ea.jsx)("a",{href:"/stripe-payments",className:"underline font-medium hover:text-amber-900",children:"Set up Stripe Payments \u2192"})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Audience"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-1 mb-2",children:[(0,ea.jsx)(wb,{checked:k.audience.whole_school,onCheckedChange:e=>D(t=>d(d({},t),{},{audience:d(d({},t.audience),{},{whole_school:e})})),"data-testid":"event-wholeschool-switch"}),(0,ea.jsx)(tf,{className:"!mb-0",children:"Everyone"})]}),!k.audience.whole_school&&(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2",children:[0===o.length&&(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:"No groups yet \u2014 create groups under the Groups tab."}),o.map(e=>{const t=k.audience.group_ids.includes(e.group_id);return(0,ea.jsx)("button",{type:"button",onClick:()=>{return t=e.group_id,void D(e=>{const s=e.audience.group_ids||[],a=s.includes(t)?s.filter(e=>e!==t):[...s,t];return d(d({},e),{},{audience:d(d({},e.audience),{},{group_ids:a})})});var t},className:"text-xs px-3 py-1.5 rounded-full border ".concat(t?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200"),"data-testid":"event-audience-group-".concat(e.group_id),children:e.name},e.group_id)})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Status"}),(0,ea.jsxs)(eb,{value:k.status,onValueChange:e=>D(t=>d(d({},t),{},{status:e})),children:[(0,ea.jsx)(sb,{"data-testid":"event-status-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"draft",children:"Draft (hidden)"}),(0,ea.jsx)(rb,{value:"published",children:"Published (live)"})]})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{var e;if(!k.title.trim())return void qs.error("Title is required");if(!k.start)return void qs.error("Start date/time is required");S(!0);const t={title:k.title.trim(),description_html:k.description_html,category:k.category||null,color:k.color,start:j2(k.start),end:k.end?j2(k.end):null,all_day:k.all_day,location:k.location||null,cost:""===k.cost?null:parseFloat(k.cost),capacity:""===k.capacity?null:parseInt(k.capacity,10),form_id:k.form_id||null,external_link_url:(null===(e=k.external_link_url)||void 0===e?void 0:e.trim())||null,audience:k.audience,status:k.status,rsvp_enabled:k.rsvp_enabled,send_push:k.send_push,waitlist_enabled:k.rsvp_enabled&&k.waitlist_enabled,waitlist_claim_hours:parseInt(k.waitlist_claim_hours,10)||24,waitlist_max:""===k.waitlist_max?null:parseInt(k.waitlist_max,10),reminders:lt(k),reminder_extra_recipients:k.reminder_extra_recipients.split(/[\n,;]+/).map(e=>e.trim()).filter(Boolean),event_type:k.event_type||null,departments:k.departments.filter(Boolean),tags:k.tags.filter(Boolean),ticket_enabled:k.ticket_enabled,ticket_price:""===k.ticket_price?null:parseFloat(k.ticket_price),ticket_currency:k.ticket_currency,ticket_name:k.ticket_name||"General Admission",ticket_limit_per_order:parseInt(k.ticket_limit_per_order,10)||10};try{var s,a;let e;w?(e=await _l.put("/events/".concat(w.event_id),t),qs.success("Event updated")):(e=await _l.post("/events",t),qs.success("Event created"));const n=null===(s=e)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.push;n&&(n.ok?qs.success("Push sent to the Taptile app \ud83d\udd14"):"taptile_not_configured"===n.reason?qs.info("Saved. Connect Taptile to send app push notifications."):qs.error("Event saved, but the Taptile push failed to send.")),N(!1),Ye()}catch(G2){var n,l;qs.error((null===(n=G2.response)||void 0===n||null===(l=n.data)||void 0===l?void 0:l.detail)||"Failed to save event")}finally{S(!1)}},disabled:_,"data-testid":"event-save-btn",children:_?"Saving\u2026":"Save Event"})]})]})}),(0,ea.jsx)(Ok,{open:F,onOpenChange:T,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:z?"Edit Group":"New Group"})}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Name *"}),(0,ea.jsx)(BN,{value:P.name,onChange:e=>B(t=>d(d({},t),{},{name:e.target.value})),"data-testid":"group-name-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Type"}),(0,ea.jsxs)(eb,{value:P.type,onValueChange:e=>B(t=>d(d({},t),{},{type:e})),children:[(0,ea.jsx)(sb,{"data-testid":"group-type-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsx)(lb,{children:p2.map(e=>(0,ea.jsx)(rb,{value:e.value,children:e.label},e.value))})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"Member emails (one per line)"}),(0,ea.jsx)(YN,{rows:5,value:P.member_emails,onChange:e=>B(t=>d(d({},t),{},{member_emails:e.target.value})),placeholder:"[email protected]\[email protected]","data-testid":"group-emails-input"})]}),b&&(0,ea.jsxs)("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-3 space-y-2",children:[(0,ea.jsxs)(tf,{className:"text-indigo-800 font-medium flex items-center gap-1.5",children:[(0,ea.jsx)(Ij,{className:"w-3.5 h-3.5"})," Taptile Push Targeting (optional)"]}),(0,ea.jsx)(BN,{value:P.taptile_group_id,onChange:e=>B(t=>d(d({},t),{},{taptile_group_id:e.target.value})),placeholder:"e.g. grp_a1b2c3d4-e5f6-...",className:"bg-white","data-testid":"group-taptile-id-input"}),(0,ea.jsxs)("p",{className:"text-xs text-indigo-700 leading-relaxed",children:["Paste the Taptile Group ID for this group. Event push notifications targeted at this group will only reach that Taptile audience.",(0,ea.jsx)("br",{}),(0,ea.jsx)("span",{className:"text-indigo-500",children:"Find it in your Taptile admin \u2192 Contacts \u2192 Groups \u2192 click the group \u2192 copy the UUID from the URL or detail panel."})]})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(!P.name.trim())return void qs.error("Group name required");const e=P.member_emails.split(/[\n,;]+/).map(e=>e.trim()).filter(Boolean),t={name:P.name.trim(),type:P.type,member_emails:e,taptile_group_id:P.taptile_group_id.trim()||null};try{z?await _l.put("/events/groups/".concat(z.group_id),t):await _l.post("/events/groups",t),qs.success("Group saved"),T(!1),Ye()}catch(s){qs.error("Failed to save group")}},"data-testid":"group-save-btn",children:"Save Group"})]})]})}),(0,ea.jsx)(Ok,{open:R,onOpenChange:L,children:(0,ea.jsxs)(Wk,{children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Import Members from CSV"})}),(0,ea.jsxs)("div",{className:"space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"New group name"}),(0,ea.jsx)(BN,{value:I.name,onChange:e=>O(t=>d(d({},t),{},{name:e.target.value})),placeholder:"Imported Group","data-testid":"import-name-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{children:"CSV data (paste emails; name,email also works)"}),(0,ea.jsx)(YN,{rows:7,value:I.csv_text,onChange:e=>O(t=>d(d({},t),{},{csv_text:e.target.value})),placeholder:"John,[email protected]\[email protected]","data-testid":"import-csv-input"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>{if(I.csv_text.trim())try{const e=await _l.post("/events/groups/import",I);qs.success("Imported ".concat(e.data.imported," members")),L(!1),O({name:"",type:"custom",csv_text:""}),Ye()}catch(G2){var e,t;qs.error((null===(e=G2.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Import failed")}else qs.error("Paste some CSV data")},"data-testid":"import-submit-btn",children:"Import"})]})]})}),(0,ea.jsx)(Ok,{open:W,onOpenChange:V,children:(0,ea.jsxs)(Wk,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsxs)($k,{children:["RSVPs \u2014 ",null===q||void 0===q?void 0:q.title]})}),G?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsxs)("div",{className:"flex gap-4 text-sm text-slate-600 mb-3","data-testid":"rsvp-summary",children:[(0,ea.jsxs)("span",{children:[(0,ea.jsx)("strong",{children:G.confirmed_count})," registered"]}),(0,ea.jsxs)("span",{children:[(0,ea.jsx)("strong",{children:G.total_seats})," seats"]}),null!=G.capacity&&(0,ea.jsxs)("span",{children:[(0,ea.jsx)("strong",{children:Math.max(G.capacity-G.total_seats,0)})," spots left"]})]}),(0,ea.jsx)("div",{className:"divide-y divide-slate-100 border border-slate-200 rounded-lg",children:0===G.rsvps.filter(e=>"confirmed"===e.status).length?(0,ea.jsx)("div",{className:"p-6 text-center text-slate-400 text-sm",children:"No confirmed RSVPs yet."}):G.rsvps.filter(e=>"confirmed"===e.status).map(e=>(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3","data-testid":"rsvp-item-".concat(e.rsvp_id),children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-800 text-sm",children:e.name}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:[e.email," \xb7 ",e.party_size," seat(s)"]})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(async e=>{try{await _l.delete("/events/".concat(q.event_id,"/rsvps/").concat(e));const t=await _l.get("/events/".concat(q.event_id,"/rsvps"));K(t.data),qs.success("RSVP removed")}catch(t){qs.error("Failed to remove")}})(e.rsvp_id),"data-testid":"rsvp-remove-".concat(e.rsvp_id),children:(0,ea.jsx)(wD,{className:"w-4 h-4 text-red-500"})})]},e.rsvp_id))}),G.waitlist_enabled&&(0,ea.jsxs)("div",{className:"mt-5",children:[(0,ea.jsxs)("h4",{className:"text-sm font-semibold text-slate-700 mb-2 flex items-center gap-1",children:[(0,ea.jsx)(Kg,{className:"w-4 h-4"})," Waitlist (",G.waitlist_active_count," waiting)"]}),(0,ea.jsx)("div",{className:"divide-y divide-slate-100 border border-slate-200 rounded-lg",children:0===G.waitlist.filter(e=>["waiting","offered"].includes(e.status)).length?(0,ea.jsx)("div",{className:"p-4 text-center text-slate-400 text-sm",children:"No one on the waitlist."}):G.waitlist.filter(e=>["waiting","offered"].includes(e.status)).map((e,t)=>(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3","data-testid":"waitlist-item-".concat(e.waitlist_id),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("span",{className:"text-xs text-slate-400 w-
25",children:[t+1,"."]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"font-medium text-slate-800 text-sm",children:e.name}),(0,ea.jsxs)("p",{className:"text-xs text-slate-500",children:[e.email," \xb7 ",e.party_size," place(s)"]})]}),(0,ea.jsx)(EC,{variant:"offered"===e.status?"default":"secondary",className:"text-[10px] ml-1",children:e.status})]}),(0,ea.jsx)(sg,{variant:"ghost",size:"icon",onClick:()=>(async e=>{try{await _l.delete("/events/".concat(q.event_id,"/waitlist/").concat(e));const t=await _l.get("/events/".concat(q.event_id,"/rsvps"));K(t.data),qs.success("Waitlist entry removed")}catch(t){qs.error("Failed to remove")}})(e.waitlist_id),"data-testid":"waitlist-remove-".concat(e.waitlist_id),children:(0,ea.jsx)(wD,{className:"w-4 h-4 text-red-500"})})]},e.waitlist_id))})]})]}):(0,ea.jsx)("div",{className:"p-6 text-center text-slate-400",children:"Loading\u2026"})]})})]})},w2="",C2=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],k2={usd:"$",gbp:"\xa3",eur:"\u20ac",aud:"A$"},D2=e=>(e||"").replace(/<[^>]+>/g,"").trim(),_2=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";const s=new Date(e);if(isNaN(s))return"";if(t){const e=e=>String(e).padStart(2,"0");return"".concat(s.getFullYear()).concat(e(s.getMonth()+1)).concat(e(s.getDate()))}return s.toISOString().replace(/[-:]/g,"").split(".")[0]+"Z"},S2=e=>{const t=_2(e.start,e.all_day),s=_2(e.end||e.start,e.all_day),a=(e.all_day,"".concat(t,"/").concat(s)),n=new URLSearchParams({action:"TEMPLATE",text:e.title||"",dates:a,details:D2(e.description_html)||"",location:e.location||""});return"https://calendar.google.com/calendar/render?".concat(n)},E2=e=>{const t=new URLSearchParams({path:"/calendar/action/compose",rru:"addevent",startdt:e.start?new Date(e.start).toISOString():"",enddt:e.end||e.start?new Date(e.end||e.start).toISOString():"",subject:e.title||"",body:D2(e.description_html)||"",location:e.location||""});return"https://outlook.live.com/calendar/0/deeplink/compose?".concat(t)};function A2(e){let{ev:s,icsUrl:a}=e;const[n,l]=(0,t.useState)(!1),[r,i]=(0,t.useState)({top:0,left:0}),o=(0,t.useRef)(null),c=(0,t.useRef)(null),d=(0,t.useRef)(null);(0,t.useEffect)(()=>{const e=e=>{o.current&&!o.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const u=n&&(0,Ts.createPortal)((0,ea.jsxs)("div",{ref:d,style:{position:"fixed",top:r.top,left:r.left,zIndex:9999},className:"w-52 bg-white rounded-xl shadow-xl border border-slate-200 overflow-hidden animate-fadeIn",children:[(0,ea.jsxs)("a",{href:S2(s),target:"_blank",rel:"noopener noreferrer","data-testid":"event-add-google-cal",onClick:()=>l(!1),className:"flex items-center gap-3 px-4 py-3 text-sm text-slate-700 hover:bg-slate-50 transition-colors",children:[(0,ea.jsxs)("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",children:[(0,ea.jsx)("path",{d:"M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12s4.48 10 10 10 10-4.48 10-10z",fill:"#4285F4"}),(0,ea.jsx)("path",{d:"M12 6.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11z",fill:"white"}),(0,ea.jsx)("path",{d:"M12 8a4 4 0 110 8 4 4 0 010-8z",fill:"#4285F4"}),(0,ea.jsx)("path",{d:"M12 10.5a1.5 1.5 0 100 3 1.5 1.5 0 000-3z",fill:"white"})]}),"Google Calendar"]}),(0,ea.jsxs)("a",{href:a,download:!0,"data-testid":"event-add-ics",onClick:()=>l(!1),className:"flex items-center gap-3 px-4 py-3 text-sm text-slate-700 hover:bg-slate-50 transition-colors border-t border-slate-100",children:[(0,ea.jsxs)("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",children:[(0,ea.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",stroke:"#6B7280",strokeWidth:"1.5",fill:"none"}),(0,ea.jsx)("path",{d:"M16 2v4M8 2v4M3 10h18",stroke:"#6B7280",strokeWidth:"1.5",strokeLinecap:"round"}),(0,ea.jsx)("path",{d:"M8 15h8M8 18h5",stroke:"#6B7280",strokeWidth:"1.5",strokeLinecap:"round"})]}),"Apple / Outlook (.ics)"]}),(0,ea.jsxs)("a",{href:E2(s),target:"_blank",rel:"noopener noreferrer","data-testid":"event-add-outlook-web",onClick:()=>l(!1),className:"flex items-center gap-3 px-4 py-3 text-sm text-slate-700 hover:bg-slate-50 transition-colors border-t border-slate-100",children:[(0,ea.jsxs)("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",children:[(0,ea.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",fill:"#0078D4"}),(0,ea.jsx)("path",{d:"M2 8l10 6 10-6",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),"Outlook Web"]})]}),document.body);return(0,ea.jsxs)("div",{className:"relative inline-block",ref:o,children:[(0,ea.jsxs)("button",{ref:c,onClick:()=>
2{if(!n&&c.current){const e=c.current.getBoundingClientRect(),t=168,s=window.innerHeight-e.bottom<t+10;i({top:s?e.top-t-6:e.bottom+6,left:e.left})}l(e=>!e)},"data-testid":"event-add-to-calendar-btn",className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 transition-colors",children:[(0,ea.jsx)(yj,{className:"w-4 h-4"}),"Add to calendar",(0,ea.jsx)(tr,{className:"w-3 h-3 transition-transform ".concat(n?"rotate-180":"")})]}),u]})}const F2=()=>{const{siteSlug:e,eventId:s,cancelToken:a,waitlistToken:n}=je(),l=be(),[r,i]=(0,t.useState)(null),[o,c]=(0,t.useState)(null),[u,m]=(0,t.useState)(!0),[h,x]=(0,t.useState)(null),[p,g]=(0,t.useState)(new Date),[f,v]=(0,t.useState)(()=>"list"===new URLSearchParams(window.location.search).get("view")?"list":"calendar"),b=(0,t.useMemo)(()=>{const e=new URLSearchParams(window.location.search),t="1"===e.get("embed");return{isEmbed:t,showFilters:!t||"0"!==e.get("show_filters"),showIcal:!t||"0"!==e.get("show_ical"),showAbsence:!t||"0"!==e.get("show_absence")}},[]),[j,y]=(0,t.useState)(!1),[N,w]=(0,t.useState)({student_name:"",parent_name:"",parent_email:"",date_from:"",date_to:"",reason:"",notes:""}),[C,k]=(0,t.useState)(!1),[D,_]=(0,t.useState)(!1),S="nexus_cal_filter_".concat(e),E=()=>{try{return JSON.parse(localStorage.getItem(S)||"{}")}catch(e){return{}}},[A,F]=(0,t.useState)(()=>E().filterType||""),[T,z]=(0,t.useState)(()=>E().filterDept||""),[M,P]=(0,t.useState)(()=>E().filterSearch||""),[B,R]=(0,t.useState)(()=>E().filterSource||"");(0,t.useEffect)(()=>{const e={filterType:A,filterDept:T,filterSearch:M,filterSource:B};A||T||M||B?localStorage.setItem(S,JSON.stringify(e)):localStorage.removeItem(S)},[A,T,M,B,S]);const[L,I]=(0,t.useState)({name:"",email:"",party_size:1}),[O,U]=(0,t.useState)(!1),[H,W]=(0,t.useState)(null),[V,q]=(0,t.useState)(null),[$,G]=(0,t.useState)(null),[K,Y]=(0,t.useState)(!1),[J,Q]=(0,t.useState)({name:"",email:"",party_size:1}),[X,Z]=(0,t.useState)(null),[ee,te]=(0,t.useState)(null),[se,ae]=(0,t.useState)(!1),[ne,le]=(0,t.useState)(null),[re,ie]=(0,t.useState)(null),[oe,ce]=(0,t.useState)(null),[de,ue]=(0,t.useState)(!1),[me,he]=(0,t.useState)({buyer_name:"",buyer_email:"",quantity:1}),[xe,pe]=(0,t.useState)(!1),[ge,fe]=(0,t.useState)(null),[ve,ye]=(0,t.useState)(!1),[Ne,we]=(0,t.useState)(!1),[Ce,ke]=(0,t.useState)(null),[De,_e]=(0,t.useState)(null),[Se,Ee]=(0,t.useState)(1),Ae=(0,t.useCallback)(async()=>{m(!0),x(null);try{if(n){const t=await fetch("".concat(w2,"/api/public/events/").concat(e,"/waitlist/").concat(n));if(!t.ok)throw new Error("Offer not found");le(await t.json())}else if(a){const t=await fetch("".concat(w2,"/api/public/events/").concat(e,"/rsvp/").concat(a));if(!t.ok)throw new Error("RSVP not found");G(await t.json())}else if(s){const t=await fetch("".concat(w2,"/api/public/events/").concat(e,"/").concat(s));if(!t.ok)throw new Error("Event not found");c(await t.json())}else{const t=await fetch("".concat(w2,"/api/public/events/").concat(e));if(!t.ok)throw new Error("Site not found");const s=await t.json();i(s),c(null);const a=s.events||[];
2if(a.length){const e=Date.now(),t=a.filter(t=>t.start&&new Date(t.start).getTime()>=e).sort((e,t)=>new Date(e.start)-new Date(t.start))[0]||a[a.length-1];null!==t&&void 0!==t&&t.start&&g(new Date(t.start))}}}catch(G2){x(G2.message)}finally{m(!1)}},[e,s,a,n]),Fe=async()=>{if(J.name.trim()&&J.email.trim()){ae(!0),te(null);try{const t=await fetch("".concat(w2,"/api/public/events/").concat(e,"/").concat(s,"/waitlist"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d(d({},J),{},{party_size:parseInt(J.party_size,10)||1}))}),a=await t.json();if(!t.ok)return void te(a.detail||"Could not join the waitlist");Z(a)}catch(G2){te("Something went wrong. Please try again.")}finally{ae(!1)}}else te("Please enter your name and email.")},Te=async()=>{ue(!0),ce(null);try{const t=await fetch("".concat(w2,"/api/public/events/").concat(e,"/waitlist/").concat(n,"/claim"),{method:"POST"}),s=await t.json();if(!t.ok)return void ce(s.detail||"Could not claim this spot");ie(s)}catch(G2){ce("Something went wrong. Please try again.")}finally{ue(!1)}},ze=async()=>{if(L.name.trim()&&L.email.trim()){U(!0),q(null);try{const t=await fetch("".concat(w2,"/api/public/events/").concat(e,"/").concat(s,"/rsvp"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d(d({},L),{},{party_size:parseInt(L.party_size,10)||1}))}),a=await t.json();if(!t.ok)return void q(a.detail||"Could not register");W(a),Ae()}catch(G2){q("Sorry, registration failed. Please try again.")}finally{U(!1)}}else alert("Please enter your name and email.")},Me=async()=>{try{if(!(await fetch("".concat(w2,"/api/public/events/").concat(e,"/rsvp/").concat(a,"/cancel"),{method:"POST"})).ok)throw new Error;Y(!0)}catch(t){alert("Could not cancel. Please try again.")}},Pe=async()=>{if(me.buyer_name.trim()&&me.buyer_email.trim()){pe(!0),fe(null);try{const t=await fetch("".concat(w2,"/api/public/event-payments/").concat(e,"/events/").concat(s,"/checkout"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({buyer_name:me.buyer_name.trim(),buyer_email:me.buyer_email.trim(),quantity:parseInt(me.quantity,10)||1,origin_url:window.location.origin})}),a=await t.json();if(!t.ok)return void fe(a.detail||"Could not create checkout. Please try again.");window.location.href=a.checkout_url}catch(t){fe("Something went wrong. Please try again.")}finally{pe(!1)}}else fe("Please enter your name and email address.")};(0,t.useEffect)(()=>{Ae()},[Ae]),(0,t.useEffect)(()=>{W(null),q(null),I({name:"",email:"",party_size:1}),Z(null),te(null),Q({name:"",email:"",party_size:1})},[s]),(0,t.useEffect)(()=>{const e=new URLSearchParams(window.location.search),t=e.get("ticket_session");if(e.get("ticket_cancelled"))return void we(!0);if(!t)return;ke(t);(async()=>{try{const e=await fetch("".concat(w2,"/api/public/event-payments/status/").concat(t));if(e.ok){const t=await e.json();"paid"===t.payment_status&&(ye(!0),Ee(t.quantity||1),t.qr_code_b64&&_e(t.qr_code_b64))}}catch(e){}})();const s=new URL(window.location.href);s.searchParams.delete("ticket_session"),s.searchParams.delete("ticket_cancelled"),window.history.replaceState({},"",s.toString())},[]);const Be=(null===r||void 0===r?void 0:r.events)||[],Re=(null===r||void 0===r?void 0:r.tenant_name)||(null===o||void 0===o?void 0:o.tenant_name)||"Events",Le=(null===r||void 0===r?void 0:r.filter_options)||{event_types:[],departments:[],tags:[]},Ie=(null===r||void 0===r?void 0:r.ical_sources)||[],Oe=(0,t.useMemo)(()=>{let e=Be;if(B&&(e=e.filter(e=>e.ical_source_id===B)),A){const t=A.toLowerCase();e=e.filter(e=>(e.event_type||"").toLowerCase()===t)}if(T){const t=T.toLowerCase();e=e.filter(e=>(e.departments||[]).some(e=>e.toLowerCase()===t))}if(M){const t=M.toLowerCase();e=e.filter(e=>(e.title||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.event_type||"").toLowerCase().includes(t)||(e.departments||[]).some(e=>e.toLowerCase().includes(t))||(e.tags||[]).some(e=>e.toLowerCase().includes(t)))}return e},[Be,A,T,M,B]),Ue=[A,T,M,B].filter(Boolean).length,He=(0,t.useMemo)(()=>{const e=p.getFullYear(),t=p.getMonth(),s=new Date(e,t,1).getDay(),a=new Date(e,t+1,0).getDate(),n=[];for(let l=0;l<s;l++)n.push(null);for(let l=1;l<=a;l++)n.push(new Date(e,t,l));for(;n.length%7!==0;)n.push(null);return n},[p]),We=(0,t.useMemo)(()=>{const e={};return Oe.forEach(t=>{if(!t.start)return;const s=new Date(t.start),a=t.end?new Date(t.end):s,n=new Date(s.getFullYear(),s.getMonth(),s.getDate()),l=new Date(a.getFullYear(),a.getMonth(),a.getDate());for(let r=new Date(n);r<=l;r.setDate(r.getDate()+1)){const s=new Date(r).toDateString();(e[s]=e[s]||[]).push(t)}}),e},[Oe]);if(u)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsx)(ql,{className:"w-8 h-8 animate-spin text-indigo-600"})});if(h)return(0,ea.jsxs)("div",{className:"min-h-screen flex flex-col items-center justify-center bg-slate-50 text-center px-4",children:[(0,ea.jsx)(yj,{className:"w-12 h-12 text-slate-300 mb-4"}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-slate-800",children:h}),(0,ea.jsx)(Nt,{to:"/site/".concat(e),className:"text-indigo-600 mt-3 hover:underline",children:"Go to site"})]});if(n){const e=null===ne||void 0===ne?void 0:ne.event,t=null===ne||void 0===ne?void 0:ne.entry,s=(null===ne||void 0===ne?void 0:ne.expired)||t&&"expired"===t.status,a=t&&"claimed"===t.status;return(0,ea.jsxs)("div",{className:"min-h-screen bg-slate-50",children:[(0,ea.jsx)(As,{children:(0,ea.jsxs)("title",{children:["Claim your spot \u2014 ",Re]})}),(0,ea.jsx)("div",{className:"max-w-md mx-auto px-4 py-16",children:(0,ea.jsx)("div",{className:"bg-white rounded-2xl border border-slate-200 p-8 text-center shadow-sm","data-testid":"waitlist-claim-card",children:re||a?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-14 h-14 roun
2ded-full bg-emerald-100 text-emerald-600 flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(Nw,{className:"w-7 h-7"})}),(0,ea.jsx)("h1",{className:"text-xl font-bold text-slate-900",children:"You're in! \ud83c\udf89"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mt-1",children:["Your spot for ",null===e||void 0===e?void 0:e.title," is confirmed. We've emailed the details."]})]}):s?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-14 h-14 rounded-full bg-slate-100 text-slate-500 flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(Kg,{className:"w-7 h-7"})}),(0,ea.jsx)("h1",{className:"text-xl font-bold text-slate-900",children:"This offer has expired"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"The spot has been offered to the next person on the waitlist."})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("h1",{className:"text-xl font-bold text-slate-900",children:"A spot opened up!"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mt-2",children:[null===t||void 0===t?void 0:t.name,", a place is available for ",(0,ea.jsx)("strong",{children:null===e||void 0===e?void 0:e.title}),null!==e&&void 0!==e&&e.start?" on ".concat(new Date(e.start).toLocaleString()):""," (",null===t||void 0===t?void 0:t.party_size," place(s))."]}),oe&&(0,ea.jsx)("div",{className:"mt-3 bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-3 py-2","data-testid":"waitlist-claim-error",children:oe}),(0,ea.jsx)("button",{onClick:Te,disabled:de,className:"mt-6 w-full py-2.5 rounded-lg bg-emerald-600 text-white text-sm font-medium hover:bg-emerald-700 disabled:opacity-60","data-testid":"waitlist-claim-btn",children:de?"Claiming\u2026":"Claim my spot"})]})})})]})}if(a){const t=null===$||void 0===$?void 0:$.event,s=null===$||void 0===$?void 0:$.rsvp,a="cancelled"===(null===s||void 0===s?void 0:s.status);return(0,ea.jsxs)("div",{className:"min-h-screen bg-slate-50",children:[(0,ea.jsx)(As,{children:(0,ea.jsxs)("title",{children:["Cancel RSVP \u2014 ",Re]})}),(0,ea.jsx)("div",{className:"max-w-md mx-auto px-4 py-16",children:(0,ea.jsx)("div",{className:"bg-white rounded-2xl border border-slate-200 p-8 text-center shadow-sm","data-testid":"rsvp-cancel-card",children:K||a?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"w-14 h-14 rounded-full bg-slate-100 text-slate-500 flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(sr,{className:"w-7 h-7"})}),(0,ea.jsx)("h1",{className:"text-xl font-bold text-slate-900",children:"RSVP cancelled"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mt-1",children:["Your spot for ",null===t||void 0===t?void 0:t.title," has been released. Thanks for letting us know."]})]}):(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("h1",{className:"text-xl font-bold text-slate-900",children:"Cancel your RSVP?"}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500 mt-2",children:[null===s||void 0===s?void 0:s.name,", you're registered for ",(0,ea.jsx)("strong",{children:null===t||void 0===t?void 0:t.title}),null!==t&&void 0!==t&&t.start?" on ".concat(new Date(t.start).toLocaleString()):""," (",null===s||void 0===s?void 0:s.party_size," seat(s))."]}),(0,ea.jsx)("button",{onClick:Me,className:"mt-6 w-full py-2.5 rounded-lg bg-red-600 text-white text-sm font-medium hover:bg-red-700","data-testid":"rsvp-cancel-confirm-btn",children:"Yes, cancel my RSVP"}),(0,ea.jsx)("button",{onClick:()=>l("/site/".concat(e,"/events/").concat(null===t||void 0===t?void 0:t.event_id)),className:"mt-2 w-full py-2.5 rounded-lg border border-slate-200 text-sm text-slate-600","data-testid":"rsvp-cancel-keep-btn",children:"Keep my RSVP"})]})})})]})}if(s&&null!==o&&void 0!==o&&o.event){var Ve;const t=o.event,s="".concat(w2,"/api/public/events/").concat(e,"/").concat(t.event_id,".ics");return(0,ea.jsxs)("div",{className:"min-h-screen bg-slate-50",children:[(0,ea.jsx)(As,{children:(0,ea.jsxs)("title",{children:[t.title," \u2014 ",Re]})}),(0,ea.jsxs)("div",{className:"max-w-3xl mx-auto px-4 py-10",children:[(0,ea.jsxs)("button",{onClick:()=>l("/site/".concat(e,"/events")),className:"flex items-center gap-2 text-sm text-slate-500 hover:text-slate-800 mb-6","data-testid":"event-back-btn",children:[(0,ea.jsx)(_j,{className:"w-4 h-4"})," Back to calendar"]}),(0,ea.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-200 overflow-hidden shadow-sm",children:[(0,ea.jsx)("div",{className:"h-2",style:{backgroundColor:t.color||"#6366f1"}}),(0,ea.jsxs)("div",{className:"p-8",children:[t.category&&(0,ea.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wide text-indigo-600",children:t.category}),(0,ea.jsx)("h1",{className:"text-3xl font-bold text-slate-900 mt-1",children:t.title}),(t.event_type||(t.departments||[]).length>0||t.ical_source_name)&&(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2 mt-2",children:[t.ical_source_name&&(0,ea.jsx)("span",{className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full text-white font-medium",style:{backgroundColor:t.color||"#6366f1"},children:t.ical_source_name}),t.event_type&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1 bg-slate-100 text-slate-600 text-xs px-2.5 py-1 rounded-full",children:[(0,ea.jsx)(Wj,{className:"w-3 h-3"})," ",t.event_type]}),(t.departments||[]).map(e=>(0,ea.jsx)("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-2.5 py-1 rounded-full",children:e},e))]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-slate-600 mt-4",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Kg,{className:"w-4 h-4 text-slate-400"}),t.all_day?new Date(t.start).toLocaleDateString():new Date(t.start).toLocaleStr
2ing(),t.end&&!t.all_day?" \u2013 ".concat(new Date(t.end).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})):""]}),t.location&&(0,ea.jsxs)("span",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Ql,{className:"w-4 h-4 text-slate-400"}),t.location]}),null!=t.cost&&t.cost>0&&(0,ea.jsxs)("span",{className:"font-medium text-slate-700",children:["$",t.cost]})]}),t.description_html&&(0,ea.jsx)("div",{className:"prose prose-slate max-w-none mt-6",dangerouslySetInnerHTML:{__html:t.description_html}}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3 mt-8",children:[(0,ea.jsx)(A2,{ev:t,icsUrl:s}),t.form&&"active"===t.form.status&&(0,ea.jsxs)("a",{href:"/site/".concat(e),className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border border-slate-200 text-sm font-medium text-slate-700 hover:bg-slate-50","data-testid":"event-form-link",children:[(0,ea.jsx)(yw,{className:"w-4 h-4"})," ",t.form.name||"Register / Consent form"]}),t.external_link_url&&(0,ea.jsxs)("a",{href:t.external_link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-slate-800 text-white text-sm font-medium hover:bg-slate-700","data-testid":"event-external-link",children:[(0,ea.jsx)(bj,{className:"w-4 h-4"})," Register / More info"]})]}),t.rsvp_enabled&&(0,ea.jsxs)("div",{className:"mt-8 border-t border-slate-100 pt-6","data-testid":"rsvp-section",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ea.jsx)("h2",{className:"text-lg font-semibold text-slate-900",children:"Register / RSVP"}),null!=t.spots_left&&(0,ea.jsx)("span",{className:"text-sm font-medium ".concat(t.rsvp_full?"text-red-600":"text-emerald-600"),"data-testid":"rsvp-spots-left",children:t.rsvp_full?"Fully booked":"".concat(t.spots_left," spot").concat(1===t.spots_left?"":"s"," left")})]}),H?(0,ea.jsxs)("div",{className:"bg-emerald-50 border border-emerald-100 rounded-xl p-5 text-center","data-testid":"rsvp-success",children:[(0,ea.jsx)("p",{className:"font-semibold text-emerald-800",children:"You're registered!"}),(0,ea.jsxs)("p",{className:"text-sm text-emerald-700 mt-1",children:["A confirmation has been emailed to ",L.email,"."]}),H.cancel_token&&(0,ea.jsxs)("p",{className:"text-sm text-emerald-700 mt-2",children:["Can't make it later?"," ",(0,ea.jsx)("a",{href:"/site/".concat(e,"/events/rsvp/").concat(H.cancel_token),className:"underline font-medium","data-testid":"rsvp-cancel-link",children:"Cancel your RSVP"}),"."]}),(0,ea.jsx)("div",{className:"mt-4 flex justify-center",children:(0,ea.jsx)(A2,{ev:t,icsUrl:s})})]}):t.rsvp_full?t.waitlist_enabled?X?(0,ea.jsxs)("div",{className:"bg-amber-50 border border-amber-100 rounded-xl p-5 text-center","data-testid":"waitlist-success",children:[(0,ea.jsx)("p",{className:"font-semibold text-amber-800",children:"You're on the waitlist \u2713"}),(0,ea.jsxs)("p",{className:"text-sm text-amber-700 mt-1",children:["If a spot opens up we'll email you a link to claim it",X.position?" \u2014 you're #".concat(X.position," in line"):"","."]})]}):t.waitlist_full?(0,ea.jsx)("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-5 text-center text-slate-500 text-sm",children:"This event is full and the waitlist is also full."}):(0,ea.jsxs)("div",{className:"bg-amber-50/60 border border-amber-100 rounded-xl p-5 space-y-3","data-testid":"waitlist-form",children:[(0,ea.jsx)("p",{className:"text-sm font-medium text-amber-900",children:"This event is full \u2014 join the waitlist and we'll email you if a spot opens up."}),ee&&(0,ea.jsx)("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-3 py-2","data-testid":"waitlist-error",children:ee}),(0,ea.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,ea.jsx)("input",{value:J.name,onChange:e=>Q(t=>d(d({},t),{},{name:e.target.value})),placeholder:"Your name",className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"waitlist-name-input"}),(0,ea.jsx)("input",{type:"email",value:J.email,onChange:e=>Q(t=>d(d({},t),{},{email:e.target.value})),placeholder:"Email",className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"waitlist-email-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Party size"}),(0,ea.jsx)("input",{type:"number",min:"1",value:J.party_size,onChange:e=>Q(t=>d(d({},t),{},{party_size:e.target.value})),className:"w-24 border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"waitlist-party-input"})]}),(0,ea.jsx)("button",{onClick:Fe,disabled:se,className:"px-5 py-2.5 rounded-lg bg-amber-600 text-white text-sm font-medium hover:bg-amber-700 disabled:opacity-60","data-testid":"waitlist-submit-btn",children:se?"Joining\u2026":"Join the waitlist"})]}):(0,ea.jsx)("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-5 text-center text-slate-500 text-sm",children:"This event is fully booked."}):(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-xl p-5 space-y-3",children:[V&&(0,ea.jsx)("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-3 py-2","data-testid":"rsvp-error",children:V}),(0,ea.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Your name"}),(0,ea.jsx)("input",{value:L.name,onChange:e=>I(t=>d(d({},t),{},{name:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"rsvp-name-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Email"}),(0,ea.jsx)("input",{type:"email",value:L.email,onChange:e=>I(t=>d(d({},t),{},{email:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"rsvp-email-input"})]})]}),(0,ea.jsxs)("div",{className:"w-28",children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Party size"}),(0,ea.jsx)("input",{type:"number",min:"1",max:null!=t.spots_left?t.spots_left:void 0,value:L.party_size,onChange:e=>I(t=>d(d({},t),{},{party_size:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"rsvp-party-input"})]}),(0,ea.jsx)("button",{onClick:ze,disabled:O,className:"px-5 py-2.5 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 disabled:opacity-60","data-testid":"rsvp-submit-btn",children:O?"Registering\u2026":"Register"})]})]}),t.ticket_enabled&&t.ticket_price&&(0,ea.jsxs)("div",{className:"mt-8 border-t border-slate-100 pt-6","data-testid":"tickets-section",children:[(0,ea.jsxs)("h2",{className:"text-lg font-semibold text-slate-900 mb-4 flex items-center gap-2",children:[(0,ea.jsx)(Aj,{className:"w-5 h-5 text-indigo-500"})," Get Tickets"]}),ve?(0,ea.jsxs)("div",{className:"bg-emerald-50 border border-emerald-100 rounded-xl p-6","data-testid":"ticket-success",children:[(0,ea.jsxs)("div",{className:"flex flex-col items-center text-center mb-5",children:[(0,ea.jsx)("div",{className:"w-12 h-12 rounded-full bg-emerald-100 text-emerald-600 flex items-center justify-center mb-3",children:(0,ea.jsx)(Aj,{className:"w-6 h-6"})}),(0,ea.jsx)("p",{className:"font-semibold text-emerald-800 text-lg",children:"Payment c
2onfirmed!"}),(0,ea.jsxs)("p",{className:"text-sm text-emerald-700 mt-1",children:["Your ",Se>1?"".concat(Se," tickets"):"ticket"," ",Se>1?"have":"has"," been confirmed. A receipt has been emailed to you."]})]}),De&&(0,ea.jsxs)("div",{className:"border-t border-emerald-100 pt-5 mb-5","data-testid":"ticket-qr-section",children:[(0,ea.jsx)("p",{className:"text-xs text-emerald-700 font-semibold text-center mb-3 uppercase tracking-wider",children:"Show this at the door"}),(0,ea.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,ea.jsx)("div",{className:"bg-white rounded-xl p-3 shadow-sm border border-emerald-100",children:(0,ea.jsx)("img",{src:De,alt:"Ticket QR Code",className:"w-48 h-48 block","data-testid":"ticket-qr-image"})}),(0,ea.jsx)("p",{className:"text-xs text-emerald-600",children:"Staff will scan this to verify your entry"}),(0,ea.jsx)("a",{href:De,download:"ticket-qr-".concat(null===(Ve=t.event_id)||void 0===Ve?void 0:Ve.slice(-6),".png"),className:"text-xs text-emerald-700 underline underline-offset-2 hover:text-emerald-900","data-testid":"ticket-qr-download",children:"Download QR code"})]})]}),(0,ea.jsxs)("div",{className:"border-t border-emerald-100 pt-4",children:[(0,ea.jsx)("p",{className:"text-xs text-emerald-700 font-medium text-center mb-3",children:"Add this event to your calendar"}),(0,ea.jsx)("div",{className:"flex justify-center","data-testid":"ticket-success-add-to-calendar",children:(0,ea.jsx)(A2,{ev:t,icsUrl:s})})]})]}):Ne?(0,ea.jsx)("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-5 text-center mb-4","data-testid":"ticket-cancelled",children:(0,ea.jsx)("p",{className:"font-medium text-amber-800",children:"Payment was cancelled \u2014 you can try again below."})}):null,!ve&&(0,ea.jsxs)("div",{className:"bg-slate-50 rounded-xl p-5 space-y-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-slate-200",children:[(0,ea.jsx)("span",{className:"font-medium text-slate-700",children:t.ticket_name||"General Admission"}),(0,ea.jsxs)("span",{className:"text-xl font-bold text-slate-900",children:[k2[t.ticket_currency||"usd"],Number(t.ticket_price).toFixed(2)]})]}),ge&&(0,ea.jsx)("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-3 py-2","data-testid":"ticket-error",children:ge}),(0,ea.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Your name"}),(0,ea.jsx)("input",{value:me.buyer_name,onChange:e=>he(t=>d(d({},t),{},{buyer_name:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"ticket-name-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Email for receipt"}),(0,ea.jsx)("input",{type:"email",value:me.buyer_email,onChange:e=>he(t=>d(d({},t),{},{buyer_email:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"ticket-email-input"})]})]}),(0,ea.jsxs)("div",{className:"flex items-end justify-between gap-4",children:[(0,ea.jsxs)("div",{className:"w-28",children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Quantity"}),(0,ea.jsx)("input",{type:"number",min:"1",max:t.ticket_limit_per_order||10,value:me.quantity,onChange:e=>he(t=>d(d({},t),{},{quantity:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"ticket-qty-input"})]}),(0,ea.jsxs)("div",{className:"text-right",children:[(0,ea.jsxs)("span",{className:"text-sm text-slate-500 block mb-2",children:["Total: ",(0,ea.jsxs)("strong",{className:"text-slate-800",children:[k2[t.ticket_currency||"usd"],(Number(t.ticket_price)*(parseInt(me.quantity,10)||1)).toFixed(2)]})]}),(0,ea.jsxs)("button",{onClick:Pe,disabled:xe,className:"px-6 py-2.5 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 disabled:opacity-60 flex items-center gap-2","data-testid":"ticket-buy-btn",children:[(0,ea.jsx)(Aj,{className:"w-4 h-4"}),xe?"Preparing\u2026":"Buy Tickets"]})]})]}),(0,ea.jsx)("p",{className:"text-xs text-slate-400 text-center",children:"Secure payment via Stripe. Your card details are never stored on this site."})]})]})]})]})]})]})}const qe=p.toLocaleDateString(void 0,{month:"long",year:"numeric"}),$e="".concat(w2,"/api/public/events/").concat(e,"/calendar.ics");return(0,ea.jsxs)("div",{className:b.isEmbed?"bg-slate-50":"min-h-screen bg-slate-50",children:[(0,ea.jsx)(As,{children:(0,ea.jsxs)("title",{children:["Events \u2014 ",Re]})}),(0,ea.jsxs)("div",{className:b.isEmbed?"max-w-5xl mx-auto px-4 py-4":"max-w-5xl mx-auto px-4 py-10",children:[(0,ea.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 mb-6",children:[(0,ea.jsxs)("div",{children:[!b.isEmbed&&(0,ea.jsx)(Nt,{to:"/site/".concat(e),className:"text-sm text-slate-400 hover:text-slate-600",children:Re}),(0,ea.jsxs)("h1",{className:"text-4xl font-bold text-slate-900 flex items-center gap-3 mt-1",children:[(0,ea.jsx)(Nw,{className:"w-8 h-8 text-indigo-600"})," Events"]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)("div",{className:"inline-flex rounded-lg border border-slate-200 bg-white p-0.5",children:[(0,ea.jsx)("button",{onClick:()=>v("calendar"),className:"px-3 py-1.5 text-sm rounded-md ".concat("calendar"===f?"bg-indigo-600 text-white":"text-slate-600"),"data-testid":"public-view-calendar",children:"Calendar"}),(0,ea.jsx)("button",{onClick:()=>v("list"),className:"px-3 py-1.5 text-sm rounded-md ".concat("list"===f?"bg-indigo-600 text-white":"text-slate-600"),"data-testid":"public-view-list",children:"List"})]}),b.showIcal&&(0,ea.jsxs)("a",{href:$e,className:"inline-flex items-center gap-2 px-3 py-2 rounded-lg border border-slate-200 bg-white text-sm text-slate-700 hover:bg-slate-50","data-testid":"public-subscribe-ical",children:[(0,ea.jsx)(jj,{className:"w-4 h-4"})," iCal"]}),b.showAbsence&&!1!==(null===r||void 0===r?void 0:r.absentee_enabled)&&(0,ea.jsxs)("button",{onClick:()=>{_(!1),y(!0)},className:"inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-900 text-white text-sm hover:bg-slate-800","data-testid":"public-report-absence-btn",children:[(0,ea.jsx)(Tw,{className:"w-4 h-4"})," Report an absence"]})]})]}
2),b.showFilters&&(0,ea.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-200 p-4 mb-6 space-y-3","data-testid":"events-filter-bar",children:[Ie.length>0&&(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2 items-center","data-testid":"filter-calendar-pills",children:[(0,ea.jsx)("span",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wide mr-1",children:"Calendar:"}),(0,ea.jsx)("button",{onClick:()=>R(""),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border transition-all ".concat(B?"bg-white text-slate-600 border-slate-200 hover:border-slate-400":"bg-slate-900 text-white border-slate-900"),"data-testid":"filter-calendar-all",children:"All calendars"}),Ie.map(e=>(0,ea.jsxs)("button",{onClick:()=>R(B===e.source_id?"":e.source_id),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border transition-all ".concat(B===e.source_id?"text-white border-transparent":"bg-white text-slate-700 border-slate-200 hover:border-slate-400"),style:B===e.source_id?{backgroundColor:e.color,borderColor:e.color}:{},"data-testid":"filter-calendar-".concat(e.source_id),children:[(0,ea.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),e.name]},e.source_id))]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-3 items-end",children:[(0,ea.jsxs)("div",{className:"relative flex-1 min-w-[160px]",children:[(0,ea.jsx)(fj,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),(0,ea.jsx)("input",{value:M,onChange:e=>P(e.target.value),placeholder:"Search events\u2026",className:"w-full pl-9 pr-3 py-2 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300","data-testid":"filter-search-input"})]}),Le.event_types.length>0&&(0,ea.jsx)("div",{className:"min-w-[160px]",children:(0,ea.jsxs)("select",{value:A,onChange:e=>F(e.target.value),className:"w-full py-2 pl-3 pr-8 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300 bg-white","data-testid":"filter-type-select",children:[(0,ea.jsx)("option",{value:"",children:"All event types"}),Le.event_types.map(e=>(0,ea.jsx)("option",{value:e,children:e},e))]})}),Le.departments.length>0&&(0,ea.jsx)("div",{className:"min-w-[160px]",children:(0,ea.jsxs)("select",{value:T,onChange:e=>z(e.target.value),className:"w-full py-2 pl-3 pr-8 text-sm border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-300 bg-white","data-testid":"filter-dept-select",children:[(0,ea.jsx)("option",{value:"",children:"All departments"}),Le.departments.map(e=>(0,ea.jsx)("option",{value:e,children:e},e))]})}),Ue>0&&(0,ea.jsxs)("button",{onClick:()=>{F(""),z(""),P(""),R("")},className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg border border-slate-200 text-sm text-slate-600 hover:bg-slate-50","data-testid":"filter-clear-btn",children:[(0,ea.jsx)(sr,{className:"w-3.5 h-3.5"})," Clear"]})]}),Ue>0&&(0,ea.jsxs)("div",{className:"flex flex-wrap gap-2","data-testid":"active-filter-chips",children:[B&&(()=>{const e=Ie.find(e=>e.source_id===B);return e?(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs px-3 py-1 rounded-full border text-white",style:{backgroundColor:e.color,borderColor:e.color},children:[(0,ea.jsx)("span",{className:"w-2 h-2 rounded-full bg-white/60 flex-shrink-0"}),e.name,(0,ea.jsx)("button",{onClick:()=>R(""),className:"hover:opacity-75 ml-0.5",children:"\xd7"})]}):null})(),M&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-indigo-50 text-indigo-700 text-xs px-3 py-1 rounded-full border border-indigo-100",children:[(0,ea.jsx)(fj,{className:"w-3 h-3"}),' "',M,'"',(0,ea.jsx)("button",{onClick:()=>P(""),className:"hover:text-indigo-900 ml-0.5",children:"\xd7"})]}),A&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-indigo-50 text-indigo-700 text-xs px-3 py-1 rounded-full border border-indigo-100",children:[(0,ea.jsx)(Wj,{className:"w-3 h-3"})," ",A,(0,ea.jsx)("button",{onClick:()=>F(""),className:"hover:text-indigo-900 ml-0.5",children:"\xd7"})]}),T&&(0,ea.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-indigo-50 text-indigo-700 text-xs px-3 py-1 rounded-full border border-indigo-100",children:[(0,ea.jsx)(kD,{className:"w-3 h-3"})," ",T,(0,ea.jsx)("button",{onClick:()=>z(""),className:"hover:text-indigo-900 ml-0.5",children:"\xd7"})]}),(0,ea.jsx)("span",{className:"text-xs text-slate-400 self-center",children:B?(()=>{const e=Ie.find(e=>e.source_id===B);return(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:[Oe.length," event",1!==Oe.length?"s":""," from ",(0,ea.jsx)("strong",{children:(null===e||void 0===e?void 0:e.name)||"this calendar"})]})})():(0,ea.jsxs)("span",{className:"text-sm text-slate-500",children:[Oe.length," event",1!==Oe.length?"s":""," shown"]})})]})]}),0===Oe.length?(0,ea.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-200 p-16 text-center text-slate-400",children:[(0,ea.jsx)(yj,{className:"w-12 h-12 mx-auto mb-4 opacity-40"}),0===Be.length?"No upcoming events right now. Check back soon.":"No events match your current filters.",Ue>0&&(0,ea.jsx)("button",{onClick:()=>{F(""),z(""),P(""),R("")},className:"block mx-auto mt-3 text-indigo-600 text-sm hover:underline",children:"Clear filters"})]}):"calendar"===f?(0,ea.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-200 p-4",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-4",children:[(0,ea.jsx)("button",{onClick:()=>g(new Date(p.getFullYear(),p.getMonth()-1,1)),className:"p-2 rounded-lg hover:bg-slate-100","data-testid":"public-cal-prev",children:(0,ea.jsx)(vj,{className:"w-5 h-5"})}),(0,ea.jsx)("h2",{className:"text-lg font-semibold w-48 text-center",children:qe}),(0,ea.jsx)("button",{onClick:()=>
2g(new Date(p.getFullYear(),p.getMonth()+1,1)),className:"p-2 rounded-lg hover:bg-slate-100","data-testid":"public-cal-next",children:(0,ea.jsx)(ax,{className:"w-5 h-5"})})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-7 gap-px bg-slate-200 rounded-lg overflow-hidden border border-slate-200",children:[C2.map(e=>(0,ea.jsx)("div",{className:"bg-slate-50 text-center text-xs font-semibold text-slate-500 py-2",children:e},e)),He.map((t,s)=>{const a=t&&We[t.toDateString()]||[],n=t&&t.toDateString()===(new Date).toDateString();return(0,ea.jsx)("div",{className:"bg-white min-h-[96px] p-1.5 ".concat(t?"":"bg-slate-50/40"),children:t&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"text-xs font-medium mb-1 ".concat(n?"bg-indigo-600 text-white rounded-full w-6 h-6 flex items-center justify-center":"text-slate-500"),children:t.getDate()}),(0,ea.jsx)("div",{className:"space-y-1",children:a.map(t=>(0,ea.jsx)("button",{onClick:()=>l("/site/".concat(e,"/events/").concat(t.event_id)),className:"w-full text-left text-[11px] leading-tight px-1.5 py-0.5 rounded truncate text-white hover:opacity-90",style:{backgroundColor:t.color||"#6366f1"},title:t.title,"data-testid":"public-event-".concat(t.event_id),children:t.title},t.event_id))})]})},s)})]})]}):(0,ea.jsx)("div",{className:"space-y-3",children:Oe.map(t=>(0,ea.jsxs)("button",{onClick:()=>l("/site/".concat(e,"/events/").concat(t.event_id)),className:"w-full text-left bg-white rounded-xl border border-slate-200 p-5 flex items-center gap-4 hover:shadow-md transition-shadow","data-testid":"public-event-row-".concat(t.event_id),children:[(0,ea.jsxs)("div",{className:"flex flex-col items-center justify-center w-16 shrink-0",children:[(0,ea.jsx)("span",{className:"text-xs uppercase text-slate-400",children:new Date(t.start).toLocaleDateString(void 0,{month:"short"})}),(0,ea.jsx)("span",{className:"text-2xl font-bold text-slate-900",children:new Date(t.start).getDate()})]}),(0,ea.jsx)("div",{className:"w-1 self-stretch rounded-full",style:{backgroundColor:t.color||"#6366f1"}}),(0,ea.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:t.title}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-slate-500 mt-1",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Kg,{className:"w-3 h-3"}),t.all_day?"All day":new Date(t.start).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),t.location&&(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Ql,{className:"w-3 h-3"}),t.location]})]}),(0,ea.jsxs)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[t.ical_source_name&&(0,ea.jsx)("span",{className:"text-[10px] px-2 py-0.5 rounded-full text-white font-medium",style:{backgroundColor:t.color||"#6366f1"},"data-testid":"event-source-badge",children:t.ical_source_name}),t.event_type&&(0,ea.jsx)("span",{className:"bg-slate-100 text-slate-600 text-[10px] px-2 py-0.5 rounded-full",children:t.event_type}),(t.departments||[]).map(e=>(0,ea.jsx)("span",{className:"bg-indigo-50 text-indigo-600 text-[10px] px-2 py-0.5 rounded-full",children:e},e))]}),t.description_html&&(0,ea.jsx)("p",{className:"text-sm text-slate-400 mt-1 line-clamp-1",children:D2(t.description_html).slice(0,120)})]})]},t.event_id))})]}),j&&(0,ea.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>y(!1),children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),"data-testid":"absence-modal",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-slate-100",children:[(0,ea.jsxs)("h3",{className:"text-lg font-semibold text-slate-900 flex items-center gap-2",children:[(0,ea.jsx)(Tw,{className:"w-5 h-5 text-slate-500"})," Report an absence"]}),(0,ea.jsx)("button",{onClick:()=>y(!1),className:"text-slate-400 hover:text-slate-600",children:(0,ea.jsx)(sr,{className:"w-5 h-5"})})]}),D?(0,ea.jsxs)("div",{className:"p-8 text-center",children:[(0,ea.jsx)("div",{className:"w-14 h-14 roun
2ded-full bg-emerald-100 text-emerald-600 flex items-center justify-center mx-auto mb-4",children:(0,ea.jsx)(Nw,{className:"w-7 h-7"})}),(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:"Absence reported"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"The office has been notified. Thank you."}),(0,ea.jsx)("button",{onClick:()=>y(!1),className:"mt-5 px-4 py-2 rounded-lg bg-slate-900 text-white text-sm",children:"Close"})]}):(0,ea.jsxs)("div",{className:"p-6 space-y-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Student name *"}),(0,ea.jsx)("input",{value:N.student_name,onChange:e=>w(t=>d(d({},t),{},{student_name:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"absence-student-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Your name"}),(0,ea.jsx)("input",{value:N.parent_name,onChange:e=>w(t=>d(d({},t),{},{parent_name:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"absence-parent-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Your email"}),(0,ea.jsx)("input",{type:"email",value:N.parent_email,onChange:e=>w(t=>d(d({},t),{},{parent_email:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"absence-email-input"})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"From *"}),(0,ea.jsx)("input",{type:"date",value:N.date_from,onChange:e=>w(t=>d(d({},t),{},{date_from:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"absence-from-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"To"}),(0,ea.jsx)("input",{type:"date",value:N.date_to,onChange:e=>w(t=>d(d({},t),{},{date_to:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"absence-to-input"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Reason *"}),(0,ea.jsx)("input",{value:N.reason,onChange:e=>w(t=>d(d({},t),{},{reason:e.target.value})),placeholder:"Illness, appointment\u2026",className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"absence-reason-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"Notes"}),(0,ea.jsx)("textarea",{rows:3,value:N.notes,onChange:e=>w(t=>d(d({},t),{},{notes:e.target.value})),className:"mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm","data-testid":"absence-notes-input"})]}),(0,ea.jsx)("button",{onClick:async()=>{if(N.student_name.trim()&&N.date_from&&N.reason.trim()){k(!0);try{if(!(await fetch("".concat(w2,"/api/public/events/").concat(e,"/absentee"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)})).ok)throw new Error("Submission failed");_(!0)}catch(G2){alert("Sorry, we could not submit your report. Please try again.")}finally{k(!1)}}else alert("Please fill in the student name, start date and reason.")},disabled:C,className:"w-full py-2.5 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 disabled:opacity-60","data-testid":"absence-submit-btn",children:C?"Submitting\u2026":"Submit absence report"})]})]})})]})},T2=Vl("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"}]]),z2=e=>{if(!e)return"";try{return new Date(e).toLocaleString(void 0,{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch(t){return e}};function M2(){var e;const{qrToken:s}=je(),[a,n]=(0,t.useState)(null),[l,r]=(0,t.useState)(!0),[i,o]=(0,t.useState)(null),[c,u]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1);(0,t.useEffect)(()=>
2{if(!s)return o("Missing QR token"),void r(!1);fetch("".concat("","/api/public/event-payments/checkin/").concat(s)).then(async e=>{const t=await e.json();if(!e.ok)throw new Error(t.detail||"Ticket not found");n(t),t.checked_in&&h(!0)}).catch(e=>o(e.message)).finally(()=>r(!1))},[s]);if(l)return(0,ea.jsx)("div",{className:"min-h-screen bg-slate-900 flex items-center justify-center",children:(0,ea.jsx)("div",{className:"w-8 h-8 border-2 border-white border-t-transparent rounded-full animate-spin"})});if(i)return(0,ea.jsx)("div",{className:"min-h-screen bg-slate-900 flex items-center justify-center p-4",children:(0,ea.jsxs)("div",{className:"bg-white rounded-2xl p-8 w-full max-w-sm text-center shadow-xl",children:[(0,ea.jsx)(fJ,{className:"w-12 h-12 text-red-500 mx-auto mb-4"}),(0,ea.jsx)("h1",{className:"text-lg font-semibold text-slate-900 mb-2",children:"Invalid QR Code"}),(0,ea.jsx)("p",{className:"text-sm text-slate-500",children:i})]})});const x="paid"===a.payment_status,p=a.checked_in,g=p&&!m;return(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(As,{children:(0,ea.jsxs)("title",{children:["Ticket Check-in \u2014 ",a.event_title]})}),(0,ea.jsx)("div",{className:"min-h-screen flex flex-col items-center justify-center p-4 transition-colors duration-500 ".concat(g?"bg-emerald-600":p&&m?"bg-amber-500":"bg-slate-900"),children:(0,ea.jsxs)("div",{className:"w-full max-w-sm",children:[(0,ea.jsx)("div",{className:"flex justify-center mb-6",children:g?(0,ea.jsx)(cr,{className:"w-20 h-20 text-white drop-shadow-lg","data-testid":"checkin-success-icon"}):p?(0,ea.jsx)(AN,{className:"w-20 h-20 text-white drop-shadow-lg","data-testid":"checkin-already-icon"}):x?(0,ea.jsx)(T2,{className:"w-20 h-20 text-white drop-shadow-lg","data-testid":"checkin-ready-icon"}):(0,ea.jsx)(fJ,{className:"w-20 h-20 text-red-400 drop-shadow-lg","data-testid":"checkin-unpaid-icon"})}),(0,ea.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl overflow-hidden",children:[(0,ea.jsxs)("div",{className:"px-6 py-4 text-white ".concat(g?"bg-emerald-600":p?"bg-amber-500":x?"bg-indigo-600":"bg-red-500"),children:[(0,ea.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider opacity-80","data-testid":"checkin-event-name",children:a.event_title}),(0,ea.jsx)("h1",{className:"text-xl font-bold mt-0.5","data-testid":"checkin-status-heading",children:g?"Checked In!":p?"Already Checked In":x?"Ready to Check In":"Unpaid Ticket"})]}),(0,ea.jsxs)("div",{className:"px-6 py-5 space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-start gap-3","data-testid":"checkin-buyer-name",children:[(0,ea.jsx)(Pj,{className:"w-4 h-4 text-slate-400 mt-0.5 shrink-0"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 uppercase tracking-wider",children:"Guest"}),(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:a.buyer_name}),(0,ea.jsx)("p",{className:"text-xs text-slate-400",children:a.buyer_email})]})]}),(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)(T2,{className:"w-4 h-4 text-slate-400 mt-0.5 shrink-0"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 uppercase tracking-wider",children:"Ticket"}),(0,ea.jsx)("p",{className:"font-semibold text-slate-900",children:a.ticket_name}),(0,ea.jsxs)("p",{className:"text-sm text-slate-500",children:[a.quantity," ",1===a.quantity?"person":"people"]})]})]}),a.event_start&&(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)(Kg,{className:"w-4 h-4 text-slate-400 mt-0.5 shrink-0"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 uppercase tracking-wider",children:"Date & Time"}),(0,ea.jsx)("p",{className:"text-sm text-slate-700",children:z2(a.event_start)})]})]}),a.event_location&&(0,ea.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ea.jsx)(Ql,{className:"w-4 h-4 text-slate-400 mt-0.5 shrink-0"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("p",{className:"text-xs text-slate-400 uppercase tracking-wider",children:"Location"}),(0,ea.jsx)("p",{className:"text-sm text-slate-700",children:a.event_location})]})]}),p&&a.checked_in_at&&(0,ea.jsx)("div",{className:"bg-amber-50 border border-amber-100 rounded-lg px-4 py-2.5 mt-1","data-testid":"checkin-timestamp",children:(0,ea.jsxs)("p",{className:"text-xs text-amber-700 font-medium",children:["Checked in at ",z2(a.checked_in_at)]})}),!x&&(0,ea.jsx)("div",{className:"bg-red-50 border border-red-100 rounded-lg px-4 py-2.5 mt-1","data-testid":"checkin-unpaid-msg",children:(0,ea.jsx)("p",{className:"text-xs text-red-700 font-medium",children:"Payment not confirmed \u2014 entry not permitted."})})]}),(0,ea.jsxs)("div",{className:"px-6 pb-6",children:[!p&&x&&(0,ea.jsx)("button",{onClick:async()=>{u(!0);try{const e=await fetch("".concat("","/api/public/event-payments/checkin/").concat(s),{method:"POST"}),t=await e.json();if(409===e.status)return h(!0),void n(e=>{var s;return d(d({},e),{},{checked_in:!0,checked_in_at:(null===(s=t.detail)||void 0===s?void 0:s.split("at ")[1])||e.checked_in_at})});if(!e.ok)return void o(t.detail||"Check-in failed");n(e=>d(d({},e),{},{checked_in:!0,checked_in_at:t.checked_in_at})),h(!1)}catch(e){o("Network error \u2014 please try again")}finally{u(!1)}}
2,disabled:c,className:"w-full py-3.5 rounded-xl bg-emerald-600 hover:bg-emerald-700 text-white font-semibold text-base transition-colors disabled:opacity-60","data-testid":"checkin-confirm-btn",children:c?"Checking in\u2026":"Check In (".concat(a.quantity," ").concat(1===a.quantity?"person":"people",")")}),p&&(0,ea.jsx)("div",{className:"w-full py-3.5 rounded-xl bg-slate-100 text-slate-500 font-semibold text-base text-center","data-testid":"checkin-done-badge",children:"Entry Recorded"})]})]}),(0,ea.jsxs)("p",{className:"text-center text-xs text-white/40 mt-4","data-testid":"checkin-ticket-id",children:["Ticket #",null===(e=a.ticket_id)||void 0===e?void 0:e.slice(-8).toUpperCase()]})]})})]})}const P2=Vl("calendar-x",[["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"}]]),B2=Vl("calendar-check",[["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"}]]),R2=Vl("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"}]]),L2=e=>e?e.slice(0,10):"",I2=e=>{if(!e)return"";const[t,s,a]=e.split("-");return new Date(+t,+s-1,+a).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})},O2={name:"",type:"announcement",status:"draft",image_url:"",title:"",body:"",cta_text:"",cta_url:"",form_id:"",form_title:"",trigger:"immediate",delay_seconds:3,frequency:"session",show_on_all_pages:!1,page_ids:[],schedule_start:"",schedule_end:""};function U2(){var e;const[s,a]=(0,t.useState)([]),[n,l]=(0,t.useState)([]),[r,i]=(0,t.useState)([]),[o,c]=(0,t.useState)(!0),[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(null),[p,g]=(0,t.useState)(O2),[f,v]=(0,t.useState)(!1),[b,j]=(0,t.useState)(null),[y,N]=(0,t.useState)(!1),[w,C]=(0,t.useState)(null),k=(0,t.useCallback)(async()=>{c(!0);try{const[e,t,s]=await Promise.all([_l.get("/popups"),_l.get("/pages"),_l.get("/forms")]);a(e.data||[]),l(t.data||[]),i(s.data||[])}catch(e){qs.error("Failed to load popups")}finally{c(!1)}},[]);(0,t.useEffect)(()=>{k()},[k]);const D=()=>{x(null),g(O2),m(!0)},_=(e,t)=>g(s=>d(d({},s),{},{[e]:t})),S={session:"Once per session",once:"Once ever",always:"Every visit"};"After ".concat(p.delay_seconds,"s");return(0,ea.jsxs)("div",{className:"p-6 max-w-5xl mx-auto",children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(Nt,{to:"/dashboard",className:"inline-flex items-center gap-1.5 text-sm text-gray-400 hover:text-gray-700 transition-colors mb-2",children:[(0,ea.jsx)(vw,{size:14})," Dashboard"]}),(0,ea.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Popups"}),(0,ea.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Show announcements or contact forms when visitors open a page"})]}),(0,ea.jsxs)(sg,{onClick:D,"data-testid":"create-popup-btn",className:"flex items-center gap-2",children:[(0,ea.jsx)(Vj,{size:16})," Create Popup"]})]}),o?(0,ea.jsx)("div",{className:"flex items-center justify-center py-16 text-gray-400",children:"Loading\u2026"}):0===s.length?(0,ea.jsxs)("div",{className:"text-center py-20 border-2 border-dashed border-gray-200 rounded-2xl",children:[(0,ea.jsx)(ww,{size:40,className:"mx-auto text-gray-300 mb-3"}),(0,ea.jsx)("p",{className:"text-gray-500 font-medium",children:"No popups yet"}),(0,ea.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"Create your first popup to engage visitors"}),(0,ea.jsx)(sg,{onClick:D,variant:"outline",children:"Create your first popup"})]}):(0,ea.jsx)("div",{className:"space-y-3",children:s.map(e=>{var t,s;return(0,ea.jsxs)("div",{"data-testid":"popup-row-".concat(e.popup_id),className:"flex items-center justify-between bg-white border border-gray-200 rounded-xl px-5 py-4 shadow-sm hover:shadow-md transition-shadow",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ea.jsx)("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center ".concat("form"===e.type?"bg-purple-50":"bg-blue-50"),children:"form"===e.type?(0,ea.jsx)(yw,{size:18,className:"text-purple-600"}):(0,ea.jsx)(ww,{size:18,className:"text-blue-600"})}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,ea.jsx)("span",{className:"font-semibold text-gray-900",children:e.name}),(()=>{const{state:t,label:s,color:a}=(e=>{const t=(new Date).toISOString().slice(0,10),s=e.schedule_start||null,a=e.schedule_end||null;return"active"!==e.status?{state:"draft",label:"Draft",color:"secondary"}:s&&t<s?{state:"pending",label:"Scheduled",color:"outline"}:a&&t>a?{state:"expired",label:"Expired",color:"destructive"}:{state:"live",label:"Live",color:"default"}})(e);return(0,ea.jsxs)(EC,{variant:{default:"default",secondary:"secondary",outline:"outline",destructive:"destructive"}[a],className:"text-xs capitalize ".concat("pending"===t?"border-amber-400 text-amber-700":"expired"===t?"bg-red-100 text-red-700 border-red-200":""),"data-testid":"popup-status-badge-".concat(e.popup_id),children:["pending"===t&&(0,ea.jsx)(TC,{size:10,
2className:"mr-1"}),"expired"===t&&(0,ea.jsx)(P2,{size:10,className:"mr-1"}),"live"===t&&(0,ea.jsx)(B2,{size:10,className:"mr-1"}),s]})})(),(0,ea.jsx)(EC,{variant:"outline",className:"text-xs capitalize",children:e.type})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-gray-400 flex-wrap",children:[(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(Kg,{size:11})," ","delayed"===e.trigger?"After ".concat(e.delay_seconds,"s"):"Immediate"]}),(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(R2,{size:11})," ",S[e.frequency]||e.frequency]}),(0,ea.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ea.jsx)(hr,{size:11}),e.show_on_all_pages?"All pages":"".concat((null===(t=e.page_ids)||void 0===t?void 0:t.length)||0," page").concat(1!==(null===(s=e.page_ids)||void 0===s?void 0:s.length)?"s":"")]}),(e.schedule_start||e.schedule_end)&&(0,ea.jsxs)("span",{className:"flex items-center gap-1 text-amber-600","data-testid":"popup-schedule-".concat(e.popup_id),children:[(0,ea.jsx)(TC,{size:11}),e.schedule_start&&e.schedule_end?"".concat(I2(e.schedule_start)," \u2013 ").concat(I2(e.schedule_end)):e.schedule_start?"From ".concat(I2(e.schedule_start)):"Until ".concat(I2(e.schedule_end))]})]})]})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("button",{onClick:()=>C(e),"data-testid":"popup-preview-".concat(e.popup_id),title:"Preview",className:"p-2 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-blue-600 transition-colors",children:(0,ea.jsx)(IN,{size:16})}),(0,ea.jsx)("button",{onClick:()=>(async e=>{const t="active"===e.status?"draft":"active";try{await _l.put("/popups/".concat(e.popup_id),{status:t}),a(s=>s.map(s=>s.popup_id===e.popup_id?d(d({},s),{},{status:t}):s))}catch(s){qs.error("Failed to update status")}})(e),"data-testid":"popup-toggle-".concat(e.popup_id),title:"active"===e.status?"Deactivate":"Activate",className:"p-2 rounded-lg hover:bg-gray-100 transition-colors",children:"active"===e.status?(0,ea.jsx)(RJ,{size:22,className:"text-green-500"}):(0,ea.jsx)(LJ,{size:22,className:"text-gray-400"})}),(0,ea.jsx)("button",{onClick:()=>(e=>{x(e),g(d(d({},O2),e)),m(!0)})(e),"data-testid":"popup-edit-".concat(e.popup_id),className:"p-2 rounded-lg hover:bg-gray-100 text-gray-500 hover:text-gray-800 transition-colors",children:(0,ea.jsx)(BQ,{size:16})}),(0,ea.jsx)("button",{onClick:()=>j(e),"data-testid":"popup-delete-".concat(e.popup_id),className:"p-2 rounded-lg hover:bg-red-50 text-gray-400 hover:text-red-500 transition-colors",children:(0,ea.jsx)(wD,{size:16})})]})]},e.popup_id)})}),(0,ea.jsx)(Ok,{open:u,onOpenChange:m,children:(0,ea.jsxs)(Wk,{className:"max-w-xl max-h-[90vh] overflow-y-auto","data-testid":"popup-dialog",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:h?"Edit Popup":"Create Popup"})}),(0,ea.jsxs)("div",{className:"space-y-5 py-2",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Internal Name *"}),(0,ea.jsx)(BN,{placeholder:"e.g. Open Day Announcement",value:p.name,onChange:e=>_("name",e.target.value),"data-testid":"popup-name-input",className:"mt-1"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium mb-2 block",children:"Popup Type"}),(0,ea.jsx)("div",{className:"grid grid-cols-2 gap-3",children:[{val:"announcement",icon:ww,label:"Announcement",desc:"Image + text
2+ button"},{val:"form",icon:yw,label:"Contact Form",desc:"Show one of your forms"}].map(e=>(0,ea.jsxs)("button",{type:"button","data-testid":"popup-type-".concat(e.val),onClick:()=>_("type",e.val),className:"flex items-start gap-3 p-3 rounded-xl border-2 text-left transition-all ".concat(p.type===e.val?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"),children:[(0,ea.jsx)(e.icon,{size:18,className:p.type===e.val?"text-blue-600 mt-0.5":"text-gray-400 mt-0.5"}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"font-medium text-sm",children:e.label}),(0,ea.jsx)("div",{className:"text-xs text-gray-500",children:e.desc})]})]},e.val))})]}),"announcement"===p.type&&(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-gray-50 rounded-xl",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsxs)(tf,{className:"text-sm font-medium",children:["Image ",(0,ea.jsx)("span",{className:"text-gray-400 font-normal",children:"(optional)"})]}),(0,ea.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,ea.jsx)(BN,{placeholder:"https://... or pick from gallery",value:p.image_url,onChange:e=>_("image_url",e.target.value),"data-testid":"popup-image-url",className:"flex-1"}),(0,ea.jsxs)(sg,{type:"button",variant:"outline",size:"sm",onClick:()=>N(!0),"data-testid":"popup-image-gallery-btn",className:"flex items-center gap-1.5 shrink-0",children:[(0,ea.jsx)(TE,{size:14})," Gallery"]})]}),p.image_url&&(0,ea.jsxs)("div",{className:"mt-2 relative w-full aspect-video rounded-lg overflow-hidden border border-gray-200",children:[(0,ea.jsx)("img",{src:p.image_url,alt:"",className:"w-full h-full object-cover"}),(0,ea.jsx)("button",{onClick:()=>_("image_url",""),className:"absolute top-1.5 right-1.5 w-6 h-6 bg-black/60 hover:bg-black/80 text-white rounded-full flex items-center justify-center transition-colors",children:(0,ea.jsx)(sr,{size:12})})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Title"}),(0,ea.jsx)(BN,{placeholder:"Admissions Open 2026",value:p.title,onChange:e=>_("title",e.target.value),className:"mt-1","data-testid":"popup-title-input"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Body Text"}),(0,ea.jsx)(YN,{placeholder:"Add a short description\u2026",value:p.body,rows:3,onChange:e=>_("body",e.target.value),className:"mt-1","data-testid":"popup-body-input"})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Button Label"}),(0,ea.jsx)(BN,{placeholder:"Enroll Now",value:p.cta_text,onChange:e=>_("cta_text",e.target.value),className:"mt-1","data-testid":"popup-cta-text"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Button URL"}),(0,ea.jsx)(BN,{placeholder:"https://...",value:p.cta_url,onChange:e=>_("cta_url",e.target.value),className:"mt-1","data-testid":"popup-cta-url"})]})]})]}),"form"===p.type&&(0,ea.jsxs)("div",{className:"space-y-4 p-4 bg-gray-50 rounded-xl",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Popup Heading"}),(0,ea.jsx)(BN,{placeholder:"Talk to Us",value:p.form_title,onChange:e=>_("form_title",e.target.value),className:"mt-1","data-testid":"popup-form-title"})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Select Form"}),0===r.length?(0,ea.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:["No forms found. ",(0,ea.jsx)("a",{href:"/forms",className:"text-blue-600 underline",children:"Create one first \u2192"})]}):(0,ea.jsxs)(eb,{value:p.form_id||"",onValueChange:e=>_("form_id",e),children:[(0,ea.jsx)(sb,{className:"mt-1","data-testid":"popup-form-select",children:(0,ea.jsx)(tb,{placeholder:"Choose a form\u2026"})}),(0,ea.jsx)(lb,{children:r.map(e=>(0,ea.jsx)(rb,{value:e.form_id,children:e.name},e.form_id))})]})]})]}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Trigger"}),(0,ea.jsxs)(eb,{value:p.trigger,onValueChange:e=>_("trigger",e),children:[(0,ea.jsx)(sb,{className:"mt-1","data-testid":"popup-trigger-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"immediate",children:"Immediately on load"}),(0,ea.jsx)(rb,{value:"delayed",children:"After a delay"})]})]}),"delayed"===p.trigger&&(0,ea.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,ea.jsx)(BN,{type:"number",min:1,max:30,value:p.delay_seconds,onChange:e=>_("delay_seconds",parseInt(e.target.value)||3),className:"w-20","data-testid":"popup-delay-seconds"}),(0,ea.jsx)("span",{className:"text-sm text-gray-500",children:"seconds"})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Show frequency"}),(0,ea.jsxs)(eb,{value:p.frequency,onValueChange:e=>_("frequency",e),children:[(0,ea.jsx)(sb,{className:"mt-1","data-testid":"popup-frequency-select",children:(0,ea.jsx)(tb,{})}),(0,ea.jsxs)(lb,{children:[(0,ea.jsx)(rb,{value:"session",children:"Once per session"}),(0,ea.jsx)(rb,{value:"once",children:"Once ever (per device)"}),(0,ea.jsx)(rb,{value:"always",children:"Every visit"})]})]})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ea.jsx)(tf,{className:"text-sm font-medium",children:"Pages"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-xs text-gray-500",children:"Show on all pages"}),(0,ea.jsx)(wb,{checked:p.show_on_all_pages,onCheckedChange:e=>_("show_on_all_pages",e),"data-testid":"popup-all-pages-toggle"})]})]}),!p.show_on_all_pages&&(0,ea.jsx)("div",{className:"border border-gray-200 rounded-xl max-h-48 overflow-y-auto p-2 space-y-1",children:0===n.length?(0,ea.jsx)("p",{className:"text-sm text-gray-400 p-2",children:"No pages found"}):n.map(e=>(0,ea.jsxs)("label",{className:"flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors ".concat(p.page_ids.includes(e.page_id)?"bg-blue-50":""),children:[(0,ea.jsx)("input",{type:"checkbox",checked:p.page_ids.includes(e.page_id),onChange:()=>{return t=e.page_id,void g(e=>d(d({},e),{},{page_ids:e.page_ids.includes(t)?e.page_ids.filter(e=>e!==t):[...e.page_ids,t]}));var t},"data-testid":"popup-page-".concat(e.page_id),className:"rounded text-blue-600"}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(qN,{size:14,className:"text-gray-400"}),(0,ea.jsx)("span",{className:"text-sm text-gray-700",children:e.title||e.slug}),(0,ea.jsxs)("span",{className:"text-xs text-gray-400",children:["/",e.slug]})]})]},e.page_id))}),!p.show_on_all_pages&&0===p.page_ids.length&&(0,ea.jsx)("p",{className:"text-xs text-amber-600 mt-1",children:'Select at least one page, or enable "Show on all pages"'})]}),(0,ea.jsxs)("div",{className:"p-4 bg-amber-50 border border-amber-100 rounded-xl space-y-3",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ea.jsx)(TC,{size:16,className:"text-amber-600"}),(0,ea.jsxs)("span",{className:"text-sm font-medium text-amber-900",children:["Schedule ",(0,ea.jsx)("span",{className:"font-normal text-amber-600",children:"(optional)"})]})]}),(0,ea.jsx)("p",{className:"text-xs text-amber-700 leading-relaxed -mt-1",children:"Set dates to auto-show and auto-hide this popup. Leave blank to follow the status toggle only."}),(0,ea.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs font-medium text-amber-800",children:"Start date"}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,ea.jsx)(BN,{type:"date",value:L2(p.schedule_start),onChange:e=>_("schedule_start",e.target.value),className:"flex-1 text-sm","data-testid":"popup-schedule-start"}),p.schedule_start&&(0,ea.jsx)("button",{type:"button",onClick:()=>_("schedule_start",""),className:"text-gray-400 hover:text-gray-600",title:"Clear",children:(0,ea.jsx)(sr,{size:14})})]})]}),(0,ea.jsxs)("div",{children:[(0,ea.jsx)(tf,{className:"text-xs font-medium text-amber-800",children:"End date"}),(0,ea.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,ea.jsx)(BN,{type:"date",value:L2(p.schedule_end),onChange:e=>_("schedule_end",e.target.value),className:"flex-1 text-sm","data-testid":"popup-schedule-end"}),p.schedule_end&&(0,ea.jsx)("button",{type:"button",onClick:()=>_("schedule_end",""),className:"text-gray-400 hover:text-gray-600",title:"Clear",children:(0,ea.jsx)(sr,{size:14})})]})]})]}),p.schedule_start&&p.schedule_end&&p.schedule_start>p.schedule_end&&(0,ea.jsx)("p",{className:"text-xs text-red-600",children:"End date must be after start date."})]}),(0,ea.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-xl",children:[(0,ea.jsxs)("div",{children:[(0,ea.jsx)("div",{className:"font-medium text-sm",children:"Status"}),(0,ea.jsx)("div",{className:"text-xs text-gray-500",children:"active"===p.status?"Live \u2014 visitors will see this popup":"Draft \u2014 hidden from visitors"})]}),(0,ea.jsx)(wb,{checked:"active"===p.status,onCheckedChange:e=>_("status",e?"active":"draft"),"data-testid":"popup-status-toggle"})]})]}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>m(!1),children:"Cancel"}),(0,ea.jsx)(sg,{onClick:async()=>
2{if(!p.name.trim())return void qs.error("Give this popup a name");if(p.schedule_start&&p.schedule_end&&p.schedule_start>p.schedule_end)return void qs.error("End date must be after start date");v(!0);const e=d({},p);try{h?(await _l.put("/popups/".concat(h.popup_id),e),qs.success("Popup updated")):(await _l.post("/popups",e),qs.success("Popup created")),m(!1),k()}catch(t){qs.error("Failed to save popup")}finally{v(!1)}},disabled:f,"data-testid":"popup-save-btn",children:f?"Saving\u2026":h?"Save Changes":"Create Popup"})]})]})}),(0,ea.jsx)(Ok,{open:!!b,onOpenChange:()=>j(null),children:(0,ea.jsxs)(Wk,{className:"max-w-sm",children:[(0,ea.jsx)(Vk,{children:(0,ea.jsx)($k,{children:"Delete Popup?"})}),(0,ea.jsxs)("p",{className:"text-sm text-gray-600",children:['"',(0,ea.jsx)("strong",{children:null===b||void 0===b?void 0:b.name}),'" will be permanently removed.']}),(0,ea.jsxs)(qk,{children:[(0,ea.jsx)(sg,{variant:"outline",onClick:()=>j(null),children:"Cancel"}),(0,ea.jsx)(sg,{variant:"destructive",onClick:async()=>{if(b)try{await _l.delete("/popups/".concat(b.popup_id)),qs.success("Popup deleted"),j(null),k()}catch(e){qs.error("Failed to delete popup")}},"data-testid":"popup-delete-confirm-btn",children:"Delete"})]})]})}),(0,ea.jsx)(Dq,{open:y,onClose:()=>N(!1),onSelect:e=>{_("image_url",e.url),N(!1)}}),w&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("div",{className:"fixed inset-0 bg-black/60 z-[9998]",onClick:()=>C(null)}),(0,ea.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:(0,ea.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,ea.jsx)("div",{className:"absolute top-0 left-0 right-0 bg-amber-400 text-amber-900 text-xs font-semibold text-center py-1 z-10",children:"PREVIEW \u2014 how visitors will see this popup"}),(0,ea.jsx)("button",{onClick:()=>C(null),"data-testid":"preview-close-btn",className:"absolute top-7 right-3 z-20 w-8 h-8 flex items-center justify-center rounded-full bg-white/90 hover:bg-gray-100 text-gray-500 shadow-sm",children:(0,ea.jsx)(sr,{size:16})}),"announcement"===w.type&&(0,ea.jsxs)("div",{className:"pt-7",children:[w.image_url&&(0,ea.jsx)("div",{className:"w-full aspect-video overflow-hidden",children:(0,ea.jsx)("img",{src:w.image_url,alt:w.title||"",className:"w-full h-full object-cover"})}),(0,ea.jsxs)("div",{className:"p-6",children:[w.title&&(0,ea.jsx)("h2",{className:"text-xl font-bold text-gray-900 mb-2",children:w.title}),w.body&&(0,ea.jsx)("p",{className:"text-gray-600 text-sm leading-relaxed mb-4",children:w.body}),w.cta_text&&w.cta_url&&(0,ea.jsx)("span",{className:"inline-block w-full text-center bg-blue-600 text-white font-semibold py-2.5 px-6 rounded-lg text-sm cursor-default",children:w.cta_text})]})]}),"form"===w.type&&(0,ea.jsxs)("div",{className:"p-6 pt-10",children:[w.form_title&&(0,ea.jsx)("h2",{className:"text-xl font-bold text-gray-900 mb-4",children:w.form_title}),(0,ea.jsx)("p",{className:"text-sm text-gray-500 italic",children:"Form fields will appear here when the popup is live on the page."}),(0,ea.jsxs)("div",{className:"mt-4 bg-gray-50 rounded-lg p-3 text-xs text-gray-400",children:["Connected form: ",(0,ea.jsx)("strong",{className:"text-gray-600",children:(null===(e=r.find(e=>e.form_id===w.form_id))||void 0===e?void 0:e.name)||w.form_id||"\u2014"})]})]})]})})]})]})}const H2=()=>{const{user:e}=Al(),[s,a]=(0,t.useState)(null),[n,l]=(0,t.useState)(!1),[r,i]=(0,t.useState)(!0),[o,c]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(null===e||void 0===e||!e.tenant_id||null!==e&&void 0!==e&&e.reseller_id)return void i(!1);(async()=>{try{const e=await _l.get("/tenant/trial-status");a(e.data);const t="trial_banner_dismissed_".concat(e.data.trial_end_date);sessionStorage.getItem(t)&&l(!0)}catch(e){console.error("Failed to fetch trial status:",e)}finally{i(!1)}})()},[e]);if(r)return null;if(!s||!s.is_trial||n)return null;if(!s.trial_active)return null;const d=s.days_remaining,u=s.plan_name||(s.plan_level?s.plan_level.charAt(0).toUpperCase()+s.plan_level.slice(1):"Pro"),m={starter:"basic",basic:"basic",pro:"pro",enterprise:"enterprise"}[(s.plan_level||"pro").toLowerCase()]||"pro";let h={bg:"bg-indigo-600",text:"text-white",buttonBg:"bg-white text-indigo-600 hover:bg-indigo-50",icon:$g};d<=3&&(h={bg:"bg-amber-500",text:"text-white",buttonBg:"bg-white text-amber-600 hover:bg-amber-50",icon:AN}),d<=1&&(h={bg:"bg-red-500",text:"text-white",buttonBg:"bg-white text-red-600 hover:bg-red-50",icon:AN});const x=h.icon;return(0,ea.jsx)("div",{className:"".concat(h.bg," ").concat(h.text," px-4 py-3"),"data-testid":"trial-banner",children:(0,ea.jsxs)("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[(0,ea.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ea.jsx)(x,{size:20,className:d<=3?"animate-pulse":""}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(Kg,{size:16}),(0,ea.jsx)("span",{className:"font-medium",children:0===d?"Your ".concat(u," trial ends today!"):1===d?"Your ".concat(u," trial ends tomorrow!"):"".concat(d," days left in your ").concat(u," trial")})]}),d<=7&&(0,ea.jsx)("span",{className:"hidden sm:inline text-sm opacity-90",children:"Upgrade to keep all your features."})]}),(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)(sg,{size:"sm",onClick:async()=>{c(!0);try{var e;const t=await _l.post("/billing/checkout",{package:m});if(null===(e=t.data)||void 0===e||!e.url)throw new Error("No checkout URL");
2window.location.href=t.data.url}catch(t){qs.error("Could not start checkout. Please try again."),c(!1)}},disabled:o,className:"".concat(h.buttonBg," font-medium"),"data-testid":"trial-banner-subscribe-btn",children:o?(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ql,{size:14,className:"mr-1 animate-spin"})," Redirecting\u2026"]}):"Subscribe to ".concat(u)}),(0,ea.jsx)(Nt,{to:"/settings/billing",className:"hidden sm:block",children:(0,ea.jsx)("button",{className:"text-sm underline underline-offset-2 opacity-90 hover:opacity-100 px-1","data-testid":"trial-banner-compare-link",children:"Compare plans"})}),d>3&&(0,ea.jsx)("button",{onClick:()=>{null!==s&&void 0!==s&&s.trial_end_date&&sessionStorage.setItem("trial_banner_dismissed_".concat(s.trial_end_date),"true"),l(!0)},className:"p-1 hover:bg-white/20 rounded transition-colors","aria-label":"Dismiss banner","data-testid":"trial-banner-dismiss",children:(0,ea.jsx)(sr,{size:18})})]})]})})},W2=()=>{const e=window.location.pathname.replace(/^\/article\//,""),[s,a]=t.useState(null);return t.useEffect(()=>{e?fetch("".concat("","/api/public/resolve-article/").concat(e)).then(e=>{if(!e.ok)throw new Error("Not found");return e.json()}).then(t=>{window.location.replace("/site/".concat(t.site_slug,"/article/").concat(e))}).catch(()=>a("Article not found")):a("No article slug")},[e]),s?(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsxs)("div",{className:"text-center",children:[(0,ea.jsx)("h1",{className:"text-4xl font-bold text-slate-900 mb-4",children:"404"}),(0,ea.jsx)("p",{className:"text-xl text-slate-600 mb-6",children:s}),(0,ea.jsx)("a",{href:"/",className:"inline-flex items-center px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700",children:"Go Home"})]})}):(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading article..."})})},V2=e=>{let{children:t}=e;const{user:s,loading:a}=Al();return a?(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading..."})}):s?(0,ea.jsxs)(TN,{children:[(0,ea.jsx)(H2,{}),t]}):(0,ea.jsx)(Re,{to:"/login"})},q2=e=>{let{children:t}=e;const{user:s,loading:a}=Al();if(a)return(0,ea.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,ea.jsx)("p",{className:"text-slate-500",children:"Loading..."})});const n=null!==s&&void 0!==s&&s.reseller_id?"/reseller/dashboard":"/dashboard";return s?(0,ea.jsx)(Re,{to:n}):t};const $2=function(){return(0,ea.jsx)(MN,{children:(0,ea.jsx)(ws,{children:(0,ea.jsx)(Rl,{children:(0,ea.jsx)(El,{children:(0,ea.jsx)(jt,{children:(0,ea.jsx)(EN,{children:(0,ea.jsxs)("div",{className:"App",children:[(0,ea.jsxs)(Oe,{children:[(0,ea.jsx)(Le,{path:"/login",element:(0,ea.jsx)(q2,{children:(0,ea.jsx)(UN,{})})}),(0,ea.jsx)(Le,{path:"/signup",element:(0,ea.jsx)(q2,{children:(0,ea.jsx)(UN,{})})}),(0,ea.jsx)(Le,{path:"/forgot-password",element:(0,ea.jsx)(HN,{})}),(0,ea.jsx)(Le,{path:"/reset-password",element:(0,ea.jsx)(VN,{})}),(0,ea.jsx)(Le,{path:"/dashboard",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(fD,{})})}),(0,ea.jsx)(Le,{path:"/analytics",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(h2,{})})}),(0,ea.jsx)(Le,{path:"/pages",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(TD,{})})}),(0,ea.jsx)(Le,{path:"/pages/:id",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(xJ,{})})}),(0,ea.jsx)(Le,{path:"/templates",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(HZ,{})})}),(0,ea.jsx)(Le,{path:"/newsletters",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(FJ,{})})}),(0,ea.jsx)(Le,{path:"/ai-assistant",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(zJ,{})})}),(0,ea.jsx)(Le,{path:"/admin/ai-bots",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(MJ,{})})}),(0,ea.jsx)(Le,{path:"/taptile",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(OJ,{})})}),(0,ea.jsx)(Le,{path:"/stripe-payments",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(HJ,{})})}),(0,ea.jsx)(Le,{path:"/newsletters/:id",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(WJ,{})})}),(0,ea.jsx)(Le,{path:"/media",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)($J,{})})}),(0,ea.jsx)(Le,{path:"/team",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(JJ,{})})}),(0,ea.jsx)(Le,{path:"/organization-members",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(J0,{})})}),(0,ea.jsx)(Le,{path:"/users",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(mQ,{})})}),(0,ea.jsx)(Le,{path:"/audit-logs",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(_Q,{})})}),(0,ea.jsx)(Le,{path:"/go-live-requests",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(FQ,{})})}),(0,ea.jsx)(Le,{path:"/settings",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(UQ,{})})}),(0,ea.jsx)(Le,{path:"/theme-settings",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(HQ,{})})}),(0,ea.jsx)(Le,{path:"/domain-settings",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(WQ,{})})}),(0,ea.jsx)(Le,{path:"/security-settings",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(VQ,{})})}),(0,ea.jsx)(Le,{path:"/api-keys",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(qQ,{})})}),(0,ea.jsx)(Le,{path:"/compliance",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(KQ,{})})}),(0,ea.jsx)(Le,{path:"/help",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(GX,{})})}),(0,ea.jsx)(Le,{path:"/navigation",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(dZ,{})})}),(0,ea.jsx)(Le,{path:"/redirects",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(c0,{})})}),(0,ea.jsx)(Le,{path:"/api-docs",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(WZ,{})})}),(0,ea.jsx)(Le,{path:"/forms",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(qZ,{})})}),(0,ea.jsx)(Le,{path:"/events",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(N2,{})})}),(0,ea.jsx)(Le,{path:"/popups",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(U2,{})})}),(0,ea.jsx)(Le,{path:"/forms/:id",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(JZ,{})})}),(0,ea.jsx)(Le,{path:"/forms/:id/submissions",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(QZ,{})})}),(0,ea.jsx)(Le,{path:"/articles",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(r0,{})})}),(0,ea.jsx)(Le,{path:"/articles/:id",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(o0,{})})}),(0,ea.jsx)(Le,{path:"/preview/article/:token",element:(0,ea.jsx)(s0,{})}),(0,ea.jsx)(Le,{path:"/preview/:token",element:(0,ea.jsx)(t0,{})}),(0,ea.jsx)(Le,{path:"/site/:siteSlug",element:(0,ea.jsx)(y0,{})}),(0,ea.jsx)(Le,{path:"/site/:siteSlug/events",element:(0,ea.jsx)(F2,{})}),(0,ea.jsx)(Le,{path:"/site/:siteSlug/events/rsvp/:cancelToken",element:(0,ea.jsx)(F2,{})}),(0,ea.jsx)(Le,{path:"/site/:siteSlug/events/waitlist/:waitlistToken",element:(0,ea.jsx)(F2,{})}),(0,ea.jsx)(Le,{path:"/site/:siteSlug/events/:eventId",element:(0,ea.jsx)(F2,{})}),(0,ea.jsx)(Le,{path:"/ticket-checkin/:qrToken",element:(0,ea.jsx)(M2,{})}),(0,ea.jsx)(Le,{path:"/site/:siteSlug/page/:pageSlug",element:(0,ea.jsx)(y0,{})}),(0,ea.jsx)(Le,{path:"/site/:siteSlug/article/:articleSlug",element:(0,ea.jsx)(y0,{})}),(0,ea.jsx)(Le,{path:"/article/*",element:(0,ea.jsx)(W2,{})}),(0,ea.jsx)(Le,{path:"/affiliate/apply",element:(0,ea.jsx)(W0,{})}),(0,ea.jsx)(Le,{path:"/affiliate/dashboard",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(q0,{})})}),(0,ea.jsx)(Le,{path:"/affiliates",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(Y0,{})})}),(0,ea.jsx)(Le,{path:"/become-a-reseller",element:(0,ea.jsx)(z0,{})}),(0,ea.jsx)(Le,{path:"/",element:(0,ea.jsx)(u0,{})}),(0,ea.jsx)(Le,{path:"/payment-success",element:(0,ea.jsx)(N0,{})}),(0,ea.jsx)(Le,{path:"/landing-page",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(g0,{})})}),(0,ea.jsx)(Le,{path:"/cms/landing-page",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(m0,{})})}),(0,ea.jsx)(Le,{path:"/plan-limits",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(MQ,{})})}),(0,ea.jsx)(Le,{path:"/marketplace",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(LQ,{})})}),(0,ea.jsx)(Le,{path:"/resellers",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(D0,{})})}),(0,ea.jsx)(Le,{path:"/reseller/dashboard",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(E0,{})})}),(0,ea.jsx)(Le,{path:"/reseller/billing",element:(0,ea.jsx)(V2,{children:(0,ea.jsx)(A0,{})})})]}),(0,ea.jsx)(ta,{position:"top-center",duration:1e4,closeButton:!0,offset:"40vh",toastOptions:{style:{cursor:"pointer"},classNames:{error:"!bg-red-600 !text-white !border-red-700 !shadow-lg"}}})]})})})})})})})};n.createRoot(document.getElementById("root")).render((0,ea.jsx)(t.StrictMode,{children:(0,ea.jsx)($2,{})}))})()})(); 3//# sourceMappingURL=main.32f6ad45.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.