HifiPlanet-Website/hifi/assets/index-kZ4ovh9r.js
Maaxxs a3767b1c0f Extend text styling to brand/model names and package text, add bold bullets
Rolls the generic text_styles mechanism out to three more areas (Phase 3/4
of the earlier text-styling plan): brands.name, car_models.name,
packages.description and packages.price_text. Registry entries reuse each
table's existing manage permission (brands.manage/models.manage/
packages.manage). Widgets are gated on an existing row (editingId in
Brands.jsx/Models.jsx, row.existing in Packages.jsx's batch editor), since
a newly-created row has no id yet to key a style on.

Added fieldStyle()/useTextStylesMap() to TextStylesContext.jsx alongside
the existing useTextStyle() - brand/model lists are open-ended, so styling
each one from inside a .map() can't call a hook per item (rules of hooks);
fieldStyle() does a plain lookup against the already-loaded styles map
instead. pkg.name stays unstyled (it's chosen from a fixed tier list, not
free text).

Deleting a brand cascades to its models and their packages in the
database, so BrandController/ModelController::destroy() now collect the
cascaded ids first and clean up their text_styles rows too (mirroring how
they already do this for orphaned uploaded images); SettingsController's
catalog reset endpoints get the same cleanup in bulk.

Separately: package descriptions can now mark individual bullet points
bold. Packages.jsx gained a "Fett" button that wraps the current textarea
selection in **markers** (one line per bullet is unchanged); the public
ModelPage.jsx renders those through a new BoldText.jsx component that
turns **text** into <strong> via a plain regex - no dangerouslySetInnerHTML,
since the only possible output is a <strong> tag. Product-name bullets
(scraped from the linked shop, not admin-authored) are unaffected.

Verified locally: registry rejects packages.name (not free text) and a
non-numeric id, and deleting a test brand correctly cascades text_styles
cleanup through its model and package.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-10 03:15:53 +02:00

325 lines
1 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{r as v,g as Kw,R as J2,D as Y2,C as X2,M as Z2,a as Q2,P as eM,U as tM,b as Dx,c as Lx,d as nM,S as rM,e as sM,E as iM,i as oM,f as Xr}from"./lucide-icons-Cg2IxtAO.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Gw={exports:{}},Ad={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var aM=v,lM=Symbol.for("react.element"),cM=Symbol.for("react.fragment"),uM=Object.prototype.hasOwnProperty,dM=aM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,hM={key:!0,ref:!0,__self:!0,__source:!0};function qw(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)uM.call(e,r)&&!hM.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:lM,type:t,key:i,ref:o,props:s,_owner:dM.current}}Ad.Fragment=cM;Ad.jsx=qw;Ad.jsxs=qw;Gw.exports=Ad;var c=Gw.exports,ep={},Jw={exports:{}},Ht={},Yw={exports:{}},Xw={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(t){function e(R,_){var $=R.length;R.push(_);e:for(;0<$;){var te=$-1>>>1,Y=R[te];if(0<s(Y,_))R[te]=_,R[$]=Y,$=te;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var _=R[0],$=R.pop();if($!==_){R[0]=$;e:for(var te=0,Y=R.length,U=Y>>>1;te<U;){var X=2*(te+1)-1,ae=R[X],ue=X+1,Re=R[ue];if(0>s(ae,$))ue<Y&&0>s(Re,ae)?(R[te]=Re,R[ue]=$,te=ue):(R[te]=ae,R[X]=$,te=X);else if(ue<Y&&0>s(Re,$))R[te]=Re,R[ue]=$,te=ue;else break e}}return _}function s(R,_){var $=R.sortIndex-_.sortIndex;return $!==0?$:R.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],d=1,h=null,f=3,p=!1,m=!1,g=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(R){for(var _=n(u);_!==null;){if(_.callback===null)r(u);else if(_.startTime<=R)r(u),_.sortIndex=_.expirationTime,e(l,_);else break;_=n(u)}}function w(R){if(g=!1,k(R),!m)if(n(l)!==null)m=!0,B(C);else{var _=n(u);_!==null&&re(w,_.startTime-R)}}function C(R,_){m=!1,g&&(g=!1,y(N),N=-1),p=!0;var $=f;try{for(k(_),h=n(l);h!==null&&(!(h.expirationTime>_)||R&&!D());){var te=h.callback;if(typeof te=="function"){h.callback=null,f=h.priorityLevel;var Y=te(h.expirationTime<=_);_=t.unstable_now(),typeof Y=="function"?h.callback=Y:h===n(l)&&r(l),k(_)}else r(l);h=n(l)}if(h!==null)var U=!0;else{var X=n(u);X!==null&&re(w,X.startTime-_),U=!1}return U}finally{h=null,f=$,p=!1}}var j=!1,S=null,N=-1,T=5,E=-1;function D(){return!(t.unstable_now()-E<T)}function P(){if(S!==null){var R=t.unstable_now();E=R;var _=!0;try{_=S(!0,R)}finally{_?O():(j=!1,S=null)}}else j=!1}var O;if(typeof b=="function")O=function(){b(P)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,H=I.port2;I.port1.onmessage=P,O=function(){H.postMessage(null)}}else O=function(){x(P,0)};function B(R){S=R,j||(j=!0,O())}function re(R,_){N=x(function(){R(t.unstable_now())},_)}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(R){R.callback=null},t.unstable_continueExecution=function(){m||p||(m=!0,B(C))},t.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<R?Math.floor(1e3/R):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(R){switch(f){case 1:case 2:case 3:var _=3;break;default:_=f}var $=f;f=_;try{return R()}finally{f=$}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(R,_){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var $=f;f=R;try{return _()}finally{f=$}},t.unstable_scheduleCallback=function(R,_,$){var te=t.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?te+$:te):$=te,R){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=$+Y,R={id:d++,callback:_,priorityLevel:R,startTime:$,expirationTime:Y,sortIndex:-1},$>te?(R.sortIndex=$,e(u,R),n(l)===null&&R===n(u)&&(g?(y(N),N=-1):g=!0,re(w,$-te))):(R.sortIndex=Y,e(l,R),m||p||(m=!0,B(C))),R},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(R){var _=f;return function(){var $=f;f=_;try{return R.apply(this,arguments)}finally{f=$}}}})(Xw);Yw.exports=Xw;var fM=Yw.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var pM=v,$t=fM;function F(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Zw=new Set,Ea={};function Qs(t,e){$i(t,e),$i(t+"Capture",e)}function $i(t,e){for(Ea[t]=e,t=0;t<e.length;t++)Zw.add(e[t])}var ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tp=Object.prototype.hasOwnProperty,mM=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Rx={},_x={};function gM(t){return tp.call(_x,t)?!0:tp.call(Rx,t)?!1:mM.test(t)?_x[t]=!0:(Rx[t]=!0,!1)}function xM(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function yM(t,e,n,r){if(e===null||typeof e>"u"||xM(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function jt(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lt[t]=new jt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lt[e]=new jt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lt[t]=new jt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lt[t]=new jt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lt[t]=new jt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lt[t]=new jt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lt[t]=new jt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lt[t]=new jt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lt[t]=new jt(t,5,!1,t.toLowerCase(),null,!1,!1)});var xg=/[\-:]([a-z])/g;function yg(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(xg,yg);lt[e]=new jt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(xg,yg);lt[e]=new jt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(xg,yg);lt[e]=new jt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lt[t]=new jt(t,1,!1,t.toLowerCase(),null,!1,!1)});lt.xlinkHref=new jt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lt[t]=new jt(t,1,!1,t.toLowerCase(),null,!0,!0)});function bg(t,e,n,r){var s=lt.hasOwnProperty(e)?lt[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(yM(e,n,s,r)&&(n=null),r||s===null?gM(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var hr=pM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ol=Symbol.for("react.element"),yi=Symbol.for("react.portal"),bi=Symbol.for("react.fragment"),vg=Symbol.for("react.strict_mode"),np=Symbol.for("react.profiler"),Qw=Symbol.for("react.provider"),e1=Symbol.for("react.context"),kg=Symbol.for("react.forward_ref"),rp=Symbol.for("react.suspense"),sp=Symbol.for("react.suspense_list"),wg=Symbol.for("react.memo"),kr=Symbol.for("react.lazy"),t1=Symbol.for("react.offscreen"),Ix=Symbol.iterator;function So(t){return t===null||typeof t!="object"?null:(t=Ix&&t[Ix]||t["@@iterator"],typeof t=="function"?t:null)}var Te=Object.assign,jh;function Vo(t){if(jh===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);jh=e&&e[1]||""}return`
`+jh+t}var Eh=!1;function Th(t,e){if(!t||Eh)return"";Eh=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=r.stack.split(`
`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
`+s[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Eh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Vo(t):""}function bM(t){switch(t.tag){case 5:return Vo(t.type);case 16:return Vo("Lazy");case 13:return Vo("Suspense");case 19:return Vo("SuspenseList");case 0:case 2:case 15:return t=Th(t.type,!1),t;case 11:return t=Th(t.type.render,!1),t;case 1:return t=Th(t.type,!0),t;default:return""}}function ip(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case bi:return"Fragment";case yi:return"Portal";case np:return"Profiler";case vg:return"StrictMode";case rp:return"Suspense";case sp:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case e1:return(t.displayName||"Context")+".Consumer";case Qw:return(t._context.displayName||"Context")+".Provider";case kg:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case wg:return e=t.displayName||null,e!==null?e:ip(t.type)||"Memo";case kr:e=t._payload,t=t._init;try{return ip(t(e))}catch{}}return null}function vM(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ip(e);case 8:return e===vg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Zr(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function n1(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function kM(t){var e=n1(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Bl(t){t._valueTracker||(t._valueTracker=kM(t))}function r1(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=n1(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function tu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function op(t,e){var n=e.checked;return Te({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Ox(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Zr(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function s1(t,e){e=e.checked,e!=null&&bg(t,"checked",e,!1)}function ap(t,e){s1(t,e);var n=Zr(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?lp(t,e.type,n):e.hasOwnProperty("defaultValue")&&lp(t,e.type,Zr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Bx(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function lp(t,e,n){(e!=="number"||tu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var $o=Array.isArray;function Ri(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Zr(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function cp(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(F(91));return Te({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function zx(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(F(92));if($o(n)){if(1<n.length)throw Error(F(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Zr(n)}}function i1(t,e){var n=Zr(e.value),r=Zr(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Fx(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function o1(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function up(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?o1(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var zl,a1=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(zl=zl||document.createElement("div"),zl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=zl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ta(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Zo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wM=["Webkit","ms","Moz","O"];Object.keys(Zo).forEach(function(t){wM.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zo[e]=Zo[t]})});function l1(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Zo.hasOwnProperty(t)&&Zo[t]?(""+e).trim():e+"px"}function c1(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=l1(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var SM=Te({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dp(t,e){if(e){if(SM[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(F(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(F(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(F(61))}if(e.style!=null&&typeof e.style!="object")throw Error(F(62))}}function hp(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var fp=null;function Sg(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var pp=null,_i=null,Ii=null;function Vx(t){if(t=fl(t)){if(typeof pp!="function")throw Error(F(280));var e=t.stateNode;e&&(e=Id(e),pp(t.stateNode,t.type,e))}}function u1(t){_i?Ii?Ii.push(t):Ii=[t]:_i=t}function d1(){if(_i){var t=_i,e=Ii;if(Ii=_i=null,Vx(t),e)for(t=0;t<e.length;t++)Vx(e[t])}}function h1(t,e){return t(e)}function f1(){}var Mh=!1;function p1(t,e,n){if(Mh)return t(e,n);Mh=!0;try{return h1(t,e,n)}finally{Mh=!1,(_i!==null||Ii!==null)&&(f1(),d1())}}function Ma(t,e){var n=t.stateNode;if(n===null)return null;var r=Id(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(F(231,e,typeof n));return n}var mp=!1;if(ar)try{var No={};Object.defineProperty(No,"passive",{get:function(){mp=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{mp=!1}function NM(t,e,n,r,s,i,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(d){this.onError(d)}}var Qo=!1,nu=null,ru=!1,gp=null,CM={onError:function(t){Qo=!0,nu=t}};function jM(t,e,n,r,s,i,o,a,l){Qo=!1,nu=null,NM.apply(CM,arguments)}function EM(t,e,n,r,s,i,o,a,l){if(jM.apply(this,arguments),Qo){if(Qo){var u=nu;Qo=!1,nu=null}else throw Error(F(198));ru||(ru=!0,gp=u)}}function ei(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function m1(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function $x(t){if(ei(t)!==t)throw Error(F(188))}function TM(t){var e=t.alternate;if(!e){if(e=ei(t),e===null)throw Error(F(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return $x(s),t;if(i===r)return $x(s),e;i=i.sibling}throw Error(F(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(F(189))}}if(n.alternate!==r)throw Error(F(190))}if(n.tag!==3)throw Error(F(188));return n.stateNode.current===n?t:e}function g1(t){return t=TM(t),t!==null?x1(t):null}function x1(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=x1(t);if(e!==null)return e;t=t.sibling}return null}var y1=$t.unstable_scheduleCallback,Hx=$t.unstable_cancelCallback,MM=$t.unstable_shouldYield,PM=$t.unstable_requestPaint,Oe=$t.unstable_now,AM=$t.unstable_getCurrentPriorityLevel,Ng=$t.unstable_ImmediatePriority,b1=$t.unstable_UserBlockingPriority,su=$t.unstable_NormalPriority,DM=$t.unstable_LowPriority,v1=$t.unstable_IdlePriority,Dd=null,On=null;function LM(t){if(On&&typeof On.onCommitFiberRoot=="function")try{On.onCommitFiberRoot(Dd,t,void 0,(t.current.flags&128)===128)}catch{}}var vn=Math.clz32?Math.clz32:IM,RM=Math.log,_M=Math.LN2;function IM(t){return t>>>=0,t===0?32:31-(RM(t)/_M|0)|0}var Fl=64,Vl=4194304;function Ho(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function iu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Ho(a):(i&=o,i!==0&&(r=Ho(i)))}else o=n&~s,o!==0?r=Ho(o):i!==0&&(r=Ho(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-vn(e),s=1<<n,r|=t[n],e&=~s;return r}function OM(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function BM(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-vn(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=OM(a,e)):l<=e&&(t.expiredLanes|=a),i&=~a}}function xp(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function k1(){var t=Fl;return Fl<<=1,!(Fl&4194240)&&(Fl=64),t}function Ph(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function dl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-vn(e),t[e]=n}function zM(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-vn(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function Cg(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-vn(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var fe=0;function w1(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var S1,jg,N1,C1,j1,yp=!1,$l=[],Or=null,Br=null,zr=null,Pa=new Map,Aa=new Map,Er=[],FM="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 submit".split(" ");function Wx(t,e){switch(t){case"focusin":case"focusout":Or=null;break;case"dragenter":case"dragleave":Br=null;break;case"mouseover":case"mouseout":zr=null;break;case"pointerover":case"pointerout":Pa.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Aa.delete(e.pointerId)}}function Co(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=fl(e),e!==null&&jg(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function VM(t,e,n,r,s){switch(e){case"focusin":return Or=Co(Or,t,e,n,r,s),!0;case"dragenter":return Br=Co(Br,t,e,n,r,s),!0;case"mouseover":return zr=Co(zr,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return Pa.set(i,Co(Pa.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Aa.set(i,Co(Aa.get(i)||null,t,e,n,r,s)),!0}return!1}function E1(t){var e=ws(t.target);if(e!==null){var n=ei(e);if(n!==null){if(e=n.tag,e===13){if(e=m1(n),e!==null){t.blockedOn=e,j1(t.priority,function(){N1(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Tc(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=bp(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);fp=r,n.target.dispatchEvent(r),fp=null}else return e=fl(n),e!==null&&jg(e),t.blockedOn=n,!1;e.shift()}return!0}function Ux(t,e,n){Tc(t)&&n.delete(e)}function $M(){yp=!1,Or!==null&&Tc(Or)&&(Or=null),Br!==null&&Tc(Br)&&(Br=null),zr!==null&&Tc(zr)&&(zr=null),Pa.forEach(Ux),Aa.forEach(Ux)}function jo(t,e){t.blockedOn===e&&(t.blockedOn=null,yp||(yp=!0,$t.unstable_scheduleCallback($t.unstable_NormalPriority,$M)))}function Da(t){function e(s){return jo(s,t)}if(0<$l.length){jo($l[0],t);for(var n=1;n<$l.length;n++){var r=$l[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Or!==null&&jo(Or,t),Br!==null&&jo(Br,t),zr!==null&&jo(zr,t),Pa.forEach(e),Aa.forEach(e),n=0;n<Er.length;n++)r=Er[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Er.length&&(n=Er[0],n.blockedOn===null);)E1(n),n.blockedOn===null&&Er.shift()}var Oi=hr.ReactCurrentBatchConfig,ou=!0;function HM(t,e,n,r){var s=fe,i=Oi.transition;Oi.transition=null;try{fe=1,Eg(t,e,n,r)}finally{fe=s,Oi.transition=i}}function WM(t,e,n,r){var s=fe,i=Oi.transition;Oi.transition=null;try{fe=4,Eg(t,e,n,r)}finally{fe=s,Oi.transition=i}}function Eg(t,e,n,r){if(ou){var s=bp(t,e,n,r);if(s===null)Fh(t,e,r,au,n),Wx(t,r);else if(VM(s,t,e,n,r))r.stopPropagation();else if(Wx(t,r),e&4&&-1<FM.indexOf(t)){for(;s!==null;){var i=fl(s);if(i!==null&&S1(i),i=bp(t,e,n,r),i===null&&Fh(t,e,r,au,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Fh(t,e,r,null,n)}}var au=null;function bp(t,e,n,r){if(au=null,t=Sg(r),t=ws(t),t!==null)if(e=ei(t),e===null)t=null;else if(n=e.tag,n===13){if(t=m1(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return au=t,null}function T1(t){switch(t){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(AM()){case Ng:return 1;case b1:return 4;case su:case DM:return 16;case v1:return 536870912;default:return 16}default:return 16}}var Pr=null,Tg=null,Mc=null;function M1(){if(Mc)return Mc;var t,e=Tg,n=e.length,r,s="value"in Pr?Pr.value:Pr.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return Mc=s.slice(t,1<r?1-r:void 0)}function Pc(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Hl(){return!0}function Kx(){return!1}function Wt(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Hl:Kx,this.isPropagationStopped=Kx,this}return Te(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Hl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Hl)},persist:function(){},isPersistent:Hl}),e}var po={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mg=Wt(po),hl=Te({},po,{view:0,detail:0}),UM=Wt(hl),Ah,Dh,Eo,Ld=Te({},hl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pg,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Eo&&(Eo&&t.type==="mousemove"?(Ah=t.screenX-Eo.screenX,Dh=t.screenY-Eo.screenY):Dh=Ah=0,Eo=t),Ah)},movementY:function(t){return"movementY"in t?t.movementY:Dh}}),Gx=Wt(Ld),KM=Te({},Ld,{dataTransfer:0}),GM=Wt(KM),qM=Te({},hl,{relatedTarget:0}),Lh=Wt(qM),JM=Te({},po,{animationName:0,elapsedTime:0,pseudoElement:0}),YM=Wt(JM),XM=Te({},po,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ZM=Wt(XM),QM=Te({},po,{data:0}),qx=Wt(QM),eP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tP={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"},nP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rP(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=nP[t])?!!e[t]:!1}function Pg(){return rP}var sP=Te({},hl,{key:function(t){if(t.key){var e=eP[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Pc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?tP[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pg,charCode:function(t){return t.type==="keypress"?Pc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Pc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),iP=Wt(sP),oP=Te({},Ld,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jx=Wt(oP),aP=Te({},hl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pg}),lP=Wt(aP),cP=Te({},po,{propertyName:0,elapsedTime:0,pseudoElement:0}),uP=Wt(cP),dP=Te({},Ld,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),hP=Wt(dP),fP=[9,13,27,32],Ag=ar&&"CompositionEvent"in window,ea=null;ar&&"documentMode"in document&&(ea=document.documentMode);var pP=ar&&"TextEvent"in window&&!ea,P1=ar&&(!Ag||ea&&8<ea&&11>=ea),Yx=" ",Xx=!1;function A1(t,e){switch(t){case"keyup":return fP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function D1(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var vi=!1;function mP(t,e){switch(t){case"compositionend":return D1(e);case"keypress":return e.which!==32?null:(Xx=!0,Yx);case"textInput":return t=e.data,t===Yx&&Xx?null:t;default:return null}}function gP(t,e){if(vi)return t==="compositionend"||!Ag&&A1(t,e)?(t=M1(),Mc=Tg=Pr=null,vi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return P1&&e.locale!=="ko"?null:e.data;default:return null}}var xP={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 Zx(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!xP[t.type]:e==="textarea"}function L1(t,e,n,r){u1(r),e=lu(e,"onChange"),0<e.length&&(n=new Mg("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ta=null,La=null;function yP(t){W1(t,0)}function Rd(t){var e=Si(t);if(r1(e))return t}function bP(t,e){if(t==="change")return e}var R1=!1;if(ar){var Rh;if(ar){var _h="oninput"in document;if(!_h){var Qx=document.createElement("div");Qx.setAttribute("oninput","return;"),_h=typeof Qx.oninput=="function"}Rh=_h}else Rh=!1;R1=Rh&&(!document.documentMode||9<document.documentMode)}function ey(){ta&&(ta.detachEvent("onpropertychange",_1),La=ta=null)}function _1(t){if(t.propertyName==="value"&&Rd(La)){var e=[];L1(e,La,t,Sg(t)),p1(yP,e)}}function vP(t,e,n){t==="focusin"?(ey(),ta=e,La=n,ta.attachEvent("onpropertychange",_1)):t==="focusout"&&ey()}function kP(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Rd(La)}function wP(t,e){if(t==="click")return Rd(e)}function SP(t,e){if(t==="input"||t==="change")return Rd(e)}function NP(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Nn=typeof Object.is=="function"?Object.is:NP;function Ra(t,e){if(Nn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!tp.call(e,s)||!Nn(t[s],e[s]))return!1}return!0}function ty(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ny(t,e){var n=ty(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ty(n)}}function I1(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?I1(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function O1(){for(var t=window,e=tu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=tu(t.document)}return e}function Dg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function CP(t){var e=O1(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&I1(n.ownerDocument.documentElement,n)){if(r!==null&&Dg(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=ny(n,i);var o=ny(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var jP=ar&&"documentMode"in document&&11>=document.documentMode,ki=null,vp=null,na=null,kp=!1;function ry(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kp||ki==null||ki!==tu(r)||(r=ki,"selectionStart"in r&&Dg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),na&&Ra(na,r)||(na=r,r=lu(vp,"onSelect"),0<r.length&&(e=new Mg("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ki)))}function Wl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var wi={animationend:Wl("Animation","AnimationEnd"),animationiteration:Wl("Animation","AnimationIteration"),animationstart:Wl("Animation","AnimationStart"),transitionend:Wl("Transition","TransitionEnd")},Ih={},B1={};ar&&(B1=document.createElement("div").style,"AnimationEvent"in window||(delete wi.animationend.animation,delete wi.animationiteration.animation,delete wi.animationstart.animation),"TransitionEvent"in window||delete wi.transitionend.transition);function _d(t){if(Ih[t])return Ih[t];if(!wi[t])return t;var e=wi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in B1)return Ih[t]=e[n];return t}var z1=_d("animationend"),F1=_d("animationiteration"),V1=_d("animationstart"),$1=_d("transitionend"),H1=new Map,sy="abort auxClick 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 ss(t,e){H1.set(t,e),Qs(e,[t])}for(var Oh=0;Oh<sy.length;Oh++){var Bh=sy[Oh],EP=Bh.toLowerCase(),TP=Bh[0].toUpperCase()+Bh.slice(1);ss(EP,"on"+TP)}ss(z1,"onAnimationEnd");ss(F1,"onAnimationIteration");ss(V1,"onAnimationStart");ss("dblclick","onDoubleClick");ss("focusin","onFocus");ss("focusout","onBlur");ss($1,"onTransitionEnd");$i("onMouseEnter",["mouseout","mouseover"]);$i("onMouseLeave",["mouseout","mouseover"]);$i("onPointerEnter",["pointerout","pointerover"]);$i("onPointerLeave",["pointerout","pointerover"]);Qs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Qs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Qs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Qs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Qs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Qs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wo="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(" "),MP=new Set("cancel close invalid load scroll toggle".split(" ").concat(Wo));function iy(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,EM(r,e,void 0,t),t.currentTarget=null}function W1(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;iy(s,a,u),i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;iy(s,a,u),i=l}}}if(ru)throw t=gp,ru=!1,gp=null,t}function ve(t,e){var n=e[jp];n===void 0&&(n=e[jp]=new Set);var r=t+"__bubble";n.has(r)||(U1(e,t,2,!1),n.add(r))}function zh(t,e,n){var r=0;e&&(r|=4),U1(n,t,r,e)}var Ul="_reactListening"+Math.random().toString(36).slice(2);function _a(t){if(!t[Ul]){t[Ul]=!0,Zw.forEach(function(n){n!=="selectionchange"&&(MP.has(n)||zh(n,!1,t),zh(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Ul]||(e[Ul]=!0,zh("selectionchange",!1,e))}}function U1(t,e,n,r){switch(T1(e)){case 1:var s=HM;break;case 4:s=WM;break;default:s=Eg}n=s.bind(null,e,n,t),s=void 0,!mp||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function Fh(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;o=o.return}for(;a!==null;){if(o=ws(a),o===null)return;if(l=o.tag,l===5||l===6){r=i=o;continue e}a=a.parentNode}}r=r.return}p1(function(){var u=i,d=Sg(n),h=[];e:{var f=H1.get(t);if(f!==void 0){var p=Mg,m=t;switch(t){case"keypress":if(Pc(n)===0)break e;case"keydown":case"keyup":p=iP;break;case"focusin":m="focus",p=Lh;break;case"focusout":m="blur",p=Lh;break;case"beforeblur":case"afterblur":p=Lh;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Gx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=GM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=lP;break;case z1:case F1:case V1:p=YM;break;case $1:p=uP;break;case"scroll":p=UM;break;case"wheel":p=hP;break;case"copy":case"cut":case"paste":p=ZM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Jx}var g=(e&4)!==0,x=!g&&t==="scroll",y=g?f!==null?f+"Capture":null:f;g=[];for(var b=u,k;b!==null;){k=b;var w=k.stateNode;if(k.tag===5&&w!==null&&(k=w,y!==null&&(w=Ma(b,y),w!=null&&g.push(Ia(b,w,k)))),x)break;b=b.return}0<g.length&&(f=new p(f,m,null,n,d),h.push({event:f,listeners:g}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&n!==fp&&(m=n.relatedTarget||n.fromElement)&&(ws(m)||m[lr]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=u,m=m?ws(m):null,m!==null&&(x=ei(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(g=Gx,w="onMouseLeave",y="onMouseEnter",b="mouse",(t==="pointerout"||t==="pointerover")&&(g=Jx,w="onPointerLeave",y="onPointerEnter",b="pointer"),x=p==null?f:Si(p),k=m==null?f:Si(m),f=new g(w,b+"leave",p,n,d),f.target=x,f.relatedTarget=k,w=null,ws(d)===u&&(g=new g(y,b+"enter",m,n,d),g.target=k,g.relatedTarget=x,w=g),x=w,p&&m)t:{for(g=p,y=m,b=0,k=g;k;k=oi(k))b++;for(k=0,w=y;w;w=oi(w))k++;for(;0<b-k;)g=oi(g),b--;for(;0<k-b;)y=oi(y),k--;for(;b--;){if(g===y||y!==null&&g===y.alternate)break t;g=oi(g),y=oi(y)}g=null}else g=null;p!==null&&oy(h,f,p,g,!1),m!==null&&x!==null&&oy(h,x,m,g,!0)}}e:{if(f=u?Si(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=bP;else if(Zx(f))if(R1)C=SP;else{C=kP;var j=vP}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=wP);if(C&&(C=C(t,u))){L1(h,C,n,d);break e}j&&j(t,f,u),t==="focusout"&&(j=f._wrapperState)&&j.controlled&&f.type==="number"&&lp(f,"number",f.value)}switch(j=u?Si(u):window,t){case"focusin":(Zx(j)||j.contentEditable==="true")&&(ki=j,vp=u,na=null);break;case"focusout":na=vp=ki=null;break;case"mousedown":kp=!0;break;case"contextmenu":case"mouseup":case"dragend":kp=!1,ry(h,n,d);break;case"selectionchange":if(jP)break;case"keydown":case"keyup":ry(h,n,d)}var S;if(Ag)e:{switch(t){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else vi?A1(t,n)&&(N="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(P1&&n.locale!=="ko"&&(vi||N!=="onCompositionStart"?N==="onCompositionEnd"&&vi&&(S=M1()):(Pr=d,Tg="value"in Pr?Pr.value:Pr.textContent,vi=!0)),j=lu(u,N),0<j.length&&(N=new qx(N,t,null,n,d),h.push({event:N,listeners:j}),S?N.data=S:(S=D1(n),S!==null&&(N.data=S)))),(S=pP?mP(t,n):gP(t,n))&&(u=lu(u,"onBeforeInput"),0<u.length&&(d=new qx("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:u}),d.data=S))}W1(h,e)})}function Ia(t,e,n){return{instance:t,listener:e,currentTarget:n}}function lu(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Ma(t,n),i!=null&&r.unshift(Ia(t,i,s)),i=Ma(t,e),i!=null&&r.push(Ia(t,i,s))),t=t.return}return r}function oi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function oy(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,s?(l=Ma(n,i),l!=null&&o.unshift(Ia(n,l,a))):s||(l=Ma(n,i),l!=null&&o.push(Ia(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var PP=/\r\n?/g,AP=/\u0000|\uFFFD/g;function ay(t){return(typeof t=="string"?t:""+t).replace(PP,`
`).replace(AP,"")}function Kl(t,e,n){if(e=ay(e),ay(t)!==e&&n)throw Error(F(425))}function cu(){}var wp=null,Sp=null;function Np(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Cp=typeof setTimeout=="function"?setTimeout:void 0,DP=typeof clearTimeout=="function"?clearTimeout:void 0,ly=typeof Promise=="function"?Promise:void 0,LP=typeof queueMicrotask=="function"?queueMicrotask:typeof ly<"u"?function(t){return ly.resolve(null).then(t).catch(RP)}:Cp;function RP(t){setTimeout(function(){throw t})}function Vh(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),Da(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Da(e)}function Fr(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function cy(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var mo=Math.random().toString(36).slice(2),In="__reactFiber$"+mo,Oa="__reactProps$"+mo,lr="__reactContainer$"+mo,jp="__reactEvents$"+mo,_P="__reactListeners$"+mo,IP="__reactHandles$"+mo;function ws(t){var e=t[In];if(e)return e;for(var n=t.parentNode;n;){if(e=n[lr]||n[In]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=cy(t);t!==null;){if(n=t[In])return n;t=cy(t)}return e}t=n,n=t.parentNode}return null}function fl(t){return t=t[In]||t[lr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Si(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(F(33))}function Id(t){return t[Oa]||null}var Ep=[],Ni=-1;function is(t){return{current:t}}function we(t){0>Ni||(t.current=Ep[Ni],Ep[Ni]=null,Ni--)}function be(t,e){Ni++,Ep[Ni]=t.current,t.current=e}var Qr={},mt=is(Qr),At=is(!1),Ws=Qr;function Hi(t,e){var n=t.type.contextTypes;if(!n)return Qr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Dt(t){return t=t.childContextTypes,t!=null}function uu(){we(At),we(mt)}function uy(t,e,n){if(mt.current!==Qr)throw Error(F(168));be(mt,e),be(At,n)}function K1(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(F(108,vM(t)||"Unknown",s));return Te({},n,r)}function du(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Qr,Ws=mt.current,be(mt,t),be(At,At.current),!0}function dy(t,e,n){var r=t.stateNode;if(!r)throw Error(F(169));n?(t=K1(t,e,Ws),r.__reactInternalMemoizedMergedChildContext=t,we(At),we(mt),be(mt,t)):we(At),be(At,n)}var Xn=null,Od=!1,$h=!1;function G1(t){Xn===null?Xn=[t]:Xn.push(t)}function OP(t){Od=!0,G1(t)}function as(){if(!$h&&Xn!==null){$h=!0;var t=0,e=fe;try{var n=Xn;for(fe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Xn=null,Od=!1}catch(s){throw Xn!==null&&(Xn=Xn.slice(t+1)),y1(Ng,as),s}finally{fe=e,$h=!1}}return null}var Ci=[],ji=0,hu=null,fu=0,Xt=[],Zt=0,Us=null,Zn=1,Qn="";function xs(t,e){Ci[ji++]=fu,Ci[ji++]=hu,hu=t,fu=e}function q1(t,e,n){Xt[Zt++]=Zn,Xt[Zt++]=Qn,Xt[Zt++]=Us,Us=t;var r=Zn;t=Qn;var s=32-vn(r)-1;r&=~(1<<s),n+=1;var i=32-vn(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Zn=1<<32-vn(e)+s|n<<s|r,Qn=i+t}else Zn=1<<i|n<<s|r,Qn=t}function Lg(t){t.return!==null&&(xs(t,1),q1(t,1,0))}function Rg(t){for(;t===hu;)hu=Ci[--ji],Ci[ji]=null,fu=Ci[--ji],Ci[ji]=null;for(;t===Us;)Us=Xt[--Zt],Xt[Zt]=null,Qn=Xt[--Zt],Xt[Zt]=null,Zn=Xt[--Zt],Xt[Zt]=null}var zt=null,Bt=null,Ne=!1,gn=null;function J1(t,e){var n=en(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function hy(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,zt=t,Bt=Fr(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,zt=t,Bt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Us!==null?{id:Zn,overflow:Qn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=en(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,zt=t,Bt=null,!0):!1;default:return!1}}function Tp(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Mp(t){if(Ne){var e=Bt;if(e){var n=e;if(!hy(t,e)){if(Tp(t))throw Error(F(418));e=Fr(n.nextSibling);var r=zt;e&&hy(t,e)?J1(r,n):(t.flags=t.flags&-4097|2,Ne=!1,zt=t)}}else{if(Tp(t))throw Error(F(418));t.flags=t.flags&-4097|2,Ne=!1,zt=t}}}function fy(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;zt=t}function Gl(t){if(t!==zt)return!1;if(!Ne)return fy(t),Ne=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Np(t.type,t.memoizedProps)),e&&(e=Bt)){if(Tp(t))throw Y1(),Error(F(418));for(;e;)J1(t,e),e=Fr(e.nextSibling)}if(fy(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(F(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Bt=Fr(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Bt=null}}else Bt=zt?Fr(t.stateNode.nextSibling):null;return!0}function Y1(){for(var t=Bt;t;)t=Fr(t.nextSibling)}function Wi(){Bt=zt=null,Ne=!1}function _g(t){gn===null?gn=[t]:gn.push(t)}var BP=hr.ReactCurrentBatchConfig;function To(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(F(309));var r=n.stateNode}if(!r)throw Error(F(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(F(284));if(!n._owner)throw Error(F(290,t))}return t}function ql(t,e){throw t=Object.prototype.toString.call(e),Error(F(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function py(t){var e=t._init;return e(t._payload)}function X1(t){function e(y,b){if(t){var k=y.deletions;k===null?(y.deletions=[b],y.flags|=16):k.push(b)}}function n(y,b){if(!t)return null;for(;b!==null;)e(y,b),b=b.sibling;return null}function r(y,b){for(y=new Map;b!==null;)b.key!==null?y.set(b.key,b):y.set(b.index,b),b=b.sibling;return y}function s(y,b){return y=Wr(y,b),y.index=0,y.sibling=null,y}function i(y,b,k){return y.index=k,t?(k=y.alternate,k!==null?(k=k.index,k<b?(y.flags|=2,b):k):(y.flags|=2,b)):(y.flags|=1048576,b)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,b,k,w){return b===null||b.tag!==6?(b=Jh(k,y.mode,w),b.return=y,b):(b=s(b,k),b.return=y,b)}function l(y,b,k,w){var C=k.type;return C===bi?d(y,b,k.props.children,w,k.key):b!==null&&(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===kr&&py(C)===b.type)?(w=s(b,k.props),w.ref=To(y,b,k),w.return=y,w):(w=Oc(k.type,k.key,k.props,null,y.mode,w),w.ref=To(y,b,k),w.return=y,w)}function u(y,b,k,w){return b===null||b.tag!==4||b.stateNode.containerInfo!==k.containerInfo||b.stateNode.implementation!==k.implementation?(b=Yh(k,y.mode,w),b.return=y,b):(b=s(b,k.children||[]),b.return=y,b)}function d(y,b,k,w,C){return b===null||b.tag!==7?(b=Rs(k,y.mode,w,C),b.return=y,b):(b=s(b,k),b.return=y,b)}function h(y,b,k){if(typeof b=="string"&&b!==""||typeof b=="number")return b=Jh(""+b,y.mode,k),b.return=y,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ol:return k=Oc(b.type,b.key,b.props,null,y.mode,k),k.ref=To(y,null,b),k.return=y,k;case yi:return b=Yh(b,y.mode,k),b.return=y,b;case kr:var w=b._init;return h(y,w(b._payload),k)}if($o(b)||So(b))return b=Rs(b,y.mode,k,null),b.return=y,b;ql(y,b)}return null}function f(y,b,k,w){var C=b!==null?b.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return C!==null?null:a(y,b,""+k,w);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Ol:return k.key===C?l(y,b,k,w):null;case yi:return k.key===C?u(y,b,k,w):null;case kr:return C=k._init,f(y,b,C(k._payload),w)}if($o(k)||So(k))return C!==null?null:d(y,b,k,w,null);ql(y,k)}return null}function p(y,b,k,w,C){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(k)||null,a(b,y,""+w,C);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ol:return y=y.get(w.key===null?k:w.key)||null,l(b,y,w,C);case yi:return y=y.get(w.key===null?k:w.key)||null,u(b,y,w,C);case kr:var j=w._init;return p(y,b,k,j(w._payload),C)}if($o(w)||So(w))return y=y.get(k)||null,d(b,y,w,C,null);ql(b,w)}return null}function m(y,b,k,w){for(var C=null,j=null,S=b,N=b=0,T=null;S!==null&&N<k.length;N++){S.index>N?(T=S,S=null):T=S.sibling;var E=f(y,S,k[N],w);if(E===null){S===null&&(S=T);break}t&&S&&E.alternate===null&&e(y,S),b=i(E,b,N),j===null?C=E:j.sibling=E,j=E,S=T}if(N===k.length)return n(y,S),Ne&&xs(y,N),C;if(S===null){for(;N<k.length;N++)S=h(y,k[N],w),S!==null&&(b=i(S,b,N),j===null?C=S:j.sibling=S,j=S);return Ne&&xs(y,N),C}for(S=r(y,S);N<k.length;N++)T=p(S,y,N,k[N],w),T!==null&&(t&&T.alternate!==null&&S.delete(T.key===null?N:T.key),b=i(T,b,N),j===null?C=T:j.sibling=T,j=T);return t&&S.forEach(function(D){return e(y,D)}),Ne&&xs(y,N),C}function g(y,b,k,w){var C=So(k);if(typeof C!="function")throw Error(F(150));if(k=C.call(k),k==null)throw Error(F(151));for(var j=C=null,S=b,N=b=0,T=null,E=k.next();S!==null&&!E.done;N++,E=k.next()){S.index>N?(T=S,S=null):T=S.sibling;var D=f(y,S,E.value,w);if(D===null){S===null&&(S=T);break}t&&S&&D.alternate===null&&e(y,S),b=i(D,b,N),j===null?C=D:j.sibling=D,j=D,S=T}if(E.done)return n(y,S),Ne&&xs(y,N),C;if(S===null){for(;!E.done;N++,E=k.next())E=h(y,E.value,w),E!==null&&(b=i(E,b,N),j===null?C=E:j.sibling=E,j=E);return Ne&&xs(y,N),C}for(S=r(y,S);!E.done;N++,E=k.next())E=p(S,y,N,E.value,w),E!==null&&(t&&E.alternate!==null&&S.delete(E.key===null?N:E.key),b=i(E,b,N),j===null?C=E:j.sibling=E,j=E);return t&&S.forEach(function(P){return e(y,P)}),Ne&&xs(y,N),C}function x(y,b,k,w){if(typeof k=="object"&&k!==null&&k.type===bi&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Ol:e:{for(var C=k.key,j=b;j!==null;){if(j.key===C){if(C=k.type,C===bi){if(j.tag===7){n(y,j.sibling),b=s(j,k.props.children),b.return=y,y=b;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===kr&&py(C)===j.type){n(y,j.sibling),b=s(j,k.props),b.ref=To(y,j,k),b.return=y,y=b;break e}n(y,j);break}else e(y,j);j=j.sibling}k.type===bi?(b=Rs(k.props.children,y.mode,w,k.key),b.return=y,y=b):(w=Oc(k.type,k.key,k.props,null,y.mode,w),w.ref=To(y,b,k),w.return=y,y=w)}return o(y);case yi:e:{for(j=k.key;b!==null;){if(b.key===j)if(b.tag===4&&b.stateNode.containerInfo===k.containerInfo&&b.stateNode.implementation===k.implementation){n(y,b.sibling),b=s(b,k.children||[]),b.return=y,y=b;break e}else{n(y,b);break}else e(y,b);b=b.sibling}b=Yh(k,y.mode,w),b.return=y,y=b}return o(y);case kr:return j=k._init,x(y,b,j(k._payload),w)}if($o(k))return m(y,b,k,w);if(So(k))return g(y,b,k,w);ql(y,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,b!==null&&b.tag===6?(n(y,b.sibling),b=s(b,k),b.return=y,y=b):(n(y,b),b=Jh(k,y.mode,w),b.return=y,y=b),o(y)):n(y,b)}return x}var Ui=X1(!0),Z1=X1(!1),pu=is(null),mu=null,Ei=null,Ig=null;function Og(){Ig=Ei=mu=null}function Bg(t){var e=pu.current;we(pu),t._currentValue=e}function Pp(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Bi(t,e){mu=t,Ig=Ei=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Pt=!0),t.firstContext=null)}function on(t){var e=t._currentValue;if(Ig!==t)if(t={context:t,memoizedValue:e,next:null},Ei===null){if(mu===null)throw Error(F(308));Ei=t,mu.dependencies={lanes:0,firstContext:t}}else Ei=Ei.next=t;return e}var Ss=null;function zg(t){Ss===null?Ss=[t]:Ss.push(t)}function Q1(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,zg(e)):(n.next=s.next,s.next=n),e.interleaved=n,cr(t,r)}function cr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var wr=!1;function Fg(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function eS(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function rr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Vr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ce&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,cr(t,n)}return s=r.interleaved,s===null?(e.next=e,zg(r)):(e.next=s.next,s.next=e),r.interleaved=e,cr(t,n)}function Ac(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Cg(t,n)}}function my(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function gu(t,e,n,r){var s=t.updateQueue;wr=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(i!==null){var h=s.baseState;o=0,d=u=l=null,a=i;do{var f=a.lane,p=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=t,g=a;switch(f=e,p=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(p,h,f);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(p,h,f):m,f==null)break e;h=Te({},h,f);break e;case 2:wr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=s.effects,f===null?s.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,l=h):d=d.next=p,o|=f;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;f=a,a=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(l=h),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Gs|=o,t.lanes=o,t.memoizedState=h}}function gy(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(F(191,s));s.call(r)}}}var pl={},Bn=is(pl),Ba=is(pl),za=is(pl);function Ns(t){if(t===pl)throw Error(F(174));return t}function Vg(t,e){switch(be(za,e),be(Ba,t),be(Bn,pl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:up(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=up(e,t)}we(Bn),be(Bn,e)}function Ki(){we(Bn),we(Ba),we(za)}function tS(t){Ns(za.current);var e=Ns(Bn.current),n=up(e,t.type);e!==n&&(be(Ba,t),be(Bn,n))}function $g(t){Ba.current===t&&(we(Bn),we(Ba))}var Ce=is(0);function xu(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Hh=[];function Hg(){for(var t=0;t<Hh.length;t++)Hh[t]._workInProgressVersionPrimary=null;Hh.length=0}var Dc=hr.ReactCurrentDispatcher,Wh=hr.ReactCurrentBatchConfig,Ks=0,je=null,We=null,Ye=null,yu=!1,ra=!1,Fa=0,zP=0;function ut(){throw Error(F(321))}function Wg(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Nn(t[n],e[n]))return!1;return!0}function Ug(t,e,n,r,s,i){if(Ks=i,je=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Dc.current=t===null||t.memoizedState===null?HP:WP,t=n(r,s),ra){i=0;do{if(ra=!1,Fa=0,25<=i)throw Error(F(301));i+=1,Ye=We=null,e.updateQueue=null,Dc.current=UP,t=n(r,s)}while(ra)}if(Dc.current=bu,e=We!==null&&We.next!==null,Ks=0,Ye=We=je=null,yu=!1,e)throw Error(F(300));return t}function Kg(){var t=Fa!==0;return Fa=0,t}function Pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ye===null?je.memoizedState=Ye=t:Ye=Ye.next=t,Ye}function an(){if(We===null){var t=je.alternate;t=t!==null?t.memoizedState:null}else t=We.next;var e=Ye===null?je.memoizedState:Ye.next;if(e!==null)Ye=e,We=t;else{if(t===null)throw Error(F(310));We=t,t={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},Ye===null?je.memoizedState=Ye=t:Ye=Ye.next=t}return Ye}function Va(t,e){return typeof e=="function"?e(t):e}function Uh(t){var e=an(),n=e.queue;if(n===null)throw Error(F(311));n.lastRenderedReducer=t;var r=We,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,l=null,u=i;do{var d=u.lane;if((Ks&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=h,o=r):l=l.next=h,je.lanes|=d,Gs|=d}u=u.next}while(u!==null&&u!==i);l===null?o=r:l.next=a,Nn(r,e.memoizedState)||(Pt=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,je.lanes|=i,Gs|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Kh(t){var e=an(),n=e.queue;if(n===null)throw Error(F(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);Nn(i,e.memoizedState)||(Pt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function nS(){}function rS(t,e){var n=je,r=an(),s=e(),i=!Nn(r.memoizedState,s);if(i&&(r.memoizedState=s,Pt=!0),r=r.queue,Gg(oS.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||Ye!==null&&Ye.memoizedState.tag&1){if(n.flags|=2048,$a(9,iS.bind(null,n,r,s,e),void 0,null),Xe===null)throw Error(F(349));Ks&30||sS(n,e,s)}return s}function sS(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=je.updateQueue,e===null?(e={lastEffect:null,stores:null},je.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function iS(t,e,n,r){e.value=n,e.getSnapshot=r,aS(e)&&lS(t)}function oS(t,e,n){return n(function(){aS(e)&&lS(t)})}function aS(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Nn(t,n)}catch{return!0}}function lS(t){var e=cr(t,1);e!==null&&kn(e,t,1,-1)}function xy(t){var e=Pn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:t},e.queue=t,t=t.dispatch=$P.bind(null,je,t),[e.memoizedState,t]}function $a(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=je.updateQueue,e===null?(e={lastEffect:null,stores:null},je.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function cS(){return an().memoizedState}function Lc(t,e,n,r){var s=Pn();je.flags|=t,s.memoizedState=$a(1|e,n,void 0,r===void 0?null:r)}function Bd(t,e,n,r){var s=an();r=r===void 0?null:r;var i=void 0;if(We!==null){var o=We.memoizedState;if(i=o.destroy,r!==null&&Wg(r,o.deps)){s.memoizedState=$a(e,n,i,r);return}}je.flags|=t,s.memoizedState=$a(1|e,n,i,r)}function yy(t,e){return Lc(8390656,8,t,e)}function Gg(t,e){return Bd(2048,8,t,e)}function uS(t,e){return Bd(4,2,t,e)}function dS(t,e){return Bd(4,4,t,e)}function hS(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function fS(t,e,n){return n=n!=null?n.concat([t]):null,Bd(4,4,hS.bind(null,e,t),n)}function qg(){}function pS(t,e){var n=an();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Wg(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function mS(t,e){var n=an();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Wg(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function gS(t,e,n){return Ks&21?(Nn(n,e)||(n=k1(),je.lanes|=n,Gs|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Pt=!0),t.memoizedState=n)}function FP(t,e){var n=fe;fe=n!==0&&4>n?n:4,t(!0);var r=Wh.transition;Wh.transition={};try{t(!1),e()}finally{fe=n,Wh.transition=r}}function xS(){return an().memoizedState}function VP(t,e,n){var r=Hr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},yS(t))bS(e,n);else if(n=Q1(t,e,n,r),n!==null){var s=St();kn(n,t,r,s),vS(n,e,r)}}function $P(t,e,n){var r=Hr(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(yS(t))bS(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Nn(a,o)){var l=e.interleaved;l===null?(s.next=s,zg(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}n=Q1(t,e,s,r),n!==null&&(s=St(),kn(n,t,r,s),vS(n,e,r))}}function yS(t){var e=t.alternate;return t===je||e!==null&&e===je}function bS(t,e){ra=yu=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function vS(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Cg(t,n)}}var bu={readContext:on,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},HP={readContext:on,useCallback:function(t,e){return Pn().memoizedState=[t,e===void 0?null:e],t},useContext:on,useEffect:yy,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Lc(4194308,4,hS.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Lc(4194308,4,t,e)},useInsertionEffect:function(t,e){return Lc(4,2,t,e)},useMemo:function(t,e){var n=Pn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Pn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=VP.bind(null,je,t),[r.memoizedState,t]},useRef:function(t){var e=Pn();return t={current:t},e.memoizedState=t},useState:xy,useDebugValue:qg,useDeferredValue:function(t){return Pn().memoizedState=t},useTransition:function(){var t=xy(!1),e=t[0];return t=FP.bind(null,t[1]),Pn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=je,s=Pn();if(Ne){if(n===void 0)throw Error(F(407));n=n()}else{if(n=e(),Xe===null)throw Error(F(349));Ks&30||sS(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,yy(oS.bind(null,r,i,t),[t]),r.flags|=2048,$a(9,iS.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Pn(),e=Xe.identifierPrefix;if(Ne){var n=Qn,r=Zn;n=(r&~(1<<32-vn(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Fa++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=zP++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},WP={readContext:on,useCallback:pS,useContext:on,useEffect:Gg,useImperativeHandle:fS,useInsertionEffect:uS,useLayoutEffect:dS,useMemo:mS,useReducer:Uh,useRef:cS,useState:function(){return Uh(Va)},useDebugValue:qg,useDeferredValue:function(t){var e=an();return gS(e,We.memoizedState,t)},useTransition:function(){var t=Uh(Va)[0],e=an().memoizedState;return[t,e]},useMutableSource:nS,useSyncExternalStore:rS,useId:xS,unstable_isNewReconciler:!1},UP={readContext:on,useCallback:pS,useContext:on,useEffect:Gg,useImperativeHandle:fS,useInsertionEffect:uS,useLayoutEffect:dS,useMemo:mS,useReducer:Kh,useRef:cS,useState:function(){return Kh(Va)},useDebugValue:qg,useDeferredValue:function(t){var e=an();return We===null?e.memoizedState=t:gS(e,We.memoizedState,t)},useTransition:function(){var t=Kh(Va)[0],e=an().memoizedState;return[t,e]},useMutableSource:nS,useSyncExternalStore:rS,useId:xS,unstable_isNewReconciler:!1};function pn(t,e){if(t&&t.defaultProps){e=Te({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Ap(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Te({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var zd={isMounted:function(t){return(t=t._reactInternals)?ei(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=St(),s=Hr(t),i=rr(r,s);i.payload=e,n!=null&&(i.callback=n),e=Vr(t,i,s),e!==null&&(kn(e,t,s,r),Ac(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=St(),s=Hr(t),i=rr(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=Vr(t,i,s),e!==null&&(kn(e,t,s,r),Ac(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=St(),r=Hr(t),s=rr(n,r);s.tag=2,e!=null&&(s.callback=e),e=Vr(t,s,r),e!==null&&(kn(e,t,r,n),Ac(e,t,r))}};function by(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!Ra(n,r)||!Ra(s,i):!0}function kS(t,e,n){var r=!1,s=Qr,i=e.contextType;return typeof i=="object"&&i!==null?i=on(i):(s=Dt(e)?Ws:mt.current,r=e.contextTypes,i=(r=r!=null)?Hi(t,s):Qr),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=zd,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function vy(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&zd.enqueueReplaceState(e,e.state,null)}function Dp(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},Fg(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=on(i):(i=Dt(e)?Ws:mt.current,s.context=Hi(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Ap(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&zd.enqueueReplaceState(s,s.state,null),gu(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Gi(t,e){try{var n="",r=e;do n+=bM(r),r=r.return;while(r);var s=n}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:s,digest:null}}function Gh(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Lp(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var KP=typeof WeakMap=="function"?WeakMap:Map;function wS(t,e,n){n=rr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){ku||(ku=!0,Hp=r),Lp(t,e)},n}function SS(t,e,n){n=rr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){Lp(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Lp(t,e),typeof r!="function"&&($r===null?$r=new Set([this]):$r.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function ky(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new KP;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=oA.bind(null,t,e,n),e.then(t,t))}function wy(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Sy(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=rr(-1,1),e.tag=2,Vr(n,e,1))),n.lanes|=1),t)}var GP=hr.ReactCurrentOwner,Pt=!1;function yt(t,e,n,r){e.child=t===null?Z1(e,null,n,r):Ui(e,t.child,n,r)}function Ny(t,e,n,r,s){n=n.render;var i=e.ref;return Bi(e,s),r=Ug(t,e,n,r,i,s),n=Kg(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,ur(t,e,s)):(Ne&&n&&Lg(e),e.flags|=1,yt(t,e,r,s),e.child)}function Cy(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!n0(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,NS(t,e,i,r,s)):(t=Oc(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Ra,n(o,r)&&t.ref===e.ref)return ur(t,e,s)}return e.flags|=1,t=Wr(i,r),t.ref=e.ref,t.return=e,e.child=t}function NS(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(Ra(i,r)&&t.ref===e.ref)if(Pt=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(Pt=!0);else return e.lanes=t.lanes,ur(t,e,s)}return Rp(t,e,n,r,s)}function CS(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},be(Mi,It),It|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,be(Mi,It),It|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,be(Mi,It),It|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,be(Mi,It),It|=r;return yt(t,e,s,n),e.child}function jS(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Rp(t,e,n,r,s){var i=Dt(n)?Ws:mt.current;return i=Hi(e,i),Bi(e,s),n=Ug(t,e,n,r,i,s),r=Kg(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,ur(t,e,s)):(Ne&&r&&Lg(e),e.flags|=1,yt(t,e,n,s),e.child)}function jy(t,e,n,r,s){if(Dt(n)){var i=!0;du(e)}else i=!1;if(Bi(e,s),e.stateNode===null)Rc(t,e),kS(e,n,r),Dp(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=on(u):(u=Dt(n)?Ws:mt.current,u=Hi(e,u));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&vy(e,o,r,u),wr=!1;var f=e.memoizedState;o.state=f,gu(e,r,o,s),l=e.memoizedState,a!==r||f!==l||At.current||wr?(typeof d=="function"&&(Ap(e,n,d,r),l=e.memoizedState),(a=wr||by(e,n,a,r,f,l,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,eS(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:pn(e.type,a),o.props=u,h=e.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=on(l):(l=Dt(n)?Ws:mt.current,l=Hi(e,l));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||f!==l)&&vy(e,o,r,l),wr=!1,f=e.memoizedState,o.state=f,gu(e,r,o,s);var m=e.memoizedState;a!==h||f!==m||At.current||wr?(typeof p=="function"&&(Ap(e,n,p,r),m=e.memoizedState),(u=wr||by(e,n,u,r,f,m,l)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),o.props=r,o.state=m,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return _p(t,e,n,r,i,s)}function _p(t,e,n,r,s,i){jS(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&dy(e,n,!1),ur(t,e,i);r=e.stateNode,GP.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Ui(e,t.child,null,i),e.child=Ui(e,null,a,i)):yt(t,e,a,i),e.memoizedState=r.state,s&&dy(e,n,!0),e.child}function ES(t){var e=t.stateNode;e.pendingContext?uy(t,e.pendingContext,e.pendingContext!==e.context):e.context&&uy(t,e.context,!1),Vg(t,e.containerInfo)}function Ey(t,e,n,r,s){return Wi(),_g(s),e.flags|=256,yt(t,e,n,r),e.child}var Ip={dehydrated:null,treeContext:null,retryLane:0};function Op(t){return{baseLanes:t,cachePool:null,transitions:null}}function TS(t,e,n){var r=e.pendingProps,s=Ce.current,i=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),be(Ce,s&1),t===null)return Mp(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=$d(o,r,0,null),t=Rs(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Op(n),e.memoizedState=Ip,t):Jg(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return qP(t,e,o,r,a,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,a=s.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Wr(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=Wr(a,i):(i=Rs(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?Op(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=Ip,r}return i=t.child,t=i.sibling,r=Wr(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Jg(t,e){return e=$d({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Jl(t,e,n,r){return r!==null&&_g(r),Ui(e,t.child,null,n),t=Jg(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function qP(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=Gh(Error(F(422))),Jl(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=$d({mode:"visible",children:r.children},s,0,null),i=Rs(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&Ui(e,t.child,null,o),e.child.memoizedState=Op(o),e.memoizedState=Ip,i);if(!(e.mode&1))return Jl(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(F(419)),r=Gh(i,r,void 0),Jl(t,e,o,r)}if(a=(o&t.childLanes)!==0,Pt||a){if(r=Xe,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,cr(t,s),kn(r,t,s,-1))}return t0(),r=Gh(Error(F(421))),Jl(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=aA.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Bt=Fr(s.nextSibling),zt=e,Ne=!0,gn=null,t!==null&&(Xt[Zt++]=Zn,Xt[Zt++]=Qn,Xt[Zt++]=Us,Zn=t.id,Qn=t.overflow,Us=e),e=Jg(e,r.children),e.flags|=4096,e)}function Ty(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Pp(t.return,e,n)}function qh(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function MS(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(yt(t,e,r.children,n),r=Ce.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Ty(t,n,e);else if(t.tag===19)Ty(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(be(Ce,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&xu(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),qh(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&xu(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}qh(e,!0,n,null,i);break;case"together":qh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Rc(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function ur(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Gs|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(F(153));if(e.child!==null){for(t=e.child,n=Wr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Wr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function JP(t,e,n){switch(e.tag){case 3:ES(e),Wi();break;case 5:tS(e);break;case 1:Dt(e.type)&&du(e);break;case 4:Vg(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;be(pu,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(be(Ce,Ce.current&1),e.flags|=128,null):n&e.child.childLanes?TS(t,e,n):(be(Ce,Ce.current&1),t=ur(t,e,n),t!==null?t.sibling:null);be(Ce,Ce.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return MS(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),be(Ce,Ce.current),r)break;return null;case 22:case 23:return e.lanes=0,CS(t,e,n)}return ur(t,e,n)}var PS,Bp,AS,DS;PS=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Bp=function(){};AS=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Ns(Bn.current);var i=null;switch(n){case"input":s=op(t,s),r=op(t,r),i=[];break;case"select":s=Te({},s,{value:void 0}),r=Te({},r,{value:void 0}),i=[];break;case"textarea":s=cp(t,s),r=cp(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=cu)}dp(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ea.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ea.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&ve("scroll",t),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};DS=function(t,e,n,r){n!==r&&(e.flags|=4)};function Mo(t,e){if(!Ne)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function dt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function YP(t,e,n){var r=e.pendingProps;switch(Rg(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(e),null;case 1:return Dt(e.type)&&uu(),dt(e),null;case 3:return r=e.stateNode,Ki(),we(At),we(mt),Hg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Gl(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,gn!==null&&(Kp(gn),gn=null))),Bp(t,e),dt(e),null;case 5:$g(e);var s=Ns(za.current);if(n=e.type,t!==null&&e.stateNode!=null)AS(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(F(166));return dt(e),null}if(t=Ns(Bn.current),Gl(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[In]=e,r[Oa]=i,t=(e.mode&1)!==0,n){case"dialog":ve("cancel",r),ve("close",r);break;case"iframe":case"object":case"embed":ve("load",r);break;case"video":case"audio":for(s=0;s<Wo.length;s++)ve(Wo[s],r);break;case"source":ve("error",r);break;case"img":case"image":case"link":ve("error",r),ve("load",r);break;case"details":ve("toggle",r);break;case"input":Ox(r,i),ve("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ve("invalid",r);break;case"textarea":zx(r,i),ve("invalid",r)}dp(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Kl(r.textContent,a,t),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Kl(r.textContent,a,t),s=["children",""+a]):Ea.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ve("scroll",r)}switch(n){case"input":Bl(r),Bx(r,i,!0);break;case"textarea":Bl(r),Fx(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=cu)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=o1(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[In]=e,t[Oa]=r,PS(t,e,!1,!1),e.stateNode=t;e:{switch(o=hp(n,r),n){case"dialog":ve("cancel",t),ve("close",t),s=r;break;case"iframe":case"object":case"embed":ve("load",t),s=r;break;case"video":case"audio":for(s=0;s<Wo.length;s++)ve(Wo[s],t);s=r;break;case"source":ve("error",t),s=r;break;case"img":case"image":case"link":ve("error",t),ve("load",t),s=r;break;case"details":ve("toggle",t),s=r;break;case"input":Ox(t,r),s=op(t,r),ve("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=Te({},r,{value:void 0}),ve("invalid",t);break;case"textarea":zx(t,r),s=cp(t,r),ve("invalid",t);break;default:s=r}dp(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?c1(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&a1(t,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Ta(t,l):typeof l=="number"&&Ta(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ea.hasOwnProperty(i)?l!=null&&i==="onScroll"&&ve("scroll",t):l!=null&&bg(t,i,l,o))}switch(n){case"input":Bl(t),Bx(t,r,!1);break;case"textarea":Bl(t),Fx(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Zr(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Ri(t,!!r.multiple,i,!1):r.defaultValue!=null&&Ri(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=cu)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return dt(e),null;case 6:if(t&&e.stateNode!=null)DS(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(F(166));if(n=Ns(za.current),Ns(Bn.current),Gl(e)){if(r=e.stateNode,n=e.memoizedProps,r[In]=e,(i=r.nodeValue!==n)&&(t=zt,t!==null))switch(t.tag){case 3:Kl(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Kl(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[In]=e,e.stateNode=r}return dt(e),null;case 13:if(we(Ce),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ne&&Bt!==null&&e.mode&1&&!(e.flags&128))Y1(),Wi(),e.flags|=98560,i=!1;else if(i=Gl(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(F(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(F(317));i[In]=e}else Wi(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;dt(e),i=!1}else gn!==null&&(Kp(gn),gn=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Ce.current&1?Ue===0&&(Ue=3):t0())),e.updateQueue!==null&&(e.flags|=4),dt(e),null);case 4:return Ki(),Bp(t,e),t===null&&_a(e.stateNode.containerInfo),dt(e),null;case 10:return Bg(e.type._context),dt(e),null;case 17:return Dt(e.type)&&uu(),dt(e),null;case 19:if(we(Ce),i=e.memoizedState,i===null)return dt(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)Mo(i,!1);else{if(Ue!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=xu(t),o!==null){for(e.flags|=128,Mo(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return be(Ce,Ce.current&1|2),e.child}t=t.sibling}i.tail!==null&&Oe()>qi&&(e.flags|=128,r=!0,Mo(i,!1),e.lanes=4194304)}else{if(!r)if(t=xu(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Mo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ne)return dt(e),null}else 2*Oe()-i.renderingStartTime>qi&&n!==1073741824&&(e.flags|=128,r=!0,Mo(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Oe(),e.sibling=null,n=Ce.current,be(Ce,r?n&1|2:n&1),e):(dt(e),null);case 22:case 23:return e0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?It&1073741824&&(dt(e),e.subtreeFlags&6&&(e.flags|=8192)):dt(e),null;case 24:return null;case 25:return null}throw Error(F(156,e.tag))}function XP(t,e){switch(Rg(e),e.tag){case 1:return Dt(e.type)&&uu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ki(),we(At),we(mt),Hg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return $g(e),null;case 13:if(we(Ce),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(F(340));Wi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return we(Ce),null;case 4:return Ki(),null;case 10:return Bg(e.type._context),null;case 22:case 23:return e0(),null;case 24:return null;default:return null}}var Yl=!1,pt=!1,ZP=typeof WeakSet=="function"?WeakSet:Set,K=null;function Ti(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(t,e,r)}else n.current=null}function zp(t,e,n){try{n()}catch(r){De(t,e,r)}}var My=!1;function QP(t,e){if(wp=ou,t=O1(),Dg(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,d=0,h=t,f=null;t:for(;;){for(var p;h!==n||s!==0&&h.nodeType!==3||(a=o+s),h!==i||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===t)break t;if(f===n&&++u===s&&(a=o),f===i&&++d===r&&(l=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Sp={focusedElem:t,selectionRange:n},ou=!1,K=e;K!==null;)if(e=K,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,K=t;else for(;K!==null;){e=K;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,x=m.memoizedState,y=e.stateNode,b=y.getSnapshotBeforeUpdate(e.elementType===e.type?g:pn(e.type,g),x);y.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(w){De(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,K=t;break}K=e.return}return m=My,My=!1,m}function sa(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&zp(e,n,i)}s=s.next}while(s!==r)}}function Fd(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Fp(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function LS(t){var e=t.alternate;e!==null&&(t.alternate=null,LS(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[In],delete e[Oa],delete e[jp],delete e[_P],delete e[IP])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function RS(t){return t.tag===5||t.tag===3||t.tag===4}function Py(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||RS(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Vp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=cu));else if(r!==4&&(t=t.child,t!==null))for(Vp(t,e,n),t=t.sibling;t!==null;)Vp(t,e,n),t=t.sibling}function $p(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for($p(t,e,n),t=t.sibling;t!==null;)$p(t,e,n),t=t.sibling}var nt=null,mn=!1;function gr(t,e,n){for(n=n.child;n!==null;)_S(t,e,n),n=n.sibling}function _S(t,e,n){if(On&&typeof On.onCommitFiberUnmount=="function")try{On.onCommitFiberUnmount(Dd,n)}catch{}switch(n.tag){case 5:pt||Ti(n,e);case 6:var r=nt,s=mn;nt=null,gr(t,e,n),nt=r,mn=s,nt!==null&&(mn?(t=nt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):nt.removeChild(n.stateNode));break;case 18:nt!==null&&(mn?(t=nt,n=n.stateNode,t.nodeType===8?Vh(t.parentNode,n):t.nodeType===1&&Vh(t,n),Da(t)):Vh(nt,n.stateNode));break;case 4:r=nt,s=mn,nt=n.stateNode.containerInfo,mn=!0,gr(t,e,n),nt=r,mn=s;break;case 0:case 11:case 14:case 15:if(!pt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&zp(n,e,o),s=s.next}while(s!==r)}gr(t,e,n);break;case 1:if(!pt&&(Ti(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){De(n,e,a)}gr(t,e,n);break;case 21:gr(t,e,n);break;case 22:n.mode&1?(pt=(r=pt)||n.memoizedState!==null,gr(t,e,n),pt=r):gr(t,e,n);break;default:gr(t,e,n)}}function Ay(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new ZP),e.forEach(function(r){var s=lA.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function un(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:nt=a.stateNode,mn=!1;break e;case 3:nt=a.stateNode.containerInfo,mn=!0;break e;case 4:nt=a.stateNode.containerInfo,mn=!0;break e}a=a.return}if(nt===null)throw Error(F(160));_S(i,o,s),nt=null,mn=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(u){De(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)IS(e,t),e=e.sibling}function IS(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(un(e,t),Mn(t),r&4){try{sa(3,t,t.return),Fd(3,t)}catch(g){De(t,t.return,g)}try{sa(5,t,t.return)}catch(g){De(t,t.return,g)}}break;case 1:un(e,t),Mn(t),r&512&&n!==null&&Ti(n,n.return);break;case 5:if(un(e,t),Mn(t),r&512&&n!==null&&Ti(n,n.return),t.flags&32){var s=t.stateNode;try{Ta(s,"")}catch(g){De(t,t.return,g)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&s1(s,i),hp(a,o);var u=hp(a,i);for(o=0;o<l.length;o+=2){var d=l[o],h=l[o+1];d==="style"?c1(s,h):d==="dangerouslySetInnerHTML"?a1(s,h):d==="children"?Ta(s,h):bg(s,d,h,u)}switch(a){case"input":ap(s,i);break;case"textarea":i1(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Ri(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Ri(s,!!i.multiple,i.defaultValue,!0):Ri(s,!!i.multiple,i.multiple?[]:"",!1))}s[Oa]=i}catch(g){De(t,t.return,g)}}break;case 6:if(un(e,t),Mn(t),r&4){if(t.stateNode===null)throw Error(F(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(g){De(t,t.return,g)}}break;case 3:if(un(e,t),Mn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Da(e.containerInfo)}catch(g){De(t,t.return,g)}break;case 4:un(e,t),Mn(t);break;case 13:un(e,t),Mn(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Zg=Oe())),r&4&&Ay(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(pt=(u=pt)||d,un(e,t),pt=u):un(e,t),Mn(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(K=t,d=t.child;d!==null;){for(h=K=d;K!==null;){switch(f=K,p=f.child,f.tag){case 0:case 11:case 14:case 15:sa(4,f,f.return);break;case 1:Ti(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(g){De(r,n,g)}}break;case 5:Ti(f,f.return);break;case 22:if(f.memoizedState!==null){Ly(h);continue}}p!==null?(p.return=f,K=p):Ly(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=l1("display",o))}catch(g){De(t,t.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){De(t,t.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:un(e,t),Mn(t),r&4&&Ay(t);break;case 21:break;default:un(e,t),Mn(t)}}function Mn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(RS(n)){var r=n;break e}n=n.return}throw Error(F(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Ta(s,""),r.flags&=-33);var i=Py(t);$p(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Py(t);Vp(t,a,o);break;default:throw Error(F(161))}}catch(l){De(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function eA(t,e,n){K=t,OS(t)}function OS(t,e,n){for(var r=(t.mode&1)!==0;K!==null;){var s=K,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Yl;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||pt;a=Yl;var u=pt;if(Yl=o,(pt=l)&&!u)for(K=s;K!==null;)o=K,l=o.child,o.tag===22&&o.memoizedState!==null?Ry(s):l!==null?(l.return=o,K=l):Ry(s);for(;i!==null;)K=i,OS(i),i=i.sibling;K=s,Yl=a,pt=u}Dy(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,K=i):Dy(t)}}function Dy(t){for(;K!==null;){var e=K;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:pt||Fd(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!pt)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:pn(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&gy(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}gy(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Da(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(F(163))}pt||e.flags&512&&Fp(e)}catch(f){De(e,e.return,f)}}if(e===t){K=null;break}if(n=e.sibling,n!==null){n.return=e.return,K=n;break}K=e.return}}function Ly(t){for(;K!==null;){var e=K;if(e===t){K=null;break}var n=e.sibling;if(n!==null){n.return=e.return,K=n;break}K=e.return}}function Ry(t){for(;K!==null;){var e=K;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Fd(4,e)}catch(l){De(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(l){De(e,s,l)}}var i=e.return;try{Fp(e)}catch(l){De(e,i,l)}break;case 5:var o=e.return;try{Fp(e)}catch(l){De(e,o,l)}}}catch(l){De(e,e.return,l)}if(e===t){K=null;break}var a=e.sibling;if(a!==null){a.return=e.return,K=a;break}K=e.return}}var tA=Math.ceil,vu=hr.ReactCurrentDispatcher,Yg=hr.ReactCurrentOwner,nn=hr.ReactCurrentBatchConfig,ce=0,Xe=null,ze=null,at=0,It=0,Mi=is(0),Ue=0,Ha=null,Gs=0,Vd=0,Xg=0,ia=null,Tt=null,Zg=0,qi=1/0,Jn=null,ku=!1,Hp=null,$r=null,Xl=!1,Ar=null,wu=0,oa=0,Wp=null,_c=-1,Ic=0;function St(){return ce&6?Oe():_c!==-1?_c:_c=Oe()}function Hr(t){return t.mode&1?ce&2&&at!==0?at&-at:BP.transition!==null?(Ic===0&&(Ic=k1()),Ic):(t=fe,t!==0||(t=window.event,t=t===void 0?16:T1(t.type)),t):1}function kn(t,e,n,r){if(50<oa)throw oa=0,Wp=null,Error(F(185));dl(t,n,r),(!(ce&2)||t!==Xe)&&(t===Xe&&(!(ce&2)&&(Vd|=n),Ue===4&&Tr(t,at)),Lt(t,r),n===1&&ce===0&&!(e.mode&1)&&(qi=Oe()+500,Od&&as()))}function Lt(t,e){var n=t.callbackNode;BM(t,e);var r=iu(t,t===Xe?at:0);if(r===0)n!==null&&Hx(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Hx(n),e===1)t.tag===0?OP(_y.bind(null,t)):G1(_y.bind(null,t)),LP(function(){!(ce&6)&&as()}),n=null;else{switch(w1(r)){case 1:n=Ng;break;case 4:n=b1;break;case 16:n=su;break;case 536870912:n=v1;break;default:n=su}n=US(n,BS.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function BS(t,e){if(_c=-1,Ic=0,ce&6)throw Error(F(327));var n=t.callbackNode;if(zi()&&t.callbackNode!==n)return null;var r=iu(t,t===Xe?at:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Su(t,r);else{e=r;var s=ce;ce|=2;var i=FS();(Xe!==t||at!==e)&&(Jn=null,qi=Oe()+500,Ls(t,e));do try{sA();break}catch(a){zS(t,a)}while(!0);Og(),vu.current=i,ce=s,ze!==null?e=0:(Xe=null,at=0,e=Ue)}if(e!==0){if(e===2&&(s=xp(t),s!==0&&(r=s,e=Up(t,s))),e===1)throw n=Ha,Ls(t,0),Tr(t,r),Lt(t,Oe()),n;if(e===6)Tr(t,r);else{if(s=t.current.alternate,!(r&30)&&!nA(s)&&(e=Su(t,r),e===2&&(i=xp(t),i!==0&&(r=i,e=Up(t,i))),e===1))throw n=Ha,Ls(t,0),Tr(t,r),Lt(t,Oe()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(F(345));case 2:ys(t,Tt,Jn);break;case 3:if(Tr(t,r),(r&130023424)===r&&(e=Zg+500-Oe(),10<e)){if(iu(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){St(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Cp(ys.bind(null,t,Tt,Jn),e);break}ys(t,Tt,Jn);break;case 4:if(Tr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-vn(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=Oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*tA(r/1960))-r,10<r){t.timeoutHandle=Cp(ys.bind(null,t,Tt,Jn),r);break}ys(t,Tt,Jn);break;case 5:ys(t,Tt,Jn);break;default:throw Error(F(329))}}}return Lt(t,Oe()),t.callbackNode===n?BS.bind(null,t):null}function Up(t,e){var n=ia;return t.current.memoizedState.isDehydrated&&(Ls(t,e).flags|=256),t=Su(t,e),t!==2&&(e=Tt,Tt=n,e!==null&&Kp(e)),t}function Kp(t){Tt===null?Tt=t:Tt.push.apply(Tt,t)}function nA(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Nn(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Tr(t,e){for(e&=~Xg,e&=~Vd,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-vn(e),r=1<<n;t[n]=-1,e&=~r}}function _y(t){if(ce&6)throw Error(F(327));zi();var e=iu(t,0);if(!(e&1))return Lt(t,Oe()),null;var n=Su(t,e);if(t.tag!==0&&n===2){var r=xp(t);r!==0&&(e=r,n=Up(t,r))}if(n===1)throw n=Ha,Ls(t,0),Tr(t,e),Lt(t,Oe()),n;if(n===6)throw Error(F(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,ys(t,Tt,Jn),Lt(t,Oe()),null}function Qg(t,e){var n=ce;ce|=1;try{return t(e)}finally{ce=n,ce===0&&(qi=Oe()+500,Od&&as())}}function qs(t){Ar!==null&&Ar.tag===0&&!(ce&6)&&zi();var e=ce;ce|=1;var n=nn.transition,r=fe;try{if(nn.transition=null,fe=1,t)return t()}finally{fe=r,nn.transition=n,ce=e,!(ce&6)&&as()}}function e0(){It=Mi.current,we(Mi)}function Ls(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,DP(n)),ze!==null)for(n=ze.return;n!==null;){var r=n;switch(Rg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&uu();break;case 3:Ki(),we(At),we(mt),Hg();break;case 5:$g(r);break;case 4:Ki();break;case 13:we(Ce);break;case 19:we(Ce);break;case 10:Bg(r.type._context);break;case 22:case 23:e0()}n=n.return}if(Xe=t,ze=t=Wr(t.current,null),at=It=e,Ue=0,Ha=null,Xg=Vd=Gs=0,Tt=ia=null,Ss!==null){for(e=0;e<Ss.length;e++)if(n=Ss[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Ss=null}return t}function zS(t,e){do{var n=ze;try{if(Og(),Dc.current=bu,yu){for(var r=je.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}yu=!1}if(Ks=0,Ye=We=je=null,ra=!1,Fa=0,Yg.current=null,n===null||n.return===null){Ue=1,Ha=e,ze=null;break}e:{var i=t,o=n.return,a=n,l=e;if(e=at,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=a,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=wy(o);if(p!==null){p.flags&=-257,Sy(p,o,a,i,e),p.mode&1&&ky(i,u,e),e=p,l=u;var m=e.updateQueue;if(m===null){var g=new Set;g.add(l),e.updateQueue=g}else m.add(l);break e}else{if(!(e&1)){ky(i,u,e),t0();break e}l=Error(F(426))}}else if(Ne&&a.mode&1){var x=wy(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Sy(x,o,a,i,e),_g(Gi(l,a));break e}}i=l=Gi(l,a),Ue!==4&&(Ue=2),ia===null?ia=[i]:ia.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=wS(i,l,e);my(i,y);break e;case 1:a=l;var b=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&($r===null||!$r.has(k)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=SS(i,a,e);my(i,w);break e}}i=i.return}while(i!==null)}$S(n)}catch(C){e=C,ze===n&&n!==null&&(ze=n=n.return);continue}break}while(!0)}function FS(){var t=vu.current;return vu.current=bu,t===null?bu:t}function t0(){(Ue===0||Ue===3||Ue===2)&&(Ue=4),Xe===null||!(Gs&268435455)&&!(Vd&268435455)||Tr(Xe,at)}function Su(t,e){var n=ce;ce|=2;var r=FS();(Xe!==t||at!==e)&&(Jn=null,Ls(t,e));do try{rA();break}catch(s){zS(t,s)}while(!0);if(Og(),ce=n,vu.current=r,ze!==null)throw Error(F(261));return Xe=null,at=0,Ue}function rA(){for(;ze!==null;)VS(ze)}function sA(){for(;ze!==null&&!MM();)VS(ze)}function VS(t){var e=WS(t.alternate,t,It);t.memoizedProps=t.pendingProps,e===null?$S(t):ze=e,Yg.current=null}function $S(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=XP(n,e),n!==null){n.flags&=32767,ze=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ue=6,ze=null;return}}else if(n=YP(n,e,It),n!==null){ze=n;return}if(e=e.sibling,e!==null){ze=e;return}ze=e=t}while(e!==null);Ue===0&&(Ue=5)}function ys(t,e,n){var r=fe,s=nn.transition;try{nn.transition=null,fe=1,iA(t,e,n,r)}finally{nn.transition=s,fe=r}return null}function iA(t,e,n,r){do zi();while(Ar!==null);if(ce&6)throw Error(F(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(F(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(zM(t,i),t===Xe&&(ze=Xe=null,at=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xl||(Xl=!0,US(su,function(){return zi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=nn.transition,nn.transition=null;var o=fe;fe=1;var a=ce;ce|=4,Yg.current=null,QP(t,n),IS(n,t),CP(Sp),ou=!!wp,Sp=wp=null,t.current=n,eA(n),PM(),ce=a,fe=o,nn.transition=i}else t.current=n;if(Xl&&(Xl=!1,Ar=t,wu=s),i=t.pendingLanes,i===0&&($r=null),LM(n.stateNode),Lt(t,Oe()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(ku)throw ku=!1,t=Hp,Hp=null,t;return wu&1&&t.tag!==0&&zi(),i=t.pendingLanes,i&1?t===Wp?oa++:(oa=0,Wp=t):oa=0,as(),null}function zi(){if(Ar!==null){var t=w1(wu),e=nn.transition,n=fe;try{if(nn.transition=null,fe=16>t?16:t,Ar===null)var r=!1;else{if(t=Ar,Ar=null,wu=0,ce&6)throw Error(F(331));var s=ce;for(ce|=4,K=t.current;K!==null;){var i=K,o=i.child;if(K.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:sa(8,d,i)}var h=d.child;if(h!==null)h.return=d,K=h;else for(;K!==null;){d=K;var f=d.sibling,p=d.return;if(LS(d),d===u){K=null;break}if(f!==null){f.return=p,K=f;break}K=p}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var x=g.sibling;g.sibling=null,g=x}while(g!==null)}}K=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,K=o;else e:for(;K!==null;){if(i=K,i.flags&2048)switch(i.tag){case 0:case 11:case 15:sa(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,K=y;break e}K=i.return}}var b=t.current;for(K=b;K!==null;){o=K;var k=o.child;if(o.subtreeFlags&2064&&k!==null)k.return=o,K=k;else e:for(o=b;K!==null;){if(a=K,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Fd(9,a)}}catch(C){De(a,a.return,C)}if(a===o){K=null;break e}var w=a.sibling;if(w!==null){w.return=a.return,K=w;break e}K=a.return}}if(ce=s,as(),On&&typeof On.onPostCommitFiberRoot=="function")try{On.onPostCommitFiberRoot(Dd,t)}catch{}r=!0}return r}finally{fe=n,nn.transition=e}}return!1}function Iy(t,e,n){e=Gi(n,e),e=wS(t,e,1),t=Vr(t,e,1),e=St(),t!==null&&(dl(t,1,e),Lt(t,e))}function De(t,e,n){if(t.tag===3)Iy(t,t,n);else for(;e!==null;){if(e.tag===3){Iy(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&($r===null||!$r.has(r))){t=Gi(n,t),t=SS(e,t,1),e=Vr(e,t,1),t=St(),e!==null&&(dl(e,1,t),Lt(e,t));break}}e=e.return}}function oA(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=St(),t.pingedLanes|=t.suspendedLanes&n,Xe===t&&(at&n)===n&&(Ue===4||Ue===3&&(at&130023424)===at&&500>Oe()-Zg?Ls(t,0):Xg|=n),Lt(t,e)}function HS(t,e){e===0&&(t.mode&1?(e=Vl,Vl<<=1,!(Vl&130023424)&&(Vl=4194304)):e=1);var n=St();t=cr(t,e),t!==null&&(dl(t,e,n),Lt(t,n))}function aA(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),HS(t,n)}function lA(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(F(314))}r!==null&&r.delete(e),HS(t,n)}var WS;WS=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||At.current)Pt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Pt=!1,JP(t,e,n);Pt=!!(t.flags&131072)}else Pt=!1,Ne&&e.flags&1048576&&q1(e,fu,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Rc(t,e),t=e.pendingProps;var s=Hi(e,mt.current);Bi(e,n),s=Ug(null,e,r,t,s,n);var i=Kg();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Dt(r)?(i=!0,du(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Fg(e),s.updater=zd,e.stateNode=s,s._reactInternals=e,Dp(e,r,t,n),e=_p(null,e,r,!0,i,n)):(e.tag=0,Ne&&i&&Lg(e),yt(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Rc(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=uA(r),t=pn(r,t),s){case 0:e=Rp(null,e,r,t,n);break e;case 1:e=jy(null,e,r,t,n);break e;case 11:e=Ny(null,e,r,t,n);break e;case 14:e=Cy(null,e,r,pn(r.type,t),n);break e}throw Error(F(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:pn(r,s),Rp(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:pn(r,s),jy(t,e,r,s,n);case 3:e:{if(ES(e),t===null)throw Error(F(387));r=e.pendingProps,i=e.memoizedState,s=i.element,eS(t,e),gu(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Gi(Error(F(423)),e),e=Ey(t,e,r,n,s);break e}else if(r!==s){s=Gi(Error(F(424)),e),e=Ey(t,e,r,n,s);break e}else for(Bt=Fr(e.stateNode.containerInfo.firstChild),zt=e,Ne=!0,gn=null,n=Z1(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wi(),r===s){e=ur(t,e,n);break e}yt(t,e,r,n)}e=e.child}return e;case 5:return tS(e),t===null&&Mp(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Np(r,s)?o=null:i!==null&&Np(r,i)&&(e.flags|=32),jS(t,e),yt(t,e,o,n),e.child;case 6:return t===null&&Mp(e),null;case 13:return TS(t,e,n);case 4:return Vg(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ui(e,null,r,n):yt(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:pn(r,s),Ny(t,e,r,s,n);case 7:return yt(t,e,e.pendingProps,n),e.child;case 8:return yt(t,e,e.pendingProps.children,n),e.child;case 12:return yt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,be(pu,r._currentValue),r._currentValue=o,i!==null)if(Nn(i.value,o)){if(i.children===s.children&&!At.current){e=ur(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=rr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Pp(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(F(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Pp(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}yt(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Bi(e,n),s=on(s),r=r(s),e.flags|=1,yt(t,e,r,n),e.child;case 14:return r=e.type,s=pn(r,e.pendingProps),s=pn(r.type,s),Cy(t,e,r,s,n);case 15:return NS(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:pn(r,s),Rc(t,e),e.tag=1,Dt(r)?(t=!0,du(e)):t=!1,Bi(e,n),kS(e,r,s),Dp(e,r,s,n),_p(null,e,r,!0,t,n);case 19:return MS(t,e,n);case 22:return CS(t,e,n)}throw Error(F(156,e.tag))};function US(t,e){return y1(t,e)}function cA(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(t,e,n,r){return new cA(t,e,n,r)}function n0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function uA(t){if(typeof t=="function")return n0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===kg)return 11;if(t===wg)return 14}return 2}function Wr(t,e){var n=t.alternate;return n===null?(n=en(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Oc(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")n0(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case bi:return Rs(n.children,s,i,e);case vg:o=8,s|=8;break;case np:return t=en(12,n,e,s|2),t.elementType=np,t.lanes=i,t;case rp:return t=en(13,n,e,s),t.elementType=rp,t.lanes=i,t;case sp:return t=en(19,n,e,s),t.elementType=sp,t.lanes=i,t;case t1:return $d(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Qw:o=10;break e;case e1:o=9;break e;case kg:o=11;break e;case wg:o=14;break e;case kr:o=16,r=null;break e}throw Error(F(130,t==null?t:typeof t,""))}return e=en(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Rs(t,e,n,r){return t=en(7,t,r,e),t.lanes=n,t}function $d(t,e,n,r){return t=en(22,t,r,e),t.elementType=t1,t.lanes=n,t.stateNode={isHidden:!1},t}function Jh(t,e,n){return t=en(6,t,null,e),t.lanes=n,t}function Yh(t,e,n){return e=en(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function dA(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ph(0),this.expirationTimes=Ph(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ph(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function r0(t,e,n,r,s,i,o,a,l){return t=new dA(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=en(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fg(i),t}function hA(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yi,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function KS(t){if(!t)return Qr;t=t._reactInternals;e:{if(ei(t)!==t||t.tag!==1)throw Error(F(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Dt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(F(171))}if(t.tag===1){var n=t.type;if(Dt(n))return K1(t,n,e)}return e}function GS(t,e,n,r,s,i,o,a,l){return t=r0(n,r,!0,t,s,i,o,a,l),t.context=KS(null),n=t.current,r=St(),s=Hr(n),i=rr(r,s),i.callback=e??null,Vr(n,i,s),t.current.lanes=s,dl(t,s,r),Lt(t,r),t}function Hd(t,e,n,r){var s=e.current,i=St(),o=Hr(s);return n=KS(n),e.context===null?e.context=n:e.pendingContext=n,e=rr(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Vr(s,e,o),t!==null&&(kn(t,s,o,i),Ac(t,s,o)),o}function Nu(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Oy(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function s0(t,e){Oy(t,e),(t=t.alternate)&&Oy(t,e)}function fA(){return null}var qS=typeof reportError=="function"?reportError:function(t){console.error(t)};function i0(t){this._internalRoot=t}Wd.prototype.render=i0.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(F(409));Hd(t,e,null,null)};Wd.prototype.unmount=i0.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;qs(function(){Hd(null,t,null,null)}),e[lr]=null}};function Wd(t){this._internalRoot=t}Wd.prototype.unstable_scheduleHydration=function(t){if(t){var e=C1();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Er.length&&e!==0&&e<Er[n].priority;n++);Er.splice(n,0,t),n===0&&E1(t)}};function o0(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ud(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function By(){}function pA(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Nu(o);i.call(u)}}var o=GS(e,r,t,0,null,!1,!1,"",By);return t._reactRootContainer=o,t[lr]=o.current,_a(t.nodeType===8?t.parentNode:t),qs(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var u=Nu(l);a.call(u)}}var l=r0(t,0,!1,null,null,!1,!1,"",By);return t._reactRootContainer=l,t[lr]=l.current,_a(t.nodeType===8?t.parentNode:t),qs(function(){Hd(e,l,n,r)}),l}function Kd(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var l=Nu(o);a.call(l)}}Hd(e,o,t,s)}else o=pA(n,e,t,s,r);return Nu(o)}S1=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Ho(e.pendingLanes);n!==0&&(Cg(e,n|1),Lt(e,Oe()),!(ce&6)&&(qi=Oe()+500,as()))}break;case 13:qs(function(){var r=cr(t,1);if(r!==null){var s=St();kn(r,t,1,s)}}),s0(t,1)}};jg=function(t){if(t.tag===13){var e=cr(t,134217728);if(e!==null){var n=St();kn(e,t,134217728,n)}s0(t,134217728)}};N1=function(t){if(t.tag===13){var e=Hr(t),n=cr(t,e);if(n!==null){var r=St();kn(n,t,e,r)}s0(t,e)}};C1=function(){return fe};j1=function(t,e){var n=fe;try{return fe=t,e()}finally{fe=n}};pp=function(t,e,n){switch(e){case"input":if(ap(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=Id(r);if(!s)throw Error(F(90));r1(r),ap(r,s)}}}break;case"textarea":i1(t,n);break;case"select":e=n.value,e!=null&&Ri(t,!!n.multiple,e,!1)}};h1=Qg;f1=qs;var mA={usingClientEntryPoint:!1,Events:[fl,Si,Id,u1,d1,Qg]},Po={findFiberByHostInstance:ws,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gA={bundleType:Po.bundleType,version:Po.version,rendererPackageName:Po.rendererPackageName,rendererConfig:Po.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:hr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=g1(t),t===null?null:t.stateNode},findFiberByHostInstance:Po.findFiberByHostInstance||fA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zl.isDisabled&&Zl.supportsFiber)try{Dd=Zl.inject(gA),On=Zl}catch{}}Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mA;Ht.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!o0(e))throw Error(F(200));return hA(t,e,null,n)};Ht.createRoot=function(t,e){if(!o0(t))throw Error(F(299));var n=!1,r="",s=qS;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=r0(t,1,!1,null,null,n,!1,r,s),t[lr]=e.current,_a(t.nodeType===8?t.parentNode:t),new i0(e)};Ht.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(F(188)):(t=Object.keys(t).join(","),Error(F(268,t)));return t=g1(e),t=t===null?null:t.stateNode,t};Ht.flushSync=function(t){return qs(t)};Ht.hydrate=function(t,e,n){if(!Ud(e))throw Error(F(200));return Kd(null,t,e,!0,n)};Ht.hydrateRoot=function(t,e,n){if(!o0(t))throw Error(F(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=qS;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=GS(e,null,t,1,n??null,s,!1,i,o),t[lr]=e.current,_a(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new Wd(e)};Ht.render=function(t,e,n){if(!Ud(e))throw Error(F(200));return Kd(null,t,e,!1,n)};Ht.unmountComponentAtNode=function(t){if(!Ud(t))throw Error(F(40));return t._reactRootContainer?(qs(function(){Kd(null,null,t,!1,function(){t._reactRootContainer=null,t[lr]=null})}),!0):!1};Ht.unstable_batchedUpdates=Qg;Ht.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Ud(n))throw Error(F(200));if(t==null||t._reactInternals===void 0)throw Error(F(38));return Kd(t,e,n,!1,r)};Ht.version="18.3.1-next-f1338f8080-20240426";function JS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(JS)}catch(t){console.error(t)}}JS(),Jw.exports=Ht;var Gd=Jw.exports;const xA=Kw(Gd);var zy=Gd;ep.createRoot=zy.createRoot,ep.hydrateRoot=zy.hydrateRoot;/**
* @remix-run/router v1.23.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Wa(){return Wa=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Wa.apply(null,arguments)}var Dr;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Dr||(Dr={}));const Fy="popstate";function yA(t){t===void 0&&(t={});function e(r,s){let{pathname:i,search:o,hash:a}=r.location;return Gp("",{pathname:i,search:o,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:Cu(s)}return vA(e,n,null,t)}function Ee(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function a0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function bA(){return Math.random().toString(36).substr(2,8)}function Vy(t,e){return{usr:t.state,key:t.key,idx:e}}function Gp(t,e,n,r){return n===void 0&&(n=null),Wa({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?go(e):e,{state:n,key:e&&e.key||r||bA()})}function Cu(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function go(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function vA(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a=Dr.Pop,l=null,u=d();u==null&&(u=0,o.replaceState(Wa({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){a=Dr.Pop;let x=d(),y=x==null?null:x-u;u=x,l&&l({action:a,location:g.location,delta:y})}function f(x,y){a=Dr.Push;let b=Gp(g.location,x,y);u=d()+1;let k=Vy(b,u),w=g.createHref(b);try{o.pushState(k,"",w)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(w)}i&&l&&l({action:a,location:g.location,delta:1})}function p(x,y){a=Dr.Replace;let b=Gp(g.location,x,y);u=d();let k=Vy(b,u),w=g.createHref(b);o.replaceState(k,"",w),i&&l&&l({action:a,location:g.location,delta:0})}function m(x){let y=s.location.origin!=="null"?s.location.origin:s.location.href,b=typeof x=="string"?x:Cu(x);return b=b.replace(/ $/,"%20"),Ee(y,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,y)}let g={get action(){return a},get location(){return t(s,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(Fy,h),l=x,()=>{s.removeEventListener(Fy,h),l=null}},createHref(x){return e(s,x)},createURL:m,encodeLocation(x){let y=m(x);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(x){return o.go(x)}};return g}var $y;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})($y||($y={}));function kA(t,e,n){return n===void 0&&(n="/"),wA(t,e,n)}function wA(t,e,n,r){let s=typeof e=="string"?go(e):e,i=Ji(s.pathname||"/",n);if(i==null)return null;let o=YS(t);SA(o);let a=null,l=RA(i);for(let u=0;a==null&&u<o.length;++u)a=DA(o[u],l);return a}function YS(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,a)=>{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(Ee(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Ur([r,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(Ee(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),YS(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:PA(u,i.index),routesMeta:d})};return t.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let l of XS(i.path))s(i,o,l)}),e}function XS(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=XS(r.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function SA(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:AA(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const NA=/^:[\w-]+$/,CA=3,jA=2,EA=1,TA=10,MA=-2,Hy=t=>t==="*";function PA(t,e){let n=t.split("/"),r=n.length;return n.some(Hy)&&(r+=MA),e&&(r+=jA),n.filter(s=>!Hy(s)).reduce((s,i)=>s+(NA.test(i)?CA:i===""?EA:TA),r)}function AA(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function DA(t,e,n){let{routesMeta:r}=t,s={},i="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],u=a===r.length-1,d=i==="/"?e:e.slice(i.length)||"/",h=qp({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},d),f=l.route;if(!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:Ur([i,h.pathname]),pathnameBase:zA(Ur([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=Ur([i,h.pathnameBase]))}return o}function qp(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=LA(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),a=s.slice(1);return{params:r.reduce((u,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let g=a[h]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const m=a[h];return p&&!m?u[f]=void 0:u[f]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:t}}function LA(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),a0(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function RA(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return a0(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Ji(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const _A=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,IA=t=>_A.test(t);function OA(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?go(t):t,i;if(n)if(IA(n))i=n;else{if(n.includes("//")){let o=n;n=ZS(n),a0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Wy(n.substring(1),"/"):i=Wy(n,e)}else i=e;return{pathname:i,search:FA(r),hash:VA(s)}}function Wy(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Xh(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function BA(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function l0(t,e){let n=BA(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function c0(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=go(t):(s=Wa({},t),Ee(!s.pathname||!s.pathname.includes("?"),Xh("?","pathname","search",s)),Ee(!s.pathname||!s.pathname.includes("#"),Xh("#","pathname","hash",s)),Ee(!s.search||!s.search.includes("#"),Xh("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}a=h>=0?e[h]:"/"}let l=OA(s,a),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const ZS=t=>t.replace(/\/\/+/g,"/"),Ur=t=>ZS(t.join("/")),zA=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),FA=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,VA=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function $A(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const QS=["post","put","patch","delete"];new Set(QS);const HA=["get",...QS];new Set(HA);/**
* React Router v6.30.4
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Ua(){return Ua=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ua.apply(null,arguments)}const qd=v.createContext(null),eN=v.createContext(null),fr=v.createContext(null),Jd=v.createContext(null),Vn=v.createContext({outlet:null,matches:[],isDataRoute:!1}),tN=v.createContext(null);function WA(t,e){let{relative:n}=e===void 0?{}:e;xo()||Ee(!1);let{basename:r,navigator:s}=v.useContext(fr),{hash:i,pathname:o,search:a}=Yd(t,{relative:n}),l=o;return r!=="/"&&(l=o==="/"?r:Ur([r,o])),s.createHref({pathname:l,search:a,hash:i})}function xo(){return v.useContext(Jd)!=null}function cn(){return xo()||Ee(!1),v.useContext(Jd).location}function nN(t){v.useContext(fr).static||v.useLayoutEffect(t)}function ml(){let{isDataRoute:t}=v.useContext(Vn);return t?i3():UA()}function UA(){xo()||Ee(!1);let t=v.useContext(qd),{basename:e,future:n,navigator:r}=v.useContext(fr),{matches:s}=v.useContext(Vn),{pathname:i}=cn(),o=JSON.stringify(l0(s,n.v7_relativeSplatPath)),a=v.useRef(!1);return nN(()=>{a.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let h=c0(u,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Ur([e,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[e,r,o,i,t])}const KA=v.createContext(null);function GA(t){let e=v.useContext(Vn).outlet;return e&&v.createElement(KA.Provider,{value:t},e)}function ti(){let{matches:t}=v.useContext(Vn),e=t[t.length-1];return e?e.params:{}}function Yd(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=v.useContext(fr),{matches:s}=v.useContext(Vn),{pathname:i}=cn(),o=JSON.stringify(l0(s,r.v7_relativeSplatPath));return v.useMemo(()=>c0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function qA(t,e){return JA(t,e)}function JA(t,e,n,r){xo()||Ee(!1);let{navigator:s}=v.useContext(fr),{matches:i}=v.useContext(Vn),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=cn(),d;if(e){var h;let x=typeof e=="string"?go(e):e;l==="/"||(h=x.pathname)!=null&&h.startsWith(l)||Ee(!1),d=x}else d=u;let f=d.pathname||"/",p=f;if(l!=="/"){let x=l.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=kA(t,{pathname:p}),g=e3(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},a,x.params),pathname:Ur([l,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:Ur([l,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r);return e&&g?v.createElement(Jd.Provider,{value:{location:Ua({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Dr.Pop}},g):g}function YA(){let t=s3(),e=$A(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:s},n):null,null)}const XA=v.createElement(YA,null);class ZA extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(Vn.Provider,{value:this.props.routeContext},v.createElement(tN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function QA(t){let{routeContext:e,match:n,children:r}=t,s=v.useContext(qd);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Vn.Provider,{value:e},r)}function e3(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(s=n)==null?void 0:s.errors;if(a!=null){let d=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);d>=0||Ee(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:f,errors:p}=n,m=h.route.loader&&f[h.route.id]===void 0&&(!p||p[h.route.id]===void 0);if(h.route.lazy||m){l=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,f)=>{let p,m=!1,g=null,x=null;n&&(p=a&&h.route.id?a[h.route.id]:void 0,g=h.route.errorElement||XA,l&&(u<0&&f===0?(o3("route-fallback"),m=!0,x=null):u===f&&(m=!0,x=h.route.hydrateFallbackElement||null)));let y=e.concat(o.slice(0,f+1)),b=()=>{let k;return p?k=g:m?k=x:h.route.Component?k=v.createElement(h.route.Component,null):h.route.element?k=h.route.element:k=d,v.createElement(QA,{match:h,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:k})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?v.createElement(ZA,{location:n.location,revalidation:n.revalidation,component:g,error:p,children:b(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):b()},null)}var rN=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(rN||{}),sN=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(sN||{});function t3(t){let e=v.useContext(qd);return e||Ee(!1),e}function n3(t){let e=v.useContext(eN);return e||Ee(!1),e}function r3(t){let e=v.useContext(Vn);return e||Ee(!1),e}function iN(t){let e=r3(),n=e.matches[e.matches.length-1];return n.route.id||Ee(!1),n.route.id}function s3(){var t;let e=v.useContext(tN),n=n3(),r=iN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function i3(){let{router:t}=t3(rN.UseNavigateStable),e=iN(sN.UseNavigateStable),n=v.useRef(!1);return nN(()=>{n.current=!0}),v.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Ua({fromRouteId:e},i)))},[t,e])}const Uy={};function o3(t,e,n){Uy[t]||(Uy[t]=!0)}function a3(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Ka(t){let{to:e,replace:n,state:r,relative:s}=t;xo()||Ee(!1);let{future:i,static:o}=v.useContext(fr),{matches:a}=v.useContext(Vn),{pathname:l}=cn(),u=ml(),d=c0(e,l0(a,i.v7_relativeSplatPath),l,s==="path"),h=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(h),{replace:n,state:r,relative:s}),[u,h,s,n,r]),null}function Xd(t){return GA(t.context)}function se(t){Ee(!1)}function l3(t){let{basename:e="/",children:n=null,location:r,navigationType:s=Dr.Pop,navigator:i,static:o=!1,future:a}=t;xo()&&Ee(!1);let l=e.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:l,navigator:i,static:o,future:Ua({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof r=="string"&&(r=go(r));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:m="default"}=r,g=v.useMemo(()=>{let x=Ji(d,l);return x==null?null:{location:{pathname:x,search:h,hash:f,state:p,key:m},navigationType:s}},[l,d,h,f,p,m,s]);return g==null?null:v.createElement(fr.Provider,{value:u},v.createElement(Jd.Provider,{children:n,value:g}))}function c3(t){let{children:e,location:n}=t;return qA(Jp(e),n)}new Promise(()=>{});function Jp(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,s)=>{if(!v.isValidElement(r))return;let i=[...e,s];if(r.type===v.Fragment){n.push.apply(n,Jp(r.props.children,i));return}r.type!==se&&Ee(!1),!r.props.index||!r.props.children||Ee(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Jp(r.props.children,i)),n.push(o)}),n}/**
* React Router DOM v6.30.4
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function ju(){return ju=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ju.apply(null,arguments)}function oN(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function u3(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function d3(t,e){return t.button===0&&(!e||e==="_self")&&!u3(t)}function Yp(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function h3(t,e){let n=Yp(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}const f3=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],p3=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],m3="6";try{window.__reactRouterVersion=m3}catch{}const g3=v.createContext({isTransitioning:!1}),x3="startTransition",Ky=J2[x3];function y3(t){let{basename:e,children:n,future:r,window:s}=t,i=v.useRef();i.current==null&&(i.current=yA({window:s,v5Compat:!0}));let o=i.current,[a,l]=v.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=v.useCallback(h=>{u&&Ky?Ky(()=>l(h)):l(h)},[l,u]);return v.useLayoutEffect(()=>o.listen(d),[o,d]),v.useEffect(()=>a3(r),[r]),v.createElement(l3,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const b3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",v3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ne=v.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:a,target:l,to:u,preventScrollReset:d,viewTransition:h}=e,f=oN(e,f3),{basename:p}=v.useContext(fr),m,g=!1;if(typeof u=="string"&&v3.test(u)&&(m=u,b3))try{let k=new URL(window.location.href),w=u.startsWith("//")?new URL(k.protocol+u):new URL(u),C=Ji(w.pathname,p);w.origin===k.origin&&C!=null?u=C+w.search+w.hash:g=!0}catch{}let x=WA(u,{relative:s}),y=w3(u,{replace:o,state:a,target:l,preventScrollReset:d,relative:s,viewTransition:h});function b(k){r&&r(k),k.defaultPrevented||y(k)}return v.createElement("a",ju({},f,{href:m||x,onClick:g||i?r:b,ref:n,target:l}))}),aN=v.forwardRef(function(e,n){let{"aria-current":r="page",caseSensitive:s=!1,className:i="",end:o=!1,style:a,to:l,viewTransition:u,children:d}=e,h=oN(e,p3),f=Yd(l,{relative:h.relative}),p=cn(),m=v.useContext(eN),{navigator:g,basename:x}=v.useContext(fr),y=m!=null&&N3(f)&&u===!0,b=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,k=p.pathname,w=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;s||(k=k.toLowerCase(),w=w?w.toLowerCase():null,b=b.toLowerCase()),w&&x&&(w=Ji(w,x)||w);const C=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let j=k===b||!o&&k.startsWith(b)&&k.charAt(C)==="/",S=w!=null&&(w===b||!o&&w.startsWith(b)&&w.charAt(b.length)==="/"),N={isActive:j,isPending:S,isTransitioning:y},T=j?r:void 0,E;typeof i=="function"?E=i(N):E=[i,j?"active":null,S?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let D=typeof a=="function"?a(N):a;return v.createElement(ne,ju({},h,{"aria-current":T,className:E,ref:n,style:D,to:l,viewTransition:u}),typeof d=="function"?d(N):d)});var Xp;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Xp||(Xp={}));var Gy;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Gy||(Gy={}));function k3(t){let e=v.useContext(qd);return e||Ee(!1),e}function w3(t,e){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:a}=e===void 0?{}:e,l=ml(),u=cn(),d=Yd(t,{relative:o});return v.useCallback(h=>{if(d3(h,n)){h.preventDefault();let f=r!==void 0?r:Cu(u)===Cu(d);l(t,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:a})}},[u,l,d,r,s,n,t,i,o,a])}function S3(t){let e=v.useRef(Yp(t)),n=v.useRef(!1),r=cn(),s=v.useMemo(()=>h3(r.search,n.current?null:e.current),[r.search]),i=ml(),o=v.useCallback((a,l)=>{const u=Yp(typeof a=="function"?a(s):a);n.current=!0,i("?"+u,l)},[i,s]);return[s,o]}function N3(t,e){e===void 0&&(e={});let n=v.useContext(g3);n==null&&Ee(!1);let{basename:r}=k3(Xp.useViewTransitionState),s=Yd(t,{relative:e.relative});if(!n.isTransitioning)return!1;let i=Ji(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ji(n.nextLocation.pathname,r)||n.nextLocation.pathname;return qp(s.pathname,o)!=null||qp(s.pathname,i)!=null}function C3(){const{pathname:t}=cn();return v.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})},[t]),null}const j3='a, button, [role="button"], label, select, summary, [data-cursor="hover"], .cursor-pointer',E3='input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="file"]), textarea, [contenteditable="true"]';function T3(){const t=v.useRef(null),e=v.useRef(null),n=v.useRef(null),r=v.useRef(null),s=v.useRef(null);return v.useEffect(()=>{const i=window.matchMedia("(pointer: fine)"),o=window.matchMedia("(prefers-reduced-motion: reduce)");if(!i.matches||o.matches)return;const a=t.current,l=e.current,u=n.current,d=r.current,h=s.current;if(!a||!l||!u||!d||!h)return;document.documentElement.classList.add("hifi-cursor-on");const f=-24*Math.PI/180,p=Math.cos(f),m=Math.sin(f);let g=-100,x=-100,y=0,b=2.4,k=2.4,w=16,C=6.5,j=16,S=6.5,N=!1,T,E=performance.now();const D=R=>{const _=Math.min((R-E)/1e3,.05);E=R,b+=(k-b)*Math.min(1,_*8),w+=(j-w)*Math.min(1,_*10),C+=(S-C)*Math.min(1,_*10),y+=b*_,l.style.transform=`translate3d(${g}px, ${x}px, 0)`,u.style.transform=`translate3d(${g}px, ${x}px, 0)`;const $=Math.cos(y)*w,te=Math.sin(y)*C;d.style.transform=`translate(${$*p-te*m}px, ${$*m+te*p}px)`,T=requestAnimationFrame(D)},P=R=>{a.dataset.state=R;const _=R==="hover";k=_?7:2.4,j=_?23:16,S=_?9.5:6.5},O=R=>{g=R.clientX,x=R.clientY,N||(N=!0,a.dataset.hidden="false")},I=R=>{const _=R.target;_ instanceof Element&&(_.closest(E3)?P("text"):_.closest(j3)?P("hover"):P("default"))},H=()=>{a.dataset.down="true",h.style.left=`${g}px`,h.style.top=`${x}px`,h.classList.remove("is-live"),h.offsetWidth,h.classList.add("is-live")},B=()=>{a.dataset.down="false"},re=()=>{N=!1,a.dataset.hidden="true"};return document.addEventListener("mousemove",O,{passive:!0}),document.addEventListener("mouseover",I,{passive:!0}),document.addEventListener("mousedown",H,{passive:!0}),document.addEventListener("mouseup",B,{passive:!0}),document.documentElement.addEventListener("mouseleave",re),window.addEventListener("blur",re),T=requestAnimationFrame(D),()=>{cancelAnimationFrame(T),document.removeEventListener("mousemove",O),document.removeEventListener("mouseover",I),document.removeEventListener("mousedown",H),document.removeEventListener("mouseup",B),document.documentElement.removeEventListener("mouseleave",re),window.removeEventListener("blur",re),document.documentElement.classList.remove("hifi-cursor-on")}},[]),c.jsxs("div",{ref:t,className:"hifi-cursor","data-state":"default","data-hidden":"true","data-down":"false","aria-hidden":"true",children:[c.jsxs("div",{ref:n,className:"hifi-cursor__orbit",children:[c.jsx("div",{className:"hifi-cursor__ring"}),c.jsx("div",{ref:r,className:"hifi-cursor__sat"})]}),c.jsx("div",{ref:e,className:"hifi-cursor__core"}),c.jsx("div",{ref:s,className:"hifi-cursor__pulse"})]})}const lN=`${"/".replace(/\/$/,"")}/api`;async function Ao(t,e={}){const n=await fetch(`${lN}${t}`,{credentials:"include",headers:e.body instanceof FormData?{}:{"Content-Type":"application/json"},...e}),r=await n.text();let s=null;if(r)try{s=JSON.parse(r)}catch{}if(!n.ok)throw new Error((s==null?void 0:s.error)||`Fehler ${n.status}`);if(s===null&&r)throw new Error("Unerwartete Server-Antwort (kein gültiges JSON)");return s}const A={get:t=>Ao(t),post:(t,e)=>Ao(t,{method:"POST",body:e instanceof FormData?e:JSON.stringify(e)}),put:(t,e)=>Ao(t,{method:"PUT",body:JSON.stringify(e)}),patch:(t,e)=>Ao(t,{method:"PATCH",body:JSON.stringify(e)}),delete:t=>Ao(t,{method:"DELETE"})};function M3({children:t}){const[e,n]=v.useState({pathname:null,needsSetup:null}),r=cn();return v.useEffect(()=>{let s=!1;return A.get("/setup/status").then(i=>{s||n({pathname:r.pathname,needsSetup:i.needs_setup})}).catch(()=>{s||n({pathname:r.pathname,needsSetup:!1})}),()=>{s=!0}},[r.pathname]),e.pathname!==r.pathname||e.needsSetup===null?c.jsx("div",{className:"min-h-screen bg-white dark:bg-neutral-950"}):e.needsSetup&&r.pathname!=="/setup"?c.jsx(Ka,{to:"/setup",replace:!0}):!e.needsSetup&&r.pathname==="/setup"?c.jsx(Ka,{to:"/",replace:!0}):t}const cN=v.createContext(null);function P3(){const t=new Date,e=t.getHours()+t.getMinutes()/60;return e>=6.5&&e<21?"light":"dark"}function A3({children:t}){const[e,n]=v.useState(()=>{const s=localStorage.getItem("hifi-theme");return s==="light"||s==="dark"?s:P3()});v.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem("hifi-theme",e)},[e]);const r=()=>n(s=>s==="dark"?"light":"dark");return c.jsx(cN.Provider,{value:{theme:e,toggleTheme:r},children:t})}function D3(){return v.useContext(cN)}const L3={nav:{openMenu:"Menü öffnen",closeMenu:"Menü schließen",close:"Schließen",adminPanel:"Zum Admin-Panel",vehicles:"Fahrzeuge",services:"Leistungen",gallery:"Galerie",contact:"Kontakt",whatsapp:"WhatsApp",shop:"Zum Shop"},themeToggle:{label:"Theme umschalten"},languageToggle:{label:"Sprache auswählen"},footer:{routePlan:"Route planen",contactHeading:"Kontakt",contactForm:"Kontaktformular",hoursHeading:"Öffnungszeiten",open:"Geöffnet",closed:"Geschlossen",days:{monFri:"Montag – Freitag",sat:"Samstag",sun:"Sonntag"},copyright:t=>`© ${t} HifiPlanet. Alle Angaben ohne Gewähr.`,imprint:"Impressum",privacy:"Datenschutz",terms:"AGB",cookieSettings:"Cookie-Einstellungen"},cookieConsent:{bannerText:"Wir verwenden nur technisch notwendige Cookies. Für Google Maps, YouTube-Videos und Statistik-Cookies benötigen wir zusätzlich deine Zustimmung, da dabei Daten an Google übertragen werden.",moreInfo:"Mehr dazu in unserer",privacyPolicy:"Datenschutzerklärung",settings:"Einstellungen",onlyNecessary:"Nur notwendige",acceptAll:"Alle akzeptieren",modalTitle:"Cookie-Einstellungen",modalIntro:"Lege fest, welche Kategorien du zulassen möchtest. Mehr dazu in unserer",necessaryTitle:"Notwendig",necessaryDesc:"Für den Betrieb der Website erforderlich (z. B. Login-Session, Theme- und Cookie-Einstellung). Kann nicht deaktiviert werden.",externalTitle:"Externe Medien",externalDesc:"Google Maps und YouTube-Videos. Beim Laden werden Daten (u. a. deine IP-Adresse) an Google übertragen.",analyticsTitle:"Statistik",analyticsDesc:"Google Analytics hilft uns zu verstehen, wie die Website genutzt wird. Dabei werden Daten an Google übertragen.",cancel:"Abbrechen",saveSelection:"Auswahl speichern"},maintenance:{title:"Wartungsarbeiten",defaultMessage:"Dieser Bereich wird gerade aktualisiert. Bitte schau in Kürze wieder vorbei.",login:"Anmelden"},lightbox:{close:"Schließen",previous:"Vorheriges Bild",next:"Nächstes Bild"},home:{metaTitle:"Car-Hifi Umbauten nach Maß",metaDescription:"HifiPlanet – dein Car-Hifi Spezialist in Amorbach. Marke und Modell wählen, passende Sound-Pakete entdecken und unverbindlich anfragen.",stickyCta:"Bereit für deinen Sound-Umbau?",selectVehicle:"Fahrzeug auswählen",getInTouch:"Kontakt aufnehmen",welcome:"Willkommen bei HifiPlanet",heroTitle:"Home of pure Sound",heroSubtitle:"Dein Car-Hifi Spezialist für individuelle Sound-Umbauten. Wähle dein Fahrzeug, entdecke passende Pakete und frag unverbindlich an – wir kümmern uns um den Rest.",stats:[{value:"20+",label:"Jahre Erfahrung"},{value:"Riesige",label:"3D-Druckfarm im eigenen Haus"},{value:"Eigene",label:"CNC- & Laserwerkstatt"},{value:"International",label:"anerkannter Car-Hifi-Spezialist"}],brandsHeading:"Marken, mit denen wir arbeiten",youtubeBadge:"HifiPlanet präsentiert",youtubeTitle:"Das Handwerk hinter deinem Sound",youtubeText:"Entdecke die Handwerkskunst hinter unserer Arbeit",youtubeCta:"Jetzt ansehen",heroImageAlt:"Ground Zero Subwoofer und Endstufen mit violetter Ambiente-Beleuchtung",craftImageAlt:"Individueller Subwoofer-Bau",adviceImageAlt:"Endstufen-Einbau mit Ambiente-Beleuchtung",moreImageAlt:"Hochwertige Endstufe und Subwoofer, Studioaufnahme",craftEyebrow:"Handwerk",craftTitle:"Präzisionsarbeit in jedem Detail",craftText:"Ob eigens gefertigte Subwoofer-Gehäuse, integrierte Beleuchtung oder unsichtbar verlegte Kabelwege – dank eigener CNC-, Laser- und 3D-Druck-Fertigung entstehen bei uns Lösungen, die es von der Stange nicht gibt.",adviceEyebrow:"Beratung",adviceTitle:"Von der ersten Idee bis zum letzten Schliff",adviceText:"Jedes Fahrzeug und jeder Anspruch ist anders. Deshalb beraten wir dich persönlich und unverbindlich – vom dezenten Upgrade bis zum kompromisslosen High-End-System.",insightsTitle:"Einblicke in unsere Umbauten",insightsText:"Vom unauffälligen Sound-Upgrade bis zum aufwendigen Komplettumbau – Handarbeit aus unserer Werkstatt in Amorbach.",galleryAlts:["Individueller Subwoofer-Bau mit Ground Zero Bässen","Endstufen-Einbau mit violetter Ambiente-Beleuchtung","Hochtöner- und Mitteltöner-Einbau von Focal Utopia","Sony Navigationssystem mit Apple CarPlay im Cockpit","Verbauter Hochtöner im Kofferraum","Individueller Subwoofer-Einbau mit LED-Beleuchtung im Kofferraum"],reviewsRating:"5,0 von 181 Kunden bewertet",reviewsRatingDynamic:(t,e)=>`${t.toFixed(1).replace(".",",")} von ${e} Kunden bewertet`,reviewsText:"Das sagen unsere Kunden über uns.",reviewsLink:"Alle Bewertungen auf Google ansehen →",testimonials:[{name:"Thomas K.",text:"Über YouTube auf dieses Klang-Juwel gestoßen. Beratung und Empfehlungen sind erstklassig – der Tesla-Vorführwagen hat meine Leidenschaft für guten Sound neu entfacht."},{name:"Andreas I.",text:"Sehr professionelle Beratung und Service. Obwohl ich von VAG zu Mercedes gewechselt bin, wurde alles reibungslos angepasst. Die 3-Wege-Lautsprecher und zwei Subwoofer liefern außergewöhnliche Leistung."},{name:"Thomas F.",text:"Kompletter Audi A4 B9 Umbau hat meine Erwartungen übertroffen. Von Anfang bis Ende professionell, mit tadelloser Verarbeitung und Klangqualität."},{name:"Drago G.",text:"Beeindruckt von der CNC-Arbeit, die auf YouTube gezeigt wird. Angefangen mit 3D-gedruckten Lautsprecherringen für meinen Ford Mustang – daraus wurde ein viel größeres Projekt."},{name:"Leonardo B.",text:"Toller Service und meisterhafte Handwerkskunst. Saubere Installation, Leidenschaft in jedem Detail erkennbar."},{name:"Marcel S.",text:"Unschlagbares Preis-Leistungs-Verhältnis. Das Team hat sich viel Zeit genommen, um genau die Lösung für mein Budget zu finden."},{name:"Julia W.",text:"Endlich ein Betrieb, der auch Wohnmobile ernst nimmt. Die Soundanlage in unserem Camper klingt jetzt wie im Wohnzimmer."},{name:"Kevin R.",text:"Dashcam und Alarmanlage in einem Termin sauber verbaut, keine sichtbaren Kabel. Absolute Empfehlung für alle, die Wert auf Verarbeitung legen."},{name:"Sabrina H.",text:"Mein Oldtimer hat jetzt modernen Sound, ohne dass es dem Original-Look geschadet hätte. Genau das habe ich gesucht."},{name:"Niklas P.",text:"Von der ersten Anfrage bis zum fertigen Umbau lief alles reibungslos. Ehrliche Beratung ohne Verkaufsdruck."}],moreTitle:"Mehr als nur Car-Hifi",moreText:"Neben individuellen Sound-Umbauten bieten wir CNC-Zerspanung, Lasertechnik, 3D-Druck und mehr – alles aus einer Hand in unserer eigenen Werkstatt.",moreCta:"Alle Leistungen entdecken",faqHeading:"Häufig gestellte Fragen"},vehicleSelect:{metaTitle:"Fahrzeug auswählen",metaDescription:"Wähle deine Fahrzeugmarke und dein Modell und entdecke passende Car-Hifi Sound-Pakete von HifiPlanet.",title:"Fahrzeug auswählen",intro:"Wähle zuerst deine Marke, dann dein Modell – wir zeigen dir direkt die passenden Sound-Pakete.",empty:"Es sind noch keine Marken hinterlegt."},brandPage:{metaTitleFallback:"Modell auswählen",metaDescription:t=>`Wähle dein ${t} Modell und entdecke passende Car-Hifi Sound-Pakete von HifiPlanet.`,loading:"Lädt…",breadcrumbVehicles:"Fahrzeuge",titleSuffix:"Modell wählen",empty:"Für diese Marke sind noch keine Modelle hinterlegt."},modelPage:{metaTitleFallback:"Sound-Pakete",metaTitle:(t,e)=>`${t} ${e} Sound-Pakete`,metaDescription:(t,e)=>`Car-Hifi Sound-Pakete für ${t} ${e} inkl. aktueller Preise – von HifiPlanet unverbindlich anfragen.`,loading:"Lädt…",breadcrumbVehicles:"Fahrzeuge",titleSuffix:"Sound-Pakete",empty:"Für dieses Modell sind noch keine Pakete hinterlegt.",totalPrice:"ab ca.",productLoading:"Produkt wird geladen…",requestContact:"Kontakt anfragen",featuredBadge:"Empfohlen",moreBullets:t=>t===1?"+ 1 weitere Leistung":`+ ${t} weitere Leistungen`,lessBullets:"Weniger anzeigen",wheelHint:"Mit dem Mausrad blättern"},leistungen:{metaTitle:"Leistungen",metaDescription:"Car-Hifi, Wohnmobil & Caravan, Oldtimer, CNC-Zerspanung, Lasertechnik, 3D-Druck, Alarmanlagen und Dash Cams – alles aus einer Hand bei HifiPlanet in Amorbach.",title:"Unsere Leistungen",intro:"Von individuellen Sound-Umbauten bis zur eigenen CNC- und 3D-Druck-Fertigung – alles aus einer Hand in unserer Werkstatt in Amorbach.",notListedTitle:"Dein Projekt ist nicht dabei?",notListedText:"Sprich uns einfach an – wir finden gemeinsam die passende Lösung.",contact:"Kontakt aufnehmen"},contactPage:{metaTitle:"Kontakt",metaDescription:"Kontaktiere HifiPlanet in Amorbach für dein individuelles Car-Hifi Projekt – wir beraten dich gerne unverbindlich.",title:"Kontakt aufnehmen",heroEyebrow:"Kontakt",heroTitlePre:"Sprich",heroTitleAccent:"mit",heroTitlePost:"uns.",heroSubtitle:"Ob Anlage, Einbau oder Klang-Tuning für dein Fahrzeug — schreib uns, wir melden uns schnellstmöglich zurück.",packageBoxTitle:"Deine Anfrage bezieht sich auf",formTitle:"Anfrage senden",sentTitle:"Anfrage gesendet ✓",sentText:"Danke! Wir melden uns innerhalb eines Werktags bei dir.",contextIntro:"Deine Anfrage bezieht sich auf:",contextBrand:"Marke",contextModel:"Modell",contextPackage:"Paket",contextProduct:"Produkt",packagePrice:"Paketpreis",upgrades:"Upgrades",optionalUpgrades:"Optionale Upgrades",totalWithUpgrades:"Gesamt inkl. Upgrades",nameLabel:"Name *",namePlaceholder:"Max Mustermann",emailLabel:"E-Mail *",emailPlaceholder:"max@mail.de",phoneLabel:"Telefon",phonePlaceholder:"Optional",vinLabel:"Fahrgestellnummer (FIN)",vinPlaceholder:"Optional – hilft bei der Einschätzung",messageLabel:"Nachricht",messagePlaceholder:"Erzähl uns von deinem Projekt – Fahrzeug, Wunschklang, Budget …",requiredHint:"* Pflichtfelder",sending:"Wird gesendet…",submit:"Anfrage senden",cardTitle:"HiFi Planet Amorbach",address:"Adresse",phone:"Telefon",email:"E-Mail",hours:"Öffnungszeiten",hoursWeek:"Mo–Fr: 9:00–18:00 Uhr",hoursSat:"Sa: 10:00–13:00 Uhr",hoursWeekDays:"Mo–Fr",hoursWeekTime:"9:00 – 18:00 Uhr",hoursSatDay:"Sa",hoursSatTime:"10:00 – 13:00 Uhr",directionsTitle:"Anfahrt",mapEmbedName:"Die Google-Maps-Karte",mapOpenChip:"In Maps öffnen",routePlan:"Route planen",featurePremiumTitle:"Premium Klang",featurePremiumSub:"Höchste Qualität",featureGermanyTitle:"Made in Germany",featureGermanySub:"Präzise Handarbeit",featureIndividualTitle:"Individuell",featureIndividualSub:"Maßgeschneiderte Lösungen",featureExpertsTitle:"Experten Team",featureExpertsSub:"Leidenschaft & Know-how"},galleryOverview:{metaTitle:"Bildergalerie",metaDescription:"Einblicke in unsere Car-Hifi Umbauten – nach Marke sortiert. Wähle eine Marke und entdecke die Projekte.",title:"Bildergalerie",intro:"Wähle eine Marke und entdecke unsere Umbauten im Detail.",loading:"Lädt…",empty:"Es sind noch keine Galerie-Marken hinterlegt."},galleryBrandPage:{metaTitleFallback:"Bildergalerie",metaTitle:t=>`${t} Umbauten`,metaDescription:t=>`Einblicke in unsere ${t} Car-Hifi Umbauten.`,loading:"Lädt…",breadcrumbGallery:"Galerie",titleSuffix:"Projekt wählen",empty:"Für diese Marke sind noch keine Projekte hinterlegt."},galleryProjectPage:{metaTitleFallback:"Bildergalerie",metaDescription:t=>`Fotos unseres ${t} Umbaus.`,loading:"Lädt…",breadcrumbGallery:"Galerie",empty:"Für dieses Projekt sind noch keine Fotos hinterlegt.",enlargeImage:"Bild vergrößern"}},R3={nav:{openMenu:"Open menu",closeMenu:"Close menu",close:"Close",adminPanel:"Go to admin panel",vehicles:"Vehicles",services:"Services",gallery:"Gallery",contact:"Contact",whatsapp:"WhatsApp",shop:"Visit shop"},themeToggle:{label:"Toggle theme"},languageToggle:{label:"Select language"},footer:{routePlan:"Get directions",contactHeading:"Contact",contactForm:"Contact form",hoursHeading:"Opening hours",open:"Open",closed:"Closed",days:{monFri:"Monday – Friday",sat:"Saturday",sun:"Sunday"},copyright:t=>`© ${t} HifiPlanet. All information without guarantee.`,imprint:"Legal notice",privacy:"Privacy",terms:"Terms",cookieSettings:"Cookie settings"},cookieConsent:{bannerText:"We only use technically necessary cookies. For Google Maps, YouTube videos and analytics cookies we need your additional consent, since data is transferred to Google in that case.",moreInfo:"More details in our",privacyPolicy:"privacy policy",settings:"Settings",onlyNecessary:"Necessary only",acceptAll:"Accept all",modalTitle:"Cookie settings",modalIntro:"Choose which categories you want to allow. More details in our",necessaryTitle:"Necessary",necessaryDesc:"Required to operate the website (e.g. login session, theme and cookie preference). Cannot be disabled.",externalTitle:"External media",externalDesc:"Google Maps and YouTube videos. Loading them transfers data (including your IP address) to Google.",analyticsTitle:"Analytics",analyticsDesc:"Google Analytics helps us understand how the website is used. This transfers data to Google.",cancel:"Cancel",saveSelection:"Save selection"},maintenance:{title:"Under maintenance",defaultMessage:"This area is currently being updated. Please check back shortly.",login:"Log in"},lightbox:{close:"Close",previous:"Previous image",next:"Next image"},home:{metaTitle:"Custom Car-Hifi Installations",metaDescription:"HifiPlanet – your car-hifi specialist in Amorbach, Germany. Choose your make and model, discover matching sound packages and get in touch, no obligation.",stickyCta:"Ready for your sound upgrade?",selectVehicle:"Select vehicle",getInTouch:"Get in touch",welcome:"Welcome to HifiPlanet",heroTitle:"Home of pure Sound",heroSubtitle:"Your car-hifi specialist for custom sound installations. Choose your vehicle, discover the right package and get in touch, no obligation – we take care of the rest.",stats:[{value:"20+",label:"years of experience"},{value:"Huge",label:"in-house 3D print farm"},{value:"In-house",label:"CNC & laser workshop"},{value:"International",label:"recognized car-hifi specialist"}],brandsHeading:"Brands we work with",youtubeBadge:"HifiPlanet presents",youtubeTitle:"The craft behind your sound",youtubeText:"Discover the artistry behind our work",youtubeCta:"Watch now",heroImageAlt:"Ground Zero subwoofer and amplifiers with purple ambient lighting",craftImageAlt:"Custom subwoofer build",adviceImageAlt:"Amplifier installation with ambient lighting",moreImageAlt:"High-end amplifier and subwoofer, studio shot",craftEyebrow:"Craftsmanship",craftTitle:"Precision work in every detail",craftText:"Whether custom-built subwoofer enclosures, integrated lighting or invisibly routed cabling – our own CNC, laser and 3D-printing production means we can build solutions you simply can't buy off the shelf.",adviceEyebrow:"Consultation",adviceTitle:"From the first idea to the final touch",adviceText:"Every vehicle and every requirement is different. That's why we advise you personally and without obligation – from a subtle upgrade to an uncompromising high-end system.",insightsTitle:"A look at our installations",insightsText:"From subtle sound upgrades to elaborate full installations – handcrafted in our workshop in Amorbach.",galleryAlts:["Custom subwoofer build with Ground Zero bass drivers","Amplifier installation with purple ambient lighting","Tweeter and midrange installation by Focal Utopia","Sony navigation system with Apple CarPlay in the cockpit","Installed tweeter in the trunk","Custom subwoofer installation with LED lighting in the trunk"],reviewsRating:"Rated 5.0 by 181 customers",reviewsRatingDynamic:(t,e)=>`Rated ${t.toFixed(1)} by ${e} customers`,reviewsText:"Here's what our customers say about us.",reviewsLink:"See all reviews on Google →",testimonials:[{name:"Thomas K.",text:"Found this gem through YouTube. Advice and recommendations are top-notch – the Tesla demo car reignited my passion for great sound."},{name:"Andreas I.",text:"Very professional advice and service. Even though I switched from VAG to Mercedes, everything was adapted smoothly. The 3-way speakers and two subwoofers deliver outstanding performance."},{name:"Thomas F.",text:"The complete Audi A4 B9 build exceeded my expectations. Professional from start to finish, with flawless workmanship and sound quality."},{name:"Drago G.",text:"Impressed by the CNC work shown on YouTube. Started with 3D-printed speaker rings for my Ford Mustang – it turned into a much bigger project."},{name:"Leonardo B.",text:"Great service and masterful craftsmanship. Clean installation, passion visible in every detail."},{name:"Marcel S.",text:"Unbeatable value for money. The team took a lot of time to find the exact solution for my budget."},{name:"Julia W.",text:"Finally a shop that takes motorhomes seriously too. The sound system in our camper now sounds like a living room."},{name:"Kevin R.",text:"Dash cam and alarm system installed cleanly in a single appointment, no visible cables. Highly recommended for anyone who values quality workmanship."},{name:"Sabrina H.",text:"My classic car now has modern sound without compromising the original look. Exactly what I was looking for."},{name:"Niklas P.",text:"From the first inquiry to the finished build, everything went smoothly. Honest advice with no sales pressure."}],moreTitle:"More than just car-hifi",moreText:"Besides custom sound installations, we also offer CNC machining, laser technology, 3D printing and more – all from a single source in our own workshop.",moreCta:"Discover all our services",faqHeading:"Frequently asked questions"},vehicleSelect:{metaTitle:"Select your vehicle",metaDescription:"Choose your vehicle make and model and discover matching car-hifi sound packages from HifiPlanet.",title:"Select your vehicle",intro:"Choose your make first, then your model – we'll show you the matching sound packages right away.",empty:"No brands have been added yet."},brandPage:{metaTitleFallback:"Select a model",metaDescription:t=>`Choose your ${t} model and discover matching car-hifi sound packages from HifiPlanet.`,loading:"Loading…",breadcrumbVehicles:"Vehicles",titleSuffix:"Select a model",empty:"No models have been added for this brand yet."},modelPage:{metaTitleFallback:"Sound packages",metaTitle:(t,e)=>`${t} ${e} sound packages`,metaDescription:(t,e)=>`Car-hifi sound packages for the ${t} ${e} including current prices – get in touch with HifiPlanet, no obligation.`,loading:"Loading…",breadcrumbVehicles:"Vehicles",titleSuffix:"Sound packages",empty:"No packages have been added for this model yet.",totalPrice:"from approx.",productLoading:"Loading product…",requestContact:"Request contact",featuredBadge:"Recommended",moreBullets:t=>t===1?"+ 1 more feature":`+ ${t} more features`,lessBullets:"Show less",wheelHint:"Scroll to browse"},leistungen:{metaTitle:"Services",metaDescription:"Car-hifi, motorhomes & caravans, classic cars, CNC machining, laser technology, 3D printing, alarm systems and dash cams – all from a single source at HifiPlanet in Amorbach.",title:"Our services",intro:"From custom sound installations to our own CNC and 3D-printing production – all from a single source in our workshop in Amorbach.",notListedTitle:"Don't see your project?",notListedText:"Just get in touch – we'll find the right solution together.",contact:"Get in touch"},contactPage:{metaTitle:"Contact",metaDescription:"Get in touch with HifiPlanet in Amorbach for your custom car-hifi project – we're happy to advise you, no obligation.",title:"Get in touch",heroEyebrow:"Contact",heroTitlePre:"Talk",heroTitleAccent:"to",heroTitlePost:"us.",heroSubtitle:"Whether it's a system, installation, or sound tuning for your car — write to us, we'll get back to you as soon as possible.",packageBoxTitle:"Your inquiry relates to",formTitle:"Send inquiry",sentTitle:"Inquiry sent ✓",sentText:"Thanks! We'll get back to you within one business day.",contextIntro:"Your inquiry relates to:",contextBrand:"Brand",contextModel:"Model",contextPackage:"Package",contextProduct:"Product",packagePrice:"Package price",upgrades:"Upgrades",optionalUpgrades:"Optional upgrades",totalWithUpgrades:"Total incl. upgrades",nameLabel:"Name *",namePlaceholder:"Max Mustermann",emailLabel:"Email *",emailPlaceholder:"max@mail.de",phoneLabel:"Phone",phonePlaceholder:"Optional",vinLabel:"Vehicle identification number (VIN)",vinPlaceholder:"Optional – helps us assess your vehicle",messageLabel:"Message",messagePlaceholder:"Tell us about your project – vehicle, desired sound, budget …",requiredHint:"* Required fields",sending:"Sending…",submit:"Send inquiry",cardTitle:"HiFi Planet Amorbach",address:"Address",phone:"Phone",email:"Email",hours:"Opening hours",hoursWeek:"Mon–Fri: 9:00 AM–6:00 PM",hoursSat:"Sat: 10:00 AM–1:00 PM",hoursWeekDays:"Mon–Fri",hoursWeekTime:"9:00 AM – 6:00 PM",hoursSatDay:"Sat",hoursSatTime:"10:00 AM – 1:00 PM",directionsTitle:"Directions",mapEmbedName:"The Google Maps map",mapOpenChip:"Open in Maps",routePlan:"Get directions",featurePremiumTitle:"Premium Sound",featurePremiumSub:"Highest quality",featureGermanyTitle:"Made in Germany",featureGermanySub:"Precision craftsmanship",featureIndividualTitle:"Custom-built",featureIndividualSub:"Tailored solutions",featureExpertsTitle:"Expert Team",featureExpertsSub:"Passion & know-how"},galleryOverview:{metaTitle:"Photo gallery",metaDescription:"A look at our car-hifi installations – sorted by brand. Choose a brand and explore the projects.",title:"Photo gallery",intro:"Choose a brand and explore our installations in detail.",loading:"Loading…",empty:"No gallery brands have been added yet."},galleryBrandPage:{metaTitleFallback:"Photo gallery",metaTitle:t=>`${t} installations`,metaDescription:t=>`A look at our ${t} car-hifi installations.`,loading:"Loading…",breadcrumbGallery:"Gallery",titleSuffix:"Select a project",empty:"No projects have been added for this brand yet."},galleryProjectPage:{metaTitleFallback:"Photo gallery",metaDescription:t=>`Photos of our ${t} installation.`,loading:"Loading…",breadcrumbGallery:"Gallery",empty:"No photos have been added for this project yet.",enlargeImage:"Enlarge image"}},Bc={de:L3,en:R3};function _3(){const t=localStorage.getItem("hifi-lang");return t==="de"||t==="en"?t:(navigator.language||"de").toLowerCase().startsWith("de")?"de":"en"}function Zp(t,e){return e.split(".").reduce((n,r)=>n==null?void 0:n[r],t)}const uN=v.createContext({language:"de",setLanguage:()=>{},toggleLanguage:()=>{},t:t=>{const e=Zp(Bc.de,t);return e!==void 0?e:t}});function qy({children:t}){const[e,n]=v.useState(_3);v.useEffect(()=>{document.documentElement.setAttribute("lang",e),localStorage.setItem("hifi-lang",e)},[e]);const r=()=>n(i=>i==="de"?"en":"de"),s=i=>{const o=Bc[e]||Bc.de,a=Zp(o,i);if(a!==void 0)return a;const l=Zp(Bc.de,i);return l!==void 0?l:i};return c.jsx(uN.Provider,{value:{language:e,setLanguage:n,toggleLanguage:r,t:s},children:t})}function ct(){return v.useContext(uN)}function dN({overHero:t=!1,forceDark:e=!1}){const{theme:n,toggleTheme:r}=D3(),{t:s}=ct();return c.jsx("button",{onClick:r,"aria-label":s("themeToggle.label"),className:`rounded-full p-2 transition ${t?"text-white hover:bg-white/10":e?"text-neutral-300 hover:bg-neutral-800":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:n==="dark"?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:c.jsx("path",{d:"M12 3a1 1 0 011 1v1a1 1 0 11-2 0V4a1 1 0 011-1zm0 15a5 5 0 100-10 5 5 0 000 10zm9-6a1 1 0 010 2h-1a1 1 0 110-2h1zM4 12a1 1 0 010 2H3a1 1 0 110-2h1zm14.36-7.36a1 1 0 011.42 1.42l-.71.7a1 1 0 11-1.41-1.4l.7-.72zM5.64 18.36a1 1 0 011.41 1.41l-.7.71a1 1 0 11-1.42-1.41l.71-.71zm12.72 0l.71.7a1 1 0 11-1.41 1.42l-.71-.71a1 1 0 011.41-1.41zM6.34 5.64l-.7-.7A1 1 0 117.05 3.5l.7.71A1 1 0 016.34 5.64zM12 6a1 1 0 011-1v0a1 1 0 01-1 1zm0 12a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1z"})}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:c.jsx("path",{fillRule:"evenodd",d:"M9.53 2.25a.75.75 0 01.19.82 8.25 8.25 0 0011.03 11.03.75.75 0 011.01.99A10.5 10.5 0 1112.9 2.1a.75.75 0 011.63-.85z",clipRule:"evenodd"})})})}function bt({name:t,className:e="h-6 w-6",...n}){return t?c.jsx(Y2,{name:t,className:e,...n}):null}const hN=v.createContext(null);function I3({children:t}){const[e,n]=v.useState(null),[r,s]=v.useState(!0);v.useEffect(()=>{A.get("/auth/me").then(d=>n(d.authenticated===!1?null:d)).catch(()=>n(null)).finally(()=>s(!1))},[]);const i=async(d,h)=>{const f=await A.post("/auth/login",{username:d,password:h});return f.requires_2fa?{requires2fa:!0}:(n(f),{requires2fa:!1})},o=async d=>{const h=await A.post("/auth/verify-2fa",{code:d});n(h)},a=async()=>{await A.post("/auth/logout",{}),n(null)},l=async()=>{const d=await A.get("/auth/me");n(d.authenticated===!1?null:d)},u=d=>{var h;return!!e&&(e.is_super_admin||((h=e.permissions)==null?void 0:h.includes(d)))};return c.jsx(hN.Provider,{value:{user:e,loading:r,login:i,verifyTwoFactor:o,logout:a,refreshUser:l,hasPermission:u},children:t})}function jn(){return v.useContext(hN)}const fN=v.createContext({phone:"09373 20 62 390",whatsapp:null,contact_email:"info@hifi-planet-amorbach.de",address_street:"Boxbrunner Str. 20a",address_zip:"63916",address_city:"Amorbach",logo_path:null,logo_dark_path:null,business_hours:null,hero_image_path:null,ga_measurement_id:null,gallery_card_text_x:0,gallery_card_text_y:100,site_font:null}),O3=fN.Provider;function ls(){return v.useContext(fN)}const Eu="/assets/logo-dark-R-ckaBhx.png",B3="https://www.audio4cars.de/",Jy=t=>(t||"").replace(/[^\d+]/g,""),Yy=70,z3=500;function F3({className:t}){return c.jsxs("svg",{viewBox:"0 0 3 2",className:t,"aria-hidden":"true",children:[c.jsx("rect",{width:"3",height:"0.667",y:"0",fill:"#000"}),c.jsx("rect",{width:"3",height:"0.667",y:"0.667",fill:"#D00"}),c.jsx("rect",{width:"3",height:"0.666",y:"1.334",fill:"#FFCE00"})]})}function V3({className:t}){return c.jsxs("svg",{viewBox:"0 0 60 30",className:t,"aria-hidden":"true",children:[c.jsx("clipPath",{id:"fgb-t",children:c.jsx("path",{d:"M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"})}),c.jsx("path",{d:"M0,0 v30 h60 v-30 z",fill:"#00247d"}),c.jsx("path",{d:"M0,0 L60,30 M60,0 L0,30",stroke:"#fff",strokeWidth:"6"}),c.jsx("path",{d:"M0,0 L60,30 M60,0 L0,30",clipPath:"url(#fgb-t)",stroke:"#cf142b",strokeWidth:"4"}),c.jsx("path",{d:"M30,0 v30 M0,15 h60",stroke:"#fff",strokeWidth:"10"}),c.jsx("path",{d:"M30,0 v30 M0,15 h60",stroke:"#cf142b",strokeWidth:"6"})]})}const Zh=[{code:"de",label:"Deutsch",Flag:F3},{code:"en",label:"English",Flag:V3}];function $3({overHero:t=!1}){const{language:e,setLanguage:n,t:r}=ct(),[s,i]=v.useState(!1),o=v.useRef(null),a=Zh.find(l=>l.code===e)||Zh[0];return v.useEffect(()=>{if(!s)return;const l=d=>{o.current&&!o.current.contains(d.target)&&i(!1)},u=d=>{d.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",l),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",u)}},[s]),c.jsxs("div",{className:"relative",ref:o,children:[c.jsxs("button",{type:"button",onClick:()=>i(l=>!l),"aria-haspopup":"listbox","aria-expanded":s,"aria-label":r("languageToggle.label"),className:`flex items-center gap-1 rounded-full p-1.5 transition ${t?"hover:bg-white/10":"hover:bg-neutral-800"}`,children:[c.jsx("span",{className:`block h-4 w-6 shrink-0 overflow-hidden rounded-[3px] ring-1 ${t?"ring-white/50":"ring-neutral-600"}`,children:c.jsx(a.Flag,{className:"h-full w-full"})}),c.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:`h-3 w-3 transition-transform ${t?"text-white/70":"text-neutral-400"} ${s?"rotate-180":""}`,children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"})})]}),s&&c.jsx("div",{role:"listbox",className:"absolute right-0 z-50 mt-2 min-w-[9rem] overflow-hidden rounded-lg border border-neutral-700 bg-neutral-900 py-1 shadow-lg",children:Zh.map(l=>c.jsxs("button",{type:"button",role:"option","aria-selected":l.code===e,onClick:()=>{n(l.code),i(!1)},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition hover:bg-neutral-800 ${l.code===e?"font-semibold text-brand-400":"text-neutral-200"}`,children:[c.jsx("span",{className:"block h-4 w-6 shrink-0 overflow-hidden rounded-[3px] ring-1 ring-neutral-600",children:c.jsx(l.Flag,{className:"h-full w-full"})}),l.label]},l.code))})]})}function H3(){const[t,e]=v.useState(!1),[n,r]=v.useState(!1),[s,i]=v.useState(!1),{user:o}=jn(),{phone:a,whatsapp:l,logo_dark_path:u}=ls(),{t:d}=ct(),h=l?8:7,p=cn().pathname==="/",[m,g]=v.useState(!p);v.useEffect(()=>{if(!p){g(!0);return}const w=()=>g(window.scrollY>24);return w(),window.addEventListener("scroll",w,{passive:!0}),()=>window.removeEventListener("scroll",w)},[p]);const x=p&&!m;v.useEffect(()=>{if(t){r(!0);let j;const S=requestAnimationFrame(()=>{j=requestAnimationFrame(()=>i(!0))});return()=>{cancelAnimationFrame(S),j&&cancelAnimationFrame(j)}}i(!1);const w=z3+(h-1)*Yy,C=setTimeout(()=>r(!1),w);return()=>clearTimeout(C)},[t,h]);const y=()=>`transition-all duration-500 ease-out ${s?"opacity-100":"opacity-0"}`,b=w=>({transitionDelay:`${(s?w:h-1-w)*Yy}ms`,transform:s?"translateY(0)":"translateY(-140px)"}),k=o&&c.jsx(ne,{to:"/admin","aria-label":d("nav.adminPanel"),title:d("nav.adminPanel"),className:`rounded-full p-2 transition ${x?"text-white hover:bg-white/10":"text-neutral-300 hover:bg-neutral-800"}`,children:c.jsx(bt,{name:"layout-dashboard",className:"h-5 w-5"})});return c.jsxs("header",{className:`sticky top-0 z-30 border-b transition-colors duration-300 ${x?"border-transparent bg-transparent":"border-neutral-800 bg-neutral-950/90 backdrop-blur"}`,children:[c.jsxs("div",{className:"mx-auto grid max-w-6xl grid-cols-[1fr_auto_1fr] items-center gap-3 px-4 py-3 sm:px-6",children:[c.jsx("div",{className:"flex items-center justify-self-start",children:c.jsx("button",{onClick:()=>e(!0),"aria-label":d("nav.openMenu"),className:`rounded-md p-2 transition ${x?"text-white hover:bg-white/10":"text-neutral-300 hover:bg-neutral-800"}`,children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-6 w-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),c.jsx(ne,{to:"/",className:"flex items-center justify-self-center rounded-lg px-2 py-1",children:c.jsx("img",{src:u||Eu,alt:"HifiPlanet",className:"h-14 w-auto sm:h-16"})}),c.jsxs("div",{className:"flex items-center justify-self-end gap-1",children:[k,!t&&c.jsx($3,{overHero:x}),c.jsx(dN,{overHero:x,forceDark:!0})]})]}),n&&Gd.createPortal(c.jsx("div",{className:"fixed inset-0 z-[100] overflow-y-auto text-left backdrop-blur-xl",style:{background:"linear-gradient(135deg, rgba(241,245,249,0.55) 0%, rgba(227,240,207,0.55) 50%, rgba(248,250,252,0.55) 100%)"},children:c.jsxs("div",{className:"relative mx-auto flex min-h-full max-w-6xl flex-col items-start justify-center gap-5 py-24 pl-6 pr-8 sm:pl-8",children:[c.jsxs("button",{onClick:()=>e(!1),"aria-label":d("nav.closeMenu"),className:"absolute left-6 top-8 flex items-center gap-2 text-neutral-600 hover:text-brand-600 sm:left-8 sm:top-[65px]",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-6 w-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6l12 12M18 6 6 18"})}),c.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:d("nav.close")})]}),c.jsx(ne,{to:"/fahrzeuge",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${y()}`,style:b(0),children:d("nav.vehicles")}),c.jsx(ne,{to:"/leistungen",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${y()}`,style:b(1),children:d("nav.services")}),c.jsx(ne,{to:"/galerie",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${y()}`,style:b(2),children:d("nav.gallery")}),c.jsx(ne,{to:"/kontakt",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${y()}`,style:b(3),children:d("nav.contact")}),c.jsx("div",{className:`h-px w-16 bg-brand-500/60 ${y()}`,style:b(4)}),a&&c.jsxs("a",{href:`tel:${Jy(a)}`,className:`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${y()}`,style:b(5),children:[c.jsx(bt,{name:"phone",className:"h-4 w-4"}),a]}),l&&c.jsxs("a",{href:`https://wa.me/${Jy(l).replace(/^0/,"49").replace("+","")}`,target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${y()}`,style:b(6),children:[c.jsx(bt,{name:"message-circle",className:"h-4 w-4"}),d("nav.whatsapp")]}),c.jsxs("a",{href:B3,target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${y()}`,style:b(l?7:6),children:[c.jsx(bt,{name:"shopping-bag",className:"h-4 w-4"}),d("nav.shop")]})]})}),document.body)]})}const Xy="hifiplanet-cookie-consent",pN={necessary:!0,external:!1,analytics:!1},mN=v.createContext({consent:pN,decided:!1,settingsOpen:!1,acceptAll:()=>{},rejectNonEssential:()=>{},saveCustom:()=>{},openSettings:()=>{},closeSettings:()=>{}});function W3({children:t}){const[e,n]=v.useState(pN),[r,s]=v.useState(!1),[i,o]=v.useState(!1);v.useEffect(()=>{try{const p=localStorage.getItem(Xy);if(p){const m=JSON.parse(p);n({necessary:!0,external:!!m.external,analytics:!!m.analytics}),s(!0)}}catch{}},[]);const a=v.useCallback(p=>{n(p),s(!0),o(!1),localStorage.setItem(Xy,JSON.stringify({...p,decidedAt:new Date().toISOString()}))},[]),l=v.useCallback(()=>a({necessary:!0,external:!0,analytics:!0}),[a]),u=v.useCallback(()=>a({necessary:!0,external:!1,analytics:!1}),[a]),d=v.useCallback(p=>a({necessary:!0,external:!!p.external,analytics:!!p.analytics}),[a]),h=v.useCallback(()=>o(!0),[]),f=v.useCallback(()=>o(!1),[]);return c.jsx(mN.Provider,{value:{consent:e,decided:r,settingsOpen:i,acceptAll:l,rejectNonEssential:u,saveCustom:d,openSettings:h,closeSettings:f},children:t})}function yo(){return v.useContext(mN)}const U3=["mon","tue","wed","thu","fri","sat","sun"],K3=["sun","mon","tue","wed","thu","fri","sat"],Qh={mon:"Mo",tue:"Di",wed:"Mi",thu:"Do",fri:"Fr",sat:"Sa",sun:"So"};function G3(t){const e=new Date,n=t==null?void 0:t[K3[e.getDay()]];if(!n||n.closed||!n.open||!n.close)return!1;const r=e.getHours()*60+e.getMinutes(),[s,i]=n.open.split(":").map(Number),[o,a]=n.close.split(":").map(Number);return r>=s*60+i&&r<o*60+a}function q3(t){return!t||t.closed||!t.open||!t.close?null:`${t.open} – ${t.close} Uhr`}function gN(t,e="Geschlossen"){const n=[];return U3.forEach(r=>{const s=q3(t==null?void 0:t[r])||e,i=n[n.length-1];i&&i.label===s?i.days=`${i.firstLabel}-${Qh[r]}`:n.push({key:r,days:Qh[r],firstLabel:Qh[r],label:s})}),n}const J3=t=>(t||"").replace(/[^\d+]/g,"");function Y3(){const{phone:t,contact_email:e,address_street:n,address_zip:r,address_city:s,business_hours:i}=ls(),o=G3(i),{openSettings:a}=yo(),{pathname:l}=cn(),u=l==="/",{t:d}=ct(),h=[n,[r,s].filter(Boolean).join(" ")].filter(Boolean).join(", "),f=`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(h)}`,p=gN(i,d("footer.closed"));return c.jsxs("footer",{className:`border-t border-neutral-200 bg-neutral-50 py-10 text-sm text-neutral-600 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-300 ${u?"pb-24":""}`,children:[c.jsxs("div",{className:"mx-auto grid max-w-6xl gap-4 px-4 sm:grid-cols-3 sm:px-6",children:[c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[c.jsx(bt,{name:"map-pin",className:"h-4 w-4 text-brand-500"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:"HifiPlanet"})]}),n&&c.jsx("p",{children:n}),(r||s)&&c.jsx("p",{children:[r,s].filter(Boolean).join(" ")}),c.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"mt-4 flex items-center justify-center gap-1.5 rounded-md bg-brand-500 px-3 py-2 text-xs font-semibold text-white hover:bg-brand-600",children:[c.jsx(bt,{name:"navigation",className:"h-3.5 w-3.5"}),d("footer.routePlan")]})]}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[c.jsx(bt,{name:"phone",className:"h-4 w-4 text-brand-500"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:d("footer.contactHeading")})]}),c.jsx("p",{children:c.jsx("a",{href:`tel:${J3(t)}`,className:"inline-block py-1 hover:text-brand-500",children:t})}),c.jsx("p",{children:c.jsx("a",{href:`mailto:${e}`,className:"inline-block py-1 hover:text-brand-500",children:e})}),c.jsx(ne,{to:"/kontakt",className:"mt-4 flex items-center justify-center gap-1.5 rounded-md border border-neutral-300 px-3 py-2 text-xs font-semibold text-neutral-700 hover:border-brand-500 hover:text-brand-600 dark:border-neutral-700 dark:text-neutral-200",children:d("footer.contactForm")})]}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(bt,{name:"clock",className:"h-4 w-4 text-brand-500"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:d("footer.hoursHeading")})]}),c.jsxs("span",{className:`flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-semibold ${o?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300":"bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"}`,children:[c.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${o?"bg-green-500":"bg-neutral-400"}`}),d(o?"footer.open":"footer.closed")]})]}),c.jsx("dl",{className:"space-y-1.5",children:p.map(m=>c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("dt",{className:"text-neutral-500 dark:text-neutral-400",children:m.days}),c.jsx("dd",{className:"font-medium text-neutral-700 dark:text-neutral-200",children:m.label})]},m.key))})]})]}),c.jsx("div",{className:"mx-auto mt-8 max-w-6xl border-t border-neutral-200 px-4 pt-6 text-center text-xs text-neutral-500 dark:border-neutral-800 dark:text-neutral-400 sm:px-6",children:c.jsxs("p",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:[c.jsx("span",{children:d("footer.copyright")(new Date().getFullYear())}),c.jsx("span",{children:"·"}),c.jsx(ne,{to:"/impressum",className:"hover:text-brand-500",children:d("footer.imprint")}),c.jsx("span",{children:"·"}),c.jsx(ne,{to:"/datenschutz",className:"hover:text-brand-500",children:d("footer.privacy")}),c.jsx("span",{children:"·"}),c.jsx(ne,{to:"/agb",className:"hover:text-brand-500",children:d("footer.terms")}),c.jsx("span",{children:"·"}),c.jsx("button",{type:"button",onClick:a,className:"hover:text-brand-500",children:d("footer.cookieSettings")})]})})]})}const u0=v.createContext({});function es(t){const e=v.useRef(null);return e.current===null&&(e.current=t()),e.current}const X3=typeof window<"u",gl=X3?v.useLayoutEffect:v.useEffect,Zd=v.createContext(null);function d0(t,e){t.indexOf(e)===-1&&t.push(e)}function Tu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Cn=(t,e,n)=>n>e?e:n<t?t:n;let h0=()=>{};const ts={},xN=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),yN=t=>typeof t=="object"&&t!==null,bN=t=>/^0[^.\s]+$/u.test(t);function vN(t){let e;return()=>(e===void 0&&(e=t()),e)}const Rt=t=>t,xl=(...t)=>t.reduce((e,n)=>r=>n(e(r))),Yi=(t,e,n)=>{const r=e-t;return r?(n-t)/r:1};class f0{constructor(){this.subscriptions=[]}add(e){return d0(this.subscriptions,e),()=>Tu(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ft=t=>t*1e3,tn=t=>t/1e3,p0=(t,e)=>e?t*(1e3/e):0,kN=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Z3=1e-7,Q3=12;function eD(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=kN(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>Z3&&++a<Q3);return o}function yl(t,e,n,r){if(t===e&&n===r)return Rt;const s=i=>eD(i,0,1,t,n);return i=>i===0||i===1?i:kN(s(i),e,r)}const wN=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,SN=t=>e=>1-t(1-e),NN=yl(.33,1.53,.69,.99),m0=SN(NN),CN=wN(m0),jN=t=>t>=1?1:(t*=2)<1?.5*m0(t):.5*(2-Math.pow(2,-10*(t-1))),g0=t=>1-Math.sin(Math.acos(t)),EN=SN(g0),TN=wN(g0),tD=yl(.42,0,1,1),nD=yl(0,0,.58,1),MN=yl(.42,0,.58,1),rD=t=>Array.isArray(t)&&typeof t[0]!="number",PN=t=>Array.isArray(t)&&typeof t[0]=="number",sD={linear:Rt,easeIn:tD,easeInOut:MN,easeOut:nD,circIn:g0,circInOut:TN,circOut:EN,backIn:m0,backInOut:CN,backOut:NN,anticipate:jN},iD=t=>typeof t=="string",Zy=t=>{if(PN(t)){h0(t.length===4);const[e,n,r,s]=t;return yl(e,n,r,s)}else if(iD(t))return sD[t];return t},Ql=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function oD(t){let e=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){i.has(u)&&(l.schedule(u),t()),u(o)}const l={schedule:(u,d=!1,h=!1)=>{const p=h&&r?e:n;return d&&i.add(u),p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0;const d=e;e=n,n=d,e.forEach(a),e.clear(),r=!1,s&&(s=!1,l.process(u))}};return l}const aD=40;function AN(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Ql.reduce((k,w)=>(k[w]=oD(i),k),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:d,update:h,preRender:f,render:p,postRender:m}=o,g=()=>{const k=ts.useManualTiming,w=k?s.timestamp:performance.now();n=!1,k||(s.delta=r?1e3/60:Math.max(Math.min(w-s.timestamp,aD),1)),s.timestamp=w,s.isProcessing=!0,a.process(s),l.process(s),u.process(s),d.process(s),h.process(s),f.process(s),p.process(s),m.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(g))},x=()=>{n=!0,r=!0,s.isProcessing||t(g)};return{schedule:Ql.reduce((k,w)=>{const C=o[w];return k[w]=(j,S=!1,N=!1)=>(n||x(),C.schedule(j,S,N)),k},{}),cancel:k=>{for(let w=0;w<Ql.length;w++)o[Ql[w]].cancel(k)},state:s,steps:o}}const{schedule:le,cancel:ln,state:Je,steps:ef}=AN(typeof requestAnimationFrame<"u"?requestAnimationFrame:Rt,!0);let zc;function lD(){zc=void 0}const vt={now:()=>(zc===void 0&&vt.set(Je.isProcessing||ts.useManualTiming?Je.timestamp:performance.now()),zc),set:t=>{zc=t,queueMicrotask(lD)}},DN=t=>e=>typeof e=="string"&&e.startsWith(t),LN=DN("--"),cD=DN("var(--"),x0=t=>cD(t)?uD.test(t.split("/*")[0].trim()):!1,uD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Qy(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const bo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ga={...bo,transform:t=>Cn(0,1,t)},ec={...bo,default:1},aa=t=>Math.round(t*1e5)/1e5,y0=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dD(t){return t==null}const hD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,b0=(t,e)=>n=>!!(typeof n=="string"&&hD.test(n)&&n.startsWith(t)||e&&!dD(n)&&Object.prototype.hasOwnProperty.call(n,e)),RN=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(y0);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},fD=t=>Cn(0,255,t),tf={...bo,transform:t=>Math.round(fD(t))},Cs={test:b0("rgb","red"),parse:RN("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+tf.transform(t)+", "+tf.transform(e)+", "+tf.transform(n)+", "+aa(Ga.transform(r))+")"};function pD(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Qp={test:b0("#"),parse:pD,transform:Cs.transform},bl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Gn=bl("deg"),zn=bl("%"),G=bl("px"),mD=bl("vh"),gD=bl("vw"),eb={...zn,parse:t=>zn.parse(t)/100,transform:t=>zn.transform(t*100)},Pi={test:b0("hsl","hue"),parse:RN("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+zn.transform(aa(e))+", "+zn.transform(aa(n))+", "+aa(Ga.transform(r))+")"},Be={test:t=>Cs.test(t)||Qp.test(t)||Pi.test(t),parse:t=>Cs.test(t)?Cs.parse(t):Pi.test(t)?Pi.parse(t):Qp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Cs.transform(t):Pi.transform(t),getAnimatableNone:t=>{const e=Be.parse(t);return e.alpha=0,Be.transform(e)}},xD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function yD(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(y0))==null?void 0:e.length)||0)+(((n=t.match(xD))==null?void 0:n.length)||0)>0}const _N="number",IN="color",bD="var",vD="var(",tb="${}",kD=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Xi(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(kD,l=>(Be.test(l)?(r.color.push(i),s.push(IN),n.push(Be.parse(l))):l.startsWith(vD)?(r.var.push(i),s.push(bD),n.push(l)):(r.number.push(i),s.push(_N),n.push(parseFloat(l))),++i,tb)).split(tb);return{values:n,split:a,indexes:r,types:s}}function wD(t){return Xi(t).values}function ON({split:t,types:e}){const n=t.length;return r=>{let s="";for(let i=0;i<n;i++)if(s+=t[i],r[i]!==void 0){const o=e[i];o===_N?s+=aa(r[i]):o===IN?s+=Be.transform(r[i]):s+=r[i]}return s}}function SD(t){return ON(Xi(t))}const ND=t=>typeof t=="number"?0:Be.test(t)?Be.getAnimatableNone(t):t,CD=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:ND(t);function jD(t){const e=Xi(t);return ON(e)(e.values.map((r,s)=>CD(r,e.split[s])))}const wn={test:yD,parse:wD,createTransformer:SD,getAnimatableNone:jD};function nf(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function ED({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=nf(l,a,t+1/3),i=nf(l,a,t),o=nf(l,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Mu(t,e){return n=>n>0?e:t}const xe=(t,e,n)=>t+(e-t)*n,rf=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},TD=[Qp,Cs,Pi],MD=t=>TD.find(e=>e.test(t));function nb(t){const e=MD(t);if(!e)return!1;let n=e.parse(t);return e===Pi&&(n=ED(n)),n}const rb=(t,e)=>{const n=nb(t),r=nb(e);if(!n||!r)return Mu(t,e);const s={...n};return i=>(s.red=rf(n.red,r.red,i),s.green=rf(n.green,r.green,i),s.blue=rf(n.blue,r.blue,i),s.alpha=xe(n.alpha,r.alpha,i),Cs.transform(s))},em=new Set(["none","hidden"]);function PD(t,e){return em.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function AD(t,e){return n=>xe(t,e,n)}function v0(t){return typeof t=="number"?AD:typeof t=="string"?x0(t)?Mu:Be.test(t)?rb:RD:Array.isArray(t)?BN:typeof t=="object"?Be.test(t)?rb:DD:Mu}function BN(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>v0(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function DD(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=v0(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function LD(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],o=t.indexes[i][r[i]],a=t.values[o]??0;n[s]=a,r[i]++}return n}const RD=(t,e)=>{const n=wn.createTransformer(e),r=Xi(t),s=Xi(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?em.has(t)&&!s.values.length||em.has(e)&&!r.values.length?PD(t,e):xl(BN(LD(r,s),s.values),n):Mu(t,e)};function zN(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?xe(t,e,n):v0(t)(t,e)}const _D=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>le.update(e,n),stop:()=>ln(e),now:()=>Je.isProcessing?Je.timestamp:vt.now()}},FN=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=Math.round(t(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Pu=2e4;function k0(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Pu;)e+=n,r=t.next(e);return e>=Pu?1/0:e}function ID(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(k0(r),Pu);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:tn(s)}}const Ae={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function tm(t,e){return t*Math.sqrt(1-e*e)}const OD=12;function BD(t,e,n){let r=n;for(let s=1;s<OD;s++)r=r-t(r)/e(r);return r}const sf=.001;function zD({duration:t=Ae.duration,bounce:e=Ae.bounce,velocity:n=Ae.velocity,mass:r=Ae.mass}){let s,i,o=1-e;o=Cn(Ae.minDamping,Ae.maxDamping,o),t=Cn(Ae.minDuration,Ae.maxDuration,tn(t)),o<1?(s=u=>{const d=u*o,h=d*t,f=d-n,p=tm(u,o),m=Math.exp(-h);return sf-f/p*m},i=u=>{const h=u*o*t,f=h*n+n,p=Math.pow(o,2)*Math.pow(u,2)*t,m=Math.exp(-h),g=tm(Math.pow(u,2),o);return(-s(u)+sf>0?-1:1)*((f-p)*m)/g}):(s=u=>{const d=Math.exp(-u*t),h=(u-n)*t+1;return-sf+d*h},i=u=>{const d=Math.exp(-u*t),h=(n-u)*(t*t);return d*h});const a=5/t,l=BD(s,i,a);if(t=Ft(t),isNaN(l))return{stiffness:Ae.stiffness,damping:Ae.damping,duration:t};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const FD=["duration","bounce"],VD=["stiffness","damping","mass"];function sb(t,e){return e.some(n=>t[n]!==void 0)}function $D(t){let e={velocity:Ae.velocity,stiffness:Ae.stiffness,damping:Ae.damping,mass:Ae.mass,isResolvedFromDuration:!1,...t};if(!sb(t,VD)&&sb(t,FD))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Cn(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Ae.mass,stiffness:s,damping:i}}else{const n=zD({...t,velocity:0});e={...e,...n,mass:Ae.mass},e.isResolvedFromDuration=!0}return e}function Au(t=Ae.visualDuration,e=Ae.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:h,velocity:f,isResolvedFromDuration:p}=$D({...n,velocity:-tn(n.velocity||0)}),m=f||0,g=u/(2*Math.sqrt(l*d)),x=o-i,y=tn(Math.sqrt(l/d)),b=Math.abs(x)<5;r||(r=b?Ae.restSpeed.granular:Ae.restSpeed.default),s||(s=b?Ae.restDelta.granular:Ae.restDelta.default);let k,w,C,j,S,N;if(g<1)C=tm(y,g),j=(m+g*y*x)/C,k=E=>{const D=Math.exp(-g*y*E);return o-D*(j*Math.sin(C*E)+x*Math.cos(C*E))},S=g*y*j+x*C,N=g*y*x-j*C,w=E=>Math.exp(-g*y*E)*(S*Math.sin(C*E)+N*Math.cos(C*E));else if(g===1){k=D=>o-Math.exp(-y*D)*(x+(m+y*x)*D);const E=m+y*x;w=D=>Math.exp(-y*D)*(y*E*D-m)}else{const E=y*Math.sqrt(g*g-1);k=I=>{const H=Math.exp(-g*y*I),B=Math.min(E*I,300);return o-H*((m+g*y*x)*Math.sinh(B)+E*x*Math.cosh(B))/E};const D=(m+g*y*x)/E,P=g*y*D-x*E,O=g*y*x-D*E;w=I=>{const H=Math.exp(-g*y*I),B=Math.min(E*I,300);return H*(P*Math.sinh(B)+O*Math.cosh(B))}}const T={calculatedDuration:p&&h||null,velocity:E=>Ft(w(E)),next:E=>{if(!p&&g<1){const P=Math.exp(-g*y*E),O=Math.sin(C*E),I=Math.cos(C*E),H=o-P*(j*O+x*I),B=Ft(P*(S*O+N*I));return a.done=Math.abs(B)<=r&&Math.abs(o-H)<=s,a.value=a.done?o:H,a}const D=k(E);if(p)a.done=E>=h;else{const P=Ft(w(E));a.done=Math.abs(P)<=r&&Math.abs(o-D)<=s}return a.value=a.done?o:D,a},toString:()=>{const E=Math.min(k0(T),Pu),D=FN(P=>T.next(E*P).value,E,30);return E+"ms "+D},toTransition:()=>{}};return T}Au.applyToOptions=t=>{const e=ID(t,100,Au);return t.ease=e.ease,t.duration=Ft(e.duration),t.type="keyframes",t};const HD=5;function VN(t,e,n){const r=Math.max(e-HD,0);return p0(n-t(r),e-r)}function nm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:d}){const h=t[0],f={done:!1,value:h},p=N=>a!==void 0&&N<a||l!==void 0&&N>l,m=N=>a===void 0?l:l===void 0||Math.abs(a-N)<Math.abs(l-N)?a:l;let g=n*e;const x=h+g,y=o===void 0?x:o(x);y!==x&&(g=y-h);const b=N=>-g*Math.exp(-N/r),k=N=>y+b(N),w=N=>{const T=b(N),E=k(N);f.done=Math.abs(T)<=u,f.value=f.done?y:E};let C,j;const S=N=>{p(f.value)&&(C=N,j=Au({keyframes:[f.value,m(f.value)],velocity:VN(k,N,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return S(0),{calculatedDuration:null,next:N=>{let T=!1;return!j&&C===void 0&&(T=!0,w(N),S(N)),C!==void 0&&N>=C?j.next(N-C):(!T&&w(N),f)}}}function WD(t,e,n){const r=[],s=n||ts.mix||zN,i=t.length-1;for(let o=0;o<i;o++){let a=s(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||Rt:e;a=xl(l,a)}r.push(a)}return r}function w0(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(h0(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=WD(e,r,s),l=a.length,u=d=>{if(o&&d<t[0])return e[0];let h=0;if(l>1)for(;h<t.length-2&&!(d<t[h+1]);h++);const f=Yi(t[h],t[h+1],d);return a[h](f)};return n?d=>u(Cn(t[0],t[i-1],d)):u}function UD(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=Yi(0,e,r);t.push(xe(n,1,s))}}function $N(t){const e=[0];return UD(e,t.length-1),e}function KD(t,e){return t.map(n=>n*e)}function GD(t,e){return t.map(()=>e||MN).splice(0,t.length-1)}function la({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=rD(r)?r.map(Zy):Zy(r),i={done:!1,value:e[0]},o=KD(n&&n.length===e.length?n:$N(e),t),a=w0(o,e,{ease:Array.isArray(s)?s:GD(e,s)});return{calculatedDuration:t,next:l=>(i.value=a(l),i.done=l>=t,i)}}const qD=t=>t!==null;function Qd(t,{repeat:e,repeatType:n="loop"},r,s=1){const i=t.filter(qD),a=s<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!a||r===void 0?i[a]:r}const JD={decay:nm,inertia:nm,tween:la,keyframes:la,spring:Au};function HN(t){typeof t.type=="string"&&(t.type=JD[t.type])}class S0{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const YD=t=>t/100;class qa extends S0{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==vt.now()&&this.tick(vt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;HN(e);const{type:n=la,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=e;let{keyframes:a}=e;const l=n||la;l!==la&&typeof a[0]!="number"&&(this.mixKeyframes=xl(YD,zN(a[0],a[1])),a=[0,100]);const u=l({...e,keyframes:a});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=k0(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:h,repeatType:f,repeatDelay:p,type:m,onUpdate:g,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let k=this.currentTime,w=r;if(h){const N=Math.min(this.currentTime,s)/a;let T=Math.floor(N),E=N%1;!E&&N>=1&&(E=1),E===1&&T--,T=Math.min(T,h+1),!!(T%2)&&(f==="reverse"?(E=1-E,p&&(E-=p/a)):f==="mirror"&&(w=o)),k=Cn(0,1,E)*a}let C;b?(this.delayState.value=d[0],C=this.delayState):C=w.next(k),i&&!b&&(C.value=i(C.value));let{done:j}=C;!b&&l!==null&&(j=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&j);return S&&m!==nm&&(C.value=Qd(d,this.options,x,this.speed)),g&&g(C.value),S&&this.finish(),C}then(e,n){return this.finished.then(e,n)}get duration(){return tn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+tn(e)}get time(){return tn(this.currentTime)}set time(e){e=Ft(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return VN(r=>this.generator.next(r).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(vt.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=tn(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:e=_D,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(vt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function XD(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const js=t=>t*180/Math.PI,rm=t=>{const e=js(Math.atan2(t[1],t[0]));return sm(e)},ZD={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:rm,rotateZ:rm,skewX:t=>js(Math.atan(t[1])),skewY:t=>js(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},sm=t=>(t=t%360,t<0&&(t+=360),t),ib=rm,ob=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ab=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),QD={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ob,scaleY:ab,scale:t=>(ob(t)+ab(t))/2,rotateX:t=>sm(js(Math.atan2(t[6],t[5]))),rotateY:t=>sm(js(Math.atan2(-t[2],t[0]))),rotateZ:ib,rotate:ib,skewX:t=>js(Math.atan(t[4])),skewY:t=>js(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function im(t){return t.includes("scale")?1:0}function om(t,e){if(!t||t==="none")return im(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=QD,s=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=ZD,s=a}if(!s)return im(e);const i=r[e],o=s[1].split(",").map(t4);return typeof i=="function"?i(o):o[i]}const e4=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return om(n,e)};function t4(t){return parseFloat(t.trim())}const vo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ko=new Set([...vo,"pathRotation"]),lb=t=>t===bo||t===G,n4=new Set(["x","y","z"]),r4=vo.filter(t=>!n4.has(t));function s4(t){const e=[];return r4.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Lr={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:r})=>{const s=t.max-t.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:r})=>{const s=t.max-t.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>om(e,"x"),y:(t,{transform:e})=>om(e,"y")};Lr.translateX=Lr.x;Lr.translateY=Lr.y;const _s=new Set;let am=!1,lm=!1,cm=!1;function WN(){if(lm){const t=Array.from(_s).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=s4(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))==null||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}lm=!1,am=!1,_s.forEach(t=>t.complete(cm)),_s.clear()}function UN(){_s.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(lm=!0)})}function i4(){cm=!0,UN(),WN(),cm=!1}class N0{constructor(e,n,r,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(_s.add(this),am||(am=!0,le.read(UN),le.resolveKeyframes(WN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const i=s==null?void 0:s.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&n){const a=r.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),s&&i===void 0&&s.set(e[0])}XD(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),_s.delete(this)}cancel(){this.state==="scheduled"&&(_s.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const o4=t=>t.startsWith("--");function KN(t,e,n){o4(e)?t.style.setProperty(e,n):t.style[e]=n}const a4={};function C0(t,e){const n=vN(t);return()=>a4[e]??n()}const j0=C0(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),GN=C0(()=>window.ViewTimeline!==void 0,"viewTimeline"),qN=C0(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Uo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,cb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Uo([0,.65,.55,1]),circOut:Uo([.55,0,1,.45]),backIn:Uo([.31,.01,.66,-.59]),backOut:Uo([.33,1.53,.69,.99])};function JN(t,e){if(t)return typeof t=="function"?qN()?FN(t,e):"ease-out":PN(t)?Uo(t):Array.isArray(t)?t.map(n=>JN(n,e)||cb.easeOut):cb[t]}function l4(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:l}={},u=void 0){const d={[e]:n};l&&(d.offset=l);const h=JN(a,s);Array.isArray(h)&&(d.easing=h);const f={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(f.pseudoElement=u),t.animate(d,f)}function YN(t){return typeof t=="function"&&"applyToOptions"in t}function c4({type:t,...e}){return YN(t)&&qN()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class XN extends S0{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,h0(typeof e.type!="string");const u=c4(e);this.animation=l4(n,r,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=Qd(s,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(d),KN(n,r,d),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const e=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return tn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+tn(e)}get time(){return tn(Number(this.animation.currentTime)||0)}set time(e){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ft(e),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:n,rangeEnd:r,observe:s}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&j0()?(this.animation.timeline=e,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Rt):s(this)}}const ZN={anticipate:jN,backInOut:CN,circInOut:TN};function u4(t){return t in ZN}function d4(t){typeof t.ease=="string"&&u4(t.ease)&&(t.ease=ZN[t.ease])}const of=10;class h4 extends XN{constructor(e){d4(e),HN(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new qa({...o,autoplay:!1}),l=Math.max(of,vt.now()-this.startTime),u=Cn(0,of,l-of),d=a.sample(l).value,{name:h}=this.options;i&&h&&KN(i,h,d),n.setWithVelocity(a.sample(Math.max(0,l-u)).value,d,u),a.stop()}}const ub=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(wn.test(t)||t==="0")&&!t.startsWith("url("));function f4(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function p4(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=ub(s,e),a=ub(i,e);return!o||!a?!1:f4(t)||(n==="spring"||YN(n))&&r}function um(t){t.duration=0,t.type="keyframes"}const QN=new Set(["opacity","clipPath","filter","transform"]),m4=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function g4(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&m4.test(t[e]))return!0;return!1}const x4=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),y4=vN(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function b4(t){var h;const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:i,type:o,keyframes:a}=t;if(!(((h=e==null?void 0:e.owner)==null?void 0:h.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=e.owner.getProps();return y4()&&n&&(QN.has(n)||x4.has(n)&&g4(a))&&(n!=="transform"||!d)&&!u&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}const v4=40;class k4 extends S0{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:a,name:l,motionValue:u,element:d,...h}){var m;super(),this.stop=()=>{var g,x;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=vt.now();const f={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,name:l,motionValue:u,element:d,...h},p=(d==null?void 0:d.KeyframeResolver)||N0;this.keyframeResolver=new p(a,(g,x,y)=>this.onKeyframesResolved(g,x,f,!y),l,u,d),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(e,n,r,s){var y,b;this.keyframeResolver=void 0;const{name:i,type:o,velocity:a,delay:l,isHandoff:u,onUpdate:d}=r;this.resolvedAt=vt.now();let h=!0;p4(e,i,o,a)||(h=!1,(ts.instantAnimations||!l)&&(d==null||d(Qd(e,r,n))),e[0]=e[e.length-1],um(r),r.repeat=0);const p={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>v4?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},m=h&&!u&&b4(p),g=(b=(y=p.motionValue)==null?void 0:y.owner)==null?void 0:b.current;let x;if(m)try{x=new h4({...p,element:g})}catch{x=new qa(p)}else x=new qa(p);x.finished.then(()=>{this.notifyFinished()}).catch(Rt),this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),i4()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function eC(t,e,n,r=0,s=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,a=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:a-i*r}const db=30,w4=t=>!isNaN(parseFloat(t)),ca={current:void 0};class S4{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=vt.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=vt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=w4(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new f0);const r=this.events[e].add(n);return e==="change"?()=>{r(),le.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return ca.current&&ca.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=vt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>db)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,db);return p0(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function yn(t,e){return new S4(t,e)}function tC(t,e){if(t!=null&&t.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function E0(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?tC(n,t):n}const N4={type:"spring",stiffness:500,damping:25,restSpeed:10},C4=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),j4={type:"keyframes",duration:.8},E4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},T4=(t,{keyframes:e})=>e.length>2?j4:ko.has(t)?t.startsWith("scale")?C4(e[1]):N4:E4,M4=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function P4(t){for(const e in t)if(!M4.has(e))return!0;return!1}const T0=(t,e,n,r={},s,i)=>o=>{const a=E0(r,t)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Ft(l);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:f=>{e.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};P4(a)||Object.assign(d,T4(t,d)),d.duration&&(d.duration=Ft(d.duration)),d.repeatDelay&&(d.repeatDelay=Ft(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(um(d),d.delay===0&&(h=!0)),(ts.instantAnimations||ts.skipAnimations||s!=null&&s.shouldSkipAnimations||a.skipAnimations)&&(h=!0,um(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,h&&!i&&e.get()!==void 0){const f=Qd(d.keyframes,a);if(f!==void 0){le.update(()=>{d.onUpdate(f),d.onComplete()});return}}return a.isSync?new qa(d):new k4(d)},A4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function D4(t){const e=A4.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function nC(t,e,n=1){const[r,s]=D4(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return xN(o)?parseFloat(o):o}return x0(s)?nC(s,e,n+1):s}function hb(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function M0(t,e,n,r){if(typeof e=="function"){const[s,i]=hb(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=hb(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function Is(t,e,n){const r=t.getProps();return M0(r,e,n!==void 0?n:r.custom,t)}const rC=new Set(["width","height","top","left","right","bottom",...vo]),dm=t=>Array.isArray(t);function L4(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,yn(n))}function R4(t){return dm(t)?t[t.length-1]||0:t}function _4(t,e){const n=Is(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=R4(i[o]);L4(t,o,a)}}const Ke=t=>!!(t&&t.getVelocity);function I4(t){return!!(Ke(t)&&t.add)}function hm(t,e){const n=t.getValue("willChange");if(I4(n))return n.add(e);if(!n&&ts.WillChange){const r=new ts.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function P0(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const O4="framerAppearId",sC="data-"+P0(O4);function iC(t){return t.props[sC]}function B4({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function oC(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:o,...a}=e;const l=t.getDefaultTransition();i=i?tC(i,l):l;const u=i==null?void 0:i.reduceMotion,d=i==null?void 0:i.skipAnimations;r&&(i=r);const h=[],f=s&&t.animationState&&t.animationState.getState()[s],p=i==null?void 0:i.path;p&&p.animateVisualElement(t,a,i,n,h);for(const m in a){const g=t.getValue(m,t.latestValues[m]??null),x=a[m];if(x===void 0||f&&B4(f,m))continue;const y={delay:n,...E0(i||{},m)};d&&(y.skipAnimations=!0);const b=g.get();if(b!==void 0&&!g.isAnimating()&&!Array.isArray(x)&&x===b&&!y.velocity){le.update(()=>g.set(x));continue}let k=!1;if(window.MotionHandoffAnimation){const j=iC(t);if(j){const S=window.MotionHandoffAnimation(j,m,le);S!==null&&(y.startTime=S,k=!0)}}hm(t,m);const w=u??t.shouldReduceMotion;g.start(T0(m,g,x,w&&rC.has(m)?{type:!1}:y,t,k));const C=g.animation;C&&h.push(C)}if(o){const m=()=>le.update(()=>{o&&_4(t,o)});h.length?Promise.all(h).then(m):m()}return h}function fm(t,e,n={}){var l;const r=Is(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(oC(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:f}=s;return z4(t,e,u,d,h,f,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[u,d]=a==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(n.delay)])}function z4(t,e,n=0,r=0,s=0,i=1,o){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(fm(l,e,{...o,delay:n+(typeof r=="function"?0:r)+eC(t.variantChildren,l,r,s,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}function F4(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>fm(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=fm(t,e,n);else{const s=typeof e=="function"?Is(t,e,n.custom):e;r=Promise.all(oC(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const V4={test:t=>t==="auto",parse:t=>t},aC=t=>e=>e.test(t),lC=[bo,G,zn,Gn,gD,mD,V4],fb=t=>lC.find(aC(t));function $4(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||bN(t):!0}const H4=new Set(["brightness","contrast","saturate","opacity"]);function W4(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(y0)||[];if(!r)return t;const s=n.replace(r,"");let i=H4.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const U4=/\b([a-z-]*)\(.*?\)/gu,pm={...wn,getAnimatableNone:t=>{const e=t.match(U4);return e?e.map(W4).join(" "):t}},mm={...wn,getAnimatableNone:t=>{const e=wn.parse(t);return wn.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},pb={...bo,transform:Math.round},K4={rotate:Gn,pathRotation:Gn,rotateX:Gn,rotateY:Gn,rotateZ:Gn,scale:ec,scaleX:ec,scaleY:ec,scaleZ:ec,skew:Gn,skewX:Gn,skewY:Gn,distance:G,translateX:G,translateY:G,translateZ:G,x:G,y:G,z:G,perspective:G,transformPerspective:G,opacity:Ga,originX:eb,originY:eb,originZ:G},Du={borderWidth:G,borderTopWidth:G,borderRightWidth:G,borderBottomWidth:G,borderLeftWidth:G,borderRadius:G,borderTopLeftRadius:G,borderTopRightRadius:G,borderBottomRightRadius:G,borderBottomLeftRadius:G,width:G,maxWidth:G,height:G,maxHeight:G,top:G,right:G,bottom:G,left:G,inset:G,insetBlock:G,insetBlockStart:G,insetBlockEnd:G,insetInline:G,insetInlineStart:G,insetInlineEnd:G,padding:G,paddingTop:G,paddingRight:G,paddingBottom:G,paddingLeft:G,paddingBlock:G,paddingBlockStart:G,paddingBlockEnd:G,paddingInline:G,paddingInlineStart:G,paddingInlineEnd:G,margin:G,marginTop:G,marginRight:G,marginBottom:G,marginLeft:G,marginBlock:G,marginBlockStart:G,marginBlockEnd:G,marginInline:G,marginInlineStart:G,marginInlineEnd:G,fontSize:G,backgroundPositionX:G,backgroundPositionY:G,...K4,zIndex:pb,fillOpacity:Ga,strokeOpacity:Ga,numOctaves:pb},G4={...Du,color:Be,backgroundColor:Be,outlineColor:Be,fill:Be,stroke:Be,borderColor:Be,borderTopColor:Be,borderRightColor:Be,borderBottomColor:Be,borderLeftColor:Be,filter:pm,WebkitFilter:pm,mask:mm,WebkitMask:mm},cC=t=>G4[t],q4=new Set([pm,mm]);function uC(t,e){let n=cC(t);return q4.has(n)||(n=wn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const J4=new Set(["auto","none","0"]);function Y4(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!J4.has(i)&&Xi(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=uC(n,s)}class X4 extends N0{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<e.length;d++){let h=e[d];if(typeof h=="string"&&(h=h.trim(),x0(h))){const f=nC(h,n.current);f!==void 0&&(e[d]=f),d===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!rC.has(r)||e.length!==2)return;const[s,i]=e,o=fb(s),a=fb(i),l=Qy(s),u=Qy(i);if(l!==u&&Lr[r]){this.needsMeasurement=!0;return}if(o!==a)if(lb(o)&&lb(a))for(let d=0;d<e.length;d++){const h=e[d];typeof h=="string"&&(e[d]=parseFloat(h))}else Lr[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||$4(e[s]))&&r.push(s);r.length&&Y4(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Lr[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var a;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,o=r[i];r[i]=Lr[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,u])=>{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const A0=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function dC(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){const s=document.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(r=>r!=null)}const gm=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function ua(t){return yN(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:Zi,cancel:hC}=AN(queueMicrotask,!1),fn={x:!1,y:!1};function fC(){return fn.x||fn.y}function Z4(t){return t==="x"||t==="y"?fn[t]?null:(fn[t]=!0,()=>{fn[t]=!1}):fn.x||fn.y?null:(fn.x=fn.y=!0,()=>{fn.x=fn.y=!1})}function pC(t,e){const n=dC(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function Q4(t){return!(t.pointerType==="touch"||fC())}function eL(t,e,n={}){const[r,s,i]=pC(t,n);return r.forEach(o=>{let a=!1,l=!1,u;const d=()=>{o.removeEventListener("pointerleave",m)},h=x=>{u&&(u(x),u=void 0),d()},f=x=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,h(x))},p=()=>{a=!0,window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",f,s)},m=x=>{if(x.pointerType!=="touch"){if(a){l=!0;return}h(x)}},g=x=>{if(!Q4(x))return;l=!1;const y=e(o,x);typeof y=="function"&&(u=y,o.addEventListener("pointerleave",m,s))};o.addEventListener("pointerenter",g,s),o.addEventListener("pointerdown",p,s)}),i}const mC=(t,e)=>e?t===e?!0:mC(t,e.parentElement):!1,D0=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,tL=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function nL(t){return tL.has(t.tagName)||t.isContentEditable===!0}const rL=new Set(["INPUT","SELECT","TEXTAREA"]);function sL(t){return rL.has(t.tagName)||t.isContentEditable===!0}const Fc=new WeakSet;function mb(t){return e=>{e.key==="Enter"&&t(e)}}function af(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const iL=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=mb(()=>{if(Fc.has(n))return;af(n,"down");const s=mb(()=>{af(n,"up")}),i=()=>af(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function gb(t){return D0(t)&&!fC()}const xb=new WeakSet;function oL(t,e,n={}){const[r,s,i]=pC(t,n),o=a=>{const l=a.currentTarget;if(!gb(a)||xb.has(a))return;Fc.add(l),n.stopPropagation&&xb.add(a);const u=e(l,a),d={...s,capture:!0},h=(m,g)=>{window.removeEventListener("pointerup",f,d),window.removeEventListener("pointercancel",p,d),Fc.has(l)&&Fc.delete(l),gb(m)&&typeof u=="function"&&u(m,{success:g})},f=m=>{h(m,l===window||l===document||n.useGlobalTarget||mC(l,m.target))},p=m=>{h(m,!1)};window.addEventListener("pointerup",f,d),window.addEventListener("pointercancel",p,d)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),ua(a)&&(a.addEventListener("focus",u=>iL(u,s)),!nL(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}function L0(t){return yN(t)&&"ownerSVGElement"in t}const Vc=new WeakMap;let br;const gC=(t,e,n)=>(r,s)=>s&&s[0]?s[0][t+"Size"]:L0(r)&&"getBBox"in r?r.getBBox()[e]:r[n],aL=gC("inline","width","offsetWidth"),lL=gC("block","height","offsetHeight");function cL({target:t,borderBoxSize:e}){var n;(n=Vc.get(t))==null||n.forEach(r=>{r(t,{get width(){return aL(t,e)},get height(){return lL(t,e)}})})}function uL(t){t.forEach(cL)}function dL(){typeof ResizeObserver>"u"||(br=new ResizeObserver(uL))}function hL(t,e){br||dL();const n=dC(t);return n.forEach(r=>{let s=Vc.get(r);s||(s=new Set,Vc.set(r,s)),s.add(e),br==null||br.observe(r)}),()=>{n.forEach(r=>{const s=Vc.get(r);s==null||s.delete(e),s!=null&&s.size||br==null||br.unobserve(r)})}}const $c=new Set;let Ai;function fL(){Ai=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};$c.forEach(e=>e(t))},window.addEventListener("resize",Ai)}function pL(t){return $c.add(t),Ai||fL(),()=>{$c.delete(t),!$c.size&&typeof Ai=="function"&&(window.removeEventListener("resize",Ai),Ai=void 0)}}function xm(t,e){return typeof t=="function"?pL(t):hL(t,e)}function xC(t,e){let n;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;n!==o&&t(o),n=o};return le.preUpdate(r,!0),()=>ln(r)}function mL(t){return L0(t)&&t.tagName==="svg"}function gL(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],s=t[1+n],i=t[2+n],o=t[3+n],a=w0(s,i,o);return e?a(r):a}function xL(t,e,n={}){const r=t.get();let s=null,i=r,o;const a=typeof r=="string"?r.replace(/[\d.-]/g,""):void 0,l=()=>{s&&(s.stop(),s=null),t.animation=void 0},u=()=>{const h=yb(t.get()),f=yb(i);if(h===f){l();return}const p=s?s.getGeneratorVelocity():t.getVelocity();l(),s=new qa({keyframes:[h,f],velocity:p,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:o})},d=()=>{var h;u(),t.animation=s??void 0,(h=t.events.animationStart)==null||h.notify(),s==null||s.then(()=>{var f;t.animation=void 0,(f=t.events.animationComplete)==null||f.notify()})};if(t.attach((h,f)=>{i=h,o=p=>f(lf(p,a)),le.postRender(d)},l),Ke(e)){let h=n.skipInitialAnimation===!0;const f=e.on("change",m=>{h?(h=!1,t.jump(lf(m,a),!1)):t.set(lf(m,a))}),p=t.on("destroy",f);return()=>{f(),p()}}return l}function lf(t,e){return e?t+e:t}function yb(t){return typeof t=="number"?t:parseFloat(t)}const yL=[...lC,Be,wn],bL=t=>yL.find(aC(t)),bb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Di=()=>({x:bb(),y:bb()}),vb=()=>({min:0,max:0}),He=()=>({x:vb(),y:vb()}),vL=new WeakMap;function eh(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Ja(t){return typeof t=="string"||Array.isArray(t)}const R0=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],_0=["initial",...R0];function th(t){return eh(t.animate)||_0.some(e=>Ja(t[e]))}function yC(t){return!!(th(t)||t.variants)}function kL(t,e,n){for(const r in e){const s=e[r],i=n[r];if(Ke(s))t.addValue(r,s);else if(Ke(i))t.addValue(r,yn(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,yn(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const ym={current:null},bC={current:!1},wL=typeof window<"u";function SL(){if(bC.current=!0,!!wL)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ym.current=t.matches;t.addEventListener("change",e),e()}else ym.current=!1}const kb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Lu={};function vC(t){Lu=t}function NL(){return Lu}class CL{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=N0,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=vt.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,le.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=a;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=th(n),this.isVariantNode=yC(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in f){const m=f[p];u[p]!==void 0&&Ke(m)&&m.set(u[p])}}mount(e){var n,r;if(this.hasBeenMounted)for(const s in this.initialValues)(n=this.values.get(s))==null||n.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=e,vL.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,i)=>this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(bC.current||SL(),this.shouldReduceMotion=ym.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),ln(this.notifyUpdate),ln(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&QN.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:u,duration:d}=n.accelerate,h=new XN({element:this.current,name:e,keyframes:a,times:l,ease:u,duration:Ft(d)}),f=o(h);this.valueSubscriptions.set(e,()=>{f(),h.cancel()});return}const r=ko.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&le.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Lu){const n=Lu[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):He()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<kb.length;r++){const s=kb[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=kL(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=yn(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(xN(r)||bN(r))?r=parseFloat(r):!bL(r)&&wn.test(n)&&(r=uC(e,n)),this.setBaseTarget(e,Ke(r)?r.get():r)),Ke(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=M0(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Ke(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new f0),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Zi.render(this.render)}}class kC extends CL{constructor(){super(...arguments),this.KeyframeResolver=X4}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ke(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class cs{constructor(e){this.isMounted=!1,this.node=e}update(){}}function wC({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function jL({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function EL(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function cf(t){return t===void 0||t===1}function bm({scale:t,scaleX:e,scaleY:n}){return!cf(t)||!cf(e)||!cf(n)}function bs(t){return bm(t)||SC(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function SC(t){return wb(t.x)||wb(t.y)}function wb(t){return t&&t!=="0%"}function Ru(t,e,n){const r=t-n,s=e*r;return n+s}function Sb(t,e,n,r,s){return s!==void 0&&(t=Ru(t,s,r)),Ru(t,n,r)+e}function vm(t,e=0,n=1,r,s){t.min=Sb(t.min,e,n,r,s),t.max=Sb(t.max,e,n,r,s)}function NC(t,{x:e,y:n}){vm(t.x,e.translate,e.scale,e.originPoint),vm(t.y,n.translate,n.scale,n.originPoint)}const Nb=.999999999999,Cb=1.0000000000001;function TL(t,e,n,r=!1){var a;const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(_n(t.x,-i.scroll.offset.x),_n(t.y,-i.scroll.offset.y)),o&&(e.x*=o.x.scale,e.y*=o.y.scale,NC(t,o)),r&&bs(i.latestValues)&&Hc(t,i.latestValues,(a=i.layout)==null?void 0:a.layoutBox))}e.x<Cb&&e.x>Nb&&(e.x=1),e.y<Cb&&e.y>Nb&&(e.y=1)}function _n(t,e){t.min+=e,t.max+=e}function jb(t,e,n,r,s=.5){const i=xe(t.min,t.max,s);vm(t,e,n,i,r)}function Eb(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function Hc(t,e,n){const r=n??t;jb(t.x,Eb(e.x,r.x),e.scaleX,e.scale,e.originX),jb(t.y,Eb(e.y,r.y),e.scaleY,e.scale,e.originY)}function CC(t,e){return wC(EL(t.getBoundingClientRect(),e))}function ML(t,e,n){const r=CC(t,n),{scroll:s}=e;return s&&(_n(r.x,s.offset.x),_n(r.y,s.offset.y)),r}const PL={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},AL=vo.length;function DL(t,e,n){let r="",s=!0;for(let o=0;o<AL;o++){const a=vo[o],l=t[a];if(l===void 0)continue;let u=!0;if(typeof l=="number")u=l===(a.startsWith("scale")?1:0);else{const d=parseFloat(l);u=a.startsWith("scale")?d===1:d===0}if(!u||n){const d=gm(l,Du[a]);if(!u){s=!1;const h=PL[a]||a;r+=`${h}(${d}) `}n&&(e[a]=d)}}const i=t.pathRotation;return i&&(s=!1,r+=`rotate(${gm(i,Du.pathRotation)}) `),r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function I0(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let o=!1,a=!1;for(const l in e){const u=e[l];if(ko.has(l)){o=!0;continue}else if(LN(l)){s[l]=u;continue}else{const d=gm(u,Du[l]);l.startsWith("origin")?(a=!0,i[l]=d):r[l]=d}}if(e.transform||(o||n?r.transform=DL(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${l} ${u} ${d}`}}function jC(t,{style:e,vars:n},r,s){const i=t.style;let o;for(o in e)i[o]=e[o];s==null||s.applyProjectionStyles(i,r);for(o in n)i.setProperty(o,n[o])}function Tb(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Do={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(G.test(t))t=parseFloat(t);else return t;const n=Tb(t,e.target.x),r=Tb(t,e.target.y);return`${n}% ${r}%`}},LL={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=wn.parse(t);if(s.length>5)return r;const i=wn.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const u=xe(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}},km={borderRadius:{...Do,applyTo:[...A0]},borderTopLeftRadius:Do,borderTopRightRadius:Do,borderBottomLeftRadius:Do,borderBottomRightRadius:Do,boxShadow:LL};function EC(t,{layout:e,layoutId:n}){return ko.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!km[t]||t==="opacity")}function O0(t,e,n){var o;const r=t.style,s=e==null?void 0:e.style,i={};if(!r)return i;for(const a in r)(Ke(r[a])||s&&Ke(s[a])||EC(a,t)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(i[a]=r[a]);return i}function RL(t){return window.getComputedStyle(t)}class _L extends kC{constructor(){super(...arguments),this.type="html",this.renderInstance=jC}readValueFromInstance(e,n){var r;if(ko.has(n))return(r=this.projection)!=null&&r.isProjecting?im(n):e4(e,n);{const s=RL(e),i=(LN(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return CC(e,n)}build(e,n,r){I0(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return O0(e,n,r)}}const IL={offset:"stroke-dashoffset",array:"stroke-dasharray"},OL={offset:"strokeDashoffset",array:"strokeDasharray"};function BL(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?IL:OL;t[i.offset]=`${-r}`,t[i.array]=`${e} ${n}`}const zL=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function TC(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...a},l,u,d){if(I0(t,a,u),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:f}=t;h.transform&&(f.transform=h.transform,delete h.transform),(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete h.transformBox);for(const p of zL)h[p]!==void 0&&(f[p]=h[p],delete h[p]);e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&BL(h,s,i,o,!1)}const MC=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),PC=t=>typeof t=="string"&&t.toLowerCase()==="svg";function FL(t,e,n,r){jC(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(MC.has(s)?s:P0(s),e.attrs[s])}function AC(t,e,n){const r=O0(t,e,n);for(const s in t)if(Ke(t[s])||Ke(e[s])){const i=vo.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}class VL extends kC{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=He}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ko.has(n)){const r=cC(n);return r&&r.default||0}return n=MC.has(n)?n:P0(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return AC(e,n,r)}build(e,n,r){TC(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){FL(e,n,r,s)}mount(e){this.isSVGTag=PC(e.tagName),super.mount(e)}}const $L=_0.length;function DC(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?DC(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<$L;n++){const r=_0[n],s=t.props[r];(Ja(s)||s===!1)&&(e[r]=s)}return e}function LC(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const HL=[...R0].reverse(),WL=R0.length;function UL(t){return e=>Promise.all(e.map(({animation:n,options:r})=>F4(t,n,r)))}function KL(t){let e=UL(t),n=Mb(),r=!0,s=!1;const i=u=>(d,h)=>{var p;const f=Is(t,h,u==="exit"?(p=t.presenceContext)==null?void 0:p.custom:void 0);if(f){const{transition:m,transitionEnd:g,...x}=f;d={...d,...x,...g}}return d};function o(u){e=u(t)}function a(u){const{props:d}=t,h=DC(t.parent)||{},f=[],p=new Set;let m={},g=1/0;for(let y=0;y<WL;y++){const b=HL[y],k=n[b],w=d[b]!==void 0?d[b]:h[b],C=Ja(w),j=b===u?k.isActive:null;j===!1&&(g=y);let S=w===h[b]&&w!==d[b]&&C;if(S&&(r||s)&&t.manuallyAnimateOnMount&&(S=!1),k.protectedKeys={...m},!k.isActive&&j===null||!w&&!k.prevProp||eh(w)||typeof w=="boolean")continue;if(b==="exit"&&k.isActive&&j!==!0){k.prevResolvedValues&&(m={...m,...k.prevResolvedValues});continue}const N=GL(k.prevProp,w);let T=N||b===u&&k.isActive&&!S&&C||y>g&&C,E=!1;const D=Array.isArray(w)?w:[w];let P=D.reduce(i(b),{});j===!1&&(P={});const{prevResolvedValues:O={}}=k,I={...O,...P},H=R=>{T=!0,p.has(R)&&(E=!0,p.delete(R)),k.needsAnimating[R]=!0;const _=t.getValue(R);_&&(_.liveStyle=!1)};for(const R in I){const _=P[R],$=O[R];if(m.hasOwnProperty(R))continue;let te=!1;dm(_)&&dm($)?te=!LC(_,$)||N:te=_!==$,te?_!=null?H(R):p.add(R):_!==void 0&&p.has(R)?H(R):k.protectedKeys[R]=!0}k.prevProp=w,k.prevResolvedValues=P,k.isActive&&(m={...m,...P}),(r||s)&&t.blockInitialAnimation&&(T=!1);const B=S&&N;T&&(!B||E)&&f.push(...D.map(R=>{const _={type:b};if(typeof R=="string"&&(r||s)&&!B&&t.manuallyAnimateOnMount&&t.parent){const{parent:$}=t,te=Is($,R);if($.enteringChildren&&te){const{delayChildren:Y}=te.transition||{};_.delay=eC($.enteringChildren,t,Y)}}return{animation:R,options:_}}))}if(p.size){const y={};if(typeof d.initial!="boolean"){const b=Is(t,Array.isArray(d.initial)?d.initial[0]:d.initial);b&&b.transition&&(y.transition=b.transition)}p.forEach(b=>{const k=t.getBaseTarget(b),w=t.getValue(b);w&&(w.liveStyle=!0),y[b]=k??null}),f.push({animation:y})}let x=!!f.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(x=!1),r=!1,s=!1,x?e(f):Promise.resolve()}function l(u,d){var f;if(n[u].isActive===d)return Promise.resolve();(f=t.variantChildren)==null||f.forEach(p=>{var m;return(m=p.animationState)==null?void 0:m.setActive(u,d)}),n[u].isActive=d;const h=a(u);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Mb(),s=!0}}}function GL(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!LC(e,t):!1}function ms(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Mb(){return{animate:ms(!0),whileInView:ms(),whileHover:ms(),whileTap:ms(),whileDrag:ms(),whileFocus:ms(),exit:ms()}}function wm(t,e){t.min=e.min,t.max=e.max}function dn(t,e){wm(t.x,e.x),wm(t.y,e.y)}function Pb(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const RC=1e-4,qL=1-RC,JL=1+RC,_C=.01,YL=0-_C,XL=0+_C;function kt(t){return t.max-t.min}function ZL(t,e,n){return Math.abs(t-e)<=n}function Ab(t,e,n,r=.5){t.origin=r,t.originPoint=xe(e.min,e.max,t.origin),t.scale=kt(n)/kt(e),t.translate=xe(n.min,n.max,t.origin)-t.originPoint,(t.scale>=qL&&t.scale<=JL||isNaN(t.scale))&&(t.scale=1),(t.translate>=YL&&t.translate<=XL||isNaN(t.translate))&&(t.translate=0)}function da(t,e,n,r){Ab(t.x,e.x,n.x,r?r.originX:void 0),Ab(t.y,e.y,n.y,r?r.originY:void 0)}function Db(t,e,n,r=0){const s=r?xe(n.min,n.max,r):n.min;t.min=s+e.min,t.max=t.min+kt(e)}function QL(t,e,n,r){Db(t.x,e.x,n.x,r==null?void 0:r.x),Db(t.y,e.y,n.y,r==null?void 0:r.y)}function Lb(t,e,n,r=0){const s=r?xe(n.min,n.max,r):n.min;t.min=e.min-s,t.max=t.min+kt(e)}function _u(t,e,n,r){Lb(t.x,e.x,n.x,r==null?void 0:r.x),Lb(t.y,e.y,n.y,r==null?void 0:r.y)}function Rb(t,e,n,r,s){return t-=e,t=Ru(t,1/n,r),s!==void 0&&(t=Ru(t,1/s,r)),t}function eR(t,e=0,n=1,r=.5,s,i=t,o=t){if(zn.test(e)&&(e=parseFloat(e),e=xe(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=xe(i.min,i.max,r);t===i&&(a-=e),t.min=Rb(t.min,e,n,a,s),t.max=Rb(t.max,e,n,a,s)}function _b(t,e,[n,r,s],i,o){eR(t,e[n],e[r],e[s],e.scale,i,o)}const tR=["x","scaleX","originX"],nR=["y","scaleY","originY"];function Ib(t,e,n,r){_b(t.x,e,tR,n?n.x:void 0,r?r.x:void 0),_b(t.y,e,nR,n?n.y:void 0,r?r.y:void 0)}function Ob(t){return t.translate===0&&t.scale===1}function IC(t){return Ob(t.x)&&Ob(t.y)}function Bb(t,e){return t.min===e.min&&t.max===e.max}function rR(t,e){return Bb(t.x,e.x)&&Bb(t.y,e.y)}function zb(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function OC(t,e){return zb(t.x,e.x)&&zb(t.y,e.y)}function Fb(t){return kt(t.x)/kt(t.y)}function Vb(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function An(t){return[t("x"),t("y")]}function sR(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,pathRotation:h,rotateX:f,rotateY:p,skewX:m,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotate(${h}deg) `),f&&(r+=`rotateX(${f}deg) `),p&&(r+=`rotateY(${p}deg) `),m&&(r+=`skewX(${m}deg) `),g&&(r+=`skewY(${g}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const iR=A0.length,$b=t=>typeof t=="string"?parseFloat(t):t,Hb=t=>typeof t=="number"||G.test(t);function oR(t,e,n,r,s,i){s?(t.opacity=xe(0,n.opacity??1,aR(r)),t.opacityExit=xe(e.opacity??1,0,lR(r))):i&&(t.opacity=xe(e.opacity??1,n.opacity??1,r));for(let o=0;o<iR;o++){const a=A0[o];let l=Wb(e,a),u=Wb(n,a);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||Hb(l)===Hb(u)?(t[a]=Math.max(xe($b(l),$b(u),r),0),(zn.test(u)||zn.test(l))&&(t[a]+="%")):t[a]=u}(e.rotate||n.rotate)&&(t.rotate=xe(e.rotate||0,n.rotate||0,r))}function Wb(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const aR=BC(0,.5,EN),lR=BC(.5,.95,Rt);function BC(t,e,n){return r=>r<t?0:r>e?1:n(Yi(t,e,r))}function cR(t,e,n){const r=Ke(t)?t:yn(t);return r.start(T0("",r,e,n)),r.animation}function Ya(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}const uR=(t,e)=>t.depth-e.depth;class dR{constructor(){this.children=[],this.isDirty=!1}add(e){d0(this.children,e),this.isDirty=!0}remove(e){Tu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(uR),this.isDirty=!1,this.children.forEach(e)}}function hR(t,e){const n=vt.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(ln(r),t(i-e))};return le.setup(r,!0),()=>ln(r)}function Wc(t){return Ke(t)?t.get():t}class fR{constructor(){this.members=[]}add(e){d0(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(Tu(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(Tu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){var n;for(let r=this.members.indexOf(e)-1;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1&&((n=s.instance)==null?void 0:n.isConnected)!==!1)return this.promote(s),!0}return!1}promote(e,n){var s;const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:o}=e.options;(i===void 0||i!==o)&&(e.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),(s=e.root)!=null&&s.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var n,r,s,i,o;(r=(n=e.options).onExitComplete)==null||r.call(n),(o=(s=e.resumingFrom)==null?void 0:(i=s.options).onExitComplete)==null||o.call(i)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const Uc={hasAnimatedSinceResize:!0,hasEverUpdated:!1},uf=["","X","Y","Z"],pR=1e3;let mR=0;function df(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function zC(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=iC(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",le,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&zC(r)}function FC({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=mR++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(yR),this.nodes.forEach(NR),this.nodes.forEach(CR),this.nodes.forEach(bR)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new dR)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new f0),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=L0(o)&&!mL(o),this.instance=o;const{layoutId:a,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),t){let d,h=0;const f=()=>this.root.updateBlockedByResize=!1;le.read(()=>{h=window.innerWidth}),t(o,()=>{const p=window.innerWidth;p!==h&&(h=p,this.root.updateBlockedByResize=!0,d&&d(),d=hR(f,250),Uc.hasAnimatedSinceResize&&(Uc.hasAnimatedSinceResize=!1,this.nodes.forEach(Gb)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&u&&(a||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||PR,{onLayoutAnimationStart:g,onLayoutAnimationComplete:x}=u.getProps(),y=!this.targetLayout||!OC(this.targetLayout,p),b=!h&&f;if(this.options.layoutRoot||this.resumeFrom||b||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...E0(m,"layout"),onPlay:g,onComplete:x};(u.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(d,b,k.path)}else h||Gb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ln(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(jR),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&zC(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(kR),this.nodes.forEach(Ub);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Kb);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(wR),this.nodes.forEach(SR),this.nodes.forEach(gR),this.nodes.forEach(xR)):this.nodes.forEach(Kb),this.clearAllSnapshots();const a=vt.now();Je.delta=Cn(0,1e3/60,a-Je.timestamp),Je.timestamp=a,Je.isProcessing=!0,ef.update.process(Je),ef.preRender.process(Je),ef.render.process(Je),Je.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Zi.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(vR),this.sharedNodes.forEach(ER)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,le.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){le.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!kt(this.snapshot.measuredBox.x)&&!kt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=He()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!IC(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(a||bs(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),AR(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return He();const a=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(DR))){const{scroll:d}=this.root;d&&(_n(a.x,d.offset.x),_n(a.y,d.offset.y))}return a}removeElementScroll(o){var l;const a=He();if(dn(a,o),(l=this.scroll)!=null&&l.wasRoot)return a;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:f}=d;d!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&dn(a,o),_n(a.x,h.offset.x),_n(a.y,h.offset.y))}return a}applyTransform(o,a=!1,l){var d,h;const u=l||He();dn(u,o);for(let f=0;f<this.path.length;f++){const p=this.path[f];!a&&p.options.layoutScroll&&p.scroll&&p!==p.root&&(_n(u.x,-p.scroll.offset.x),_n(u.y,-p.scroll.offset.y)),bs(p.latestValues)&&Hc(u,p.latestValues,(d=p.layout)==null?void 0:d.layoutBox)}return bs(this.latestValues)&&Hc(u,this.latestValues,(h=this.layout)==null?void 0:h.layoutBox),u}removeTransform(o){var l;const a=He();dn(a,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!bs(d.latestValues))continue;let h;d.instance&&(bm(d.latestValues)&&d.updateSnapshot(),h=He(),dn(h,d.measurePageBox())),Ib(a,d.latestValues,(l=d.snapshot)==null?void 0:l.layoutBox,h)}return bs(this.latestValues)&&Ib(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Je.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var p;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:h}=this.options;if(!this.layout||!(d||h))return;this.resolvedRelativeTargetAt=Je.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=He(),this.targetWithTransforms=He()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),QL(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):dn(this.target,this.layout.layoutBox),NC(this.target,this.targetDelta)):dn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||bm(this.parent.latestValues)||SC(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,a,l){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=He(),this.relativeTargetOrigin=He(),_u(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),dn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var m;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Je.timestamp&&(l=!1),l)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;dn(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;TL(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=He());const{target:p}=o;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Pb(this.prevProjectionDelta.x,this.projectionDelta.x),Pb(this.prevProjectionDelta.y,this.projectionDelta.y)),da(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!Vb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Vb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Di(),this.projectionDelta=Di(),this.projectionDeltaWithTransform=Di()}setAnimationOrigin(o,a=!1,l){const u=this.snapshot,d=u?u.latestValues:{},h={...this.latestValues},f=Di();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const p=He(),m=u?u.source:void 0,g=this.layout?this.layout.source:void 0,x=m!==g,y=this.getStack(),b=!y||y.members.length<=1,k=!!(x&&!b&&this.options.crossfade===!0&&!this.path.some(MR));this.animationProgress=0;let w;const C=l==null?void 0:l.interpolateProjection(o);this.mixTargetDelta=j=>{const S=j/1e3,N=C==null?void 0:C(S);N?(f.x.translate=N.x,f.x.scale=xe(o.x.scale,1,S),f.x.origin=o.x.origin,f.x.originPoint=o.x.originPoint,f.y.translate=N.y,f.y.scale=xe(o.y.scale,1,S),f.y.origin=o.y.origin,f.y.originPoint=o.y.originPoint):(qb(f.x,o.x,S),qb(f.y,o.y,S)),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_u(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),TR(this.relativeTarget,this.relativeTargetOrigin,p,S),w&&rR(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=He()),dn(w,this.relativeTarget)),x&&(this.animationValues=h,oR(h,d,this.latestValues,S,k,b)),N&&N.rotate!==void 0&&(this.animationValues||(this.animationValues=h),this.animationValues.pathRotation=N.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,u;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(ln(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=le.update(()=>{Uc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=yn(0)),this.motionValue.jump(0,!1),this.currentAnimation=cR(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(pR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:d}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&VC(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||He();const h=kt(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const f=kt(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+f}dn(a,l),Hc(a,d),da(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new fR),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&df("z",o,u,this.animationValues);for(let d=0;d<uf.length;d++)df(`rotate${uf[d]}`,o,u,this.animationValues),df(`skew${uf[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Wc(a==null?void 0:a.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Wc(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!bs(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=sR(this.projectionDeltaWithTransform,this.treeScale,d);l&&(h=l(d,h)),o.transform=h;const{x:f,y:p}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in km){if(d[m]===void 0)continue;const{correct:g,applyTo:x,isCSSVariable:y}=km[m],b=h==="none"?d[m]:g(d[m],u);if(x){const k=x.length;for(let w=0;w<k;w++)o[x[w]]=b}else y?this.options.visualElement.renderState.vars[m]=b:o[m]=b}this.options.layoutId&&(o.pointerEvents=u===this?Wc(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(Ub),this.root.sharedNodes.clear()}}}function gR(t){t.updateLayout()}function xR(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;if(i==="size")An(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],p=kt(f);f.min=r[h].min,f.max=f.min+p});else if(i==="x"||i==="y"){const h=i==="x"?"y":"x";wm(o?e.measuredBox[h]:e.layoutBox[h],r[h])}else VC(i,e.layoutBox,r)&&An(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],p=kt(r[h]);f.max=f.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+p)});const a=Di();da(a,r,e.layoutBox);const l=Di();o?da(l,t.applyTransform(s,!0),e.measuredBox):da(l,r,e.layoutBox);const u=!IC(a);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const m=t.options.layoutAnchor||void 0,g=He();_u(g,e.layoutBox,f.layoutBox,m);const x=He();_u(x,r,p.layoutBox,m),OC(g,x)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=g,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function yR(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function bR(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function vR(t){t.clearSnapshot()}function Ub(t){t.clearMeasurements()}function kR(t){t.isLayoutDirty=!0,t.updateLayout()}function Kb(t){t.isLayoutDirty=!1}function wR(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function SR(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Gb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function NR(t){t.resolveTargetDelta()}function CR(t){t.calcProjection()}function jR(t){t.resetSkewAndRotation()}function ER(t){t.removeLeadSnapshot()}function qb(t,e,n){t.translate=xe(e.translate,0,n),t.scale=xe(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Jb(t,e,n,r){t.min=xe(e.min,n.min,r),t.max=xe(e.max,n.max,r)}function TR(t,e,n,r){Jb(t.x,e.x,n.x,r),Jb(t.y,e.y,n.y,r)}function MR(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const PR={duration:.45,ease:[.4,0,.1,1]},Yb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Xb=Yb("applewebkit/")&&!Yb("chrome/")?Math.round:Rt;function Zb(t){t.min=Xb(t.min),t.max=Xb(t.max)}function AR(t){Zb(t.x),Zb(t.y)}function VC(t,e,n){return t==="position"||t==="preserve-aspect"&&!ZL(Fb(e),Fb(n),.2)}function DR(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const LR=FC({attachResizeListener:(t,e)=>Ya(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),hf={current:void 0},$C=FC({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!hf.current){const t=new LR({});t.mount(window),t.setOptions({layoutScroll:!0}),hf.current=t}return hf.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),vl=v.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Qb(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function RR(...t){return e=>{let n=!1;const r=t.map(s=>{const i=Qb(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():Qb(t[s],null)}}}}function _R(...t){return v.useCallback(RR(...t),t)}class IR extends v.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(ua(n)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,s=ua(r)&&r.offsetWidth||0,i=ua(r)&&r.offsetHeight||0,o=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=s-a.width-a.left,a.bottom=i-a.height-a.top,a.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function OR({children:t,isPresent:e,anchorX:n,anchorY:r,root:s,pop:i}){var f;const o=v.useId(),a=v.useRef(null),l=v.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:u}=v.useContext(vl),d=((f=t.props)==null?void 0:f.ref)??(t==null?void 0:t.ref),h=_R(a,d);return v.useInsertionEffect(()=>{const{width:p,height:m,top:g,left:x,right:y,bottom:b,direction:k}=l.current;if(e||i===!1||!a.current||!p||!m)return;const w=k==="rtl",C=n==="left"?w?`right: ${y}`:`left: ${x}`:w?`left: ${x}`:`right: ${y}`,j=r==="bottom"?`bottom: ${b}`:`top: ${g}`;a.current.dataset.motionPopId=o;const S=document.createElement("style");u&&(S.nonce=u);const N=s??document.head;return N.appendChild(S),S.sheet&&S.sheet.insertRule(`
[data-motion-pop-id="${o}"] {
position: absolute !important;
width: ${p}px !important;
height: ${m}px !important;
${C}px !important;
${j}px !important;
}
`),()=>{var T;(T=a.current)==null||T.removeAttribute("data-motion-pop-id"),N.contains(S)&&N.removeChild(S)}},[e]),c.jsx(IR,{isPresent:e,childRef:a,sizeRef:l,pop:i,children:i===!1?t:v.cloneElement(t,{ref:h})})}const BR=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:a,anchorY:l,root:u})=>{const d=es(zR),h=v.useId(),f=v.useRef(n),p=v.useRef(r);gl(()=>{f.current=n,p.current=r});let m=!0,g=v.useMemo(()=>(m=!1,{id:h,initial:e,isPresent:n,custom:s,onExitComplete:x=>{d.set(x,!0);for(const y of d.values())if(!y)return;r&&r()},register:x=>(d.set(x,!1),()=>{var y;d.delete(x),!f.current&&!d.size&&((y=p.current)==null||y.call(p))})}),[n,d,r]);return i&&m&&(g={...g}),v.useMemo(()=>{d.forEach((x,y)=>d.set(y,!1))},[n]),v.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),t=c.jsx(OR,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:u,children:t}),c.jsx(Zd.Provider,{value:g,children:t})};function zR(){return new Map}function HC(t=!0){const e=v.useContext(Zd);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=v.useId();v.useEffect(()=>{if(t)return s(i)},[t]);const o=v.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,o]:[!0]}const tc=t=>t.key||"";function ev(t){const e=[];return v.Children.forEach(t,n=>{v.isValidElement(n)&&e.push(n)}),e}const FR=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1,anchorX:a="left",anchorY:l="top",root:u})=>{const[d,h]=HC(o),f=v.useMemo(()=>ev(t),[t]),p=o&&!d?[]:f.map(tc),m=v.useRef(!0),g=v.useRef(f),x=es(()=>new Map),y=v.useRef(new Set),[b,k]=v.useState(f),[w,C]=v.useState(f);gl(()=>{m.current=!1,g.current=f;for(let N=0;N<w.length;N++){const T=tc(w[N]);p.includes(T)?(x.delete(T),y.current.delete(T)):x.get(T)!==!0&&x.set(T,!1)}},[w,p.length,p.join("-")]);const j=[];if(f!==b){let N=[...f];for(let T=0;T<w.length;T++){const E=w[T],D=tc(E);p.includes(D)||(N.splice(T,0,E),j.push(E))}return i==="wait"&&j.length&&(N=j),C(ev(N)),k(f),null}const{forceRender:S}=v.useContext(u0);return c.jsx(c.Fragment,{children:w.map(N=>{const T=tc(N),E=o&&!d?!1:f===w||p.includes(T),D=()=>{if(y.current.has(T))return;if(x.has(T))y.current.add(T),x.set(T,!0);else return;let P=!0;x.forEach(O=>{O||(P=!1)}),P&&(S==null||S(),C(g.current),o&&(h==null||h()),r&&r())};return c.jsx(BR,{isPresent:E,initial:!m.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:u,onExitComplete:E?void 0:D,anchorX:a,anchorY:l,children:N},T)})})},WC=v.createContext({strict:!1}),tv={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let nv=!1;function VR(){if(nv)return;const t={};for(const e in tv)t[e]={isEnabled:n=>tv[e].some(r=>!!n[r])};vC(t),nv=!0}function UC(){return VR(),NL()}function $R(t){const e=UC();for(const n in t)e[n]={...e[n],...t[n]};vC(e)}const HR=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Iu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HR.has(t)}let KC=t=>!Iu(t);function WR(t){typeof t=="function"&&(KC=e=>e.startsWith("on")?!Iu(e):t(e))}try{WR(require("@emotion/is-prop-valid").default)}catch{}function UR(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||Ke(t[s])||(KC(s)||n===!0&&Iu(s)||!e&&!Iu(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const nh=v.createContext({});function KR(t,e){if(th(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Ja(n)?n:void 0,animate:Ja(r)?r:void 0}}return t.inherit!==!1?e:{}}function GR(t){const{initial:e,animate:n}=KR(t,v.useContext(nh));return v.useMemo(()=>({initial:e,animate:n}),[rv(e),rv(n)])}function rv(t){return Array.isArray(t)?t.join(" "):t}const B0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function GC(t,e,n){for(const r in e)!Ke(e[r])&&!EC(r,n)&&(t[r]=e[r])}function qR({transformTemplate:t},e){return v.useMemo(()=>{const n=B0();return I0(n,e,t),Object.assign({},n.vars,n.style)},[e])}function JR(t,e){const n=t.style||{},r={};return GC(r,n,t),Object.assign(r,qR(t,e)),r}function YR(t,e){const n={},r=JR(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const qC=()=>({...B0(),attrs:{}});function XR(t,e,n,r){const s=v.useMemo(()=>{const i=qC();return TC(i,e,PC(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};GC(i,t.style,t),s.style={...i,...s.style}}return s}const ZR=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function z0(t){return typeof t!="string"||t.includes("-")?!1:!!(ZR.indexOf(t)>-1||/[A-Z]/u.test(t))}function QR(t,e,n,{latestValues:r},s,i=!1,o){const l=(o??z0(t)?XR:YR)(e,r,s,t),u=UR(e,typeof t=="string",i),d=t!==v.Fragment?{...u,...l,ref:n}:{},{children:h}=e,f=v.useMemo(()=>Ke(h)?h.get():h,[h]);return v.createElement(t,{...d,children:f})}function e_({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:t_(n,r,s,t),renderState:e()}}function t_(t,e,n,r){const s={},i=r(t,{});for(const f in i)s[f]=Wc(i[f]);let{initial:o,animate:a}=t;const l=th(t),u=yC(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?a:o;if(h&&typeof h!="boolean"&&!eh(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p<f.length;p++){const m=M0(t,f[p]);if(m){const{transitionEnd:g,transition:x,...y}=m;for(const b in y){let k=y[b];if(Array.isArray(k)){const w=d?k.length-1:0;k=k[w]}k!==null&&(s[b]=k)}for(const b in g)s[b]=g[b]}}}return s}const JC=t=>(e,n)=>{const r=v.useContext(nh),s=v.useContext(Zd),i=()=>e_(t,e,r,s);return n?i():es(i)},n_=JC({scrapeMotionValuesFromProps:O0,createRenderState:B0}),r_=JC({scrapeMotionValuesFromProps:AC,createRenderState:qC}),s_=Symbol.for("motionComponentSymbol");function i_(t,e,n){const r=v.useRef(n);v.useInsertionEffect(()=>{r.current=n});const s=v.useRef(null);return v.useCallback(i=>{var a;i&&((a=t.onMount)==null||a.call(t,i)),e&&(i?e.mount(i):e.unmount());const o=r.current;if(typeof o=="function")if(i){const l=o(i);typeof l=="function"&&(s.current=l)}else s.current?(s.current(),s.current=null):o(i);else o&&(o.current=i)},[e])}const YC=v.createContext({});function hi(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function o_(t,e,n,r,s,i){var k,w;const{visualElement:o}=v.useContext(nh),a=v.useContext(WC),l=v.useContext(Zd),u=v.useContext(vl),d=u.reducedMotion,h=u.skipAnimations,f=v.useRef(null),p=v.useRef(!1);r=r||a.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d,skipAnimations:h,isSVG:i}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const m=f.current,g=v.useContext(YC);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&a_(f.current,n,s,g);const x=v.useRef(!1);v.useInsertionEffect(()=>{m&&x.current&&m.update(n,l)});const y=n[sC],b=v.useRef(!!y&&typeof window<"u"&&!((k=window.MotionHandoffIsComplete)!=null&&k.call(window,y))&&((w=window.MotionHasOptimisedAnimation)==null?void 0:w.call(window,y)));return gl(()=>{p.current=!0,m&&(x.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),b.current&&m.animationState&&m.animationState.animateChanges())}),v.useEffect(()=>{m&&(!b.current&&m.animationState&&m.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var C;(C=window.MotionHandoffMarkAsComplete)==null||C.call(window,y)}),b.current=!1),m.enteringChildren=void 0)}),m}function a_(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u,layoutAnchor:d,layoutCrossfade:h}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:XC(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&hi(a),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:u,layoutAnchor:d})}function XC(t){if(t)return t.options.allowProjection!==!1?t.projection:XC(t.parent)}function ff(t,{forwardMotionProps:e=!1,type:n}={},r,s){r&&$R(r);const i=n?n==="svg":z0(t),o=i?r_:n_;function a(u,d){let h;const f={...v.useContext(vl),...u,layoutId:l_(u)},{isStatic:p}=f,m=GR(u),g=o(u,p);if(!p&&typeof window<"u"){c_();const x=u_(f);h=x.MeasureLayout,m.visualElement=o_(t,g,f,s,x.ProjectionNode,i)}return c.jsxs(nh.Provider,{value:m,children:[h&&m.visualElement?c.jsx(h,{visualElement:m.visualElement,...f}):null,QR(t,u,i_(g,m.visualElement,d),g,p,e,i)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=v.forwardRef(a);return l[s_]=t,l}function l_({layoutId:t}){const e=v.useContext(u0).id;return e&&t!==void 0?e+"-"+t:t}function c_(t,e){v.useContext(WC).strict}function u_(t){const e=UC(),{drag:n,layout:r}=e;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(t)||r!=null&&r.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function d_(t,e){if(typeof Proxy>"u")return ff;const n=new Map,r=(i,o)=>ff(i,o,t,e),s=(i,o)=>r(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,ff(o,void 0,t,e)),n.get(o))})}const h_=(t,e)=>e.isSVG??z0(t)?new VL(e):new _L(e,{allowProjection:t!==v.Fragment});class f_ extends cs{constructor(e){super(e),e.animationState||(e.animationState=KL(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();eh(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let p_=0;class m_ extends cs{constructor(){super(...arguments),this.id=p_++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:o,custom:a}=this.node.getProps();if(typeof o=="string"||typeof o=="object"&&o!==null&&!Array.isArray(o)){const l=Is(this.node,o,a);if(l){const{transition:u,transitionEnd:d,...h}=l;for(const f in h)(i=this.node.getValue(f))==null||i.jump(h[f])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const g_={animation:{Feature:f_},exit:{Feature:m_}};function kl(t){return{point:{x:t.pageX,y:t.pageY}}}const x_=t=>e=>D0(e)&&t(e,kl(e));function ha(t,e,n,r){return Ya(t,e,x_(n),r)}const ZC=({current:t})=>t?t.ownerDocument.defaultView:null,sv=(t,e)=>Math.abs(t-e);function y_(t,e){const n=sv(t.x,e.x),r=sv(t.y,e.y);return Math.sqrt(n**2+r**2)}const iv=new Set(["auto","scroll"]);class QC{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=m=>{this.handleScroll(m.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=nc(this.lastRawMoveEventInfo,this.transformPagePoint));const m=pf(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=y_(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:y}=m,{timestamp:b}=Je;this.history.push({...y,timestamp:b});const{onStart:k,onMove:w}=this.handlers;g||(k&&k(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,m)},this.handlePointerMove=(m,g)=>{this.lastMoveEvent=m,this.lastRawMoveEventInfo=g,this.lastMoveEventInfo=nc(g,this.transformPagePoint),le.update(this.updatePoint,!0)},this.handlePointerUp=(m,g)=>{this.end();const{onEnd:x,onSessionEnd:y,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=pf(m.type==="pointercancel"?this.lastMoveEventInfo:nc(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(m,k),y&&y(m,k)},!D0(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=kl(e),u=nc(l,this.transformPagePoint),{point:d}=u,{timestamp:h}=Je;this.history=[{...d,timestamp:h}];const{onSessionStart:f}=n;f&&f(e,pf(u,this.history));const p={passive:!0,capture:!0};this.removeListeners=xl(ha(this.contextWindow,"pointermove",this.handlePointerMove,p),ha(this.contextWindow,"pointerup",this.handlePointerUp,p),ha(this.contextWindow,"pointercancel",this.handlePointerUp,p)),a&&this.startScrollTracking(a)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(iv.has(r.overflowX)||iv.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const r=e===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,s),le.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ln(this.updatePoint)}}function nc(t,e){return e?{point:e(t.point)}:t}function ov(t,e){return{x:t.x-e.x,y:t.y-e.y}}function pf({point:t},e){return{point:t,delta:ov(t,ej(e)),offset:ov(t,b_(e)),velocity:v_(e,.1)}}function b_(t){return t[0]}function ej(t){return t[t.length-1]}function v_(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=ej(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Ft(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&s.timestamp-r.timestamp>Ft(e)*2&&(r=t[1]);const i=tn(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function k_(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?xe(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?xe(n,t,r.max):Math.min(t,n)),t}function av(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function w_(t,{top:e,left:n,bottom:r,right:s}){return{x:av(t.x,n,s),y:av(t.y,e,r)}}function lv(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function S_(t,e){return{x:lv(t.x,e.x),y:lv(t.y,e.y)}}function N_(t,e){let n=.5;const r=kt(t),s=kt(e);return s>r?n=Yi(e.min,e.max-r,t.min):r>s&&(n=Yi(t.min,t.max-s,e.min)),Cn(0,1,n)}function C_(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Sm=.35;function j_(t=Sm){return t===!1?t=0:t===!0&&(t=Sm),{x:cv(t,"left","right"),y:cv(t,"top","bottom")}}function cv(t,e,n){return{min:uv(t,e),max:uv(t,n)}}function uv(t,e){return typeof t=="number"?t:t[e]||0}const E_=new WeakMap;class T_{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=He(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{n&&this.snapToCursor(kl(h).point),this.stopAnimation()},o=(h,f)=>{const{drag:p,dragPropagation:m,onDragStart:g}=this.getProps();if(p&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Z4(p),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),An(y=>{let b=this.getAxisMotionValue(y).get()||0;if(zn.test(b)){const{projection:k}=this.visualElement;if(k&&k.layout){const w=k.layout.layoutBox[y];w&&(b=kt(w)*(parseFloat(b)/100))}}this.originPoint[y]=b}),g&&le.update(()=>g(h,f),!1,!0),hm(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},a=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:m,onDirectionLock:g,onDrag:x}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=f;if(m&&this.currentDirection===null){this.currentDirection=P_(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),x&&le.update(()=>x(h,f),!1,!0)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new QC(e,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:ZC(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&le.postRender(()=>a(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!rc(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=k_(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;e&&hi(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=w_(r.layoutBox,e):this.constraints=!1,this.elastic=j_(n),s!==this.constraints&&!hi(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&An(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=C_(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!hi(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;s.root&&(s.root.scroll=void 0,s.root.updateScroll());const i=ML(r,s.root,this.visualElement.getTransformPagePoint());let o=S_(s.layout.layoutBox,i);if(n){const a=n(jL(o));this.hasMutatedConstraints=!!a,a&&(o=wC(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=An(d=>{if(!rc(d,n,this.currentDirection))return;let h=l&&l[d]||{};(o===!0||o===d)&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?e[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return hm(this.visualElement,e),r.start(T0(e,r,0,n,this.visualElement,!1))}stopAnimation(){An(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps()[n];return s||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){An(n=>{const{drag:r}=this.getProps();if(!rc(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n],l=i.get()||0;i.set(e[n]-xe(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!hi(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};An(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=N_({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),An(o=>{if(!rc(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(xe(l,u,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;E_.set(this.visualElement,this);const e=this.visualElement.current,n=ha(e,"pointerdown",u=>{const{drag:d,dragListener:h=!0}=this.getProps(),f=u.target,p=f!==e&&sL(f);d&&h&&!p&&this.start(u)});let r;const s=()=>{const{dragConstraints:u}=this.getProps();hi(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=M_(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),le.read(s);const a=Ya(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(An(h=>{const f=this.getAxisMotionValue(h);f&&(this.originPoint[h]+=u[h].translate,f.set(f.get()+u[h].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),l&&l(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Sm,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function dv(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function M_(t,e,n){const r=xm(t,dv(n)),s=xm(e,dv(n));return()=>{r(),s()}}function rc(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function P_(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class A_ extends cs{constructor(e){super(e),this.removeGroupControls=Rt,this.removeListeners=Rt,this.controls=new T_(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Rt}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const mf=t=>(e,n)=>{t&&le.update(()=>t(e,n),!1,!0)};class D_ extends cs{constructor(){super(...arguments),this.removePointerDownListener=Rt}onPointerDown(e){this.session=new QC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ZC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:mf(e),onStart:mf(n),onMove:mf(r),onEnd:(i,o)=>{delete this.session,s&&le.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=ha(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let gf=!1;class L_ extends v.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),gf&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Uc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:o}=r;return o&&(o.isPresent=i,e.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),gf=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||le.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Zi.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;gf=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function tj(t){const[e,n]=HC(),r=v.useContext(u0);return c.jsx(L_,{...t,layoutGroup:r,switchLayoutGroup:v.useContext(YC),isPresent:e,safeToRemove:n})}const R_={pan:{Feature:D_},drag:{Feature:A_,ProjectionNode:$C,MeasureLayout:tj}};function hv(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&le.postRender(()=>i(e,kl(e)))}class __ extends cs{mount(){const{current:e}=this.node;e&&(this.unmount=eL(e,(n,r)=>(hv(this.node,r,"Start"),s=>hv(this.node,s,"End"))))}unmount(){}}class I_ extends cs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xl(Ya(this.node.current,"focus",()=>this.onFocus()),Ya(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function fv(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&le.postRender(()=>i(e,kl(e)))}class O_ extends cs{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=oL(e,(s,i)=>(fv(this.node,i,"Start"),(o,{success:a})=>fv(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Nm=new WeakMap,xf=new WeakMap,B_=t=>{const e=Nm.get(t.target);e&&e(t)},z_=t=>{t.forEach(B_)};function F_({root:t,...e}){const n=t||document;xf.has(n)||xf.set(n,{});const r=xf.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(z_,{root:t,...e})),r[s]}function V_(t,e,n){const r=F_(e);return Nm.set(t,n),r.observe(t),()=>{Nm.delete(t),r.unobserve(t)}}const $_={some:0,all:1};class H_ extends cs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:$_[s]},a=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:f}=this.node.getProps(),p=d?h:f;p&&p(u)};this.stopObserver=V_(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(W_(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function W_({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const U_={inView:{Feature:H_},tap:{Feature:O_},focus:{Feature:I_},hover:{Feature:__}},K_={layout:{ProjectionNode:$C,MeasureLayout:tj}},G_={...g_,...U_,...R_,...K_},er=d_(G_,h_);function Ou(t){return typeof window>"u"?!1:t?GN():j0()}const q_=50,pv=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),J_=()=>({time:0,x:pv(),y:pv()}),Y_={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function mv(t,e,n,r){const s=n[e],{length:i,position:o}=Y_[e],a=s.current,l=n.time;s.current=Math.abs(t[`scroll${o}`]),s.scrollLength=t[`scroll${i}`]-t[`client${i}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=Yi(0,s.scrollLength,s.current);const u=r-l;s.velocity=u>q_?0:p0(s.current-a,u)}function X_(t,e,n){mv(t,"x",e,n),mv(t,"y",e,n),e.time=n}function Z_(t,e){const n={x:0,y:0};let r=t;for(;r&&r!==e;)if(ua(r))n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if(r.tagName==="svg"){const s=r.getBoundingClientRect();r=r.parentElement;const i=r.getBoundingClientRect();n.x+=s.left-i.left,n.y+=s.top-i.top}else if(r instanceof SVGGraphicsElement){const{x:s,y:i}=r.getBBox();n.x+=s,n.y+=i;let o=null,a=r.parentNode;for(;!o;)a.tagName==="svg"&&(o=a),a=r.parentNode;r=o}else break;return n}const Cm={start:0,center:.5,end:1};function gv(t,e,n=0){let r=0;if(t in Cm&&(t=Cm[t]),typeof t=="string"){const s=parseFloat(t);t.endsWith("px")?r=s:t.endsWith("%")?t=s/100:t.endsWith("vw")?r=s/100*document.documentElement.clientWidth:t.endsWith("vh")?r=s/100*document.documentElement.clientHeight:t=s}return typeof t=="number"&&(r=e*t),n+r}const Q_=[0,0];function eI(t,e,n,r){let s=Array.isArray(t)?t:Q_,i=0,o=0;return typeof t=="number"?s=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?s=t.split(" "):s=[t,Cm[t]?t:"0"]),i=gv(s[0],n,r),o=gv(s[1],e),i-o}const Ko={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},tI={x:0,y:0};function nI(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function rI(t,e,n){const{offset:r=Ko.All}=n,{target:s=t,axis:i="y"}=n,o=i==="y"?"height":"width",a=s!==t?Z_(s,t):tI,l=s===t?{width:t.scrollWidth,height:t.scrollHeight}:nI(s),u={width:t.clientWidth,height:t.clientHeight};e[i].offset.length=0;let d=!e[i].interpolate;const h=r.length;for(let f=0;f<h;f++){const p=eI(r[f],u[o],l[o],a[i]);!d&&p!==e[i].interpolatorOffsets[f]&&(d=!0),e[i].offset[f]=p}d&&(e[i].interpolate=w0(e[i].offset,$N(r),{clamp:!1}),e[i].interpolatorOffsets=[...e[i].offset]),e[i].progress=Cn(0,1,e[i].interpolate(e[i].current))}function sI(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let r=e;for(;r&&r!==t;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}function iI(t,e,n,r={}){return{measure:s=>{sI(t,r.target,n),X_(t,n,s),(r.offset||r.target)&&rI(t,n,r)},notify:()=>e(n)}}const ai=new WeakMap,xv=new WeakMap,yf=new WeakMap,yv=new WeakMap,sc=new WeakMap,bv=t=>t===document.scrollingElement?window:t;function nj(t,{container:e=document.scrollingElement,trackContentSize:n=!1,...r}={}){if(!e)return Rt;let s=yf.get(e);s||(s=new Set,yf.set(e,s));const i=J_(),o=iI(e,t,i,r);if(s.add(o),!ai.has(e)){const l=()=>{for(const f of s)f.measure(Je.timestamp);le.preUpdate(u)},u=()=>{for(const f of s)f.notify()},d=()=>le.read(l);ai.set(e,d);const h=bv(e);window.addEventListener("resize",d),e!==document.documentElement&&xv.set(e,xm(e,d)),h.addEventListener("scroll",d),d()}if(n&&!sc.has(e)){const l=ai.get(e),u={width:e.scrollWidth,height:e.scrollHeight};yv.set(e,u);const d=()=>{const f=e.scrollWidth,p=e.scrollHeight;(u.width!==f||u.height!==p)&&(l(),u.width=f,u.height=p)},h=le.read(d,!0);sc.set(e,h)}const a=ai.get(e);return le.read(a,!1,!0),()=>{var h;ln(a);const l=yf.get(e);if(!l||(l.delete(o),l.size))return;const u=ai.get(e);ai.delete(e),u&&(bv(e).removeEventListener("scroll",u),(h=xv.get(e))==null||h(),window.removeEventListener("resize",u));const d=sc.get(e);d&&(ln(d),sc.delete(e)),yv.delete(e)}}const oI=[[Ko.Enter,"entry"],[Ko.Exit,"exit"],[Ko.Any,"cover"],[Ko.All,"contain"]],vv={start:0,end:1};function aI(t){const e=t.trim().split(/\s+/);if(e.length!==2)return;const n=vv[e[0]],r=vv[e[1]];if(!(n===void 0||r===void 0))return[n,r]}function lI(t){if(t.length!==2)return;const e=[];for(const n of t)if(Array.isArray(n))e.push(n);else if(typeof n=="string"){const r=aI(n);if(!r)return;e.push(r)}else return;return e}function cI(t,e){const n=lI(t);if(!n)return!1;for(let r=0;r<2;r++){const s=n[r],i=e[r];if(s[0]!==i[0]||s[1]!==i[1])return!1}return!0}function F0(t){if(!t)return{rangeStart:"contain 0%",rangeEnd:"contain 100%"};for(const[e,n]of oI)if(cI(t,e))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const kv=new Map;function wv(t){const e={value:0},n=nj(r=>{e.value=r[t.axis].progress*100},t);return{currentTime:e,cancel:n}}function rj({source:t,container:e,...n}){const{axis:r}=n;t&&(e=t);let s=kv.get(e);s||(s=new Map,kv.set(e,s));const i=n.target??"self";let o=s.get(i);o||(o={},s.set(i,o));const a=r+(n.offset??[]).join(",");return o[a]||(n.target&&Ou(n.target)?F0(n.offset)?o[a]=new ViewTimeline({subject:n.target,axis:r}):o[a]=wv({container:e,...n}):Ou()?o[a]=new ScrollTimeline({source:e,axis:r}):o[a]=wv({container:e,...n})),o[a]}function uI(t,e){const n=rj(e),r=e.target?F0(e.offset):void 0,s=e.target?Ou(e.target)&&!!r:Ou();return t.attachTimeline({timeline:s?n:void 0,...r&&s&&{rangeStart:r.rangeStart,rangeEnd:r.rangeEnd},observe:i=>(i.pause(),xC(o=>{i.time=i.iterationDuration*o},n))})}function dI(t){return t&&(t.target||t.offset)}function hI(t){return t.length===2}function fI(t,e){return hI(t)||dI(e)?nj(n=>{t(n[e.axis].progress,n)},e):xC(t,rj(e))}function sj(t,{axis:e="y",container:n=document.scrollingElement,...r}={}){if(!n)return Rt;const s={axis:e,container:n,...r};return typeof t=="function"?fI(t,s):uI(t,s)}const pI=()=>({scrollX:yn(0),scrollY:yn(0),scrollXProgress:yn(0),scrollYProgress:yn(0)}),Li=t=>t?!t.current:!1;function Sv(t,e,n,r){return{factory:s=>{let i;const o=()=>{if(Li(n)||Li(r)){Zi.read(o);return}i=sj(s,{...e,axis:t,container:(n==null?void 0:n.current)||void 0,target:(r==null?void 0:r.current)||void 0})};return Zi.read(o),()=>{hC(o),i==null||i()}},times:[0,1],keyframes:[0,1],ease:s=>s,duration:1}}function mI(t,e){return typeof window>"u"?!1:t?GN()&&!!F0(e):j0()}function ij({container:t,target:e,...n}={}){const r=es(pI);mI(e,n.offset)&&(r.scrollXProgress.accelerate=Sv("x",n,t,e),r.scrollYProgress.accelerate=Sv("y",n,t,e));const s=v.useRef(null),i=v.useRef(!1),o=v.useCallback(()=>(s.current=sj((a,{x:l,y:u})=>{r.scrollX.set(l.current),r.scrollXProgress.set(l.progress),r.scrollY.set(u.current),r.scrollYProgress.set(u.progress)},{...n,container:(t==null?void 0:t.current)||void 0,target:(e==null?void 0:e.current)||void 0}),()=>{var a;(a=s.current)==null||a.call(s)}),[t,e,JSON.stringify(n.offset)]);return gl(()=>{if(i.current=!1,Li(t)||Li(e)){i.current=!0;return}else return o()},[o]),v.useEffect(()=>{if(!i.current)return;let a;const l=()=>{const u=Li(t),d=Li(e);!u&&!d&&(a=o())};return Zi.read(l),()=>{hC(l),a==null||a()}},[o]),r}function oj(t){const e=es(()=>yn(t)),{isStatic:n}=v.useContext(vl);if(n){const[,r]=v.useState(t);v.useEffect(()=>e.on("change",r),[])}return e}function aj(t,e){const n=oj(e()),r=()=>n.set(e());return r(),gl(()=>{const s=()=>le.preRender(r,!1,!0),i=t.map(o=>o.on("change",s));return()=>{i.forEach(o=>o()),ln(r)}}),n}function gI(t){ca.current=[],t();const e=aj(ca.current,t);return ca.current=void 0,e}function Sr(t,e,n,r){if(typeof t=="function")return gI(t);if(n!==void 0&&!Array.isArray(n)&&typeof e!="function")return xI(t,e,n,r);const o=typeof e=="function"?e:gL(e,n,r),a=Array.isArray(t)?Nv(t,o):Nv([t],([u])=>o(u)),l=Array.isArray(t)?void 0:t.accelerate;return l&&!l.isTransformed&&typeof e!="function"&&Array.isArray(n)&&(r==null?void 0:r.clamp)!==!1&&(a.accelerate={...l,times:e,keyframes:n,isTransformed:!0}),a}function Nv(t,e){const n=es(()=>[]);return aj(t,()=>{n.length=0;const r=t.length;for(let s=0;s<r;s++)n[s]=t[s].get();return e(n)})}function xI(t,e,n,r){const s=es(()=>Object.keys(n)),i=es(()=>({}));for(const o of s)i[o]=Sr(t,e,n[o],r);return i}function yI(t,e={}){const{isStatic:n}=v.useContext(vl),r=()=>Ke(t)?t.get():t;if(n)return Sr(r);const s=oj(r());return v.useInsertionEffect(()=>xL(s,t,e),[s,JSON.stringify(e)]),s}function bI(t,e={}){return yI(t,{type:"spring",...e})}function vI(){const{scrollYProgress:t}=ij(),e=bI(t,{stiffness:200,damping:30,restDelta:.001});return c.jsx(er.div,{style:{scaleX:e},className:"fixed left-0 top-0 z-40 h-0.5 w-full origin-left bg-brand-500"})}const kI=()=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"h-10 w-10",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.7 6.3a4 4 0 0 0-5.5 4.5L3 17l2 2 6.2-6.2a4 4 0 0 0 4.5-5.5l-2.6 2.6-2-2 2.6-2.6Z"})});function wl({message:t,fullScreen:e=!1}){const{t:n}=ct(),r=c.jsxs("div",{className:"mx-auto max-w-md text-center",children:[c.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:c.jsx(kI,{})}),c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:n("maintenance.title")}),c.jsx("p",{className:"text-neutral-600 dark:text-neutral-300",children:t||n("maintenance.defaultMessage")})]});return e?c.jsxs("div",{className:"relative flex min-h-screen items-center justify-center bg-white px-4 dark:bg-neutral-950",children:[r,c.jsxs(ne,{to:"/admin/login","aria-label":n("maintenance.login"),title:n("maintenance.login"),className:"fixed bottom-4 right-4 flex items-center gap-2 rounded-full border border-neutral-200 bg-white px-3 py-2 text-sm font-medium text-neutral-600 shadow-sm transition hover:border-brand-500 hover:text-brand-600 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-300 dark:hover:text-brand-400",children:[c.jsx(bt,{name:"log-in",className:"h-4 w-4"}),n("maintenance.login")]})]}):c.jsx("div",{className:"mx-auto max-w-6xl px-4 py-20 sm:px-6",children:r})}const Cv=c.jsx(c.Fragment,{children:'Wartungsmodus aktiv – Besucher sehen aktuell eine Wartungsmeldung. Du siehst diese Seite nur, weil du die Berechtigung "Wartungsmodus umgehen" hast.'});function Sl({inline:t=!1}){return t?c.jsx("div",{className:"mb-8 rounded-lg bg-amber-500 px-4 py-2 text-center text-xs font-semibold text-white",children:Cv}):c.jsx("div",{className:"bg-amber-500 px-4 py-2 text-center text-xs font-semibold text-white",children:Cv})}function wI({onClose:t}){const{consent:e,saveCustom:n}=yo(),[r,s]=v.useState(e.external),[i,o]=v.useState(e.analytics),{t:a}=ct();return c.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/50 p-4",onClick:t,children:c.jsxs("div",{className:"w-full max-w-md rounded-xl bg-white p-6 dark:bg-neutral-900",onClick:l=>l.stopPropagation(),children:[c.jsx("h2",{className:"mb-1 text-lg font-bold text-neutral-900 dark:text-white",children:a("cookieConsent.modalTitle")}),c.jsxs("p",{className:"mb-4 text-sm text-neutral-600 dark:text-neutral-300",children:[a("cookieConsent.modalIntro")," ",c.jsx(ne,{to:"/datenschutz",className:"underline hover:text-brand-500",onClick:t,children:a("cookieConsent.privacyPolicy")}),"."]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-neutral-200 p-3 dark:border-neutral-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-neutral-800 dark:text-neutral-100",children:a("cookieConsent.necessaryTitle")}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:a("cookieConsent.necessaryDesc")})]}),c.jsx("input",{type:"checkbox",checked:!0,disabled:!0,className:"mt-1 h-4 w-4 shrink-0"})]}),c.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-neutral-200 p-3 dark:border-neutral-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-neutral-800 dark:text-neutral-100",children:a("cookieConsent.externalTitle")}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:a("cookieConsent.externalDesc")})]}),c.jsx("input",{type:"checkbox",checked:r,onChange:l=>s(l.target.checked),className:"mt-1 h-4 w-4 shrink-0"})]}),c.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-neutral-200 p-3 dark:border-neutral-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-neutral-800 dark:text-neutral-100",children:a("cookieConsent.analyticsTitle")}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:a("cookieConsent.analyticsDesc")})]}),c.jsx("input",{type:"checkbox",checked:i,onChange:l=>o(l.target.checked),className:"mt-1 h-4 w-4 shrink-0"})]})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:t,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:a("cookieConsent.cancel")}),c.jsx("button",{type:"button",onClick:()=>n({external:r,analytics:i}),className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:a("cookieConsent.saveSelection")})]})]})})}function SI(){const{decided:t,settingsOpen:e,acceptAll:n,rejectNonEssential:r,openSettings:s,closeSettings:i}=yo(),{t:o}=ct();return c.jsxs(c.Fragment,{children:[!t&&c.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t border-neutral-200 bg-white/95 p-4 shadow-lg backdrop-blur dark:border-neutral-800 dark:bg-neutral-900/95 sm:p-5",children:c.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:[o("cookieConsent.bannerText")," ",o("cookieConsent.moreInfo")," ",c.jsx(ne,{to:"/datenschutz",className:"underline hover:text-brand-500",children:o("cookieConsent.privacyPolicy")}),"."]}),c.jsxs("div",{className:"flex flex-wrap gap-2 sm:shrink-0",children:[c.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-neutral-300 px-3 py-2 text-sm dark:border-neutral-700",children:o("cookieConsent.settings")}),c.jsx("button",{type:"button",onClick:r,className:"rounded-md border border-neutral-300 px-3 py-2 text-sm dark:border-neutral-700",children:o("cookieConsent.onlyNecessary")}),c.jsx("button",{type:"button",onClick:n,className:"rounded-md bg-brand-500 px-3 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:o("cookieConsent.acceptAll")})]})]})}),e&&c.jsx(wI,{onClose:i})]})}function NI(){const{consent:t}=yo(),{ga_measurement_id:e}=ls(),n=v.useRef(!1);return v.useEffect(()=>{if(!e||!t.analytics||n.current)return;n.current=!0;const r=document.createElement("script");r.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,r.async=!0,document.head.appendChild(r),window.dataLayer=window.dataLayer||[];function s(...i){window.dataLayer.push(i)}window.gtag=s,s("js",new Date),s("config",e,{anonymize_ip:!0})},[e,t.analytics]),null}const lj=v.createContext({global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null},bypass:!1}),CI=lj.Provider;function rh(){return v.useContext(lj)}const V0=v.createContext({}),jI=V0.Provider;function Xa(t,e){const n=t[e];if(!n)return{};const r={};return n.font_family&&(r.fontFamily=n.font_family),n.font_size&&(r.fontSize=n.font_size),n.color&&(r.color=n.color),r}function ht(t){const e=v.useContext(V0);return Xa(e,t)}function $0(){return v.useContext(V0)}const EI={global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null}},TI={mon:{open:"09:00",close:"18:00",closed:!1},tue:{open:"09:00",close:"18:00",closed:!1},wed:{open:"09:00",close:"18:00",closed:!1},thu:{open:"09:00",close:"18:00",closed:!1},fri:{open:"09:00",close:"18:00",closed:!1},sat:{open:"10:00",close:"13:00",closed:!1},sun:{open:"",close:"",closed:!0}},MI={phone:"09373 20 62 390",whatsapp:null,contact_email:"info@hifi-planet-amorbach.de",address_street:"Boxbrunner Str. 20a",address_zip:"63916",address_city:"Amorbach",logo_path:null,logo_dark_path:null,business_hours:TI,hero_image_path:null,ga_measurement_id:null,package_card_theme:"graphite",package_card_layout:"strip",package_wheel_hint_interval:8,gallery_card_text_x:0,gallery_card_text_y:100,site_font:null},PI=["/impressum","/datenschutz","/agb"];function AI(){const[t,e]=v.useState(null),[n,r]=v.useState(MI),[s,i]=v.useState({}),{loading:o,hasPermission:a}=jn(),l=cn();if(v.useEffect(()=>{A.get("/maintenance").then(e).catch(()=>e(EI)),A.get("/site-settings").then(r).catch(()=>{}),A.get("/text-styles").then(i).catch(()=>{})},[]),v.useEffect(()=>{n.site_font?document.documentElement.style.setProperty("--site-font",n.site_font):document.documentElement.style.removeProperty("--site-font")},[n.site_font]),t===null||o)return c.jsx("div",{className:"min-h-screen bg-white dark:bg-neutral-950"});const u=a("maintenance.bypass"),d=PI.includes(l.pathname);return t.global.enabled&&!u&&!d?c.jsx(qy,{children:c.jsx(wl,{message:t.global.message,fullScreen:!0})}):c.jsx(qy,{children:c.jsx(CI,{value:{...t,bypass:u},children:c.jsx(O3,{value:n,children:c.jsx(jI,{value:s,children:c.jsxs("div",{className:"page-texture flex min-h-screen flex-col text-neutral-900 dark:text-neutral-100",children:[u&&t.global.enabled&&c.jsx(Sl,{}),c.jsx(vI,{}),c.jsx(H3,{}),c.jsx("main",{className:"flex-1",children:c.jsx(Xd,{})}),c.jsx(Y3,{}),c.jsx(SI,{}),c.jsx(NI,{})]})})})})})}const Bu="/assets/logo-BNfZDkmN.png",DI={home:"M3 11.5 12 4l9 7.5M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9",tag:"M4 4h7l9 9-7 7-9-9V4Zm3.5 3.5h.01",car:"M3 13.5 4.5 9A2 2 0 0 1 6.4 7.5h11.2A2 2 0 0 1 19.5 9L21 13.5M3 13.5v4a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1h12v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-4M3 13.5h18M6.5 16.5h.01M17.5 16.5h.01",box:"M12 3 4 7.5v9L12 21l8-4.5v-9L12 3Zm0 9 8-4.5M12 12v9M12 12 4 7.5",mail:"M4 6h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm0 0 8 7 8-7",users:"M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm-4 6c-4 0-7 2-7 4.5V19h14v-1.5C19 15 16 13 12 13Z",shield:"M12 3 4 6v6c0 4.5 3.4 7.7 8 9 4.6-1.3 8-4.5 8-9V6l-8-3Zm-1.5 9.5 4-4 1 1-5 5-2.5-2.5 1-1 1.5 1.5Z",lock:"M6 10V8a6 6 0 1 1 12 0v2m-13 0h14a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1Zm7 5v2",briefcase:"M4 7h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1Zm4 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M3 12h18",sliders:"M4 6h16M4 6a2 2 0 1 0 4 0 2 2 0 0 0-4 0Zm16 6H4m10 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0ZM4 18h16m-12 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0Z",image:"M4 5h16a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Zm2 12 4.5-5.5L14 16l2.5-3L20 17H6ZM8 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z",help:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-5.5v.01M9.5 9.25a2.5 2.5 0 1 1 3.5 2.29c-.7.32-1 .77-1 1.46v.3"},LI=({path:t})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"h-5 w-5 shrink-0",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:t})});function RI(){const{logout:t,user:e,hasPermission:n}=jn(),r=ml(),[s,i]=v.useState(!1),[o,a]=v.useState(0);v.useEffect(()=>{n("contact.manage")&&A.get("/contact").then(f=>a(f.filter(p=>p.status==="new").length)).catch(()=>{})},[]);const l=[{title:null,links:[{to:"/admin",label:"Dashboard",icon:"home",end:!0},{to:"/admin/account",label:"Mein Konto",icon:"lock"}]},{title:"Fahrzeug-Katalog",links:[{to:"/admin/brands",label:"Marken",icon:"tag",permission:"brands.manage"},{to:"/admin/models",label:"Modelle",icon:"car",permission:"models.manage"},{to:"/admin/packages",label:"Pakete",icon:"box",permission:"packages.manage"}]},{title:"Website",links:[{to:"/admin/home-sections",label:"Startseite",icon:"home",permission:"content.manage"},{to:"/admin/services",label:"Leistungen",icon:"briefcase",permission:"services.manage"},{to:"/admin/faqs",label:"FAQ",icon:"help",permission:"content.manage"},{to:"/admin/partners",label:"Partner",icon:"tag",permission:"content.manage"}]},{title:"Bildergalerie",links:[{to:"/admin/gallery-brands",label:"Marken",icon:"tag",permission:"gallery.manage"},{to:"/admin/gallery-projects",label:"Projekte",icon:"image",permission:"gallery.manage"}]},{title:"Kunden",links:[{to:"/admin/contact-requests",label:"Kontaktanfragen",icon:"mail",permission:"contact.manage",badge:o}]},{title:"Verwaltung",links:[{to:"/admin/users",label:"Benutzer",icon:"users",permission:"users.manage"},{to:"/admin/permission-groups",label:"Berechtigungsgruppen",icon:"shield",permission:"permission_groups.manage"},{to:"/admin/settings",label:"Einstellungen",icon:"sliders",permission:"settings.manage"}]}].map(f=>({...f,links:f.links.filter(p=>!p.permission||n(p.permission))})).filter(f=>f.links.length>0),u=async()=>{await t(),r("/admin/login")},d=({isActive:f})=>`flex items-center justify-between gap-2 rounded-md px-3 py-2 text-sm font-medium transition ${f?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,h=({onNavigate:f})=>c.jsx("nav",{className:"space-y-5",children:l.map((p,m)=>c.jsxs("div",{children:[p.title&&c.jsx("p",{className:"mb-1.5 px-3 text-xs font-semibold uppercase tracking-wide text-neutral-400 dark:text-neutral-500",children:p.title}),c.jsx("div",{className:"space-y-1",children:p.links.map(g=>c.jsxs(aN,{to:g.to,end:g.end,className:d,onClick:f,children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx(LI,{path:DI[g.icon]}),g.label]}),!!g.badge&&c.jsx("span",{className:"rounded-full bg-red-500 px-2 py-0.5 text-xs font-bold text-white",children:g.badge})]},g.to))})]},m))});return c.jsxs("div",{className:"flex min-h-screen bg-neutral-50 text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[c.jsxs("aside",{className:"hidden w-60 shrink-0 border-r border-neutral-200 p-4 dark:border-neutral-800 sm:block",children:[c.jsxs("div",{className:"mb-6 flex items-center gap-2 px-3",children:[c.jsxs(ne,{to:"/",className:"rounded-lg px-2 py-1",children:[c.jsx("img",{src:Bu,alt:"HifiPlanet",className:"h-7 w-auto dark:hidden"}),c.jsx("img",{src:Eu,alt:"HifiPlanet",className:"hidden h-7 w-auto dark:block"})]}),c.jsx("span",{className:"text-sm font-semibold text-neutral-500 dark:text-neutral-400",children:"Admin"})]}),c.jsx(h,{})]}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("header",{className:"border-b border-neutral-200 dark:border-neutral-800",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 sm:px-6",children:[c.jsxs("div",{className:"flex items-center gap-2 sm:hidden",children:[c.jsx("button",{onClick:()=>i(f=>!f),"aria-label":"Menü öffnen",className:"rounded-md p-2 text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-6 w-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})}),c.jsxs(ne,{to:"/",className:"rounded-lg px-1.5 py-0.5",children:[c.jsx("img",{src:Bu,alt:"HifiPlanet",className:"h-6 w-auto dark:hidden"}),c.jsx("img",{src:Eu,alt:"HifiPlanet",className:"hidden h-6 w-auto dark:block"})]})]}),c.jsxs("p",{className:"hidden text-sm text-neutral-500 dark:text-neutral-400 sm:block",children:["Angemeldet als ",e==null?void 0:e.username,e!=null&&e.is_super_admin?" · Super-Admin":""]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(dN,{}),c.jsx("button",{onClick:u,className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800",children:"Abmelden"})]})]}),s&&c.jsx("div",{className:"border-t border-neutral-200 px-4 py-3 dark:border-neutral-800 sm:hidden",children:c.jsx(h,{onNavigate:()=>i(!1)})})]}),c.jsx("main",{className:"p-4 sm:p-6",children:c.jsx(Xd,{})})]})]})}function _I(){const{user:t,loading:e}=jn();return e?c.jsx("div",{className:"flex min-h-screen items-center justify-center text-neutral-500",children:"Lädt…"}):t?c.jsx(Xd,{}):c.jsx(Ka,{to:"/admin/login",replace:!0})}function et({permission:t,children:e}){const{hasPermission:n}=jn();return(Array.isArray(t)?t:[t]).some(i=>n(i))?e:c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-8 text-center dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h1",{className:"mb-2 text-lg font-bold text-neutral-900 dark:text-white",children:"Keine Berechtigung"}),c.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"Du hast keinen Zugriff auf diesen Bereich. Bitte wende dich an einen Administrator, falls du hier Zugriff brauchst."})]})}function bf(t,e,n="name"){if(!e)return;let r=document.head.querySelector(`meta[${n}="${t}"]`);r||(r=document.createElement("meta"),r.setAttribute(n,t),document.head.appendChild(r)),r.setAttribute("content",e)}function II(t){let e=document.head.querySelector('link[rel="canonical"]');e||(e=document.createElement("link"),e.setAttribute("rel","canonical"),document.head.appendChild(e)),e.setAttribute("href",`https://hifi-planet.de${t}`)}function Ut({title:t,description:e,path:n}){v.useEffect(()=>{t&&(document.title=`${t} | HifiPlanet`,bf("og:title",`${t} | HifiPlanet`,"property")),e&&(bf("description",e),bf("og:description",e,"property")),n&&II(n)},[t,e,n])}const OI=[.16,1,.3,1],jv={up:{y:40},left:{x:-56},right:{x:56}};function BI(t){return{hidden:{opacity:0,scale:.96,filter:"blur(8px)",...jv[t]||jv.up},visible:{opacity:1,scale:1,x:0,y:0,filter:"blur(0px)"}}}const zI={hidden:{x:"-130%"},visible:{x:"230%",transition:{duration:1.1,ease:"easeInOut",delay:.4}}};function tt({children:t,direction:e="up",className:n="",index:r=0,shine:s=!1,style:i}){const o=Math.min(r*.09,.45);return c.jsxs(er.div,{className:n,style:{position:"relative",overflow:"hidden",...i},initial:"hidden",whileInView:"visible",viewport:{once:!0,amount:.25,margin:"-100px"},variants:BI(e),transition:{duration:.75,ease:OI,delay:o},children:[t,s&&c.jsx(er.div,{"aria-hidden":!0,variants:zI,className:"pointer-events-none absolute inset-y-0 -left-1/3 w-1/3 rotate-12 bg-gradient-to-r from-transparent via-white/40 to-transparent"})]})}function FI({items:t}){const[e,n]=v.useState(null);return c.jsx("div",{className:"divide-y divide-neutral-200 rounded-xl border border-neutral-200 bg-white dark:divide-neutral-800 dark:border-neutral-800 dark:bg-neutral-900",children:t.map((r,s)=>{const i=e===s;return c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>n(i?null:s),className:"flex w-full items-center justify-between gap-4 px-5 py-4 text-left","aria-expanded":i,children:[c.jsx("span",{className:"font-medium text-neutral-900 dark:text-white",children:r.question}),c.jsx(er.svg,{animate:{rotate:i?180:0},transition:{duration:.2},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-5 w-5 shrink-0 text-neutral-500",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6 9 6 6 6-6"})})]}),c.jsx(FR,{initial:!1,children:i&&c.jsx(er.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:c.jsx("p",{className:"px-5 pb-4 text-sm text-neutral-600 dark:text-neutral-300",children:r.answer})})})]},r.question)})})}function cj({count:t=5,className:e="h-4 w-4"}){return c.jsx("div",{className:"flex gap-0.5 text-amber-400",children:Array.from({length:t}).map((n,r)=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:e,children:c.jsx("path",{d:"M10 1.5l2.6 5.6 6.1.6-4.6 4.1 1.3 6-5.4-3.1-5.4 3.1 1.3-6-4.6-4.1 6.1-.6L10 1.5z"})},r))})}const VI=70;function $I({testimonials:t}){const e=v.useRef(null),n=v.useRef(null),r=v.useRef({pos:0,half:0,hovering:!1,dragging:!1,dragStartX:0,dragStartPos:0,lastTime:null,rafId:null}).current;v.useLayoutEffect(()=>{const i=n.current,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,a=()=>{i.style.transform=`translateX(${r.pos}px)`},l=b=>{if(r.half<=0)return b;for(;b>0;)b-=r.half;for(;b<=-r.half;)b+=r.half;return b},u=()=>{r.half=i.scrollWidth/2,r.pos===0?r.pos=-r.half:r.pos=l(r.pos),a()};u();const d=new ResizeObserver(u);d.observe(i);const h=b=>{r.lastTime===null&&(r.lastTime=b);const k=(b-r.lastTime)/1e3;r.lastTime=b,!r.dragging&&!r.hovering&&!o&&(r.pos=l(r.pos+VI*k),a()),r.rafId=requestAnimationFrame(h)};r.rafId=requestAnimationFrame(h);const f=e.current,p=()=>{r.hovering=!0},m=()=>{r.hovering=!1},g=b=>{r.dragging=!0,r.dragStartX=b.clientX,r.dragStartPos=r.pos,f.setPointerCapture(b.pointerId),f.classList.add("cursor-grabbing"),f.classList.remove("cursor-grab")},x=b=>{r.dragging&&(r.pos=l(r.dragStartPos+(b.clientX-r.dragStartX)),a())},y=b=>{r.dragging&&(r.dragging=!1,f.hasPointerCapture(b.pointerId)&&f.releasePointerCapture(b.pointerId),f.classList.remove("cursor-grabbing"),f.classList.add("cursor-grab"))};return f.addEventListener("pointerenter",p),f.addEventListener("pointerleave",m),f.addEventListener("pointerdown",g),f.addEventListener("pointermove",x),f.addEventListener("pointerup",y),f.addEventListener("pointercancel",y),()=>{cancelAnimationFrame(r.rafId),d.disconnect(),f.removeEventListener("pointerenter",p),f.removeEventListener("pointerleave",m),f.removeEventListener("pointerdown",g),f.removeEventListener("pointermove",x),f.removeEventListener("pointerup",y),f.removeEventListener("pointercancel",y)}},[t.length]);const s=[...t,...t];return c.jsx("div",{ref:e,className:"marquee-viewport cursor-grab touch-pan-y select-none overflow-hidden",children:c.jsx("div",{ref:n,className:"marquee-track flex w-max gap-5",children:s.map((i,o)=>c.jsx("div",{className:"w-64 shrink-0 sm:w-72 lg:w-80",children:c.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden rounded-xl border border-neutral-200 bg-white p-6 shadow-sm transition-shadow duration-300 hover:shadow-lg dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 32 24",className:"absolute -right-1 -top-1 h-16 w-16 text-brand-500/10 dark:text-brand-400/10",children:c.jsx("path",{fill:"currentColor",d:"M9.4 0C4.4 3.5 1 9.1 1 15.3 1 20.6 4.3 24 8.4 24c3.8 0 6.6-3 6.6-6.6 0-3.4-2.4-5.9-5.4-5.9-.6 0-1.4.1-1.6.2C8.5 8.5 11.6 4.6 14.6 2.6L9.4 0zm16.5 0c-4.8 3.5-8.3 9.1-8.3 15.3 0 5.3 3.3 8.6 7.5 8.6 3.7 0 6.6-3 6.6-6.6 0-3.4-2.5-5.9-5.4-5.9-.6 0-1.4.1-1.6.2.5-3.3 3.6-7.1 6.7-9.1L25.9 0z"})}),c.jsx(cj,{className:"relative z-10 mb-3 h-4 w-4",count:i.rating||5}),c.jsxs("p",{className:"relative z-10 mb-4 line-clamp-6 flex-1 text-sm leading-relaxed text-neutral-600 dark:text-neutral-300",children:["„",i.text,'"']}),c.jsxs("div",{className:"relative z-10 mt-auto flex items-center gap-3",children:[i.photo?c.jsx("img",{src:i.photo,alt:"",referrerPolicy:"no-referrer",className:"h-9 w-9 shrink-0 rounded-full object-cover"}):c.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-brand-100 text-sm font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-300",children:i.name.charAt(0).toUpperCase()}),c.jsx("p",{className:"text-sm font-semibold text-neutral-900 dark:text-white",children:i.name})]})]})},`${i.name}-${o}`))})})}function Qi(t,e,n={x:0,y:0}){const r=Math.max(0,Math.min(100,t==null?n.x:Number(t)||0)),s=Math.max(0,Math.min(100,e==null?n.y:Number(e)||0));return{left:`${r}%`,top:`${s}%`,transform:`translate(-${r}%, -${s}%)`}}const HI="/assets/gallery-dash2-CEVCErVK.webp",uj="/assets/gallery-amp-purple-CESAKuOf.webp",WI="/assets/gallery-speaker-CUXQZ49Q.webp",dj="/assets/gallery-subs-COSd4seJ.webp",hj="/assets/gallery-dash-Cg-7v9qo.webp",UI="/assets/hero-trunk-Dp4_JHDh.webp",KI="/assets/gallery-rear-8cIXPC7T.webp",GI="/assets/hero-highlight-Co4f1Kj5.webp",qI="/assets/youtube-hintergrund-C0osNxn7.mp4",ic={left:"text-left",center:"text-center",right:"text-right"},JI={left:"",center:"mx-auto",right:"ml-auto"},YI={eyebrow_de:"",eyebrow_en:"",title_de:"",title_en:"",body_html_de:"",body_html_en:"",text_align:"center",text_align_x:50,text_align_y:50,button_label_de:"",button_label_en:"",button_url:"",font_family:null};function Ev({label:t,url:e,className:n,style:r}){return!t||!e?null:e.startsWith("/")?c.jsx(ne,{to:e,className:n,style:r,children:t}):c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:n,style:r,children:t})}const XI=[{src:dj,width:900,height:600},{src:uj,width:900,height:600},{src:WI,width:900,height:1200},{src:hj,width:900,height:814},{src:KI,width:900,height:1200},{src:UI,width:1920,height:1280}];function ZI(){const{hero_image_path:t}=ls(),e=t||HI,{t:n,language:r}=ct(),s=n("home.stats"),i=n("home.galleryAlts"),o=XI.map((U,X)=>({...U,alt:i[X]})),[a,l]=v.useState([]),[u,d]=v.useState({}),[h,f]=v.useState([]),p=U=>{const X=u[U]||YI;return{eyebrow:X[`eyebrow_${r}`]||"",title:X[`title_${r}`]||"",bodyHtml:X[`body_html_${r}`]||"",align:X.text_align||"center",alignX:X.text_align_x,alignY:X.text_align_y,buttonLabel:X[`button_label_${r}`]||"",buttonUrl:X.button_url||"",fontFamily:X.font_family||void 0}},m=ht("home_sections.hero.eyebrow"),g=ht("home_sections.hero.title"),x=ht("home_sections.youtube.eyebrow"),y=ht("home_sections.youtube.title"),b=ht("home_sections.youtube.button_label"),k=ht("home_sections.craft.eyebrow"),w=ht("home_sections.craft.title"),C=ht("home_sections.advice.eyebrow"),j=ht("home_sections.advice.title"),S=ht("home_sections.insights.eyebrow"),N=ht("home_sections.insights.title"),T=ht("home_sections.more.eyebrow"),E=ht("home_sections.more.title"),D=ht("home_sections.more.button_label");v.useEffect(()=>{A.get("/home-sections").then(d).catch(()=>{})},[]),v.useEffect(()=>{A.get("/partners").then(f).catch(()=>{})},[]);const[P,O]=v.useState(null),I=P?P.reviews.filter(U=>U.review_text).map(U=>({name:U.author_name,text:U.review_text,rating:U.rating,photo:U.profile_photo_url})):n("home.testimonials");v.useEffect(()=>{A.get("/faqs").then(U=>{l(U.map(X=>({question:r==="de"?X.question_de:X.question_en,answer:r==="de"?X.answer_de:X.answer_en})))}).catch(()=>{})},[r]),v.useEffect(()=>{A.get("/google-reviews").then(U=>{U.rating!=null&&U.reviews.some(X=>X.review_text)&&O(U)}).catch(()=>{})},[]),Ut({title:n("home.metaTitle"),description:n("home.metaDescription"),path:"/"}),v.useEffect(()=>{if(a.length===0)return;const U=document.createElement("script");return U.type="application/ld+json",U.text=JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:a.map(X=>({"@type":"Question",name:X.question,acceptedAnswer:{"@type":"Answer",text:X.answer}}))}),document.head.appendChild(U),()=>document.head.removeChild(U)},[a]);const H=v.useRef(null),{scrollYProgress:B}=ij({target:H,offset:["start start","end start"]}),re=Sr(B,[0,1],["-6%","6%"]),R=Sr(B,[0,1],["0%","60%"]),_=Sr(B,[0,.8],[1,0]),$=Sr(B,[.5,1],[0,1]),te=Sr($,U=>U>.05?"auto":"none"),Y=Sr(B,[.5,1],[16,0]);return c.jsxs("div",{children:[c.jsx(er.div,{style:{opacity:$,pointerEvents:te,y:Y},className:"fixed inset-x-0 bottom-0 z-20 border-t border-neutral-200 bg-white/95 px-4 py-3 shadow-[0_-8px_24px_rgba(0,0,0,0.08)] backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/95 sm:px-6",children:c.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between gap-3",children:[c.jsx("p",{className:"hidden text-sm font-medium text-neutral-600 dark:text-neutral-300 sm:block",children:n("home.stickyCta")}),c.jsxs("div",{className:"flex w-full gap-3 sm:w-auto",children:[c.jsx(ne,{to:"/fahrzeuge",className:"flex-1 rounded-md bg-brand-500 px-5 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 sm:flex-none",children:n("home.selectVehicle")}),c.jsx(ne,{to:"/kontakt",className:"flex-1 rounded-md border border-neutral-300 px-5 py-2.5 text-center text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800 sm:flex-none",children:n("home.getInTouch")})]})]})}),c.jsxs("section",{ref:H,className:"relative -mt-[89px] h-dvh min-h-[560px] overflow-hidden sm:-mt-[97px]",children:[c.jsx(er.img,{style:{y:re,scale:1.15},src:e,alt:n("home.heroImageAlt"),className:"absolute inset-0 h-full w-full object-cover"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-neutral-950 via-neutral-950/80 to-neutral-950/40"}),c.jsx(er.div,{style:{y:R,opacity:_},className:"absolute inset-0",children:c.jsx("div",{className:"absolute w-full max-w-2xl px-4 text-center sm:px-6",style:{...Qi(p("hero").alignX,p("hero").alignY,{x:50,y:50}),fontFamily:p("hero").fontFamily},children:c.jsxs(er.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.7,ease:"easeOut"},children:[p("hero").eyebrow&&c.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-wide text-brand-400",style:m,children:p("hero").eyebrow}),c.jsx("h1",{className:"text-3xl font-extrabold tracking-tight text-white sm:text-5xl",style:g,children:p("hero").title}),c.jsx("div",{className:"legal-content mx-auto mt-4 max-w-2xl text-base text-neutral-200 sm:text-lg",dangerouslySetInnerHTML:{__html:p("hero").bodyHtml}}),c.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-3",children:[c.jsx(ne,{to:"/fahrzeuge",className:"rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 hover:shadow-lg",children:n("home.selectVehicle")}),c.jsx(ne,{to:"/kontakt",className:"rounded-md border border-white/30 bg-white/10 px-6 py-3 text-sm font-semibold text-white backdrop-blur transition hover:-translate-y-0.5 hover:bg-white/20",children:n("home.getInTouch")})]})]})})})]}),c.jsx("section",{className:"border-b border-neutral-200 bg-neutral-950 py-8 dark:border-neutral-800",children:c.jsx("div",{className:"mx-auto grid max-w-6xl grid-cols-2 gap-6 px-4 text-center sm:grid-cols-4 sm:px-6",children:s.map((U,X)=>c.jsxs(tt,{index:X,children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-400 sm:text-3xl",children:U.value}),c.jsx("p",{className:"text-sm text-neutral-400",children:U.label})]},U.label))})}),c.jsx("section",{className:"border-b border-neutral-200 py-8 dark:border-neutral-800",children:c.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[c.jsx("p",{className:"mb-4 text-center text-xs font-semibold uppercase tracking-wide text-neutral-400",children:n("home.brandsHeading")}),c.jsx("div",{className:"flex flex-wrap items-center justify-center gap-x-8 gap-y-3",children:h.map((U,X)=>c.jsx(tt,{index:X,children:U.logo_path?c.jsx("img",{src:U.logo_path,alt:U.name,className:"h-8 max-w-[8rem] object-contain opacity-70 grayscale transition hover:opacity-100 hover:grayscale-0"}):c.jsx("span",{className:"text-lg font-bold text-neutral-400 dark:text-neutral-600",children:U.name})},U.id))})]})}),c.jsxs("section",{className:"relative min-h-[70vh] overflow-hidden sm:min-h-[85vh]",children:[c.jsx("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,poster:hj,className:"absolute inset-0 h-full w-full object-cover",children:c.jsx("source",{src:qI,type:"video/mp4"})}),c.jsx("div",{className:"absolute inset-0 bg-black/55"}),c.jsx("div",{className:"absolute w-full max-w-3xl px-4 text-center sm:px-6",style:{...Qi(p("youtube").alignX,p("youtube").alignY,{x:50,y:50}),fontFamily:p("youtube").fontFamily},children:c.jsxs(tt,{children:[p("youtube").eyebrow&&c.jsx("p",{className:"mb-4 text-xs font-semibold uppercase tracking-[0.2em] text-neutral-200 sm:text-sm",style:x,children:p("youtube").eyebrow}),c.jsx("h2",{className:"text-3xl font-bold uppercase tracking-wide text-white sm:text-5xl",style:y,children:p("youtube").title}),c.jsx("div",{className:"legal-content mt-4 text-xs font-semibold uppercase tracking-wide text-neutral-200 sm:text-sm",dangerouslySetInnerHTML:{__html:p("youtube").bodyHtml}}),c.jsx(Ev,{label:p("youtube").buttonLabel,url:p("youtube").buttonUrl,className:"mt-8 inline-flex items-center justify-center rounded-full bg-white px-8 py-3 text-xs font-bold uppercase tracking-wide text-neutral-900 transition hover:-translate-y-0.5 hover:bg-neutral-100",style:b})]})})]}),c.jsx("section",{className:"grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40",children:c.jsxs("div",{className:"mx-auto max-w-6xl space-y-16 overflow-hidden px-4 sm:px-6",children:[c.jsxs("div",{className:"grid items-center gap-8 md:grid-cols-2",children:[c.jsx(tt,{direction:"left",shine:!0,className:"rounded-xl shadow-lg",children:c.jsx("img",{src:dj,alt:n("home.craftImageAlt"),width:900,height:600,className:"w-full rounded-xl object-cover",style:{maxHeight:380}})}),c.jsxs(tt,{direction:"right",index:1,className:ic[p("craft").align],style:{fontFamily:p("craft").fontFamily},children:[p("craft").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:k,children:p("craft").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",style:w,children:p("craft").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:p("craft").bodyHtml}})]})]}),c.jsxs("div",{className:"grid items-center gap-8 md:grid-cols-2",children:[c.jsxs(tt,{direction:"left",className:`order-2 md:order-1 ${ic[p("advice").align]}`,style:{fontFamily:p("advice").fontFamily},children:[p("advice").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:C,children:p("advice").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",style:j,children:p("advice").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:p("advice").bodyHtml}})]}),c.jsx(tt,{direction:"right",index:1,shine:!0,className:"order-1 md:order-2 rounded-xl shadow-lg",children:c.jsx("img",{src:uj,alt:n("home.adviceImageAlt"),width:900,height:600,className:"w-full rounded-xl object-cover",style:{maxHeight:380}})})]})]})}),c.jsxs("section",{className:"mx-auto max-w-6xl px-4 py-16 sm:px-6",children:[c.jsxs(tt,{className:`mb-8 ${ic[p("insights").align]}`,style:{fontFamily:p("insights").fontFamily},children:[p("insights").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:S,children:p("insights").eyebrow}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",style:N,children:p("insights").title}),c.jsx("div",{className:"legal-content mt-2 text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:p("insights").bodyHtml}})]}),c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:o.map((U,X)=>c.jsx(tt,{index:X%3,shine:!0,className:"aspect-square overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsx("img",{src:U.src,alt:U.alt,width:U.width,height:U.height,loading:"lazy",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})},U.src))})]}),c.jsx("section",{className:"grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40",children:c.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[c.jsxs(tt,{className:"mb-10 text-center",children:[c.jsx("div",{className:"mb-2 flex items-center justify-center gap-2",children:c.jsx(cj,{className:"h-6 w-6",count:P?Math.round(P.rating):5})}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:P?n("home.reviewsRatingDynamic")(P.rating,P.rating_count):n("home.reviewsRating")}),c.jsx("p",{className:"mt-1 text-neutral-600 dark:text-neutral-300",children:n("home.reviewsText")}),c.jsx("a",{href:"https://www.google.com/maps/search/?api=1&query=Hifi+Planet+Amorbach+Boxbrunner+Stra%C3%9Fe+20a",target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-block text-sm font-medium text-brand-600 hover:underline dark:text-brand-400",children:n("home.reviewsLink")})]}),c.jsx(tt,{children:c.jsx($I,{testimonials:I})})]})}),c.jsx("section",{className:"mx-auto max-w-6xl overflow-hidden px-4 py-16 sm:px-6",children:c.jsxs("div",{className:"grid items-center gap-10 md:grid-cols-2",children:[c.jsx(tt,{direction:"left",shine:!0,className:"overflow-hidden rounded-xl shadow-lg",children:c.jsx("img",{src:GI,alt:n("home.moreImageAlt"),width:1600,height:905,className:"h-full w-full object-cover",loading:"lazy"})}),c.jsxs(tt,{direction:"right",index:1,className:`rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 ${ic[p("more").align]}`,style:{fontFamily:p("more").fontFamily},children:[p("more").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:T,children:p("more").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",style:E,children:p("more").title}),c.jsx("div",{className:`legal-content mb-8 max-w-2xl text-neutral-600 dark:text-neutral-300 ${JI[p("more").align]}`,dangerouslySetInnerHTML:{__html:p("more").bodyHtml}}),c.jsx(Ev,{label:p("more").buttonLabel,url:p("more").buttonUrl,className:"inline-block rounded-md border border-neutral-300 px-6 py-3 text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800",style:D})]})]})}),c.jsx("section",{className:"border-t border-neutral-300 py-16 dark:border-neutral-700",children:c.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[c.jsx(tt,{className:"mb-8 text-center",children:c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:n("home.faqHeading")})}),c.jsx(tt,{index:1,children:c.jsx(FI,{items:a})})]})})]})}function QI(){const[t,e]=v.useState([]),[n,r]=v.useState(""),s=rh(),{t:i}=ct(),o=$0();return Ut({title:i("vehicleSelect.metaTitle"),description:i("vehicleSelect.metaDescription"),path:"/fahrzeuge"}),v.useEffect(()=>{s.vehicles.enabled&&!s.bypass||A.get("/brands").then(e).catch(a=>r(a.message))},[s.vehicles.enabled,s.bypass]),s.vehicles.enabled&&!s.bypass?c.jsx(wl,{message:s.vehicles.message}):c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[s.vehicles.enabled&&s.bypass&&c.jsx(Sl,{inline:!0}),c.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:i("vehicleSelect.title")}),c.jsx("p",{className:"mb-8 text-neutral-600 dark:text-neutral-300",children:i("vehicleSelect.intro")}),n&&c.jsx("p",{className:"text-red-600",children:n}),t.length===0&&!n&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:i("vehicleSelect.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:t.map(a=>c.jsxs(ne,{to:`/fahrzeuge/${a.slug}`,className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 py-8 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100",children:[a.image_path&&c.jsx("img",{src:a.image_path,alt:"",className:"h-16 w-full object-contain"}),c.jsx("span",{style:Xa(o,`brands.${a.id}.name`),children:a.name})]},a.id))})]})}function eO(){const{brandSlug:t}=ti(),[e,n]=v.useState(null),[r,s]=v.useState(""),i=rh(),{t:o}=ct(),a=$0(),l=ht(e?`brands.${e.brand.id}.name`:"");return v.useEffect(()=>{i.vehicles.enabled&&!i.bypass||A.get(`/brands/${t}/models`).then(n).catch(u=>s(u.message))},[t,i.vehicles.enabled,i.bypass]),Ut({title:e?`${e.brand.name} ${o("brandPage.titleSuffix")}`:o("brandPage.metaTitleFallback"),description:e?o("brandPage.metaDescription")(e.brand.name):void 0,path:`/fahrzeuge/${t}`}),i.vehicles.enabled&&!i.bypass?c.jsx(wl,{message:i.vehicles.message}):r?c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:r}):e?c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[i.vehicles.enabled&&i.bypass&&c.jsx(Sl,{inline:!0}),c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/fahrzeuge",className:"hover:text-brand-500",children:o("brandPage.breadcrumbVehicles")})," / ",c.jsx("span",{style:l,children:e.brand.name})]}),c.jsxs("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:[c.jsx("span",{style:l,children:e.brand.name})," – ",o("brandPage.titleSuffix")]}),e.models.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:o("brandPage.empty")}),c.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3",children:e.models.map(u=>c.jsxs(ne,{to:`/fahrzeuge/${t}/${u.slug}`,className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 py-8 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100",children:[u.image_path&&c.jsx("img",{src:u.image_path,alt:"",className:"h-16 w-full object-contain"}),c.jsx("span",{style:Xa(a,`car_models.${u.id}.name`),children:u.name})]},u.id))})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:o("brandPage.loading")})}function tO({text:t}){return t?t.split(/(\*\*[^*]+\*\*)/g).map((n,r)=>{const s=n.match(/^\*\*([^*]+)\*\*$/);return s?c.jsx("strong",{children:s[1]},r):c.jsx("span",{children:n},r)}):null}const Tv="data:image/webp;base64,UklGRmoNAABXRUJQVlA4IF4NAAAQjACdASrgAVYDPlEok0ajoqGhIRK4IHAKCWlu/F+5xDCoDux8VXNtc99B5Uf715Q+k/+V6E/yD7bfvf7tYI7QKys1Pu/n/K9wD+L/0L/aeqHflfZf937AH81/p//N/yXr9f9f+M/yf7c+4D6R/7n+O+BL9d+rb+0f//9yX9VQU+fHDhw4cN7KTkCBAgQIECBAgQIEB8GtgzU5WrVq1atWrVq1atTTWWxGRvDLM5r169evXr169evVcNgPhleRXp06dOnTp06dOnTpUIn65+OKaJVsmzZs2bNmzZs2bNmSyYC6ipEunTp06dOnTp06dOlydZVuN901q1atWrVq1atWrVXZqLYS16JYyeHDhw4cOHDhw4cN4wtQeDaQLgECBAgQIECBAgQIDddB6sEmQB2atWrVq1atWrVq1aq1iYS5JU9iBlzXr169evXr169evXeEPp+8N6OklatWrVq1atWrVq1V3IfqDdZ8CK1AgQIECBAgQIECBBQFoI3bXHSzdGb8+OHDhw4cOHDhw4ZwLNj/Gx48ePHjx48ePHjx5HaZ5q8hFQPLVq1atWrVq1atWrVWlrSSS1atWrVq1atWrVq1VouJ4vs1atWrVq1atWrVqzMNN6naRaj4OHDhw4cOHDhwzggYy8goXr169evXr169evXbAmy3nWg79+/fv379+/fv377Aw+GV3JG24BIkSJEiRIkSJEiRH091sORb3KZK2rVq1atWrVq1atWZgOgxn2g3CECBAgQIECBAgQHwEh4tRYq5WHRSJEiRIkSJEiRIkRmQ4gXd9q0Xa9evXr169evXr169SUP3aSDmqBOfHDhw4cOHDhw4cN/rYXzoW6jx48ePHjx48ePHjwyNgV/F/hRIkSJEiRIkSJEiRGcgeccx2x48ePHjx48ePHjx5+h2DL7y1q1atWrVq1atWrVqrLjxn1+UevXr169evXr169epWz/ixb7G7Fx48ePHjx48ePHjx64Dpo0+TFzjw4cOHDhw4cOHDhwr64/FOVqj1ftlBYsWLFixYsWLFixsB93m6MKtrfi/YePHjx48ePHjx48eGCFP4MdBX+BXbQiRIkSJEiRIkSJEiA+X4/Ne4l0FixYsWLFixYsWLTKZjxkHLs7TTrVq1atWrVq1atWrSGY83Cktx0PPjhw4cOHDhw4cN/7Xmd/H4DxEePHjx48ePHjx48ct7KWpas7p5jy5cuXLly5cuXLlyM+h2/gRIkSJEiRIkSJEiRAPRMs9EnbFixYsWLFixYsWLBwJstxClHwcOHDhw4cOHDhw3+o6GvCGxY8ePHjx48ePHjx45aAayr3BCnnxw4cOHDhw4cOG/2HuJWxIvK1JLZs2bNmzZs2bNmyAMNnZLnTo6dOnTp06dOnTp06Vd0rFPQfnwwCPHjx48ePHjx48eOU7jRhCFUn5bFixYsWLFixYsWKZRr/1LzwcOHDhw4cOHDhw4ZshIGgexQoECBAgQIECBAgQH+hD+jvXr169eu0AAP7/2BA2pStbx3f0LK6/mZcFuZpv73FLTm7GUv07j8lFLoOGX1EwKUHfPc4FImBkAvjxF1E2TgBogJKpQ2lbMv5bOqPckB4PELJo9ZXlMwGup4PkMOtTZPmrbNoaCJqn0H4Bx7A0xA439P5hkMGBnAEfInQIN5UeUIDb3y6tLej2gR8HhJ5XmTsxvmM15ltL5ZwdGmoNeW8NevUVUKqJ8mNngu7ocCsyGYaeYOGGZBBt6rj6bPVKVbxvb8onw6mljAaaxGTz0W+aNPv06kK3qhDe6/uHi8kg2qvjF3njhRMyOJKZzg12h4qOtVgTuKPAMRWYDkgwiRs9iYqcumonNNXvXk3FAk2LO5XnyjtD5sHSUO3pIrztpBvqq+UJzKeIwGBlPwA2NP46tOJxLzbrKeH4SQjt2HAsbrVcQ/b/TgKZGPwaqfGDN+OjqJK3Z9dyCkGGfGKeG1w9+HSZTm/qh052lQEJAcdUX6vm/+sDBxtrfl4Sg8iMcVnDsfTKJpsTYF/vzJ1oQ6/VPyIX1HpDwnPXsptu9rKDFazlkwc3ofi8uKJmycgPiG9xOLlzn4Af8Dm+LcjJUMAtA7XeZPLlW1bwogbRthU8oA4LcURuku6eXDJ1eb1IKUU7k/UK0cBeK+R5YVcmrOnZIyHzcIaClYnrIwerP535fHv4VXjURTO6/85BvSeTNWvQGqkW5v1hG6AEMrxBryfat3kmr+SNEz5wC2f54z1O7C2KsRpt3maISh9PhMg7jDIxmVe07eHtkLtz6v3yQUJQV95yazDYpH5JfpuYSb8dtmB1cKjeoDTPvik9dCA1UFCTZBfojpIOwXdwAR7JEdZkEi/24hMNKJJlB6udZZKqNJB1hNl24Z++z6lAGSAuRgSwDZGdbqxs+0iL6wmRHilqPOiYB6hQiPZ7cfpMZxesqRwyhcf1O29w4ORG/7BlerR8hYvY4B1XsPYbDORvPk6FHIDXwTXGpuDIta7G4F6RNDdOvCFkAl53GZo5h/p2QkWUry5YuyegnPlKjT3He6ewYypA9YOvMhaqip7kr9sF4TU2bX9foKZ+FFZNzhyySS+13+g4BdJo9YF3bw5b6eSxUfTWiDLNh50VjuqRQWHUEkiA8zJqnqkKCwuDy6iY2oF20FJQlGIPpCDKPBzdXSb/n9NDltaoUlbam7cDAU7CwNdaWFXTABRk0S0e49iF4tO106Uwul7DGYpq0Eu71TnKUjCtEBc83QH8skvRzHniEne3AtJLYRH0cMNSSzeCJ1g+Nfc8RaZkhLhCaZGZdYe5j0LGmQnVFt2iapZvGBi7Sw0X56zdziC9Foq0OPsqKFetZdICc2eUV5Vu1+nvisSzn8wlSDUt3OmRkt/gJxfJQfWxcu5HZ26qqNpA4ablWrX4E9DEmvXzpFGYCnYJMheN2BlWwBVLh1cyQ8INngXaoB8I5Pj9oYyuz/W+jvJQ6G074luX9D3pLkuc88D0Hae3ZqXrRYRzGF1vD8pHsk9Co8B6rpE/4GEwW/zsCtnjz5G8m4KFwf2qW1k0HkNv7Nlg38bcz6TdTzuw/jega5XZQQhflLu4I6l+s90BHFIR+JEXTBBqJwT+IgTnpHNc+h5Ek74HiKqXuGUNGIKIozHkiFxMlnrsklrpweBzYY6ype9CzepAuQF63xC/eIJw1pMZEC1pPgq/r+1gWx5M6g8fpu2O12sb6pLeqT+G4mK3yHMZTojfp1xwQedRmwZnWQ8SCh4XV2a/+3OTz4D4pmmumyBV7V2VW3he8y6usinSjfYPxLyTng27fgw6jQhHl2mVhxBBjiwr5ljvJV7L+MJYDiZjGWfBCsTmehk6rbNt7ahTJpHu4B9ctRqiZXjx0zGpTF91OKifmy4nTq31p1XaIsZAHCWvItXKeke06KKKRTIm6mCT9yBJVwG1sqQhjrkP77q0/JGYgOwgdCQCstsAZQ0FlOrGYXYTIQK/krLyCAZjg8vP/Ers/KVN8F88OsyU5/T1e5ba8A2F63qgwhtkWoVIEZErOVL8sM/DtpWTlcBNsvVOFl4tT+Sk6a2ScCptFL5F6cZXTIw8JmgoCbyqB6xyU+uPP5y09s5T8MDC7Em7NpxCjgD39eed40gHQrBm6CtAbS9JOCVPkPxbpcGDj/LoAGbnyYzMpOmTi28LJ9FTIqyGuAI0jxY/QpNelOOEvNK3io1HeYkK3AprImDk99tlUjgt9bc3ejCOFDXt9LqGHjFssGrhVHyJBmWjwHQipcIMHxF2jfP5jfAGuHtJRRncHIFgLWmJ1XmzJ0LLqWCJShdJSJLc7L6YeVcgKfzOZCwhtzJ7VeI3uBhPXQNOqCf5tlQ32HApAMvCIiBwhYrpfFo/kvjfTMB/NJ0w2Lk8GAFfFQY+U6uX1oB0hztGmA5HggJTwgLo8exG64m3Xu4fg2g4MmQol7z6xNwwubABnpoS3Og85giFkaarUP2ovQyixFpXki8Xf5a5NwjUGCPbx+LD3WKJiBtkiHsYMMV/VAZVNvdg/Ph/V4ZYOr+hw7g9mOJXi+oVZxG9pqJC9w8nRkegsnQ2lpRHn22lTsIa9aOkR0X8zp/IajQxUzv057a3WptBst0EZbZtfmWp6h2K0sDQS9oQT1PqOkGDJlz6ZHZzDMShDTcwJfIZMdnjpeHdPoYoqlcn3M8daRuMeTSP3mabP1/pdQrs6Wl7ToKog2Au/gv46pUMgVcKmdWNJdDF8RplMMXJpU2tZMdkTWq4ofSypsCfuWfeHOpFQGJdFF6OoH2pDJXvkqpj1a832g3uYtVQg1TGyqYqI7UBZQy4NEZbdj6O/s6MNEnfujUDQ8QZj7rSE2RI77egKDWzM708AsvlMFoeX4CVP09rMzXNP2aOZwY7zOBTvBgEEqCWlXAFlY8pW0zIm16gqSPiwRUgH41i1PuJx382C0zTWGT243ZhLnyOIlreUrMQAfwR/oYt+ljnDFKqa5PEczDPa+u/vWmR6UM+Q/lLFiIlgBJTfaekWoeLpPd9FPN4gIHzK1ZS8kDHyq3lh/e6FQ84a4Zg6JlfQC/qhAAAAA==",nO="/assets/base-BKOm0Bib.webp",rO="/assets/clear-DZZMSrMX.webp",sO="/assets/drive-BE2W1yna.webp",iO="/assets/prime-BTVNe2Gb.webp",oO="/assets/elite_r-BRvz_pyr.webp",aO="/assets/apex-CFy2qup8.webp",lO="/assets/statement-pTO-wTPx.webp",cO="/assets/limitless-DDs0S_PU.webp",uO=(t,e,n)=>{e/=100,n/=100;const r=o=>(o+t/30)%12,s=e*Math.min(n,1-n),i=o=>n-s*Math.max(-1,Math.min(r(o)-3,Math.min(9-r(o),1)));return[Math.round(i(0)*255),Math.round(i(8)*255),Math.round(i(4)*255)]},vf=(t,e,n)=>`rgb(${uO(t,e,n).join(", ")})`,Mv=t=>t.map(([e,n,r,s,i,o])=>({bgTop:vf(e,n,r),border:vf(e,n,r+8),accent:vf(s,i,o),img:null})),Pv={graphite:[{accent:"#b6b6b6",border:"#2a2a2a",bgTop:"#1c1c1c",img:nO},{accent:"#d3d3d3",border:"#2e2e2e",bgTop:"#212121",img:rO},{accent:"#8fb8bd",border:"#26383b",bgTop:"#16282b",img:sO},{accent:"#6fbf73",border:"#1f3a24",bgTop:"#122916",img:iO},{accent:"#63d34f",border:"#204a1c",bgTop:"#123312",img:oO},{accent:"#8bea3c",border:"#2b5518",bgTop:"#173a0f",img:aO},{accent:"#d9a83c",border:"#4a3a16",bgTop:"#33270d",img:lO},{accent:"#f2c14e",border:"#5a4718",bgTop:"#3d2f0c",img:cO}],"deep-blue":Mv([[215,18,11,210,15,60],[212,25,11,208,32,60],[210,38,12,206,46,60],[212,46,12,205,56,61],[214,52,12,205,63,62],[216,58,12,205,68,63],[220,62,12,212,73,65],[226,66,12,216,78,68]]),"warm-bronze":Mv([[30,15,11,34,22,60],[34,32,11,34,46,60],[32,46,12,30,58,60],[26,52,12,24,65,60],[20,55,12,18,68,60],[14,55,12,12,68,61],[8,52,12,6,64,62],[2,50,12,358,60,63]])},dO="#f2f2f2",hO="#8a8a8a",fO="#c4c4c4",Av=5;function pO({pkg:t,tier:e,tierT:n,layout:r,bullets:s,formatPrice:i,contactUrl:o,t:a}){const[l,u]=v.useState(!1),d=s.length-Av,h=l?s:s.slice(0,Av),f=$0(),p=Xa(f,`packages.${t.id}.description`),m=Xa(f,`packages.${t.id}.price_text`),g=e.img?null:{backgroundColor:e.accent,WebkitMaskImage:`url(${Tv})`,maskImage:`url(${Tv})`,maskMode:"luminance",WebkitMaskSize:"cover",maskSize:"cover",WebkitMaskPosition:"center",maskPosition:"center",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat"};return c.jsxs("div",{style:{borderColor:e.border,background:`linear-gradient(180deg, ${e.bgTop} 0%, #0b0b0b 55%, #080808 100%)`},className:r==="strip"?"relative flex min-h-[420px] grow shrink basis-[190px] min-w-[190px] max-w-[240px] snap-start flex-col overflow-hidden rounded-[18px] border shadow-xl shadow-neutral-900/20 dark:shadow-black/40 sm:min-h-[640px] sm:basis-[210px]":r==="coverflow"?"relative flex min-h-[420px] w-[230px] shrink-0 snap-center flex-col overflow-hidden rounded-[18px] border shadow-xl shadow-neutral-900/20 will-change-transform dark:shadow-black/40 sm:min-h-[640px]":"relative flex min-h-[420px] flex-col overflow-hidden rounded-[18px] border shadow-xl shadow-neutral-900/20 dark:shadow-black/40 sm:min-h-[640px]",children:[e.img?c.jsx("img",{src:e.img,alt:"","aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full object-cover"}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"pointer-events-none absolute inset-0",style:{...g,opacity:.2+n*.45,filter:"blur(18px)"},"aria-hidden":"true"}),c.jsx("div",{className:"pointer-events-none absolute inset-0",style:{...g,opacity:.55+n*.45},"aria-hidden":"true"})]}),t.is_featured&&c.jsx("span",{className:"absolute top-2 left-1/2 z-10 -translate-x-1/2 rounded-full bg-brand-500 px-3 py-1 text-xs font-bold text-white shadow",children:a("modelPage.featuredBadge")}),c.jsxs("div",{className:"relative z-10 text-center",style:{padding:"34px 20px 0"},children:[c.jsx("div",{style:{fontFamily:"'Barlow Condensed', sans-serif",fontSize:"30px",letterSpacing:"3px",fontWeight:600,color:e.accent,textTransform:"uppercase",lineHeight:1.1},children:t.name}),c.jsx("div",{style:{width:"44px",height:"2px",margin:"14px auto 0",background:`linear-gradient(90deg, rgba(255,255,255,0) 0%, ${e.accent} 50%, rgba(255,255,255,0) 100%)`}})]}),s.length>0&&c.jsxs("div",{className:"relative z-10",style:{padding:"18px 20px 14px",background:l?"linear-gradient(180deg, rgba(8,8,8,0.7) 0%, rgba(8,8,8,0.62) 94%, rgba(8,8,8,0) 100%)":"linear-gradient(180deg, rgba(8,8,8,0.55) 0%, rgba(8,8,8,0.48) 92%, rgba(8,8,8,0) 100%)"},children:[c.jsx("ul",{className:"space-y-1.5 text-left",children:h.map((x,y)=>c.jsxs("li",{className:"flex items-start gap-2",style:{fontSize:"13px",color:fO,...x.fromDescription?p:null},children:[c.jsx(bt,{name:"check",className:"mt-0.5 h-3.5 w-3.5 shrink-0",style:{color:e.accent}}),c.jsx("span",{className:"leading-snug",children:x.fromDescription?c.jsx(tO,{text:x.text}):x.text})]},y))}),d>0&&c.jsxs("button",{type:"button",onClick:()=>u(x=>!x),className:"mt-2.5 flex items-center gap-1 hover:opacity-80",style:{fontSize:"13px",color:e.accent},children:[l?a("modelPage.lessBullets"):a("modelPage.moreBullets")(d),c.jsx(bt,{name:l?"chevron-up":"chevron-down",className:"h-3.5 w-3.5"})]})]}),c.jsx("div",{className:"relative z-10 flex-1"}),c.jsx("div",{className:"relative z-10",style:{padding:"20px 20px 28px",background:"linear-gradient(180deg, rgba(8,8,8,0) 0%, rgba(8,8,8,0.85) 45%, rgba(8,8,8,0.95) 100%)"},children:c.jsxs("div",{className:"text-center",children:[!t.price_text&&c.jsx("div",{style:{fontSize:"13px",color:hO},children:a("modelPage.totalPrice")}),c.jsx("div",{style:{marginTop:"4px",fontFamily:"'Barlow Condensed', sans-serif",fontSize:"30px",fontWeight:600,letterSpacing:"1px",color:dO,...t.price_text?m:null},children:t.price_text||i(t.total_price)}),c.jsx(ne,{to:o(t),className:"mt-4 inline-block rounded-md bg-brand-500 px-4 py-2 text-center text-sm font-semibold text-white shadow-lg shadow-brand-500/30 hover:bg-brand-400",children:a("modelPage.requestContact")})]})})]})}function mO(){const{brandSlug:t,modelSlug:e}=ti(),[n,r]=v.useState(null),[s,i]=v.useState(""),o=rh(),{t:a,language:l}=ct(),{package_card_theme:u,package_card_layout:d,package_wheel_hint_interval:h}=ls(),f=Pv[u]||Pv.graphite,p=["grid","strip","coverflow"].includes(d)?d:"strip",m=Math.max(2,Number(h)||8)*1e3,g=v.useRef(null),x=v.useRef(null),y=v.useRef(null),[b,k]=v.useState(!1),w=P=>new Intl.NumberFormat(l==="de"?"de-DE":"en-US",{style:"currency",currency:"EUR"}).format(P);v.useEffect(()=>{o.vehicles.enabled&&!o.bypass||A.get(`/models/${t}/${e}/packages`).then(r).catch(P=>i(P.message))},[t,e,o.vehicles.enabled,o.bypass]),v.useEffect(()=>{const P=g.current;if(p!=="coverflow"||!P)return;let O=0;const I=()=>{O=0;const re=P.scrollLeft+P.clientWidth/2;for(const R of P.children){const _=R.offsetLeft+R.offsetWidth/2,$=Math.max(-1,Math.min(1,(_-re)/(R.offsetWidth*1.4))),te=Math.abs($);R.style.transform=`rotateY(${(-$*35).toFixed(2)}deg) scale(${(1-te*.13).toFixed(3)}) translateZ(${(-te*60).toFixed(1)}px)`,R.style.zIndex=String(100-Math.round(te*50))}},H=()=>{O||(O=requestAnimationFrame(I))};I(),P.addEventListener("scroll",H,{passive:!0});const B=new ResizeObserver(H);return B.observe(P),()=>{P.removeEventListener("scroll",H),B.disconnect(),cancelAnimationFrame(O)}},[p,n]),v.useEffect(()=>{const P=g.current;if(p==="grid"||!P)return;const O=window.matchMedia("(pointer: coarse)").matches;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let H=[],B=0;const re=()=>{const _=Math.min(P.clientWidth*.4,160);H.push(setTimeout(()=>P.scrollTo({left:_,behavior:"smooth"}),500)),H.push(setTimeout(()=>P.scrollTo({left:0,behavior:"smooth"}),1250)),O||(H.push(setTimeout(()=>k(!0),450)),H.push(setTimeout(()=>k(!1),1700)))},R=new IntersectionObserver(([_])=>{_.isIntersecting&&(R.disconnect(),re(),B=setInterval(()=>{P.scrollLeft<=1&&re()},m))},{threshold:.35});return R.observe(P),()=>{R.disconnect(),clearInterval(B),H.forEach(clearTimeout)}},[p,n,m]),v.useEffect(()=>{const P=g.current;if(p==="grid"||!P)return;let O=0,I=0,H=!1,B=0,re=0;const R=()=>[...P.children].map(Y=>Y.offsetLeft+Y.offsetWidth/2),_=(Y,U)=>{let X=0,ae=1/0;return Y.forEach((ue,Re)=>{const mr=Math.abs(ue-U);mr<ae&&(ae=mr,X=Re)}),X},$=()=>{H=!1;const Y=R();if(!Y.length)return;const U=P.scrollLeft+P.clientWidth/2,X=_(Y,U);let ae=X;X===B&&Math.abs(re)>4&&(ae=re>0?Math.min(B+1,Y.length-1):Math.max(B-1,0));const ue=P.scrollWidth-P.clientWidth,Re=Math.max(0,Math.min(Y[ae]-P.clientWidth/2,ue));P.scrollTo({left:Re,behavior:"smooth"}),clearTimeout(I),I=setTimeout(()=>{P.style.scrollSnapType=""},450)},te=Y=>{if(Math.abs(Y.deltaX)>Math.abs(Y.deltaY))return;const U=P.scrollWidth-P.clientWidth;if(U<=1)return;const X=P.scrollLeft<=1,ae=P.scrollLeft>=U-1;Y.deltaY<0&&X||Y.deltaY>0&&ae||(Y.preventDefault(),H||(H=!0,re=0,B=_(R(),P.scrollLeft+P.clientWidth/2)),re+=Y.deltaY,P.style.scrollSnapType="none",P.scrollLeft+=Y.deltaY,clearTimeout(O),O=setTimeout($,150))};return P.addEventListener("wheel",te,{passive:!1}),()=>{P.removeEventListener("wheel",te),clearTimeout(O),clearTimeout(I)}},[p,n]),v.useEffect(()=>{const P=g.current,O=x.current,I=y.current;if(p==="grid"||!P||!O||!I)return;let H=0;const B=()=>{H=0;const ae=P.scrollWidth-P.clientWidth;if(ae<=1){O.style.opacity="0",O.style.pointerEvents="none";return}O.style.opacity="1",O.style.pointerEvents="auto";const ue=O.clientWidth,Re=Math.max(32,P.clientWidth/P.scrollWidth*ue);I.style.width=`${Re}px`,I.style.transform=`translateX(${(P.scrollLeft/ae*(ue-Re)).toFixed(1)}px)`},re=()=>{H||(H=requestAnimationFrame(B))};B(),P.addEventListener("scroll",re,{passive:!0});const R=new ResizeObserver(re);R.observe(P);let _=!1,$=0;const te=ae=>{const ue=O.getBoundingClientRect(),Re=I.clientWidth,mr=Math.min(Math.max(ae-ue.left-$,0),ue.width-Re);P.scrollLeft=mr/(ue.width-Re)*(P.scrollWidth-P.clientWidth)},Y=ae=>{_=!0,O.setPointerCapture(ae.pointerId),P.style.scrollSnapType="none";const ue=I.getBoundingClientRect();$=ae.clientX>=ue.left&&ae.clientX<=ue.right?ae.clientX-ue.left:I.clientWidth/2,ae.clientX>=ue.left&&ae.clientX<=ue.right||te(ae.clientX)},U=ae=>{_&&te(ae.clientX)},X=ae=>{var ue;_&&(_=!1,(ue=O.hasPointerCapture)!=null&&ue.call(O,ae.pointerId)&&O.releasePointerCapture(ae.pointerId),P.style.scrollSnapType="")};return O.addEventListener("pointerdown",Y),O.addEventListener("pointermove",U),O.addEventListener("pointerup",X),O.addEventListener("pointercancel",X),()=>{P.removeEventListener("scroll",re),R.disconnect(),cancelAnimationFrame(H),O.removeEventListener("pointerdown",Y),O.removeEventListener("pointermove",U),O.removeEventListener("pointerup",X),O.removeEventListener("pointercancel",X)}},[p,n]),Ut({title:n?a("modelPage.metaTitle")(n.model.brand_name,n.model.name):a("modelPage.metaTitleFallback"),description:n?a("modelPage.metaDescription")(n.model.brand_name,n.model.name):void 0,path:`/fahrzeuge/${t}/${e}`});const C=ht(n?`car_models.${n.model.id}.name`:"");if(o.vehicles.enabled&&!o.bypass)return c.jsx(wl,{message:o.vehicles.message});if(s)return c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:s});if(!n)return c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:a("modelPage.loading")});const{model:j,packages:S}=n,N=new Map([...S].sort((P,O)=>P.total_price-O.total_price).map((P,O)=>[P.id,O])),T=P=>{const O=S.length,I=N.get(P.id)??0,H=O<=1?0:I/(O-1),B=Math.round(H*(f.length-1));return{tier:f[B],tierT:H}},E=P=>[...P.products.map(O=>({text:O.name_override||O.scraped_name||a("modelPage.productLoading"),fromDescription:!1})),...(P.description||"").split(`
`).map(O=>O.trim()).filter(Boolean).map(O=>({text:O,fromDescription:!0}))],D=P=>`/kontakt?${new URLSearchParams({brand:j.brand_name,model:j.name,package:P.name,packageId:P.id,total:P.total_price}).toString()}`;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mx-auto max-w-6xl px-4 pt-12 sm:px-6",children:[o.vehicles.enabled&&o.bypass&&c.jsx(Sl,{inline:!0}),c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/fahrzeuge",className:"hover:text-brand-500",children:a("modelPage.breadcrumbVehicles")})," /"," ",c.jsx(ne,{to:`/fahrzeuge/${t}`,className:"hover:text-brand-500",children:j.brand_name})," / ",c.jsx("span",{style:C,children:j.name})]}),c.jsxs("h1",{className:`text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl ${S.length?"mb-2":"mb-8"}`,children:[j.brand_name," ",c.jsx("span",{style:C,children:j.name})," – ",a("modelPage.titleSuffix")]}),S.length===0&&c.jsx("p",{className:"pb-12 text-neutral-500 dark:text-neutral-400",children:a("modelPage.empty")})]}),S.length>0&&c.jsx("section",{className:"py-10 sm:py-14",style:{fontFamily:"'Barlow', sans-serif"},children:c.jsxs("div",{className:p==="grid"?"mx-auto max-w-6xl px-4 sm:px-6":"relative mx-auto max-w-[1880px] px-4 sm:px-6",children:[c.jsx("div",{ref:p==="grid"?void 0:g,className:p==="grid"?"grid items-start gap-[18px] sm:grid-cols-2 xl:grid-cols-3":"flex select-none items-start gap-[18px] overflow-x-auto pb-3 snap-x snap-mandatory [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:p==="coverflow"?{perspective:"1200px",paddingLeft:"calc(50% - 115px)",paddingRight:"calc(50% - 115px)",paddingTop:"10px"}:void 0,children:S.map(P=>{const{tier:O,tierT:I}=T(P);return c.jsx(pO,{pkg:P,tier:O,tierT:I,layout:p,bullets:E(P),formatPrice:w,contactUrl:D,t:a},P.id)})}),p!=="grid"&&c.jsx("div",{className:`pointer-events-none absolute inset-x-0 top-1/2 z-[200] flex -translate-y-1/2 justify-center transition-opacity duration-300 ${b?"opacity-100":"opacity-0"}`,"aria-hidden":"true",children:c.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-neutral-900/85 px-4 py-2 text-xs font-medium text-white shadow-lg backdrop-blur-sm",children:[c.jsx(X2,{className:"h-3.5 w-3.5 text-brand-400"}),c.jsx(Z2,{className:"h-4 w-4 text-brand-400"}),c.jsx(Q2,{className:"h-3.5 w-3.5 text-brand-400"}),c.jsx("span",{children:a("modelPage.wheelHint")})]})}),p!=="grid"&&c.jsx("div",{ref:x,className:"relative mx-auto mt-5 h-2 w-56 max-w-full cursor-pointer rounded-full bg-neutral-900/10 transition-opacity duration-200 dark:bg-white/10",style:{touchAction:"none"},"aria-hidden":"true",children:c.jsx("div",{ref:y,className:"absolute left-0 top-0 h-full rounded-full bg-brand-500 shadow-[0_0_10px_rgba(107,166,38,0.7)]",style:{width:"48px"}})})]})})]})}function gO(){const[t,e]=v.useState(null),[n,r]=v.useState(""),{t:s}=ct(),{gallery_card_text_x:i,gallery_card_text_y:o}=ls();return Ut({title:s("galleryOverview.metaTitle"),description:s("galleryOverview.metaDescription"),path:"/galerie"}),v.useEffect(()=>{A.get("/gallery-brands").then(e).catch(a=>r(a.message))},[]),c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:s("galleryOverview.title")}),c.jsx("p",{className:"mb-8 text-neutral-600 dark:text-neutral-300",children:s("galleryOverview.intro")}),n&&c.jsx("p",{className:"text-red-600",children:n}),!t&&!n&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("galleryOverview.loading")}),t&&t.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("galleryOverview.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:t==null?void 0:t.map(a=>c.jsxs(ne,{to:`/galerie/${a.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[a.cover_image_path?c.jsx("img",{src:a.cover_image_path,alt:a.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):c.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),c.jsx("span",{className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:Qi(i,o,{x:0,y:100}),children:a.name})]},a.id))})]})}function xO(){const{brandSlug:t}=ti(),[e,n]=v.useState(null),[r,s]=v.useState(""),{t:i}=ct(),{gallery_card_text_x:o,gallery_card_text_y:a}=ls();return v.useEffect(()=>{A.get(`/gallery-brands/${t}/projects`).then(n).catch(l=>s(l.message))},[t]),Ut({title:e?i("galleryBrandPage.metaTitle")(e.brand.name):i("galleryBrandPage.metaTitleFallback"),description:e?i("galleryBrandPage.metaDescription")(e.brand.name):void 0,path:`/galerie/${t}`}),r?c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:r}):e?c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/galerie",className:"hover:text-brand-500",children:i("galleryBrandPage.breadcrumbGallery")})," / ",e.brand.name]}),c.jsxs("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:[e.brand.name," – ",i("galleryBrandPage.titleSuffix")]}),e.projects.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:i("galleryBrandPage.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:e.projects.map(l=>c.jsxs(ne,{to:`/galerie/${t}/${l.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[l.cover_image_path?c.jsx("img",{src:l.cover_image_path,alt:l.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):c.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),c.jsx("span",{className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:Qi(o,a,{x:0,y:100}),children:l.name})]},l.id))})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:i("galleryBrandPage.loading")})}function yO({photos:t,index:e,onClose:n,onNavigate:r}){const{t:s}=ct();if(v.useEffect(()=>{if(e==null)return;const a=l=>{l.key==="Escape"&&n(),l.key==="ArrowRight"&&r(1),l.key==="ArrowLeft"&&r(-1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,n,r]),e==null)return null;const i=t[e],o=a=>a.stopPropagation();return Gd.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/90 p-4",onClick:n,children:[c.jsx("button",{onClick:a=>{o(a),n()},"aria-label":s("lightbox.close"),className:"absolute right-4 top-4 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-7 w-7",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6l12 12M18 6 6 18"})})}),t.length>1&&c.jsx("button",{onClick:a=>{o(a),r(-1)},"aria-label":s("lightbox.previous"),className:"absolute left-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:left-4",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m15 18-6-6 6-6"})})}),c.jsx("img",{src:i.image_path,alt:i.caption||"",onClick:o,className:"max-h-[85vh] max-w-full rounded-lg object-contain"}),t.length>1&&c.jsx("button",{onClick:a=>{o(a),r(1)},"aria-label":s("lightbox.next"),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:right-4",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9 18 6-6-6-6"})})}),i.caption&&c.jsx("p",{onClick:o,className:"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full bg-black/60 px-4 py-1.5 text-sm text-white",children:i.caption})]}),document.body)}function bO(){const{brandSlug:t,projectSlug:e}=ti(),[n,r]=v.useState(null),[s,i]=v.useState(""),[o,a]=v.useState(null),{t:l}=ct();v.useEffect(()=>{A.get(`/gallery-brands/${t}/${e}/photos`).then(r).catch(d=>i(d.message))},[t,e]),Ut({title:n?`${n.project.name} – ${n.project.brand_name}`:l("galleryProjectPage.metaTitleFallback"),description:n?l("galleryProjectPage.metaDescription")(n.project.name):void 0,path:`/galerie/${t}/${e}`});const u=d=>{a(h=>{const f=n.photos.length;return(h+d+f)%f})};return s?c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:s}):n?c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/galerie",className:"hover:text-brand-500",children:l("galleryProjectPage.breadcrumbGallery")})," /"," ",c.jsx(ne,{to:`/galerie/${t}`,className:"hover:text-brand-500",children:n.project.brand_name})," / ",n.project.name]}),c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:n.project.name}),n.photos.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:l("galleryProjectPage.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:n.photos.map((d,h)=>c.jsx(tt,{index:h%6,shine:!0,className:"aspect-square overflow-hidden rounded-xl",children:c.jsx("button",{onClick:()=>a(h),className:"block h-full w-full","aria-label":d.caption||l("galleryProjectPage.enlargeImage"),children:c.jsx("img",{src:d.image_path,alt:d.caption||"",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})})},d.id))}),c.jsx(yO,{photos:n.photos,index:o,onClose:()=>a(null),onNavigate:u})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:l("galleryProjectPage.loading")})}function vO(){const[t,e]=v.useState([]),n=rh(),{t:r}=ct();return v.useEffect(()=>{A.get("/services").then(e).catch(()=>e([]))},[]),Ut({title:r("leistungen.metaTitle"),description:r("leistungen.metaDescription"),path:"/leistungen"}),n.services.enabled&&!n.bypass?c.jsx(wl,{message:n.services.message}):c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[n.services.enabled&&n.bypass&&c.jsx(Sl,{inline:!0}),c.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:r("leistungen.title")}),c.jsx("p",{className:"mb-10 max-w-2xl text-neutral-600 dark:text-neutral-300",children:r("leistungen.intro")}),c.jsx("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:t.map((s,i)=>c.jsxs(tt,{index:i%3,shine:!0,className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"relative aspect-[4/3]",children:[s.image_path&&c.jsx("img",{src:s.image_path,alt:s.title,className:"h-full w-full object-cover",loading:"lazy"}),c.jsx("div",{className:"absolute -bottom-5 left-5 flex h-12 w-12 items-center justify-center rounded-full bg-brand-500 text-white shadow-lg ring-4 ring-white dark:ring-neutral-900",children:c.jsx(bt,{name:s.icon_name,className:"h-6 w-6"})})]}),c.jsxs("div",{className:"p-6 pt-8",children:[c.jsx("h2",{className:"mb-2 font-semibold text-neutral-900 dark:text-white",children:s.title}),c.jsx("p",{className:"mb-3 text-sm text-neutral-600 dark:text-neutral-300",children:s.description}),c.jsxs(ne,{to:s.cta_url||"/kontakt",className:"text-sm font-semibold text-brand-600 hover:underline dark:text-brand-400",children:[s.cta_label||r("leistungen.contact")," →"]})]})]},s.id))}),c.jsxs("div",{className:"mt-12 rounded-xl border border-neutral-200 bg-neutral-50 p-8 text-center dark:border-neutral-800 dark:bg-neutral-900/40",children:[c.jsx("h2",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:r("leistungen.notListedTitle")}),c.jsx("p",{className:"mb-5 text-neutral-600 dark:text-neutral-300",children:r("leistungen.notListedText")}),c.jsx(ne,{to:"/kontakt",className:"inline-block rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white hover:bg-brand-600",children:r("leistungen.contact")})]})]})}function kO({name:t,description:e,className:n="",children:r}){const{consent:s,acceptAll:i,openSettings:o}=yo();return s.external?r:c.jsxs("div",{className:`flex flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-neutral-50 p-6 text-center dark:border-neutral-800 dark:bg-neutral-900/40 ${n}`,children:[c.jsx("p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:e||`${t} wird erst nach deiner Zustimmung geladen, da dabei Daten an Google übertragen werden.`}),c.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[c.jsx("button",{type:"button",onClick:i,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:"Laden erlauben"}),c.jsx("button",{type:"button",onClick:o,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Cookie-Einstellungen"})]})]})}const fj=t=>(t||"").replace(/[^\d+]/g,""),wO=t=>`https://wa.me/${fj(t).replace(/^0/,"49").replace("+","")}`,Kc={fontFamily:"'Michroma', sans-serif"};function SO({className:t}){return c.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"M12 2a10 10 0 0 0-8.6 15l-1.3 4.8 5-1.3A10 10 0 1 0 12 2zm0 2a8 8 0 1 1-4.2 14.8l-.3-.2-2.6.7.7-2.5-.2-.3A8 8 0 0 1 12 4zm4.3 9.9c-.2-.1-1.4-.7-1.6-.8s-.4-.1-.5.1l-.7.9c-.1.1-.3.2-.5.1a6.5 6.5 0 0 1-3.2-2.8c-.1-.2 0-.4.1-.5l.4-.5.2-.4v-.4l-.7-1.7c-.2-.4-.4-.4-.5-.4h-.5c-.2 0-.4.1-.6.3-.7.7-.9 1.6-.6 2.7.5 1.7 1.6 3.1 3.4 4.2 1.7 1 2.5 1 3.4.9.5-.1 1.4-.6 1.6-1.1.2-.5.2-1 .1-1.1z"})})}function NO({path:t,className:e}){return c.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:t})})}const CO={premium:"M4 12v3M8 8v11M12 4v16M16 8v11M20 12v3",germany:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0 M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19",individual:"M6 3h12l4 6-10 12L2 9z M11 3 8 9l4 12 4-12-3-6M2 9h20",experts:"M20 6 9 17l-5-5"};function Dv({formatted:t,color:e}){const[n,r]=t.split("€");return c.jsxs("span",{style:{...Kc,color:e},children:[n,c.jsx("span",{style:{fontFamily:"'Barlow', sans-serif"},children:"€"}),r]})}function oc({icon:t,label:e,name:n,type:r="text",required:s,value:i,onChange:o,placeholder:a}){return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("label",{htmlFor:`kf-${n}`,className:"text-xs font-semibold uppercase tracking-[2px]",style:{color:"var(--kf-label)"},children:e}),c.jsxs("div",{className:"relative flex items-center",children:[c.jsx(t,{className:"pointer-events-none absolute left-[14px] h-[17px] w-[17px]",style:{color:"var(--kf-fieldicon)"}}),c.jsx("input",{id:`kf-${n}`,name:n,type:r,required:s,value:i,onChange:o,placeholder:a,className:"w-full rounded-lg border py-3.5 pl-[42px] pr-4 text-[15px] outline-none transition-colors",style:{background:"var(--kf-field)",borderColor:"var(--kf-fieldbrd)",color:"var(--kf-text2)"}})]})]})}function jO(){const[t]=S3(),{phone:e,whatsapp:n,contact_email:r,address_street:s,address_zip:i,address_city:o,business_hours:a}=ls(),{t:l,language:u}=ct(),{consent:d}=yo(),h=[s,[i,o].filter(Boolean).join(" ")].filter(Boolean).join(", "),f=encodeURIComponent(h),p=`https://www.google.com/maps/dir/?api=1&destination=${f}`,m=gN(a,l("footer.closed")),g=_=>new Intl.NumberFormat(u==="de"?"de-DE":"en-US",{style:"currency",currency:"EUR"}).format(_),[x,y]=v.useState({name:"",email:"",phone:"",vin:"",message:""}),[b,k]=v.useState("idle"),[w,C]=v.useState(""),[j,S]=v.useState([]),[N,T]=v.useState([]),E=t.get("packageId"),D=t.get("total")?Number(t.get("total")):null;v.useEffect(()=>{if(!E){S([]);return}A.get(`/packages/${E}/upgrades`).then(S).catch(()=>S([]))},[E]);const P=_=>{T($=>$.includes(_)?$.filter(te=>te!==_):[...$,_])},O=j.filter(_=>N.includes(_.id)).reduce((_,$)=>_+Number($.price),0);Ut({title:l("contactPage.metaTitle"),description:l("contactPage.metaDescription"),path:"/kontakt"});const I={brand:t.get("brand")||"",model:t.get("model")||"",package:t.get("package")||""},H=!!(I.brand&&I.model&&I.package),B=_=>y($=>({...$,[_.target.name]:_.target.value})),re=async _=>{_.preventDefault(),k("sending"),C("");try{await A.post("/contact",{...x,brand_name:I.brand||null,model_name:I.model||null,package_name:I.package||null,product_name:t.get("product")||null,package_id:E||null,package_product_id:t.get("productId")||null,upgrade_ids:N}),k("sent"),y({name:"",email:"",phone:"",vin:"",message:""})}catch($){C($.message),k("idle")}},R=[{key:"premium",title:l("contactPage.featurePremiumTitle"),sub:l("contactPage.featurePremiumSub")},{key:"germany",title:l("contactPage.featureGermanyTitle"),sub:l("contactPage.featureGermanySub")},{key:"individual",title:l("contactPage.featureIndividualTitle"),sub:l("contactPage.featureIndividualSub")},{key:"experts",title:l("contactPage.featureExpertsTitle"),sub:l("contactPage.featureExpertsSub")}];return c.jsx("div",{className:"kf-page kontakt-sektion relative w-full overflow-hidden px-4 pb-10 sm:px-10",style:{color:"var(--kf-text2)",fontFamily:"'Barlow', sans-serif"},children:c.jsxs("div",{className:"relative z-10 mx-auto max-w-[1280px] pt-10 sm:pt-14",children:[c.jsx("div",{className:"mb-3 text-[13px] font-semibold uppercase tracking-[6px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.heroEyebrow")}),c.jsxs("h1",{className:"text-[34px] leading-[1.08] sm:text-[46px] lg:text-[60px]",style:{...Kc,color:"var(--kf-text)"},children:[l("contactPage.heroTitlePre")," ",c.jsx("span",{style:{color:"var(--kf-accent2)"},children:l("contactPage.heroTitleAccent")})," ",l("contactPage.heroTitlePost")]}),c.jsx("p",{className:"mb-10 mt-5 max-w-[520px] text-lg leading-[1.55]",style:{color:"var(--kf-muted)"},children:l("contactPage.heroSubtitle")}),c.jsxs("div",{className:"grid grid-cols-1 items-start gap-10 min-[981px]:grid-cols-[minmax(0,1.35fr)_minmax(320px,1fr)]",children:[c.jsx("div",{children:c.jsxs("div",{className:"rounded-2xl border p-[22px] sm:p-10",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow)"},children:[H&&c.jsxs("div",{className:"mb-8 rounded-xl border px-6 py-[22px]",style:{background:"var(--kf-pkgbg)",borderColor:"var(--kf-pkgbrd)"},children:[c.jsxs("div",{className:"mb-3.5 flex items-center gap-2.5 text-xs font-bold uppercase tracking-[2px]",style:{color:"var(--kf-accent2)"},children:[c.jsx(eM,{className:"h-4 w-4"}),l("contactPage.packageBoxTitle")]}),c.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-5 gap-y-2 text-[15px]",children:[c.jsx("span",{style:{color:"var(--kf-label)"},children:l("contactPage.contextBrand")}),c.jsx("span",{className:"font-semibold",style:{color:"var(--kf-text2)"},children:I.brand}),c.jsx("span",{style:{color:"var(--kf-label)"},children:l("contactPage.contextModel")}),c.jsx("span",{className:"font-semibold",style:{color:"var(--kf-text2)"},children:I.model}),c.jsx("span",{style:{color:"var(--kf-label)"},children:l("contactPage.contextPackage")}),c.jsx("span",{className:"font-semibold",style:{color:"var(--kf-text2)"},children:I.package})]}),c.jsxs("div",{className:"mt-3.5 flex items-baseline justify-between border-t pt-3.5",style:{borderColor:"var(--kf-pkgbrd)"},children:[c.jsx("span",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:"var(--kf-muted)"},children:l("contactPage.packagePrice")}),c.jsx("span",{className:"text-xl",children:D!=null?c.jsx(Dv,{formatted:g(D),color:"var(--kf-text)"}):"—"})]})]}),j.length>0&&c.jsxs("div",{className:"mb-8 rounded-xl border p-5",style:{background:"var(--kf-field)",borderColor:"var(--kf-fieldbrd)"},children:[c.jsx("div",{className:"mb-3 text-xs font-bold uppercase tracking-[2px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.optionalUpgrades")}),c.jsx("div",{className:"space-y-2",children:j.map(_=>c.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg border p-3 text-sm",style:{borderColor:"var(--kf-fieldbrd)"},children:[c.jsx("input",{type:"checkbox",checked:N.includes(_.id),onChange:()=>P(_.id),className:"mt-0.5 h-4 w-4 rounded",style:{accentColor:"var(--kf-accent)"}}),c.jsxs("span",{className:"flex-1",children:[c.jsx("span",{className:"block font-semibold",style:{color:"var(--kf-text2)"},children:_.name}),_.description&&c.jsx("span",{className:"block text-xs",style:{color:"var(--kf-muted)"},children:_.description})]}),c.jsxs("span",{className:"font-semibold",style:{color:"var(--kf-accent2)"},children:["+",g(_.price)]})]},_.id))}),N.length>0&&D!=null&&c.jsxs("div",{className:"mt-3 flex items-baseline justify-between border-t pt-3 text-sm",style:{borderColor:"var(--kf-pkgbrd)"},children:[c.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--kf-muted)"},children:l("contactPage.totalWithUpgrades")}),c.jsx(Dv,{formatted:g(D+O),color:"var(--kf-text)"})]})]}),c.jsx("h2",{className:"mb-8 text-xl",style:{...Kc,color:"var(--kf-text)"},children:l("contactPage.formTitle")}),b==="sent"&&c.jsxs("div",{className:"mb-6 rounded-[10px] border p-5",style:{borderColor:"var(--kf-accent)",background:"var(--kf-accentsoft)"},children:[c.jsx("div",{className:"text-base font-bold",style:{color:"var(--kf-accent2)"},children:l("contactPage.sentTitle")}),c.jsx("div",{className:"mt-1 text-sm",style:{color:"var(--kf-muted)"},children:l("contactPage.sentText")})]}),c.jsxs("form",{onSubmit:re,children:[c.jsxs("div",{className:"grid grid-cols-1 gap-6 min-[641px]:grid-cols-2",children:[c.jsx(oc,{icon:tM,label:l("contactPage.nameLabel"),name:"name",required:!0,value:x.name,onChange:B,placeholder:l("contactPage.namePlaceholder")}),c.jsx(oc,{icon:Dx,label:l("contactPage.emailLabel"),name:"email",type:"email",required:!0,value:x.email,onChange:B,placeholder:l("contactPage.emailPlaceholder")}),c.jsx(oc,{icon:Lx,label:l("contactPage.phoneLabel"),name:"phone",value:x.phone,onChange:B,placeholder:l("contactPage.phonePlaceholder")}),c.jsx(oc,{icon:nM,label:l("contactPage.vinLabel"),name:"vin",value:x.vin,onChange:B,placeholder:l("contactPage.vinPlaceholder")})]}),c.jsxs("div",{className:"mt-6 flex flex-col gap-2",children:[c.jsx("label",{htmlFor:"kf-message",className:"text-xs font-semibold uppercase tracking-[2px]",style:{color:"var(--kf-label)"},children:l("contactPage.messageLabel")}),c.jsx("textarea",{id:"kf-message",name:"message",rows:5,value:x.message,onChange:B,placeholder:l("contactPage.messagePlaceholder"),className:"w-full resize-y rounded-lg border px-4 py-3.5 text-[15px] outline-none",style:{background:"var(--kf-field)",borderColor:"var(--kf-fieldbrd)",color:"var(--kf-text2)"}})]}),w&&c.jsx("p",{className:"mt-4 text-sm text-red-600 dark:text-red-400",children:w}),c.jsxs("div",{className:"mt-8 flex flex-wrap items-center gap-5",children:[c.jsxs("button",{type:"submit",disabled:b==="sending",className:"inline-flex items-center gap-3 rounded-lg px-8 py-4 text-sm font-bold uppercase tracking-[3px] transition-[filter,box-shadow] hover:brightness-110 disabled:opacity-60",style:{background:"var(--kf-accent)",color:"var(--kf-btntext)",boxShadow:"0 10px 24px rgba(150,200,20,0.32)"},children:[c.jsx(rM,{className:"h-[18px] w-[18px]"}),l(b==="sending"?"contactPage.sending":"contactPage.submit")]}),c.jsx("div",{className:"text-[13px]",style:{color:"var(--kf-label)"},children:l("contactPage.requiredHint")})]})]})]})}),c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"relative overflow-hidden rounded-2xl border px-[22px] py-[26px] sm:px-8 sm:py-[34px]",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow)"},children:[c.jsx("div",{className:"pointer-events-none absolute -right-[60px] -top-[60px] h-[190px] w-[190px] rounded-full border border-dashed",style:{borderColor:"var(--kf-pkgbrd)"}}),c.jsx("h2",{className:"mb-7 text-[17px]",style:{...Kc,color:"var(--kf-text)"},children:l("contactPage.cardTitle")}),c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx(Lx,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.phone")}),c.jsx("a",{href:`tel:${fj(e)}`,className:"text-base font-semibold",style:{color:"var(--kf-text2)"},children:e})]})]}),c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx(Dx,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.email")}),c.jsx("a",{href:`mailto:${r}`,className:"text-base font-semibold",style:{color:"var(--kf-text2)"},children:r})]})]}),c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx(sM,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.address")}),c.jsxs("div",{className:"text-base font-semibold leading-[1.4]",style:{color:"var(--kf-text2)"},children:[s,c.jsx("br",{}),[i,o].filter(Boolean).join(" ")]})]})]}),n&&c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx(SO,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("nav.whatsapp")}),c.jsx("a",{href:wO(n),className:"text-base font-semibold",style:{color:"var(--kf-text2)"},children:n})]})]})]}),c.jsxs("div",{className:"mt-7 border-t pt-6",style:{borderColor:"var(--kf-divider)"},children:[c.jsx("div",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.hours")}),c.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-[15px]",children:m.map(_=>c.jsxs("span",{style:{display:"contents"},children:[c.jsx("span",{style:{color:"var(--kf-label)"},children:_.days}),c.jsx("span",{children:_.label})]},_.key))})]})]}),c.jsxs("div",{className:"relative overflow-hidden rounded-2xl border",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow)"},children:[d.external&&c.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"absolute left-3.5 top-3.5 z-10 inline-flex items-center gap-2 rounded-lg border px-3.5 py-2 text-[13px] font-semibold hover:border-[var(--kf-accent)]",style:{background:"var(--kf-pill)",borderColor:"var(--kf-pillbrd)",color:"var(--kf-text2)",boxShadow:"var(--kf-shadow2)"},children:[l("contactPage.mapOpenChip"),c.jsx(iM,{className:"h-3.5 w-3.5",style:{color:"var(--kf-accent2)"}})]}),c.jsx(kO,{name:l("contactPage.mapEmbedName"),className:"h-[210px] w-full",children:c.jsx("div",{className:"h-[210px] overflow-hidden",children:c.jsx("iframe",{title:"HifiPlanet Amorbach – Standort",src:`https://www.google.com/maps?q=${f}&output=embed`,width:"100%",height:"290",style:{border:0,display:"block",marginTop:"-60px"},loading:"lazy",referrerPolicy:"no-referrer-when-downgrade"})})}),c.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2.5 border-t px-4 py-4 text-[13px] font-bold uppercase tracking-[3px] hover:bg-[var(--kf-accentsoft)]",style:{borderColor:"var(--kf-divider)",color:"var(--kf-accent2)"},children:[l("contactPage.routePlan")," →"]})]})]})]}),c.jsx("div",{className:"mt-10 grid grid-cols-1 overflow-hidden rounded-2xl border min-[641px]:grid-cols-2 min-[901px]:grid-cols-4",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow2)"},children:R.map(_=>c.jsxs("div",{className:"flex items-center gap-4 border-b p-6 last:border-b-0 min-[641px]:border-b-0 min-[641px]:border-r min-[641px]:last:border-r-0",style:{borderColor:"var(--kf-divider)"},children:[c.jsx("div",{className:"flex h-[46px] w-[46px] flex-shrink-0 items-center justify-center rounded-full border-[1.5px]",style:{borderColor:"var(--kf-pkgbrd)",color:"var(--kf-accent2)"},children:c.jsx(NO,{path:CO[_.key],className:"h-[22px] w-[22px]"})}),c.jsxs("div",{children:[c.jsx("div",{className:"text-[15px] font-bold",style:{color:"var(--kf-text)"},children:_.title}),c.jsx("div",{className:"mt-0.5 text-[13px]",style:{color:"var(--kf-muted)"},children:_.sub})]})]},_.key))})]})})}function EO(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/impressum").then(e).catch(()=>{})},[]),Ut({title:(t==null?void 0:t.title)||"Impressum",description:"Impressum von HifiPlanet Amorbach gemäß § 5 DDG.",path:"/impressum"}),t?c.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),c.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}function TO(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/datenschutz").then(e).catch(()=>{})},[]),Ut({title:(t==null?void 0:t.title)||"Datenschutzerklärung",description:"Datenschutzerklärung von HifiPlanet Amorbach gemäß Art. 13 DSGVO.",path:"/datenschutz"}),t?c.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),c.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}function MO(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/agb").then(e).catch(()=>{})},[]),Ut({title:(t==null?void 0:t.title)||"AGB",description:"Allgemeine Geschäftsbedingungen von HifiPlanet Amorbach.",path:"/agb"}),t?c.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),c.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}const PO={host:"",name:"",user:"",password:"",charset:"utf8mb4"},AO={username:"",password:"",password_confirmation:""};function DO(){Ut({title:"Ersteinrichtung",path:"/setup"});const[t,e]=v.useState("loading"),[n,r]=v.useState(""),[s,i]=v.useState(!1),[o,a]=v.useState(""),[l,u]=v.useState(PO),[d,h]=v.useState(AO),[f,p]=v.useState(null),m=()=>A.get("/setup/status").then(S=>(S.needs_setup?S.steps.admin.ok?e("done"):S.steps.schema.ok?e("admin"):e(S.steps.database.ok?"schema":"database"):e("locked"),S));v.useEffect(()=>{A.get("/setup/status").then(S=>e(S.needs_setup?"password":"locked")).catch(()=>e("locked"))},[]);const g=async S=>{S.preventDefault(),r(""),i(!0);try{await A.post("/setup/verify-password",{password:o}),await m()}catch(N){r(N.message)}finally{i(!1)}},x=async S=>{S.preventDefault(),r(""),i(!0);try{await A.post("/setup/database",l),await m()}catch(N){r(N.message)}finally{i(!1)}},y=async()=>{r(""),i(!0);try{const S=await A.post("/setup/migrate",{});p(S.actions),S.status.steps.schema.ok&&e("admin")}catch(S){r(S.message)}finally{i(!1)}},b=async S=>{if(S.preventDefault(),r(""),d.password!==d.password_confirmation){r("Die Passwörter stimmen nicht überein");return}i(!0);try{await A.post("/setup/admin",d),e("done")}catch(N){r(N.message)}finally{i(!1)}},k="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900",w="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",C=[{key:"database",label:"Datenbank"},{key:"schema",label:"Struktur"},{key:"admin",label:"Admin-Account"}],j=C.findIndex(S=>S.key===t);return c.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 py-12 dark:bg-neutral-950",children:[c.jsx("img",{src:Bu,alt:"HifiPlanet",className:"h-16 w-auto sm:h-20"}),c.jsxs("div",{className:"w-full max-w-md rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[t==="loading"&&c.jsx("p",{className:"text-center text-sm text-neutral-400",children:"Lädt…"}),t==="locked"&&c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bereits eingerichtet"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Diese Seite wurde bereits vollständig eingerichtet. Der Assistent ist deshalb gesperrt."}),c.jsx(ne,{to:"/admin/login",className:"text-sm font-medium text-brand-600 hover:underline dark:text-brand-400",children:"Zum Login"})]}),["database","schema","admin"].includes(t)&&c.jsx("div",{className:"mb-6 flex items-center justify-center gap-2",children:C.map((S,N)=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-full text-xs font-semibold ${N<j?"bg-green-500 text-white":N===j?"bg-brand-500 text-white":"bg-neutral-200 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400"}`,children:N<j?"✓":N+1}),N<C.length-1&&c.jsx("span",{className:"h-px w-6 bg-neutral-300 dark:bg-neutral-700"})]},S.key))}),t==="password"&&c.jsxs("form",{onSubmit:g,children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Ersteinrichtung"}),c.jsxs("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:["Gib das Einmalpasswort ein, das in ",c.jsx("code",{children:"config/setup.php"})," hinterlegt ist."]}),c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:w,children:"Einmalpasswort"}),c.jsx("input",{type:"password",value:o,onChange:S=>a(S.target.value),required:!0,autoFocus:!0,className:k})]}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Prüfe…":"Weiter"})]}),t==="database"&&c.jsxs("form",{onSubmit:x,children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Datenbank-Zugangsdaten"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Trage die Zugangsdaten der Datenbank auf diesem Server ein. Die Verbindung wird vor dem Speichern getestet."}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Host *"}),c.jsx("input",{required:!0,value:l.host,onChange:S=>u({...l,host:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Datenbankname *"}),c.jsx("input",{required:!0,value:l.name,onChange:S=>u({...l,name:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Benutzer *"}),c.jsx("input",{required:!0,value:l.user,onChange:S=>u({...l,user:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Passwort"}),c.jsx("input",{type:"password",value:l.password,onChange:S=>u({...l,password:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:w,children:"Zeichensatz"}),c.jsx("input",{value:l.charset,onChange:S=>u({...l,charset:S.target.value}),className:k})]}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Teste Verbindung…":"Verbindung testen & speichern"})]}),t==="schema"&&c.jsxs("div",{children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Datenbankstruktur"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Datenbankverbindung funktioniert. Jetzt legen wir die benötigten Tabellen an."}),f&&c.jsx("ul",{className:"mb-4 space-y-1 rounded-md bg-neutral-50 p-3 text-sm text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300",children:f.map((S,N)=>c.jsx("li",{children:S},N))}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"button",onClick:y,disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Richte ein…":"Datenbankstruktur einrichten"})]}),t==="admin"&&c.jsxs("form",{onSubmit:b,children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Erster Admin-Account"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Lege den ersten Super-Admin-Account an, mit dem du dich anschließend einloggen kannst."}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Benutzername"}),c.jsx("input",{required:!0,autoFocus:!0,value:d.username,onChange:S=>h({...d,username:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Passwort"}),c.jsx("input",{type:"password",required:!0,minLength:8,value:d.password,onChange:S=>h({...d,password:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:w,children:"Passwort wiederholen"}),c.jsx("input",{type:"password",required:!0,minLength:8,value:d.password_confirmation,onChange:S=>h({...d,password_confirmation:S.target.value}),className:k})]}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Lege an…":"Admin-Account anlegen"})]}),t==="done"&&c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Fertig!"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Ersteinrichtung ist abgeschlossen. Du kannst dich jetzt mit deinem neuen Admin-Account anmelden."}),c.jsx(ne,{to:"/admin/login",className:"inline-block w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600",children:"Zum Login"})]})]})]})}function LO(){const{user:t,login:e,verifyTwoFactor:n}=jn(),r=ml(),[s,i]=v.useState("credentials"),[o,a]=v.useState(""),[l,u]=v.useState(""),[d,h]=v.useState(""),[f,p]=v.useState(""),[m,g]=v.useState(!1);if(t)return c.jsx(Ka,{to:"/admin",replace:!0});const x=async b=>{b.preventDefault(),g(!0),p("");try{(await e(o,l)).requires2fa?i("code"):r("/admin")}catch(k){p(k.message)}finally{g(!1)}},y=async b=>{b.preventDefault(),g(!0),p("");try{await n(d),r("/admin")}catch(k){p(k.message)}finally{g(!1)}};return c.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 dark:bg-neutral-950",children:[c.jsx("img",{src:Bu,alt:"HifiPlanet",className:"h-16 w-auto dark:hidden sm:h-20"}),c.jsx("img",{src:Eu,alt:"HifiPlanet",className:"hidden h-16 w-auto dark:block sm:h-20"}),s==="credentials"?c.jsxs("form",{onSubmit:x,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h1",{className:"mb-6 text-xl font-bold text-neutral-900 dark:text-white",children:"Admin-Login"}),c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername"}),c.jsx("input",{value:o,onChange:b=>a(b.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort"}),c.jsx("input",{type:"password",value:l,onChange:b=>u(b.target.value),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),f&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:f}),c.jsx("button",{type:"submit",disabled:m,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:m?"Anmelden…":"Anmelden"})]}):c.jsxs("form",{onSubmit:y,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bestätigungscode"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Öffne die Google Authenticator App und gib den 6-stelligen Code ein. Alternativ kannst du auch einen deiner Wiederherstellungscodes verwenden."}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Code"}),c.jsx("input",{value:d,onChange:b=>h(b.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),f&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:f}),c.jsx("button",{type:"submit",disabled:m,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:m?"Prüfe…":"Bestätigen"}),c.jsx("button",{type:"button",onClick:()=>{i("credentials"),h(""),p("")},className:"mt-3 w-full text-sm text-neutral-500 hover:underline dark:text-neutral-400",children:"Zurück zum Login"})]})]})}const RO={tag:"M4 4h7l9 9-7 7-9-9V4Zm3.5 3.5h.01",car:"M3 13.5 4.5 9A2 2 0 0 1 6.4 7.5h11.2A2 2 0 0 1 19.5 9L21 13.5M3 13.5v4a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1h12v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-4M3 13.5h18M6.5 16.5h.01M17.5 16.5h.01",box:"M12 3 4 7.5v9L12 21l8-4.5v-9L12 3Zm0 9 8-4.5M12 12v9M12 12 4 7.5",mail:"M4 6h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm0 0 8 7 8-7"},_O=({path:t,className:e="h-6 w-6"})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:e,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:t})});function IO(){const[t,e]=v.useState(null),[n,r]=v.useState("");if(v.useEffect(()=>{A.get("/analytics/report").then(e).catch(i=>r(i.message))},[]),n)return c.jsxs("section",{className:"mt-8 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google Analytics"}),c.jsx("p",{className:"text-sm text-red-600",children:n})]});if(!t)return null;if(!t.configured)return c.jsxs("section",{className:"mt-8 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google Analytics"}),c.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:["Noch nicht eingerichtet. Unter"," ",c.jsx(ne,{to:"/admin/settings/website",className:"text-brand-600 hover:underline dark:text-brand-400",children:"Einstellungen → Website"})," ","kannst du die Dashboard-Anbindung konfigurieren, um hier Besucherzahlen zu sehen."]})]});const s=Math.max(1,...t.daily.map(i=>i.pageviews));return c.jsxs("section",{className:"mt-8 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google Analytics"}),c.jsx("p",{className:"mb-5 text-sm text-neutral-500 dark:text-neutral-400",children:"Letzte 7 Tage."}),c.jsxs("div",{className:"mb-6 grid grid-cols-3 gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:t.totals.users}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Nutzer"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:t.totals.sessions}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Sitzungen"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:t.totals.pageviews}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Seitenaufrufe"})]})]}),t.daily.length>0&&c.jsx("div",{className:"mb-6 flex h-24 items-end gap-1.5",children:t.daily.map(i=>c.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[c.jsx("div",{className:"w-full rounded-t bg-brand-400 dark:bg-brand-500",style:{height:`${Math.max(4,i.pageviews/s*80)}px`},title:`${i.date}: ${i.pageviews} Seitenaufrufe`}),c.jsxs("span",{className:"text-[10px] text-neutral-400",children:[i.date.slice(6,8),".",i.date.slice(4,6),"."]})]},i.date))}),t.top_pages.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-neutral-400",children:"Meistbesuchte Seiten"}),c.jsx("ul",{className:"space-y-1 text-sm",children:t.top_pages.map(i=>c.jsxs("li",{className:"flex items-center justify-between gap-3 text-neutral-700 dark:text-neutral-300",children:[c.jsx("span",{className:"truncate font-mono text-xs",children:i.path}),c.jsx("span",{className:"shrink-0 font-semibold",children:i.pageviews})]},i.path))})]})]})}function OO(){const{user:t,hasPermission:e}=jn(),[n,r]=v.useState({});v.useEffect(()=>{e("brands.manage")&&A.get("/brands").then(i=>r(o=>({...o,brands:i.length}))),(e("models.manage")||e("packages.manage"))&&A.get("/models").then(i=>r(o=>({...o,models:i.length}))),e("packages.manage")&&A.get("/packages").then(i=>r(o=>({...o,packages:i.length}))),e("contact.manage")&&A.get("/contact").then(i=>r(o=>({...o,newContacts:i.filter(a=>a.status==="new").length})))},[]);const s=[{key:"brands",label:"Marken",icon:"tag",hint:"Die Hersteller, z. B. Audi oder BMW.",value:n.brands,to:"/admin/brands",show:e("brands.manage")},{key:"models",label:"Modelle",icon:"car",hint:"Die Fahrzeuge einer Marke, z. B. A4.",value:n.models,to:"/admin/models",show:e("models.manage")},{key:"packages",label:"Pakete",icon:"box",hint:"Die Sound-Pakete für ein Modell.",value:n.packages,to:"/admin/packages",show:e("packages.manage")},{key:"contacts",label:"Neue Anfragen",icon:"mail",hint:"Kunden, die noch auf Antwort warten.",value:n.newContacts,to:"/admin/contact-requests",show:e("contact.manage"),highlight:!0}].filter(i=>i.show);return c.jsxs("div",{children:[c.jsxs("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:["Willkommen, ",t==null?void 0:t.username,"!"]}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Hier siehst du auf einen Blick, wie viel in deinem Shop hinterlegt ist. Klicke auf eine Kachel, um dorthin zu gelangen."}),s.length===0?c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:"Für deinen Account sind noch keine Bereiche freigeschaltet. Bitte wende dich an einen Administrator."}):c.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:s.map(i=>c.jsxs(ne,{to:i.to,className:`rounded-xl border p-5 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md ${i.highlight&&i.value>0?"border-brand-300 bg-brand-50 dark:border-brand-900 dark:bg-brand-900/20":"border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900"}`,children:[c.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:c.jsx(_O,{path:RO[i.icon]})}),c.jsx("p",{className:"text-sm font-semibold text-neutral-700 dark:text-neutral-200",children:i.label}),c.jsx("p",{className:"mt-1 text-3xl font-extrabold text-brand-600 dark:text-brand-400",children:i.value??"…"}),c.jsx("p",{className:"mt-2 text-xs text-neutral-500 dark:text-neutral-400",children:i.hint})]},i.key))}),e("settings.manage")&&c.jsx(IO,{})]})}var Lv=!1,vs,jm,Em,Gc,qc,pj,Jc,Tm,Mm,Pm,mj,Am,Dm,gj,xj;function Et(){if(!Lv){Lv=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),n=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if(Am=/\b(iPhone|iP[ao]d)/.exec(t),Dm=/\b(iP[ao]d)/.exec(t),Pm=/Android/i.exec(t),gj=/FBAN\/\w+;/i.exec(t),xj=/Mobile/i.exec(t),mj=!!/Win64/.exec(t),e){vs=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN,vs&&document&&document.documentMode&&(vs=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(t);pj=r?parseFloat(r[1])+4:vs,jm=e[2]?parseFloat(e[2]):NaN,Em=e[3]?parseFloat(e[3]):NaN,Gc=e[4]?parseFloat(e[4]):NaN,Gc?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),qc=e&&e[1]?parseFloat(e[1]):NaN):qc=NaN}else vs=jm=Em=qc=Gc=NaN;if(n){if(n[1]){var s=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);Jc=s?parseFloat(s[1].replace("_",".")):!0}else Jc=!1;Tm=!!n[2],Mm=!!n[3]}else Jc=Tm=Mm=!1}}var Lm={ie:function(){return Et()||vs},ieCompatibilityMode:function(){return Et()||pj>vs},ie64:function(){return Lm.ie()&&mj},firefox:function(){return Et()||jm},opera:function(){return Et()||Em},webkit:function(){return Et()||Gc},safari:function(){return Lm.webkit()},chrome:function(){return Et()||qc},windows:function(){return Et()||Tm},osx:function(){return Et()||Jc},linux:function(){return Et()||Mm},iphone:function(){return Et()||Am},mobile:function(){return Et()||Am||Dm||Pm||xj},nativeApp:function(){return Et()||gj},android:function(){return Et()||Pm},ipad:function(){return Et()||Dm}},BO=Lm,zO=!!(typeof window<"u"&&window.document&&window.document.createElement),FO={canUseDOM:zO},VO=FO,yj=VO,bj;yj.canUseDOM&&(bj=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/function $O(t,e){if(!yj.canUseDOM||e&&!("addEventListener"in document))return!1;var n="on"+t,r=n in document;if(!r){var s=document.createElement("div");s.setAttribute(n,"return;"),r=typeof s[n]=="function"}return!r&&bj&&t==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var HO=$O,WO=BO,UO=HO,Rv=10,_v=40,Iv=800;function vj(t){var e=0,n=0,r=0,s=0;return"detail"in t&&(n=t.detail),"wheelDelta"in t&&(n=-t.wheelDelta/120),"wheelDeltaY"in t&&(n=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=n,n=0),r=e*Rv,s=n*Rv,"deltaY"in t&&(s=t.deltaY),"deltaX"in t&&(r=t.deltaX),(r||s)&&t.deltaMode&&(t.deltaMode==1?(r*=_v,s*=_v):(r*=Iv,s*=Iv)),r&&!e&&(e=r<1?-1:1),s&&!n&&(n=s<1?-1:1),{spinX:e,spinY:n,pixelX:r,pixelY:s}}vj.getEventType=function(){return WO.firefox()?"DOMMouseScroll":UO("wheel")?"wheel":"mousewheel"};var KO=vj,GO=KO;const qO=Kw(GO);function Za(t){"@babel/helpers - typeof";return Za=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Za(t)}function JO(t,e){if(Za(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Za(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YO(t){var e=JO(t,"string");return Za(e)=="symbol"?e:e+""}function XO(t,e,n){return(e=YO(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ov(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function qe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ov(Object(n),!0).forEach(function(r){XO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ov(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ZO(t,e,n,r,s,i=0){const{width:o,height:a}=eo(t,e,i),l=Math.min(o,n),u=Math.min(a,r);return l>u*s?{width:u*s,height:u}:{width:l,height:l/s}}function QO(t){return t.width>t.height?t.width/t.naturalWidth:t.height/t.naturalHeight}function Lo(t,e,n,r,s=0){const{width:i,height:o}=eo(e.width,e.height,s);return{x:Bv(t.x,i,n.width,r),y:Bv(t.y,o,n.height,r)}}function Bv(t,e,n,r){const s=Math.abs(e*r/2-n/2);return sh(t,-s,s)}function zv(t,e){return Math.sqrt(Math.pow(t.y-e.y,2)+Math.pow(t.x-e.x,2))}function Fv(t,e){return Math.atan2(e.y-t.y,e.x-t.x)*180/Math.PI}function e5(t,e,n,r,s,i=0,o=!0){const a=o?t5:n5,l=eo(e.width,e.height,i),u=eo(e.naturalWidth,e.naturalHeight,i),d={x:a(100,((l.width-n.width/s)/2-t.x/s)/l.width*100),y:a(100,((l.height-n.height/s)/2-t.y/s)/l.height*100),width:a(100,n.width/l.width*100/s),height:a(100,n.height/l.height*100/s)},h=Math.round(a(u.width,d.width*u.width/100)),f=Math.round(a(u.height,d.height*u.height/100)),p=u.width>=u.height*r?{width:Math.round(f*r),height:f}:{width:h,height:Math.round(h/r)};return{croppedAreaPercentages:d,croppedAreaPixels:qe(qe({},p),{},{x:Math.round(a(u.width-p.width,d.x*u.width/100)),y:Math.round(a(u.height-p.height,d.y*u.height/100))})}}function t5(t,e){return Math.min(t,Math.max(0,e))}function n5(t,e){return e}function r5(t,e,n,r,s,i){const o=eo(e.width,e.height,n),a=sh(r.width/o.width*(100/t.width),s,i);return{crop:{x:a*o.width/2-r.width/2-o.width*a*(t.x/100),y:a*o.height/2-r.height/2-o.height*a*(t.y/100)},zoom:a}}function s5(t,e,n){const r=QO(e);return n.height>n.width?n.height/(t.height*r):n.width/(t.width*r)}function i5(t,e,n=0,r,s,i){const o=eo(e.naturalWidth,e.naturalHeight,n),a=sh(s5(t,e,r),s,i),l=r.height>r.width?r.height/t.height:r.width/t.width;return{crop:{x:((o.width-t.width)/2-t.x)*l,y:((o.height-t.height)/2-t.y)*l},zoom:a}}function Vv(t,e){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function o5(t){return t*Math.PI/180}function eo(t,e,n){const r=o5(n);return{width:Math.abs(Math.cos(r)*t)+Math.abs(Math.sin(r)*e),height:Math.abs(Math.sin(r)*t)+Math.abs(Math.cos(r)*e)}}function sh(t,e,n){return Math.min(Math.max(t,e),n)}function ac(...t){return t.filter(e=>typeof e=="string"&&e.length>0).join(" ").trim()}var a5=`.reactEasyCrop_Container {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
user-select: none;
touch-action: none;
cursor: move;
display: flex;
justify-content: center;
align-items: center;
}
.reactEasyCrop_Image,
.reactEasyCrop_Video {
will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
max-width: unset; /* prevent global img/video reset rules from constraining the cropper media */
}
.reactEasyCrop_Contain {
max-width: 100%;
max-height: 100%;
margin: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.reactEasyCrop_Cover_Horizontal {
width: 100%;
height: auto;
}
.reactEasyCrop_Cover_Vertical {
width: auto;
height: 100%;
}
.reactEasyCrop_CropArea {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
border: 1px solid rgba(255, 255, 255, 0.5);
box-sizing: border-box;
box-shadow: 0 0 0 9999em;
color: rgba(0, 0, 0, 0.5);
overflow: hidden;
}
.reactEasyCrop_CropAreaRound {
border-radius: 50%;
}
.reactEasyCrop_CropAreaGrid::before {
content: ' ';
box-sizing: border-box;
position: absolute;
border: 1px solid rgba(255, 255, 255, 0.5);
top: 0;
bottom: 0;
left: 33.33%;
right: 33.33%;
border-top: 0;
border-bottom: 0;
}
.reactEasyCrop_CropAreaGrid::after {
content: ' ';
box-sizing: border-box;
position: absolute;
border: 1px solid rgba(255, 255, 255, 0.5);
top: 33.33%;
bottom: 33.33%;
left: 0;
right: 0;
border-left: 0;
border-right: 0;
}
`;const l5=250,c5=1,u5=3,d5=1;var ih=class hn extends v.Component{constructor(...e){super(...e),this.cropperRef=v.createRef(),this.imageRef=v.createRef(),this.videoRef=v.createRef(),this.containerPosition={x:0,y:0},this.containerRef=null,this.styleRef=null,this.containerRect=null,this.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},this.dragStartPosition={x:0,y:0},this.dragStartCrop={x:0,y:0},this.gestureZoomStart=0,this.gestureRotationStart=0,this.isTouching=!1,this.lastPinchDistance=0,this.lastPinchRotation=0,this.rafDragTimeout=null,this.rafPinchTimeout=null,this.wheelTimer=null,this.resizeEmitTimer=null,this.currentDoc=typeof document<"u"?document:null,this.currentWindow=typeof window<"u"?window:null,this.resizeObserver=null,this.previousCropSize=null,this.isInitialized=!1,this.dragInteractionSource=null,this.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},this.initResizeObserver=()=>{if(typeof window.ResizeObserver>"u"||!this.containerRef)return;let n=!0;this.resizeObserver=new window.ResizeObserver(r=>{if(n){n=!1;return}this.computeSizes({isResizeTriggered:!0})}),this.resizeObserver.observe(this.containerRef)},this.onWindowResize=()=>{this.computeSizes({isResizeTriggered:!0})},this.preventZoomSafari=n=>n.preventDefault(),this.cleanEvents=()=>{this.currentDoc&&(this.currentDoc.removeEventListener("mousemove",this.onMouseMove),this.currentDoc.removeEventListener("mouseup",this.onDragStopped),this.currentDoc.removeEventListener("touchmove",this.onTouchMove),this.currentDoc.removeEventListener("touchend",this.onDragStopped),this.currentDoc.removeEventListener("gesturechange",this.onGestureChange),this.currentDoc.removeEventListener("gestureend",this.onGestureEnd),this.currentDoc.removeEventListener("scroll",this.onScroll))},this.clearScrollEvent=()=>{this.containerRef&&this.containerRef.removeEventListener("wheel",this.onWheel),this.wheelTimer&&clearTimeout(this.wheelTimer)},this.onMediaLoad=()=>{const n=this.computeSizes();n&&(this.previousCropSize=n,this.emitCropData(),this.setInitialCrop(n),this.isInitialized=!0),this.props.onMediaLoaded&&this.props.onMediaLoaded(this.mediaSize)},this.setInitialCrop=n=>{if(this.props.initialCroppedAreaPercentages){const{crop:r,zoom:s}=r5(this.props.initialCroppedAreaPercentages,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(s)}else if(this.props.initialCroppedAreaPixels){const{crop:r,zoom:s}=i5(this.props.initialCroppedAreaPixels,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(s)}},this.computeSizes=({isResizeTriggered:n=!1}={})=>{const r=this.imageRef.current||this.videoRef.current;if(r&&this.containerRef){var s,i,o,a,l,u;this.containerRect=this.containerRef.getBoundingClientRect(),this.saveContainerPosition();const d=this.containerRect.width/this.containerRect.height,h=((s=this.imageRef.current)===null||s===void 0?void 0:s.naturalWidth)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoWidth)||0,f=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((a=this.videoRef.current)===null||a===void 0?void 0:a.videoHeight)||0,p=r.offsetWidth<h||r.offsetHeight<f,m=h/f;let g;if(p)switch(this.state.mediaObjectFit){default:case"contain":g=d>m?{width:this.containerRect.height*m,height:this.containerRect.height}:{width:this.containerRect.width,height:this.containerRect.width/m};break;case"horizontal-cover":g={width:this.containerRect.width,height:this.containerRect.width/m};break;case"vertical-cover":g={width:this.containerRect.height*m,height:this.containerRect.height};break}else g={width:r.offsetWidth,height:r.offsetHeight};this.mediaSize=qe(qe({},g),{},{naturalWidth:h,naturalHeight:f}),this.props.setMediaSize&&this.props.setMediaSize(this.mediaSize);const x=this.props.cropSize?this.props.cropSize:ZO(this.mediaSize.width,this.mediaSize.height,this.containerRect.width,this.containerRect.height,this.props.aspect,this.props.rotation);return(((l=this.state.cropSize)===null||l===void 0?void 0:l.height)!==x.height||((u=this.state.cropSize)===null||u===void 0?void 0:u.width)!==x.width)&&this.props.onCropSizeChange&&this.props.onCropSizeChange(x),this.setState({cropSize:x},()=>this.recomputeCropPosition({isResizeTriggered:n})),this.props.setCropSize&&this.props.setCropSize(x),x}},this.saveContainerPosition=()=>{if(this.containerRef){const n=this.containerRef.getBoundingClientRect();this.containerPosition={x:n.left,y:n.top}}},this.onMouseDown=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("mousemove",this.onMouseMove),this.currentDoc.addEventListener("mouseup",this.onDragStopped),this.saveContainerPosition(),this.onDragStart(hn.getMousePoint(n),"mouse"))},this.onMouseMove=n=>this.onDrag(hn.getMousePoint(n)),this.onScroll=n=>{this.currentDoc&&(n.preventDefault(),this.saveContainerPosition())},this.onTouchStart=n=>{this.currentDoc&&(this.isTouching=!0,!(this.props.onTouchRequest&&!this.props.onTouchRequest(n))&&(this.currentDoc.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.currentDoc.addEventListener("touchend",this.onDragStopped),this.saveContainerPosition(),n.touches.length===2?this.onPinchStart(n):n.touches.length===1&&this.onDragStart(hn.getTouchPoint(n.touches[0]),"touch")))},this.onTouchMove=n=>{n.preventDefault(),n.touches.length===2?this.onPinchMove(n):n.touches.length===1&&this.onDrag(hn.getTouchPoint(n.touches[0]))},this.onGestureStart=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("gesturechange",this.onGestureChange),this.currentDoc.addEventListener("gestureend",this.onGestureEnd),this.gestureZoomStart=this.props.zoom,this.gestureRotationStart=this.props.rotation)},this.onGestureChange=n=>{if(n.preventDefault(),this.isTouching)return;const r=hn.getMousePoint(n),s=this.gestureZoomStart-1+n.scale;if(this.setNewZoom(s,r,{shouldUpdatePosition:!0}),this.props.onRotationChange){const i=this.gestureRotationStart+n.rotation;this.props.onRotationChange(i)}},this.onGestureEnd=n=>{this.cleanEvents()},this.onDragStart=({x:n,y:r},s)=>{var i,o;this.dragStartPosition={x:n,y:r},this.dragStartCrop=qe({},this.props.crop),this.dragInteractionSource=s,(i=(o=this.props).onInteractionStart)===null||i===void 0||i.call(o,{source:s})},this.onDrag=({x:n,y:r})=>{this.currentWindow&&(this.rafDragTimeout&&this.currentWindow.cancelAnimationFrame(this.rafDragTimeout),this.rafDragTimeout=this.currentWindow.requestAnimationFrame(()=>{if(!this.state.cropSize||n===void 0||r===void 0)return;const s=n-this.dragStartPosition.x,i=r-this.dragStartPosition.y,o={x:this.dragStartCrop.x+s,y:this.dragStartCrop.y+i},a=this.props.restrictPosition?Lo(o,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):o;this.props.onCropChange(a)}))},this.onDragStopped=()=>{var n,r,s;this.isTouching=!1,this.cleanEvents(),this.emitCropData(),(n=(r=this.props).onInteractionEnd)===null||n===void 0||n.call(r,{source:(s=this.dragInteractionSource)!==null&&s!==void 0?s:"mouse"}),this.dragInteractionSource=null},this.onWheel=n=>{if(!this.currentWindow||this.props.onWheelRequest&&!this.props.onWheelRequest(n))return;n.preventDefault();const r=hn.getMousePoint(n),{pixelY:s}=qO(n),i=this.props.zoom-s*this.props.zoomSpeed/200;this.setNewZoom(i,r,{shouldUpdatePosition:!0}),this.state.hasWheelJustStarted||this.setState({hasWheelJustStarted:!0},()=>{var o,a;return(o=(a=this.props).onInteractionStart)===null||o===void 0?void 0:o.call(a,{source:"wheel"})}),this.wheelTimer&&clearTimeout(this.wheelTimer),this.wheelTimer=this.currentWindow.setTimeout(()=>this.setState({hasWheelJustStarted:!1},()=>{var o,a;return(o=(a=this.props).onInteractionEnd)===null||o===void 0?void 0:o.call(a,{source:"wheel"})}),250)},this.getPointOnContainer=({x:n,y:r},s)=>{if(!this.containerRect)throw new Error("The Cropper is not mounted");return{x:this.containerRect.width/2-(n-s.x),y:this.containerRect.height/2-(r-s.y)}},this.getPointOnMedia=({x:n,y:r})=>{const{crop:s,zoom:i}=this.props;return{x:(n+s.x)/i,y:(r+s.y)/i}},this.setNewZoom=(n,r,{shouldUpdatePosition:s=!0}={})=>{if(!this.state.cropSize||!this.props.onZoomChange)return;const i=sh(n,this.props.minZoom,this.props.maxZoom);if(s){const o=this.getPointOnContainer(r,this.containerPosition),a=this.getPointOnMedia(o),l={x:a.x*i-o.x,y:a.y*i-o.y},u=this.props.restrictPosition?Lo(l,this.mediaSize,this.state.cropSize,i,this.props.rotation):l;this.props.onCropChange(u)}this.props.onZoomChange(i)},this.getCropData=()=>this.state.cropSize?e5(this.props.restrictPosition?Lo(this.props.crop,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):this.props.crop,this.mediaSize,this.state.cropSize,this.getAspect(),this.props.zoom,this.props.rotation,this.props.restrictPosition):null,this.emitCropData=()=>{this.resizeEmitTimer&&(clearTimeout(this.resizeEmitTimer),this.resizeEmitTimer=null);const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:s}=n;this.props.onCropComplete&&this.props.onCropComplete(r,s),this.props.onCropAreaChange&&this.props.onCropAreaChange(r,s)},this.emitCropAreaChange=()=>{const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:s}=n;this.props.onCropAreaChange&&this.props.onCropAreaChange(r,s)},this.recomputeCropPosition=({isResizeTriggered:n=!1}={})=>{var r,s;if(!this.state.cropSize)return;let i=this.props.crop;if(this.isInitialized&&(!((r=this.previousCropSize)===null||r===void 0)&&r.width)&&(!((s=this.previousCropSize)===null||s===void 0)&&s.height)&&(Math.abs(this.previousCropSize.width-this.state.cropSize.width)>1e-6||Math.abs(this.previousCropSize.height-this.state.cropSize.height)>1e-6)){const a=this.state.cropSize.width/this.previousCropSize.width,l=this.state.cropSize.height/this.previousCropSize.height;i={x:this.props.crop.x*a,y:this.props.crop.y*l}}const o=this.props.restrictPosition?Lo(i,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):i;this.previousCropSize=this.state.cropSize,this.props.onCropChange(o),n?this.debouncedEmitCropData():this.emitCropData()},this.debouncedEmitCropData=()=>{this.currentWindow&&(this.resizeEmitTimer&&clearTimeout(this.resizeEmitTimer),this.resizeEmitTimer=this.currentWindow.setTimeout(()=>{this.emitCropData()},l5))},this.onKeyDown=n=>{const{crop:r,onCropChange:s,keyboardStep:i,zoom:o,rotation:a}=this.props;let l=i;if(!this.state.cropSize)return;n.shiftKey&&(l*=.2);let u=qe({},r);switch(n.key){case"ArrowUp":u.y-=l,n.preventDefault();break;case"ArrowDown":u.y+=l,n.preventDefault();break;case"ArrowLeft":u.x-=l,n.preventDefault();break;case"ArrowRight":u.x+=l,n.preventDefault();break;default:return}if(this.props.restrictPosition&&(u=Lo(u,this.mediaSize,this.state.cropSize,o,a)),!n.repeat){var d,h;(d=(h=this.props).onInteractionStart)===null||d===void 0||d.call(h,{source:"keyboard"})}s(u)},this.onKeyUp=n=>{var r,s;switch(n.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":n.preventDefault();break;default:return}this.emitCropData(),(r=(s=this.props).onInteractionEnd)===null||r===void 0||r.call(s,{source:"keyboard"})}}componentDidMount(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.onWindowResize),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=a5,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))}componentWillUnmount(){var e;if(!(!this.currentDoc||!this.currentWindow)){if(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.onWindowResize),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.resizeEmitTimer&&clearTimeout(this.resizeEmitTimer),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef){var n;(n=this.styleRef.parentNode)===null||n===void 0||n.removeChild(this.styleRef)}this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()}}componentDidUpdate(e){var n,r,s,i,o,a,l,u;if(e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((n=e.cropSize)===null||n===void 0?void 0:n.height)!==((r=this.props.cropSize)===null||r===void 0?void 0:r.height)||((s=e.cropSize)===null||s===void 0?void 0:s.width)!==((i=this.props.cropSize)===null||i===void 0?void 0:i.width)?this.computeSizes():(((o=e.crop)===null||o===void 0?void 0:o.x)!==((a=this.props.crop)===null||a===void 0?void 0:a.x)||((l=e.crop)===null||l===void 0?void 0:l.y)!==((u=this.props.crop)===null||u===void 0?void 0:u.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video){var d;(d=this.videoRef.current)===null||d===void 0||d.load()}const h=this.getObjectFit();h!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:h},this.computeSizes)}getAspect(){const{cropSize:e,aspect:n}=this.props;return e?e.width/e.height:n}getObjectFit(){if(this.props.objectFit==="cover"){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){var e,n,r,s;this.containerRect=this.containerRef.getBoundingClientRect();const i=this.containerRect.width/this.containerRect.height;return(((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((n=this.videoRef.current)===null||n===void 0?void 0:n.videoWidth)||0)/(((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalHeight)||((s=this.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0)<i?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit}onPinchStart(e){const n=hn.getTouchPoint(e.touches[0]),r=hn.getTouchPoint(e.touches[1]);this.lastPinchDistance=zv(n,r),this.lastPinchRotation=Fv(n,r),this.onDragStart(Vv(n,r),"touch")}onPinchMove(e){if(!this.currentDoc||!this.currentWindow)return;const n=hn.getTouchPoint(e.touches[0]),r=hn.getTouchPoint(e.touches[1]),s=Vv(n,r);this.onDrag(s),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(()=>{const i=zv(n,r),o=this.props.zoom*(i/this.lastPinchDistance);this.setNewZoom(o,s,{shouldUpdatePosition:!1}),this.lastPinchDistance=i;const a=Fv(n,r),l=this.props.rotation+(a-this.lastPinchRotation);this.props.onRotationChange&&this.props.onRotationChange(l),this.lastPinchRotation=a})}render(){var e;const{image:n,video:r,mediaProps:s,cropperProps:i,transform:o,crop:{x:a,y:l},rotation:u,zoom:d,cropShape:h,showGrid:f,roundCropAreaPixels:p,style:{containerStyle:m,cropAreaStyle:g,mediaStyle:x},classes:{containerClassName:y,cropAreaClassName:b,mediaClassName:k}}=this.props,w=(e=this.state.mediaObjectFit)!==null&&e!==void 0?e:this.getObjectFit();return v.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:C=>this.containerRef=C,"data-testid":"container",style:m,className:ac("reactEasyCrop_Container",y)},n?v.createElement("img",qe(qe({alt:"",className:ac("reactEasyCrop_Image",w==="contain"&&"reactEasyCrop_Contain",w==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",w==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",k)},s),{},{src:n,ref:this.imageRef,style:qe(qe({},x),{},{transform:o||`translate(${a}px, ${l}px) rotate(${u}deg) scale(${d})`}),onLoad:this.onMediaLoad})):r&&v.createElement("video",qe(qe({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:ac("reactEasyCrop_Video",w==="contain"&&"reactEasyCrop_Contain",w==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",w==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",k)},s),{},{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:qe(qe({},x),{},{transform:o||`translate(${a}px, ${l}px) rotate(${u}deg) scale(${d})`}),controls:!1}),(Array.isArray(r)?r:[{src:r}]).map(C=>v.createElement("source",qe({key:C.src},C)))),this.state.cropSize&&v.createElement("div",qe({ref:this.cropperRef,style:qe(qe({},g),{},{width:p?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:p?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:ac("reactEasyCrop_CropArea",h==="round"&&"reactEasyCrop_CropAreaRound",f&&"reactEasyCrop_CropAreaGrid",b)},i)))}};ih.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:u5,minZoom:c5,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:d5};ih.getMousePoint=t=>({x:Number(t.clientX),y:Number(t.clientY)});ih.getTouchPoint=t=>({x:Number(t.clientX),y:Number(t.clientY)});var h5=ih;function f5(t){return new Promise((e,n)=>{const r=new Image;r.addEventListener("load",()=>e(r)),r.addEventListener("error",s=>n(s)),r.crossOrigin="anonymous",r.src=t})}async function p5(t,e,n="image/png"){const r=await f5(t),s=document.createElement("canvas");return s.width=Math.round(e.width),s.height=Math.round(e.height),s.getContext("2d").drawImage(r,e.x,e.y,e.width,e.height,0,0,s.width,s.height),new Promise((o,a)=>{s.toBlob(l=>{if(!l){a(new Error("Zuschneiden fehlgeschlagen"));return}o(l)},n)})}function m5(t){return t==="image/jpeg"?"jpg":t==="image/webp"?"webp":"png"}function sr({value:t,onChange:e,label:n="Bild",aspect:r}){const[s,i]=v.useState(!1),[o,a]=v.useState(""),[l,u]=v.useState(null),[d,h]=v.useState("image/png"),[f,p]=v.useState({x:0,y:0}),[m,g]=v.useState(1),[x,y]=v.useState(null),[b,k]=v.useState(r||1),w=E=>{h(E.type||"image/png"),p({x:0,y:0}),g(1),y(null),k(r||1),u(URL.createObjectURL(E))},C=E=>{var P;const D=(P=E.target.files)==null?void 0:P[0];E.target.value="",D&&(a(""),w(D))},j=async()=>{if(t){a("");try{const D=await(await fetch(t)).blob();w(D)}catch{a("Bild konnte nicht zum Zuschneiden geladen werden.")}}},S=({width:E,height:D})=>{!r&&E&&D&&k(E/D)},N=()=>{l&&URL.revokeObjectURL(l),u(null)},T=async()=>{if(!(!l||!x)){i(!0),a("");try{const E=await p5(l,x,d),D=new FormData;D.append("file",E,`zugeschnitten.${m5(d)}`);const P=await A.post("/uploads",D);e(P.path),N()}catch(E){a(E.message)}finally{i(!1)}}};return c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:n}),c.jsxs("div",{className:"flex items-center gap-3",children:[t&&c.jsxs("div",{className:"relative",children:[c.jsx("img",{src:t,alt:"",className:"h-12 w-12 rounded-md object-cover"}),c.jsx("button",{type:"button",onClick:()=>e(null),title:"Bild entfernen","aria-label":"Bild entfernen",className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-600 text-xs font-bold leading-none text-white shadow hover:bg-red-700",children:"×"})]}),c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",onChange:C,className:"text-sm"}),t&&c.jsx("button",{type:"button",onClick:j,className:"rounded-md border border-neutral-300 px-2 py-1 text-xs font-medium text-neutral-600 hover:bg-neutral-50 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Zuschneiden"}),s&&c.jsx("span",{className:"text-sm text-neutral-500",children:"Lädt hoch…"})]}),o&&c.jsx("p",{className:"mt-1 text-sm text-red-600",children:o}),l&&c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:c.jsxs("div",{className:"w-full max-w-lg rounded-xl bg-white p-4 dark:bg-neutral-900",children:[c.jsx("p",{className:"mb-3 text-sm font-semibold text-neutral-900 dark:text-white",children:"Bild zuschneiden"}),c.jsx("div",{className:"relative h-80 w-full overflow-hidden rounded-md bg-neutral-800 sm:h-96",children:c.jsx(h5,{image:l,crop:f,zoom:m,aspect:b,onCropChange:p,onZoomChange:g,onCropComplete:(E,D)=>y(D),onMediaLoaded:S})}),c.jsx("input",{type:"range",min:1,max:3,step:.01,value:m,onChange:E=>g(Number(E.target.value)),className:"mt-4 w-full"}),o&&c.jsx("p",{className:"mt-2 text-sm text-red-600",children:o}),c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:N,disabled:s,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"}),c.jsx("button",{type:"button",onClick:T,disabled:s||!x,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s?"Lädt hoch…":"Übernehmen"})]})]})})]})}const oh=[{label:"Systemschrift",value:""},{label:"Serifenlos (Arial)",value:"Arial, Helvetica, sans-serif"},{label:"Serif (Georgia)",value:'Georgia, "Times New Roman", serif'},{label:"Klassisch (Times New Roman)",value:'"Times New Roman", Times, serif'},{label:"Modern (Verdana)",value:"Verdana, Geneva, sans-serif"},{label:"Schreibmaschine (Courier New)",value:'"Courier New", Courier, monospace'}],g5=[{label:"Standard",value:""},{label:"S (14px)",value:"14px"},{label:"M (16px)",value:"16px"},{label:"L (18px)",value:"18px"},{label:"XL (20px)",value:"20px"},{label:"XXL (24px)",value:"24px"},{label:"XXXL (28px)",value:"28px"},{label:"Groß (36px)",value:"36px"},{label:"Riesig (48px)",value:"48px"}],kf={font_family:"",font_size:"",color:""};function Os({fieldKey:t,previewText:e="Beispieltext",label:n="Stil"}){const[r,s]=v.useState(kf),[i,o]=v.useState(!0),[a,l]=v.useState("");v.useEffect(()=>{o(!0),A.get(`/text-styles/one?key=${encodeURIComponent(t)}`).then(h=>s({font_family:h.font_family||"",font_size:h.font_size||"",color:h.color||""})).catch(()=>s(kf)).finally(()=>o(!1))},[t]);const u=async h=>{s(h),l("");try{await A.put("/text-styles",{field_key:t,...h})}catch(f){l(f.message)}};if(i)return null;const d={fontFamily:r.font_family||void 0,fontSize:r.font_size||void 0,color:r.color||void 0};return c.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 rounded-md border border-neutral-200 bg-neutral-50 p-2 dark:border-neutral-700 dark:bg-neutral-800/50",children:[c.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral-400",children:n}),c.jsx("select",{value:r.font_family,onChange:h=>u({...r,font_family:h.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:oh.map(h=>c.jsx("option",{value:h.value,children:h.label},h.label))}),c.jsx("select",{value:r.font_size,onChange:h=>u({...r,font_size:h.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:g5.map(h=>c.jsx("option",{value:h.value,children:h.label},h.label))}),c.jsx("input",{type:"color",value:r.color||"#000000",onChange:h=>u({...r,color:h.target.value}),className:"h-7 w-9 cursor-pointer rounded border border-neutral-300 bg-white p-0.5 dark:border-neutral-700 dark:bg-neutral-900",title:"Textfarbe"}),c.jsx("button",{type:"button",onClick:()=>u(kf),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-700",children:"Zurücksetzen"}),c.jsx("span",{className:"ml-1 rounded px-2 py-1 text-sm",style:d,children:e}),a&&c.jsx("span",{className:"text-xs text-red-600",children:a})]})}const $v={name:"",image_path:"",sort_order:0};function x5(){const[t,e]=v.useState([]),[n,r]=v.useState($v),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/brands").then(e);v.useEffect(()=>{l()},[]);const u=p=>{i(p.id),r({name:p.name,image_path:p.image_path||"",sort_order:p.sort_order})},d=()=>{i(null),r($v)},h=async p=>{p.preventDefault(),a("");try{s?await A.put(`/brands/${s}`,n):await A.post("/brands",n),d(),l()}catch(m){a(m.message)}},f=async p=>{confirm("Marke inkl. aller Modelle/Pakete/Produkte wirklich löschen?")&&(await A.delete(`/brands/${p}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Marken"}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Bild"}),c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(p=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:p.image_path?c.jsx("img",{src:p.image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:c.jsx(ne,{to:`/marken/${p.slug}`,target:"_blank",className:"hover:text-brand-500",children:p.name})}),c.jsx("td",{className:"px-4 py-2",children:p.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(p),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>f(p.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},p.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Marken angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Marke bearbeiten":"Neue Marke"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.name,onChange:p=>r({...n,name:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),s&&c.jsx(Os,{fieldKey:`brands.${s}.name`,previewText:n.name||"Beispieltext"})]}),c.jsx(sr,{value:n.image_path,onChange:p=>r({...n,image_path:p}),label:"Bild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:p=>r({...n,sort_order:Number(p.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const Hv={name:"",brand_id:"",image_path:"",sort_order:0};function y5(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(Hv),[o,a]=v.useState(null),[l,u]=v.useState(""),[d,h]=v.useState("all"),f=v.useMemo(()=>d==="all"?t:t.filter(b=>String(b.brand_id)===d),[t,d]),p=()=>{A.get("/models").then(e),A.get("/brands").then(r)};v.useEffect(p,[]);const m=b=>{a(b.id),i({name:b.name,brand_id:b.brand_id,image_path:b.image_path||"",sort_order:b.sort_order})},g=()=>{a(null),i(Hv)},x=async b=>{b.preventDefault(),u("");const k={...s,brand_id:Number(s.brand_id)};try{o?await A.put(`/models/${o}`,k):await A.post("/models",k),g(),p()}catch(w){u(w.message)}},y=async b=>{confirm("Modell inkl. aller Pakete/Produkte wirklich löschen?")&&(await A.delete(`/models/${b}`),p())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Modelle"}),c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Nach Marke filtern:"}),c.jsxs("select",{value:d,onChange:b=>h(b.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Marken"}),n.map(b=>c.jsx("option",{value:String(b.id),children:b.name},b.id))]}),d!=="all"&&c.jsx("button",{onClick:()=>h("all"),className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),c.jsxs("span",{className:"text-sm text-neutral-400",children:[f.length," von ",t.length]})]}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Bild"}),c.jsx("th",{className:"px-4 py-2",children:"Marke"}),c.jsx("th",{className:"px-4 py-2",children:"Modell"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[f.map(b=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:b.image_path?c.jsx("img",{src:b.image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2",children:b.brand_name}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:b.name}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>m(b),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>y(b.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},b.id)),f.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:t.length===0?"Noch keine Modelle angelegt.":"Keine Modelle für diese Marke."})})]})]})})]}),c.jsxs("form",{onSubmit:x,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:o?"Modell bearbeiten":"Neues Modell"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Marke *"}),c.jsxs("select",{required:!0,value:s.brand_id,onChange:b=>i({...s,brand_id:b.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Bitte wählen…"}),n.map(b=>c.jsx("option",{value:b.id,children:b.name},b.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Modellname *"}),c.jsx("input",{required:!0,value:s.name,onChange:b=>i({...s,name:b.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),o&&c.jsx(Os,{fieldKey:`car_models.${o}.name`,previewText:s.name||"Beispieltext"})]}),c.jsx(sr,{value:s.image_path,onChange:b=>i({...s,image_path:b}),label:"Bild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:s.sort_order,onChange:b=>i({...s,sort_order:Number(b.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),l&&c.jsx("p",{className:"text-sm text-red-600",children:l}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:o?"Speichern":"Anlegen"}),o&&c.jsx("button",{type:"button",onClick:g,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const Wv={name:"",cover_image_path:"",sort_order:0};function b5(){const[t,e]=v.useState([]),[n,r]=v.useState(Wv),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/gallery-brands").then(e);v.useEffect(()=>{l()},[]);const u=p=>{i(p.id),r({name:p.name,cover_image_path:p.cover_image_path||"",sort_order:p.sort_order})},d=()=>{i(null),r(Wv)},h=async p=>{p.preventDefault(),a("");try{s?await A.put(`/gallery-brands/${s}`,n):await A.post("/gallery-brands",n),d(),l()}catch(m){a(m.message)}},f=async p=>{confirm("Marke inkl. aller Projekte/Fotos wirklich löschen?")&&(await A.delete(`/gallery-brands/${p}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Marken"}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Bild"}),c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(p=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:p.cover_image_path?c.jsx("img",{src:p.cover_image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:c.jsx(ne,{to:`/galerie/${p.slug}`,target:"_blank",className:"hover:text-brand-500",children:p.name})}),c.jsx("td",{className:"px-4 py-2",children:p.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(p),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>f(p.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},p.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Galerie-Marken angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Marke bearbeiten":"Neue Marke"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.name,onChange:p=>r({...n,name:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(sr,{value:n.cover_image_path,onChange:p=>r({...n,cover_image_path:p}),aspect:4/3,label:"Titelbild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:p=>r({...n,sort_order:Number(p.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const Uv={name:"",gallery_brand_id:"",cover_image_path:"",sort_order:0};function v5(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(Uv),[o,a]=v.useState(null),[l,u]=v.useState(""),[d,h]=v.useState("all"),f=v.useMemo(()=>d==="all"?t:t.filter(b=>String(b.gallery_brand_id)===d),[t,d]),p=()=>{A.get("/gallery-projects").then(e),A.get("/gallery-brands").then(r)};v.useEffect(p,[]);const m=b=>{a(b.id),i({name:b.name,gallery_brand_id:b.gallery_brand_id,cover_image_path:b.cover_image_path||"",sort_order:b.sort_order})},g=()=>{a(null),i(Uv)},x=async b=>{b.preventDefault(),u("");const k={...s,gallery_brand_id:Number(s.gallery_brand_id)};try{o?await A.put(`/gallery-projects/${o}`,k):await A.post("/gallery-projects",k),g(),p()}catch(w){u(w.message)}},y=async b=>{confirm("Projekt inkl. aller Fotos wirklich löschen?")&&(await A.delete(`/gallery-projects/${b}`),p())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Projekte"}),c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Nach Marke filtern:"}),c.jsxs("select",{value:d,onChange:b=>h(b.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Marken"}),n.map(b=>c.jsx("option",{value:String(b.id),children:b.name},b.id))]}),d!=="all"&&c.jsx("button",{onClick:()=>h("all"),className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),c.jsxs("span",{className:"text-sm text-neutral-400",children:[f.length," von ",t.length]})]}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Marke"}),c.jsx("th",{className:"px-4 py-2",children:"Projekt"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[f.map(b=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:b.brand_name}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:b.name}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx(ne,{to:`/admin/gallery-projects/${b.id}/photos`,className:"mr-3 text-brand-600 hover:underline",children:"Fotos"}),c.jsx("button",{onClick:()=>m(b),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>y(b.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},b.id)),f.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:t.length===0?"Noch keine Projekte angelegt.":"Keine Projekte für diese Marke."})})]})]})})]}),c.jsxs("form",{onSubmit:x,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:o?"Projekt bearbeiten":"Neues Projekt"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Marke *"}),c.jsxs("select",{required:!0,value:s.gallery_brand_id,onChange:b=>i({...s,gallery_brand_id:b.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Bitte wählen…"}),n.map(b=>c.jsx("option",{value:b.id,children:b.name},b.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Projektname *"}),c.jsx("input",{required:!0,placeholder:"z. B. Audi TT",value:s.name,onChange:b=>i({...s,name:b.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(sr,{value:s.cover_image_path,onChange:b=>i({...s,cover_image_path:b}),aspect:4/3,label:"Titelbild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:s.sort_order,onChange:b=>i({...s,sort_order:Number(b.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),l&&c.jsx("p",{className:"text-sm text-red-600",children:l}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:o?"Speichern":"Anlegen"}),o&&c.jsx("button",{type:"button",onClick:g,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}function k5(){const{projectId:t}=ti(),[e,n]=v.useState([]),[r,s]=v.useState(""),[i,o]=v.useState(!1),[a,l]=v.useState(""),u=v.useRef(null),d=()=>A.get(`/gallery-projects/${t}/photos`).then(n);v.useEffect(()=>{d()},[t]);const h=async x=>{const y=Array.from(x.target.files||[]);if(y.length!==0){s(""),o(!0);try{for(let b=0;b<y.length;b++){l(`Lade Bild ${b+1} von ${y.length} hoch…`);const k=new FormData;k.append("file",y[b]);const w=await A.post("/uploads",k);await A.post("/gallery-photos",{gallery_project_id:Number(t),image_path:w.path,sort_order:e.length+b})}d()}catch(b){s(b.message)}finally{o(!1),l(""),u.current&&(u.current.value="")}}},f=(x,y)=>{n(b=>b.map(k=>k.id===x.id?{...k,caption:y}:k))},p=(x,y)=>{n(b=>b.map(k=>k.id===x.id?{...k,sort_order:y}:k))},m=async x=>{await A.put(`/gallery-photos/${x.id}`,{caption:x.caption,sort_order:x.sort_order}),d()},g=async x=>{confirm("Foto wirklich entfernen?")&&(await A.delete(`/gallery-photos/${x}`),d())};return c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-sm",children:c.jsx(ne,{to:"/admin/gallery-projects",className:"text-brand-600 hover:underline",children:"← Zurück zu den Projekten"})}),c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Fotos im Projekt"}),c.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Fotos hinzufügen (Mehrfachauswahl möglich)"}),c.jsx("input",{ref:u,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp",onChange:h,disabled:i,className:"text-sm"}),i&&c.jsx("p",{className:"mt-2 text-sm text-neutral-500",children:a})]}),r&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:r}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:[e.map(x=>c.jsxs("div",{className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("img",{src:x.image_path,alt:x.caption||"",className:"aspect-square w-full object-cover"}),c.jsxs("div",{className:"space-y-2 p-3",children:[c.jsx("input",{value:x.caption||"",onChange:y=>f(x,y.target.value),onBlur:()=>m(x),placeholder:"Bildunterschrift (optional)",className:"w-full rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"number",value:x.sort_order,onChange:y=>p(x,Number(y.target.value)),onBlur:()=>m(x),className:"w-16 rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("button",{onClick:()=>g(x.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]},x.id)),e.length===0&&c.jsx("p",{className:"col-span-full py-6 text-center text-neutral-400",children:"Noch keine Fotos in diesem Projekt."})]})]})}const w5=["Base","Clear","Drive","Prime","Elite","Apex","The Statement","Limitless"],S5=t=>(t+1)*10,lc="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",Rm=t=>({description:t.description||"",markup_type:t.markup_type||"none",markup_value:t.markup_value||0,icon_name:t.icon_name||"",tagline:t.tagline||"",price_text:t.price_text||"",is_featured:!!t.is_featured,sort_order:t.sort_order??0}),N5=t=>({description:"",markup_type:"none",markup_value:0,icon_name:"",tagline:"",price_text:"",is_featured:!1,sort_order:S5(t)}),C5=["description","markup_type","markup_value","icon_name","tagline","price_text","is_featured","sort_order"],wf=t=>{if(!t.existing)return t.checked;const e=Rm(t.existing);return C5.some(n=>n==="is_featured"?!!e[n]!=!!t.form[n]:String(e[n])!==String(t.form[n]))},Ro=(t,e)=>{const n=e.filter(o=>o.car_model_id===t).slice().sort((o,a)=>o.sort_order-a.sort_order||o.name.localeCompare(a.name)),r=new Set,s=w5.map((o,a)=>{const l=n.find(u=>!r.has(u.id)&&u.name.trim().toLowerCase()===o.toLowerCase());return l&&r.add(l.id),{key:`tier-${a}`,tierName:o,existing:l||null,checked:!!l,form:l?Rm(l):N5(a)}}),i=n.filter(o=>!r.has(o.id)).map(o=>({key:`legacy-${o.id}`,tierName:null,existing:o,checked:!0,form:Rm(o)}));return[...s,...i]},j5=t=>{t.target.style.height="auto",t.target.style.height=`${t.target.scrollHeight}px`};function E5(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(""),[o,a]=v.useState(""),[l,u]=v.useState([]),[d,h]=v.useState({}),[f,p]=v.useState(!1),[m,g]=v.useState(null),[x,y]=v.useState(""),[b,k]=v.useState(!1),[w,C]=v.useState(null),[j,S]=v.useState("all"),[N,T]=v.useState("all"),E=v.useRef(new Map),D=M=>{const ee=E.current.get(M);if(!ee)return;const{selectionStart:q,selectionEnd:Me,value:En}=ee;if(q===Me)return;const L=En.slice(q,Me),pe=L.startsWith("**")&&L.endsWith("**")&&L.length>=4?L.slice(2,-2):`**${L}**`,_e=En.slice(0,q)+pe+En.slice(Me);U(M,{description:_e}),requestAnimationFrame(()=>{ee.focus();const Tn=q+pe.length;ee.setSelectionRange(Tn,Tn)})},P=async()=>{const[M,ee]=await Promise.all([A.get("/packages"),A.get("/models")]);return e(M),r(ee),M};v.useEffect(()=>{P()},[]);const O=v.useMemo(()=>new Map(n.map(M=>[M.id,M])),[n]),I=v.useMemo(()=>{const M=new Map;return n.forEach(ee=>{M.has(ee.brand_id)||M.set(ee.brand_id,ee.brand_name)}),Array.from(M,([ee,q])=>({id:ee,name:q})).sort((ee,q)=>ee.name.localeCompare(q.name))},[n]),H=v.useMemo(()=>n.filter(M=>!s||String(M.brand_id)===s).sort((M,ee)=>M.name.localeCompare(ee.name)),[n,s]),B=o?O.get(Number(o)):null,re=v.useMemo(()=>l.some(wf),[l]),R=()=>!re||confirm("Ungespeicherte Änderungen verwerfen?"),_=(M,ee,q=t)=>{i(String(M)),a(String(ee)),u(Ro(Number(ee),q)),h({}),g(null),y(""),C(null)},$=M=>{R()&&(i(M),a(""),u([]),h({}),g(null),C(null))},te=M=>{if(!R())return;if(!M){a(""),u([]);return}const ee=O.get(Number(M));_(ee?ee.brand_id:s,M)},Y=(M,ee)=>u(q=>q.map(Me=>Me.key===M?{...Me,checked:ee}:Me)),U=(M,ee)=>u(q=>q.map(Me=>Me.key===M?{...Me,form:{...Me.form,...ee}}:Me)),X=M=>({name:M.tierName??M.existing.name,car_model_id:Number(o),...M.form,markup_value:Number(M.form.markup_value),sort_order:Number(M.form.sort_order)}),ae=async()=>{p(!0),g(null);const M={},ee=l;let q=0,Me=0;for(const _e of l)try{_e.existing?wf(_e)&&(await A.put(`/packages/${_e.existing.id}`,X(_e)),Me+=1):_e.checked&&(await A.post("/packages",X(_e)),q+=1)}catch(Tn){M[_e.key]=Tn.message}const En=await P(),L=Ro(Number(o),En).map(_e=>{if(!M[_e.key])return _e;const Tn=ee.find(q2=>q2.key===_e.key);return Tn?{..._e,checked:Tn.checked,form:Tn.form}:_e});u(L),h(M);const ge=Object.keys(M).length,pe=[];q&&pe.push(`${q} neu angelegt`),Me&&pe.push(`${Me} aktualisiert`),!pe.length&&!ge&&pe.push("Keine Änderungen"),g(ge?{kind:"error",text:`${pe.join(", ")||"Nichts gespeichert"} – ${ge} Paket(e) fehlgeschlagen (Details an der Zeile).`}:{kind:"ok",text:`${pe.join(", ")}.`}),p(!1)},ue=async M=>{if(!confirm(`Paket "${M.tierName??M.existing.name}" inkl. aller Produkte wirklich löschen?`))return;await A.delete(`/packages/${M.existing.id}`);const ee=await P();u(Ro(Number(o),ee)),g(null)},Re=async M=>{if(!confirm("Paket inkl. aller Produkte wirklich löschen?"))return;await A.delete(`/packages/${M.id}`);const ee=await P();o&&u(Ro(Number(o),ee))},mr=async()=>{if(!x||!R())return;const M=O.get(Number(x)),ee=O.get(Number(o));if(confirm(`Alle Pakete von "${M.brand_name} ${M.name}" inkl. verknüpfter Produkte nach "${ee.brand_name} ${ee.name}" kopieren?
Bereits vorhandene Paketstufen werden übersprungen. Upgrades werden nicht mitkopiert.`)){k(!0),C(null);try{const q=await A.post(`/models/${o}/copy-packages`,{source_model_id:Number(x)}),Me=q.copied.reduce((ge,pe)=>ge+pe.products,0),En=[`${q.copied.length} Paket(e) kopiert (${Me} Produkte)`];q.skipped.length&&En.push(`übersprungen: ${q.skipped.join(", ")}`),C({text:`${En.join(" – ")}.`});const L=await P();u(Ro(Number(o),L)),h({})}catch(q){C({error:q.message})}k(!1)}},si=l.filter(M=>!M.existing&&M.checked).length,Rl=l.filter(M=>M.existing&&wf(M)).length,_l=v.useMemo(()=>n.filter(M=>j==="all"||String(M.brand_id)===j).sort((M,ee)=>M.name.localeCompare(ee.name)),[n,j]),ii=v.useMemo(()=>t.filter(M=>{const ee=O.get(M.car_model_id);return!(j!=="all"&&String(ee==null?void 0:ee.brand_id)!==j||N!=="all"&&String(M.car_model_id)!==N)}),[t,O,j,N]),Il=c.jsxs("div",{children:[c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Filtern:"}),c.jsxs("select",{value:j,onChange:M=>{S(M.target.value),T("all")},className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Marken"}),I.map(M=>c.jsx("option",{value:String(M.id),children:M.name},M.id))]}),c.jsxs("select",{value:N,onChange:M=>T(M.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Modelle"}),_l.map(M=>c.jsxs("option",{value:String(M.id),children:[M.brand_name," ",M.name]},M.id))]}),(j!=="all"||N!=="all")&&c.jsx("button",{onClick:()=>{S("all"),T("all")},className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),c.jsxs("span",{className:"text-sm text-neutral-400",children:[ii.length," von ",t.length]})]}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Marke / Modell"}),c.jsx("th",{className:"px-4 py-2",children:"Paket"}),c.jsx("th",{className:"px-4 py-2",children:"Aufschlag"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[ii.map(M=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsxs("td",{className:"px-4 py-2",children:[M.brand_name," ",M.model_name]}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[M.name,M.is_featured&&c.jsx("span",{className:"rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400",children:"Empfohlen"})]})}),c.jsxs("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:[M.markup_type==="fixed"&&`+${M.markup_value} €`,M.markup_type==="percent"&&`+${M.markup_value} %`,(!M.markup_type||M.markup_type==="none")&&"–"]}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx(ne,{to:`/admin/packages/${M.id}/products`,className:"mr-3 text-brand-600 hover:underline",children:"Produkte"}),c.jsx(ne,{to:`/admin/packages/${M.id}/upgrades`,className:"mr-3 text-brand-600 hover:underline",children:"Upgrades"}),c.jsx("button",{onClick:()=>{if(!R())return;const ee=O.get(M.car_model_id);_(ee.brand_id,M.car_model_id),window.scrollTo({top:0,behavior:"smooth"})},className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>Re(M),className:"text-red-600 hover:underline",children:"Löschen"})]})]},M.id)),ii.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:t.length===0?"Noch keine Pakete angelegt.":"Keine Pakete für diesen Filter."})})]})]})})]});return c.jsxs("div",{className:"space-y-6",children:[c.jsx("h1",{className:"text-xl font-bold text-neutral-900 dark:text-white",children:"Pakete"}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-3 font-bold text-neutral-900 dark:text-white",children:"Modell wählen"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsxs("select",{value:s,onChange:M=>$(M.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Marke wählen…"}),I.map(M=>c.jsx("option",{value:String(M.id),children:M.name},M.id))]}),c.jsxs("select",{value:o,onChange:M=>te(M.target.value),className:"min-w-[220px] rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Modell wählen…"}),H.map(M=>c.jsxs("option",{value:String(M.id),children:[M.brand_name," ",M.name]},M.id))]})]}),!o&&c.jsx("p",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:"Modell auswählen, um dessen Pakete anzulegen oder zu bearbeiten – die Standard-Paketstufen stehen dann als Checkliste bereit."})]}),B&&c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800",children:[c.jsxs("h2",{className:"font-bold text-neutral-900 dark:text-white",children:["Pakete für ",B.brand_name," ",B.name]}),c.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:"Paketstufen anhaken, Beschreibung und Aufschlag ausfüllen, unten alles auf einmal speichern."}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 rounded-lg border border-neutral-200 bg-neutral-50 px-3 py-2.5 dark:border-neutral-800 dark:bg-neutral-950",children:[c.jsx("span",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Pakete von anderem Modell kopieren:"}),c.jsxs("select",{value:x,onChange:M=>y(M.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Quellmodell wählen…"}),n.filter(M=>String(M.id)!==o).sort((M,ee)=>`${M.brand_name} ${M.name}`.localeCompare(`${ee.brand_name} ${ee.name}`)).map(M=>c.jsxs("option",{value:String(M.id),children:[M.brand_name," ",M.name]},M.id))]}),c.jsx("button",{type:"button",onClick:mr,disabled:!x||b,className:"rounded-md border border-brand-500 px-3 py-1.5 text-sm font-semibold text-brand-600 hover:bg-brand-50 disabled:opacity-50 dark:hover:bg-brand-900/20",children:b?"Kopiert…":"Kopieren"}),c.jsx("span",{className:"text-xs text-neutral-400",children:"inkl. Produkte, ohne Upgrades"}),w&&c.jsx("span",{className:`w-full text-sm ${w.error?"text-red-600":"text-brand-600 dark:text-brand-400"}`,children:w.error||w.text})]})]}),c.jsx("div",{children:l.map((M,ee)=>c.jsxs("div",{children:[M.tierName===null&&ee>0&&l[ee-1].tierName!==null&&c.jsx("div",{className:"border-t border-neutral-200 bg-neutral-50 px-5 py-2 text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-400",children:"Weitere Pakete (alte Namen)"}),c.jsxs("div",{className:`border-t border-neutral-100 dark:border-neutral-800 ${M.checked?"":"opacity-70"}`,children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-5 py-3",children:[c.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[c.jsx("input",{type:"checkbox",checked:M.checked,disabled:!!M.existing||f,onChange:q=>Y(M.key,q.target.checked),className:"h-5 w-5 rounded border-neutral-300 text-brand-600 focus:ring-brand-500 disabled:opacity-60"}),c.jsx("span",{className:"font-semibold text-neutral-900 dark:text-white",children:M.tierName??M.existing.name})]}),M.tierName===null&&c.jsx("span",{className:"text-xs text-neutral-400",children:"(alter Name)"}),M.existing?c.jsx("span",{className:"rounded-full bg-neutral-100 px-2 py-0.5 text-xs font-semibold text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",children:"Vorhanden"}):M.checked&&c.jsx("span",{className:"rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400",children:"Neu"}),M.form.is_featured&&c.jsx("span",{className:"rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400",children:"Empfohlen"}),M.existing&&c.jsxs("span",{className:"ml-auto flex items-center gap-3 text-sm",children:[c.jsx(ne,{to:`/admin/packages/${M.existing.id}/products`,className:"text-brand-600 hover:underline",children:"Produkte"}),c.jsx(ne,{to:`/admin/packages/${M.existing.id}/upgrades`,className:"text-brand-600 hover:underline",children:"Upgrades"}),c.jsx("button",{type:"button",onClick:()=>ue(M),className:"text-red-600 hover:underline",children:"Löschen"})]})]}),M.checked&&c.jsxs("div",{className:"space-y-4 px-5 pb-5 sm:pl-[52px]",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),c.jsx("p",{className:"mb-1 text-xs text-neutral-500 dark:text-neutral-400",children:'Jede Zeile erscheint als eigener Stichpunkt zusammen mit den Bauteilen. Text markieren und "Fett" klicken, um nur diese Stelle hervorzuheben.'}),c.jsx("div",{className:"mb-1",children:c.jsx("button",{type:"button",onClick:()=>D(M.key),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs font-bold text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Fett"})}),c.jsx("textarea",{ref:q=>E.current.set(M.key,q),rows:10,value:M.form.description,onChange:q=>U(M.key,{description:q.target.value}),onInput:j5,className:lc}),M.existing&&c.jsx(Os,{fieldKey:`packages.${M.existing.id}.description`,previewText:"Beispieltext"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Aufschlag"}),c.jsxs("div",{className:"flex max-w-md gap-2",children:[c.jsxs("select",{value:M.form.markup_type,onChange:q=>U(M.key,{markup_type:q.target.value}),className:"w-40 rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"none",children:"Kein Aufschlag"}),c.jsx("option",{value:"fixed",children:"Fester Betrag (€)"}),c.jsx("option",{value:"percent",children:"Prozent (%)"})]}),c.jsx("input",{type:"number",step:"0.01",min:"0",disabled:M.form.markup_type==="none",value:M.form.markup_value,onChange:q=>U(M.key,{markup_value:q.target.value}),className:`${lc} disabled:opacity-50`})]}),c.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"Wird auf die Summe der Bauteilpreise aufgeschlagen und ergibt den Gesamtpreis für den Kunden."})]}),c.jsxs("details",{className:"rounded-lg border border-neutral-200 dark:border-neutral-800",children:[c.jsx("summary",{className:"cursor-pointer select-none px-3 py-2 text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Weitere Optionen (Preis-Text, Empfohlen, Sortierung)"}),c.jsxs("div",{className:"space-y-4 border-t border-neutral-200 p-3 dark:border-neutral-800",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Preis-Text (optional)"}),c.jsx("input",{value:M.form.price_text,onChange:q=>U(M.key,{price_text:q.target.value}),placeholder:'z. B. "Coming soon" oder "Preis auf Anfrage"',className:lc}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"Ersetzt auf der Kachel den berechneten Preis, solange ausgefüllt."}),M.existing&&c.jsx(Os,{fieldKey:`packages.${M.existing.id}.price_text`,previewText:"Beispieltext"})]}),c.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:M.form.is_featured,onChange:q=>U(M.key,{is_featured:q.target.checked}),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),"Als empfohlen hervorheben"]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:M.form.sort_order,onChange:q=>U(M.key,{sort_order:q.target.value}),className:`${lc} max-w-[160px]`})]})]})]}),d[M.key]&&c.jsx("p",{className:"text-sm text-red-600",children:d[M.key]})]})]})]},M.key))}),c.jsxs("div",{className:"sticky bottom-0 flex flex-wrap items-center gap-3 rounded-b-xl border-t border-neutral-200 bg-white px-5 py-3 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("button",{type:"button",onClick:ae,disabled:f||!re,className:"rounded-md bg-brand-500 px-5 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:f?"Speichert…":"Alle speichern"}),c.jsxs("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:[si," neu, ",Rl," geändert"]}),m&&c.jsx("span",{className:`text-sm ${m.kind==="error"?"text-red-600":"text-brand-600 dark:text-brand-400"}`,children:m.text})]})]}),B?c.jsxs("details",{className:"rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("summary",{className:"cursor-pointer select-none px-5 py-3 font-bold text-neutral-900 dark:text-white",children:"Alle Pakete (Übersicht)"}),c.jsx("div",{className:"border-t border-neutral-200 p-5 dark:border-neutral-800",children:Il})]}):Il]})}const cc=[...oM].sort(),T5=120,M5=200;function P5({value:t,onChange:e}){const[n,r]=v.useState(""),s=v.useMemo(()=>{const i=n.trim().toLowerCase();return i?cc.filter(o=>o.includes(i)).slice(0,M5):cc.slice(0,T5)},[n]);return c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-3 rounded-md border border-neutral-300 p-2 dark:border-neutral-700",children:[c.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:t?c.jsx(bt,{name:t,className:"h-6 w-6"}):c.jsx("span",{className:"text-xs text-neutral-400",children:"?"})}),c.jsxs("div",{className:"text-sm",children:[c.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:t||"Kein Icon gewählt"}),c.jsxs("p",{className:"text-xs text-neutral-400",children:[cc.length," Icons verfügbar"]})]})]}),c.jsx("input",{value:n,onChange:i=>r(i.target.value),placeholder:"Icon suchen (z. B. car, shield, zap)…",className:"mb-2 w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsxs("div",{className:"grid max-h-64 grid-cols-6 gap-1 overflow-y-auto rounded-md border border-neutral-200 p-2 sm:grid-cols-8 dark:border-neutral-700",children:[s.map(i=>c.jsx("button",{type:"button",title:i,onClick:()=>e(i),className:`flex h-10 w-10 items-center justify-center rounded-md transition ${t===i?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:c.jsx(bt,{name:i,className:"h-5 w-5"})},i)),s.length===0&&c.jsx("p",{className:"col-span-full py-4 text-center text-sm text-neutral-400",children:"Keine Icons gefunden."})]}),!n&&c.jsxs("p",{className:"mt-1 text-xs text-neutral-400",children:["Tipp: Tippe einen Suchbegriff ein, um alle ",cc.length," Icons zu durchsuchen."]})]})}const Kv={icon_name:"",title:"",description:"",image_path:"",cta_label:"",cta_url:"",sort_order:0};function A5(){const[t,e]=v.useState([]),[n,r]=v.useState(Kv),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/services").then(e);v.useEffect(l,[]);const u=p=>{i(p.id),r({icon_name:p.icon_name,title:p.title,description:p.description,image_path:p.image_path||"",cta_label:p.cta_label||"",cta_url:p.cta_url||"",sort_order:p.sort_order})},d=()=>{i(null),r(Kv)},h=async p=>{if(p.preventDefault(),a(""),!n.icon_name){a("Bitte ein Icon auswählen");return}const m={...n,sort_order:Number(n.sort_order)};try{s?await A.put(`/services/${s}`,m):await A.post("/services",m),d(),l()}catch(g){a(g.message)}},f=async p=>{confirm("Diese Leistung wirklich löschen?")&&(await A.delete(`/services/${p}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Leistungen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Diese Karten erscheinen auf der öffentlichen Leistungen-Seite. Die 8 mitgelieferten Einträge sind die Standard-Einstellung – du kannst sie bearbeiten, löschen und beliebig neue hinzufügen."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Icon"}),c.jsx("th",{className:"px-4 py-2",children:"Titel"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(p=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:c.jsx(bt,{name:p.icon_name,className:"h-5 w-5"})})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:p.title}),c.jsx("td",{className:"px-4 py-2",children:p.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(p),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>f(p.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},p.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Leistungen angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Leistung bearbeiten":"Neue Leistung"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Icon *"}),c.jsx(P5,{value:n.icon_name,onChange:p=>r({...n,icon_name:p})})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.title,onChange:p=>r({...n,title:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung *"}),c.jsx("textarea",{required:!0,rows:4,value:n.description,onChange:p=>r({...n,description:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(sr,{value:n.image_path,onChange:p=>r({...n,image_path:p}),aspect:4/3,label:"Bild"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Button-Text (optional)"}),c.jsx("input",{value:n.cta_label,onChange:p=>r({...n,cta_label:p.target.value}),placeholder:"z. B. Fahrzeug konfigurieren",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Button-Link (optional)"}),c.jsx("input",{value:n.cta_url,onChange:p=>r({...n,cta_url:p.target.value}),placeholder:"z. B. /fahrzeuge",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:p=>r({...n,sort_order:Number(p.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const Gv={question_de:"",answer_de:"",question_en:"",answer_en:"",sort_order:0};function D5(){const[t,e]=v.useState([]),[n,r]=v.useState(Gv),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/faqs").then(e);v.useEffect(l,[]);const u=p=>{i(p.id),r({question_de:p.question_de,answer_de:p.answer_de,question_en:p.question_en,answer_en:p.answer_en,sort_order:p.sort_order})},d=()=>{i(null),r(Gv)},h=async p=>{p.preventDefault(),a("");const m={...n,sort_order:Number(n.sort_order)};try{s?await A.put(`/faqs/${s}`,m):await A.post("/faqs",m),d(),l()}catch(g){a(g.message)}},f=async p=>{confirm("Diese Frage wirklich löschen?")&&(await A.delete(`/faqs/${p}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Häufig gestellte Fragen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Diese Fragen erscheinen im FAQ-Bereich der Startseite, jeweils in der aktuell gewählten Sprache. Die 6 mitgelieferten Einträge sind die Standard-Einstellung – du kannst sie bearbeiten, löschen und beliebig neue hinzufügen."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Frage (DE)"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(p=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:p.question_de}),c.jsx("td",{className:"px-4 py-2",children:p.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(p),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>f(p.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},p.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Fragen angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Frage bearbeiten":"Neue Frage"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Frage (Deutsch) *"}),c.jsx("input",{required:!0,value:n.question_de,onChange:p=>r({...n,question_de:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Antwort (Deutsch) *"}),c.jsx("textarea",{required:!0,rows:3,value:n.answer_de,onChange:p=>r({...n,answer_de:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Frage (Englisch) *"}),c.jsx("input",{required:!0,value:n.question_en,onChange:p=>r({...n,question_en:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Antwort (Englisch) *"}),c.jsx("textarea",{required:!0,rows:3,value:n.answer_en,onChange:p=>r({...n,answer_en:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:p=>r({...n,sort_order:Number(p.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const qv={name:"",logo_path:"",sort_order:0};function L5(){const[t,e]=v.useState([]),[n,r]=v.useState(qv),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/partners").then(e);v.useEffect(()=>{l()},[]);const u=p=>{i(p.id),r({name:p.name,logo_path:p.logo_path||"",sort_order:p.sort_order})},d=()=>{i(null),r(qv)},h=async p=>{p.preventDefault(),a("");try{s?await A.put(`/partners/${s}`,n):await A.post("/partners",n),d(),l()}catch(m){a(m.message)}},f=async p=>{confirm("Partner wirklich löschen?")&&(await A.delete(`/partners/${p}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Partner"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Marken-Logozeile auf der Startseite. Ohne Logo wird der Name als Text angezeigt."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Logo"}),c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(p=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:p.logo_path?c.jsx("img",{src:p.logo_path,alt:"",className:"h-10 w-10 rounded-md object-contain"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:p.name}),c.jsx("td",{className:"px-4 py-2",children:p.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(p),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>f(p.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},p.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Partner angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Partner bearbeiten":"Neuer Partner"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.name,onChange:p=>r({...n,name:p.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(sr,{value:n.logo_path,onChange:p=>r({...n,logo_path:p}),label:"Logo (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:p=>r({...n,sort_order:Number(p.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}var kj={exports:{}},wj={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var to=v;function R5(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _5=typeof Object.is=="function"?Object.is:R5,I5=to.useState,O5=to.useEffect,B5=to.useLayoutEffect,z5=to.useDebugValue;function F5(t,e){var n=e(),r=I5({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return B5(function(){s.value=n,s.getSnapshot=e,Sf(s)&&i({inst:s})},[t,n,e]),O5(function(){return Sf(s)&&i({inst:s}),t(function(){Sf(s)&&i({inst:s})})},[t]),z5(n),n}function Sf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!_5(t,n)}catch{return!0}}function V5(t,e){return e()}var $5=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?V5:F5;wj.useSyncExternalStore=to.useSyncExternalStore!==void 0?to.useSyncExternalStore:$5;kj.exports=wj;var H0=kj.exports,Jv=Object.defineProperty,H5=(t,e)=>{let n={};for(var r in t)Jv(n,r,{get:t[r],enumerable:!0});return Jv(n,Symbol.toStringTag,{value:"Module"}),n};function rt(t){this.content=t}rt.prototype={constructor:rt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new rt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new rt(n)},addToStart:function(t,e){return new rt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new rt(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new rt(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=rt.from(t),t.size?new rt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=rt.from(t),t.size?new rt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=rt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};rt.from=function(t){if(t instanceof rt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new rt(e)};function Sj(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){let o=s.text,a=i.text,l=0;for(;o[l]==a[l];l++)n++;return l&&l<o.length&&l<a.length&&jj(o.charCodeAt(l-1))&&Cj(o.charCodeAt(l))&&n--,n}if(s.content.size||i.content.size){let o=Sj(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Nj(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let u=o.text,d=a.text,h=u.length,f=d.length;for(;h>0&&f>0&&u[h-1]==d[f-1];)h--,f--,n--,r--;return h&&f&&h<u.length&&jj(u.charCodeAt(h-1))&&Cj(u.charCodeAt(h))&&(n++,r++),{a:n,b:r}}if(o.content.size||a.content.size){let u=Nj(o.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}function Cj(t){return t>=56320&&t<57344}function jj(t){return t>=55296&&t<56320}class z{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],u=a+l.nodeSize;if(u>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),r,s+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new z(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new z(r,s)}cutByIndex(e,n){return e==n?z.empty:e==0&&n==this.content.length?this:new z(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new z(s,i)}addToStart(e){return new z([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new z(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return Sj(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Nj(this,e,n,r)}findIndex(e){if(e==0)return uc(0,e);if(e==this.size)return uc(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?uc(n+1,i):uc(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return z.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return z.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return z.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new z(n||e,r)}static from(e){if(!e)return z.empty;if(e instanceof z)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new z([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}z.empty=new z([],0);const Nf={index:0,offset:0};function uc(t,e){return Nf.index=t,Nf.offset=e,Nf}function zu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!zu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!zu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ye=class _m{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return _m.none;if(e instanceof _m)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};ye.none=[];class Qa extends Error{}class W{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Tj(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,n){return new W(Ej(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return W.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(z.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new W(e,r,s)}}W.empty=new W(z.empty,0,0);function Ej(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Ej(i.content,e-s-1,n-s-1)))}function Tj(t,e,n,r,s,i){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=Tj(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,l);return u&&t.replaceChild(o,l.copy(u))}function W5(t,e,n){if(n.openStart>t.depth)throw new Qa("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qa("Inconsistent open depths");return Mj(t,e,n,0)}function Mj(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=Mj(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return zs(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=U5(n,t);return zs(i,Aj(t,o,a,e,r))}else return zs(i,Fu(t,e,r))}function Pj(t,e){if(!e.type.compatibleContent(t.type))throw new Qa("Cannot join "+e.type.name+" onto "+t.type.name)}function Im(t,e,n){let r=t.node(n);return Pj(r,e.node(n)),r}function Bs(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function fa(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Bs(t.nodeAfter,r),i++));for(let a=i;a<o;a++)Bs(s.child(a),r);e&&e.depth==n&&e.textOffset&&Bs(e.nodeBefore,r)}function zs(t,e){if(!t.type.validContent(e))throw new Qa("Invalid content for node "+t.type.name);return t.copy(e)}function Aj(t,e,n,r,s){let i=t.depth>s&&Im(t,e,s+1),o=r.depth>s&&Im(n,r,s+1),a=[];return fa(null,t,s,a),i&&o&&e.index(s)==n.index(s)?(Pj(i,o),Bs(zs(i,Aj(t,e,n,r,s+1)),a)):(i&&Bs(zs(i,Fu(t,e,s+1)),a),fa(e,n,s,a),o&&Bs(zs(o,Fu(n,r,s+1)),a)),fa(r,null,s,a),new z(a)}function Fu(t,e,n){let r=[];if(fa(null,t,n,r),t.depth>n){let s=Im(t,e,n+1);Bs(zs(s,Fu(t,e,n+1)),r)}return fa(e,null,n,r),new z(r)}function U5(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(z.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class el{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ye.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Vu(this,e,r);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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),u=i-l;if(r.push(o,a,s+l),!u||(o=o.child(a),o.isText))break;i=u-1,s+=l+1}return new el(n,r,i)}static resolveCached(e,n){let r=Yv.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else Yv.set(e,r=new K5);let s=r.elts[r.i]=el.resolve(e,n);return r.i=(r.i+1)%G5,s}}class K5{constructor(){this.elts=[],this.i=0}}const G5=12,Yv=new WeakMap;class Vu{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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 q5=Object.create(null);let Fs=class Om{constructor(e,n,r,s=ye.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||z.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,n,r,s=0){this.content.nodesBetween(e,n,r,s,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,n,r,s){return this.content.textBetween(e,n,r,s)}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,n,r){return this.type==e&&zu(this.attrs,n||e.defaultAttrs||q5)&&ye.sameSet(this.marks,r||ye.none)}copy(e=null){return e==this.content?this:new Om(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Om(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return W.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),u=s.node(o).content.cut(s.pos-a,i.pos-a);return new W(u,s.depth-o,i.depth-o)}replace(e,n,r){return W5(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return el.resolveCached(this,e)}resolveNoCache(e){return el.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),Dj(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=z.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}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=ye.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ye.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=z.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Fs.prototype.text=void 0;class $u extends Fs{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Dj(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new $u(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new $u(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Dj(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Js{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new J5(e,n);if(r.next==null)return Js.empty;let s=Lj(r);r.next&&r.err("Unexpected trailing text");let i=nB(tB(s));return rB(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return z.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:h}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(h)==-1){s.push(h);let f=i(h,a.concat(d));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
`)}}Js.empty=new Js(!0);class J5{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Lj(t){let e=[];do e.push(Y5(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Y5(t){let e=[];do e.push(X5(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function X5(t){let e=eB(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Z5(t,e);else break;return e}function Xv(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Z5(t,e){let n=Xv(t),r=n;return t.eat(",")&&(t.next!="}"?r=Xv(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Q5(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function eB(t){if(t.eat("(")){let e=Lj(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Q5(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function tB(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(i(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=i(o.exprs[l],a);if(l==o.exprs.length-1)return u;s(u,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let u=0;u<o.min;u++){let d=n();s(i(o.expr,l),d),l=d}if(o.max==-1)s(i(o.expr,l),l);else for(let u=o.min;u<o.max;u++){let d=n();r(l,d),s(i(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Rj(t,e){return e-t}function Zv(t,e){let n=[];return r(e),n.sort(Rj);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function nB(t){let e=Object.create(null);return n(Zv(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let d=0;d<s.length;d++)s[d][0]==a&&(u=s[d][1]);Zv(t,l).forEach(d=>{u||s.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new Js(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(Rj);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function rB(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:u}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function _j(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Ij(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function Oj(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in t)t[s].validate&&t[s].validate(e[s])}function Bj(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new iB(t,r,e[r]);return n}let Qv=class zj{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Bj(e,r.attrs),this.defaultAttrs=_j(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Js.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:Ij(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Fs(this,this.computeAttrs(e),z.from(n),ye.setFrom(r))}createChecked(e=null,n,r){return n=z.from(n),this.checkContent(n),new Fs(this,this.computeAttrs(e),n,ye.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=z.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(z.empty,!0);return i?new Fs(this,e,n.append(i),ye.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Oj(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ye.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new zj(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function sB(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class iB{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sB(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ah{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=Bj(e,s.attrs),this.excluded=null;let i=_j(this.attrs);this.instance=i?new ye(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ye(this,Ij(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new ah(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Oj(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Fj{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=rt.from(e.nodes),n.marks=rt.from(e.marks||{}),this.nodes=Qv.compile(this.spec.nodes,this),this.marks=ah.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Js.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?ek(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ek(this,o.split(" "))}this.nodeFromJSON=s=>Fs.fromJSON(this,s),this.markFromJSON=s=>ye.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Qv){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new $u(r,r.defaultAttrs,e,ye.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function ek(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function oB(t){return t.tag!=null}function aB(t){return t.style!=null}class Kr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(oB(s))this.tags.push(s);else if(aB(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new nk(this,n,!1);return r.addAll(e,ye.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new nk(this,n,!0);return r.addAll(e,ye.none,n.from,n.to),W.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(uB(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=rk(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=rk(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Kr(e,Kr.schemaRules(e)))}}const Vj={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},lB={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$j={ol:!0,ul:!0},tl=1,Bm=2,pa=4;function tk(t,e,n){return e!=null?(e?tl:0)|(e==="full"?Bm:0):t&&t.whitespace=="pre"?tl|Bm:n&~pa}class dc{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=ye.none,this.match=i||(o&pa?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(z.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&tl)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=z.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(z.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vj.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class nk{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=tk(null,n.preserveWhitespace,0)|(r?pa:0);s?i=new dc(s.type,s.attrs,ye.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new dc(null,null,ye.none,!0,null,o):i=new dc(e.schema.topNodeType,null,ye.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&Bm?"full":this.localPreserveWS||(s.options&tl)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;$j.hasOwnProperty(o)&&this.parser.normalizeLists&&cB(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:lB.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,d=this.needsBlock;if(Vj.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let h=l&&l.skip?n:this.readStyles(e,n);h&&this.addAll(e,h),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(e);if(u&&(!s||s.length>u.length+a)&&(s=u,i=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ye.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):sk(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=tk(e,i,o.options);o.options&pa&&o.content.length==0&&(a|=pa);let l=ye.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):sk(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new dc(e,n,l,s,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=tl)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function cB(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$j.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function uB(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rk(t){let e={};for(let n in t)e[n]=t[n];return e}function sk(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:d}=a.edge(l);if(u==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class ni{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=hc(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let u=o.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(i[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let u=o.marks[l++],d=this.serializeMark(u,o.isInline,n);d&&(i.push([u,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return hc(n).createTextNode(e.text);let{dom:r,contentDOM:s}=Yc(hc(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Yc(hc(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:Yc(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ni(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=ik(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return ik(e.marks)}}function ik(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function hc(t){return t.document||window.document}const ok=new WeakMap;function dB(t){let e=ok.get(t);return e===void 0&&ok.set(t,e=hB(t)),e}function hB(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Yc(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=dB(r))&&i.indexOf(e)>-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 o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let h in u)if(u[h]!=null){let f=h.indexOf(" ");f>0?l.setAttributeNS(h.slice(0,f),h.slice(f+1),u[h]):h=="style"&&l.style?l.style.cssText=u[h]:l.setAttribute(h,u[h])}}for(let h=d;h<e.length;h++){let f=e[h];if(f===0){if(h<e.length-1||h>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(t.createTextNode(f));else{let{dom:p,contentDOM:m}=Yc(t,f,n,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const Hj=65535,Wj=Math.pow(2,16);function fB(t,e){return t+e*Wj}function ak(t){return t&Hj}function pB(t){return(t-(t&Hj))/Wj}const Uj=1,Kj=2,Xc=4,Gj=8;class zm{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Gj)>0}get deletedBefore(){return(this.delInfo&(Uj|Xc))>0}get deletedAfter(){return(this.delInfo&(Kj|Xc))>0}get deletedAcross(){return(this.delInfo&Xc)>0}}class Ot{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ot.empty)return Ot.empty}recover(e){let n=0,r=ak(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+pB(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let u=this.ranges[a+i],d=this.ranges[a+o],h=l+u;if(e<=h){let f=u?e==l?-1:e==h?1:n:n,p=l+s+(f<0?0:d);if(r)return p;let m=e==(n<0?l:h)?null:fB(a/3,e-l),g=e==l?Kj:e==h?Uj:Xc;return(n<0?e!=l:e!=h)&&(g|=Gj),new zm(p,g,m)}s+=d-u}return r?e+s:new zm(e+s,0,null)}touches(e,n){let r=0,s=ak(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+i],d=l+u;if(e<=d&&a==s*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),u=this.ranges[s+n],d=this.ranges[s+r];e(a,a+u,l,l+d),i+=d-u}}invert(){return new Ot(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ot.empty:new Ot(e<0?[0,-e,0]:[0,0,e])}}Ot.empty=new Ot([]);class nl{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new nl(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new nl;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new zm(e,s,null)}}const Cf=Object.create(null);class xt{getMap(){return Ot.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Cf[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Cf)throw new RangeError("Duplicate use of step JSON ID "+e);return Cf[e]=n,n.prototype.jsonID=e,n}}class Fe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Fe(e,null)}static fail(e){return new Fe(null,e)}static fromReplace(e,n,r,s){try{return Fe.ok(e.replace(n,r,s))}catch(i){if(i instanceof Qa)return Fe.fail(i.message);throw i}}}function W0(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(W0(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return z.fromArray(r)}class Rr extends xt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new W(W0(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,i)}invert(){return new bn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Rr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Rr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Rr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Rr(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("addMark",Rr);class bn extends xt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new W(W0(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,r)}invert(){return new Rr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new bn(n.pos,r.pos,this.mark)}merge(e){return e instanceof bn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("removeMark",bn);class _r extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new W(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new _r(this.pos,n.marks[s]);return new _r(this.pos,this.mark)}}return new Ys(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _r(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new _r(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("addNodeMark",_r);class Ys extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new W(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new _r(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ys(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ys(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("removeNodeMark",Ys);class Ie extends xt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Fm(e,this.from,this.to)?Fe.fail("Structure replace would overwrite content"):Fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ot([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ie(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Ie.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Ie(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ie)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?W.empty:new W(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ie(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?W.empty:new W(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ie(e.from,this.to,n,this.structure)}else return null}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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ie(n.from,n.to,W.fromJSON(e,n.slice),!!n.structure)}}Ie.MAP_BIAS=1;xt.jsonID("replace",Ie);class Ze extends xt{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Fm(e,this.from,this.gapFrom)||Fm(e,this.gapTo,this.to)))return Fe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Fe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Fe.fromReplace(e,this.from,this.to,r):Fe.fail("Content does not fit in gap")}getMap(){return new Ot([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ze(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new Ze(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ze(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(e,n.slice),n.insert,!!n.structure)}}xt.jsonID("replaceAround",Ze);function Fm(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function mB(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(l,u,d)=>{if(!l.isInline)return;let h=l.marks;if(!r.isInSet(h)&&d.type.allowsMarkType(r.type)){let f=Math.max(u,e),p=Math.min(u+l.nodeSize,n),m=r.addToSet(h);for(let g=0;g<h.length;g++)h[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(h[g])?o.to=p:s.push(o=new bn(f,p,h[g])));a&&a.to==f?a.to=p:i.push(a=new Rr(f,p,r))}}),s.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function gB(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof ah){let u=o.marks,d;for(;d=r.isInSet(u);)(l||(l=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,n);for(let d=0;d<l.length;d++){let h=l[d],f;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&h.eq(s[p].style)&&(f=m)}f?(f.to=u,f.step=i):s.push({style:h,from:Math.max(a,e),to:u,step:i})}}}),s.forEach(o=>t.step(new bn(o.from,o.to,o.style)))}function U0(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let u=i.child(l),d=a+u.nodeSize,h=r.matchType(u.type);if(!h)o.push(new Ie(a,d,W.empty));else{r=h;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new bn(a,d,u.marks[f]));if(s&&u.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(u.text);)m||(m=new W(z.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new Ie(a+f.index,a+f.index+f[0].length,m))}}a=d}if(!r.validEnd){let l=r.fillBefore(z.empty,!0);t.replace(a,a,new W(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function xB(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function wo(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+s,l=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!xB(o,a,l))break;a&&(s=1),l<o.childCount&&(i=1)}return null}function yB(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,u=a,d=z.empty,h=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,d=z.from(r.node(m).copy(d)),h++):l--;let f=z.empty,p=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=z.from(s.node(m).copy(f)),p++):u++;t.step(new Ze(l,u,o,a,new W(d.append(f),h,p),d.size-h,!0))}function K0(t,e,n=null,r=t){let s=bB(t,e),i=s&&vB(r,e);return i?s.map(lk).concat({type:e,attrs:n}).concat(i.map(lk)):null}function lk(t){return{type:t,attrs:null}}function bB(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function vB(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;l&&u<s;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:o}function kB(t,e,n){let r=z.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=z.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Ze(s,i,s,i,new W(r,0,0),n.length,!0))}function wB(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&SB(t.doc,t.mapping.slice(i).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&Jj(t,o,a,i),U0(t,t.mapping.slice(i).map(a,1),r,void 0,u===null);let d=t.mapping.slice(i),h=d.map(a,1),f=d.map(a+o.nodeSize,1);return t.step(new Ze(h,f,h+1,f-1,new W(z.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&qj(t,o,a,i),!1}})}function qj(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Jj(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
`))}})}function SB(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function NB(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ze(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new W(z.from(o),0,0),1,!0))}function ir(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,d=n-2;u>i;u--,d--){let h=s.node(u),f=s.index(u);if(h.type.spec.isolating)return!1;let p=h.content.cutByIndex(f,h.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||h;if(!h.canReplace(f+1,h.childCount)||!g.type.validContent(p))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function CB(t,e,n=1,r){let s=t.doc.resolve(e),i=z.empty,o=z.empty;for(let a=s.depth,l=s.depth-n,u=n-1;a>l;a--,u--){i=z.from(s.node(a).copy(i));let d=r&&r[u];o=z.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}t.step(new Ie(e,e,new W(i.append(o),n,n),!0))}function us(t,e){let n=t.resolve(e),r=n.index();return Yj(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function jB(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Yj(t,e){return!!(t&&e&&!t.isLeaf&&jB(t,e))}function lh(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&Yj(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function EB(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",h=!!o.contentMatch.matchType(s);d&&!h?r=!1:!d&&h&&(r=!0)}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);Jj(t,d.node(),d.before(),a)}o.inlineContent&&U0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),u=l.map(e-n);if(t.step(new Ie(u,l.map(e+n,-1),W.empty,!0)),r===!0){let d=t.doc.resolve(u);qj(t,d.node(),d.before(),t.steps.length)}return t}function TB(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function Xj(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),u=r.node(o),d=!1;if(i==1)d=u.canReplace(l,l,s);else{let h=u.contentMatchAt(l).findWrapping(s.firstChild.type);d=h&&u.canReplaceWith(l,l,h[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function ch(t,e,n=e,r=W.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return Zj(s,i,r)?new Ie(e,n,r):new MB(s,i,r).fit()}function Zj(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class MB{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=z.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=z.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new W(i,o,a);return e>-1?new Ze(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ie(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=ck(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],d,h=null;if(n==1&&(o?u.matchType(o.type)||(h=u.fillBefore(z.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:h};if(n==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return uk(e,-1)<=n?!1:(this.unplaced.size>1&&uk(e,1)>r&&r++,this.unplaced=new W(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=ck(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new W(Go(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new W(Go(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,u=0,d=[],{match:h,type:f}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)d.push(s.child(g));h=h.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let g=a.child(u),x=h.matchType(g.type);if(!x)break;u++,(u>1||l==0||g.content.size)&&(h=x,d.push(Qj(g.mark(f.allowedMarks(g.marks)),u==1?l:0,u==a.childCount?p:-1)))}let m=u==a.childCount;m||(p=-1),this.placed=qo(this.placed,n,z.from(d)),this.frontier[n].match=h,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,x=a;g<p;g++){let y=x.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),x=y.content}this.unplaced=m?e==0?W.empty:new W(Go(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new W(Go(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!jf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=jf(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],d=jf(e,a,u,l,!0);if(!d||d.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=qo(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=qo(this.placed,this.depth,z.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(z.empty,!0);n.childCount&&(this.placed=qo(this.placed,this.frontier.length,n))}}function Go(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Go(t.firstChild.content,e-1,n)))}function qo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(qo(t.lastChild.content,e-1,n)))}function ck(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Qj(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Qj(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(z.empty,!0)))),t.copy(r)}function jf(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!PB(n,i.content,o)?a:null}function PB(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function AB(t){return t.spec.defining||t.spec.definingForContent}function uk(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function DB(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(Zj(s,i,r))return t.step(new Ie(e,n,r));let o=tE(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let f=s.depth,p=s.pos-1;f>0;f--,p--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:s.before(f)==p&&o.splice(1,0,-f)}let l=o.indexOf(a),u=[],d=r.openStart;for(let f=r.content,p=0;;p++){let m=f.firstChild;if(u.push(m),p==r.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let p=u[f],m=AB(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(a)-1)))d=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),m=u[p];if(m)for(let g=0;g<o.length;g++){let x=o[(g+l)%o.length],y=!0;x<0&&(y=!1,x=-x);let b=s.node(x-1),k=s.index(x-1);if(b.canReplaceWith(k,k,m.type,m.marks))return t.replace(s.before(x),y?i.after(x):n,new W(eE(r.content,0,r.openStart,p),p,r.openEnd))}}let h=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>h));f--){let p=o[f];p<0||(e=s.before(p),n=i.after(p))}}function eE(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(eE(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(z.empty,!0))}return t}function LB(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=TB(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new W(z.from(r),0,0))}function RB(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=s.depth;l>o;l--)s.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=s.depth;l>0&&n==s.start(l);l--)n=s.before(l);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=tE(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function tE(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Fi extends xt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Fe.fromReplace(e,this.pos,this.pos+1,new W(z.from(s),0,n.isLeaf?0:1))}getMap(){return Ot.empty}invert(e){return new Fi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Fi(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Fi(n.pos,n.attr,n.value)}}xt.jsonID("attr",Fi);class rl extends xt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Fe.ok(r)}getMap(){return Ot.empty}invert(e){return new rl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rl(n.attr,n.value)}}xt.jsonID("docAttr",rl);let no=class extends Error{};no=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};no.prototype=Object.create(Error.prototype);no.prototype.constructor=no;no.prototype.name="TransformError";class nE{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new nl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new no(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=W.empty){let s=ch(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new W(z.from(r),0,0))}delete(e,n){return this.replace(e,n,W.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return DB(this,e,n,r),this}replaceRangeWith(e,n,r){return LB(this,e,n,r),this}deleteRange(e,n){return RB(this,e,n),this}lift(e,n){return yB(this,e,n),this}join(e,n=1){return EB(this,e,n),this}wrap(e,n){return kB(this,e,n),this}setBlockType(e,n=e,r,s=null){return wB(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return NB(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Fi(e,n,r)),this}setDocAttribute(e,n){return this.step(new rl(e,n)),this}addNodeMark(e,n){return this.step(new _r(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ye)n.isInSet(r.marks)&&this.step(new Ys(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new Ys(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return CB(this,e,n,r),this}addMark(e,n,r){return mB(this,e,n,r),this}removeMark(e,n,r){return gB(this,e,n,r),this}clearIncompatible(e,n,r){return U0(this,e,n,r),this}}const Ef=Object.create(null);class ie{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new _B(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=W.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:u}=o[a],d=e.mapping.slice(i);e.replaceRange(d.map(l.pos),d.map(u.pos),a?W.empty:n),a==0&&fk(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),u=l.map(o.pos),d=l.map(a.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,n),fk(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new Q(e):fi(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?fi(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):fi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Vt(e.node(0))}static atStart(e){return fi(e,e,0,0,1)||new Vt(e)}static atEnd(e){return fi(e,e,e.content.size,e.childCount,-1)||new Vt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ef[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ef)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ef[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Q.between(this.$anchor,this.$head).getBookmark()}}ie.prototype.visible=!0;class _B{constructor(e,n){this.$from=e,this.$to=n}}let dk=!1;function hk(t){!dk&&!t.parent.inlineContent&&(dk=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Q extends ie{constructor(e,n=e){hk(e),hk(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ie.near(r);let s=e.resolve(n.map(this.anchor));return new Q(s.parent.inlineContent?s:r,r)}replace(e,n=W.empty){if(super.replace(e,n),n==W.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Q&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new uh(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Q(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=ie.findFrom(n,r,!0)||ie.findFrom(n,-r,!0);if(i)n=i.$head;else return ie.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(ie.findFrom(e,-r,!0)||ie.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new Q(e,n)}}ie.jsonID("text",Q);class uh{constructor(e,n){this.anchor=e,this.head=n}map(e){return new uh(e.map(this.anchor),e.map(this.head))}resolve(e){return Q.between(e.resolve(this.anchor),e.resolve(this.head))}}class Z extends ie{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?ie.near(i):new Z(i)}content(){return new W(z.from(this.node),0,0)}eq(e){return e instanceof Z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new G0(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Z(e.resolve(n.anchor))}static create(e,n){return new Z(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Z.prototype.visible=!1;ie.jsonID("node",Z);class G0{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new uh(r,r):new G0(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Z.isSelectable(r)?new Z(n):ie.near(n)}}class Vt extends ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=W.empty){if(n==W.empty){e.delete(0,e.doc.content.size);let r=ie.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Vt(e)}map(e){return new Vt(e)}eq(e){return e instanceof Vt}getBookmark(){return IB}}ie.jsonID("all",Vt);const IB={map(){return this},resolve(t){return new Vt(t)}};function fi(t,e,n,r,s,i=!1){if(e.inlineContent)return Q.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&Z.isSelectable(a))return Z.create(t,n-(s<0?a.nodeSize:0))}else{let l=fi(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function fk(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Ie||s instanceof Ze))return;let i=t.mapping.maps[r],o;i.forEach((a,l,u,d)=>{o==null&&(o=d)}),t.setSelection(ie.near(t.doc.resolve(o),n))}const pk=1,fc=2,mk=4;class OB extends nE{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=(this.updated|pk)&~fc,this.storedMarks=null,this}get selectionSet(){return(this.updated&pk)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=fc,this}ensureMarks(e){return ye.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&fc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~fc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ye.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ie.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=mk,this}get scrolledIntoView(){return(this.updated&mk)>0}}function gk(t,e){return!e||!t?t:t.bind(e)}class Jo{constructor(e,n,r){this.name=e,this.init=gk(n.init,r),this.apply=gk(n.apply,r)}}const BB=[new Jo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Jo("selection",{init(t,e){return t.selection||ie.atStart(e.doc)},apply(t){return t.selection}}),new Jo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Jo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Tf{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=BB.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Jo(r.key,r.spec.state,r))})}}class Es{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,u=s?s[o].state:this,d=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let h=0;h<this.config.plugins.length;h++)s.push(h<o?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Es(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new OB(this)}static create(e){let n=new Tf(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Es(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new Tf(this.schema,e.plugins),r=n.fields,s=new Es(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Tf(e.schema,e.plugins),i=new Es(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Fs.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=ie.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=u.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function rE(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=rE(s,e,{})),n[r]=s}return n}class Se{constructor(e){this.spec=e,this.props={},e.props&&rE(e.props,this,this.props),this.key=e.key?e.key.key:sE("plugin")}getState(e){return e[this.key]}}const Mf=Object.create(null);function sE(t){return t in Mf?t+"$"+ ++Mf[t]:(Mf[t]=0,t+"$")}class $e{constructor(e="key"){this.key=sE(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const iE=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function oE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const aE=(t,e,n)=>{let r=oE(t,n);if(!r)return!1;let s=q0(r);if(!s){let o=r.blockRange(),a=o&&wo(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(gE(t,s,e,-1))return!0;if(r.parent.content.size==0&&(ro(i,"end")||Z.isSelectable(i)))for(let o=r.depth;;o--){let a=ch(t.doc,r.before(o),r.after(o),W.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(ro(i,"end")?ie.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):Z.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},zB=(t,e,n)=>{let r=oE(t,n);if(!r)return!1;let s=q0(r);return s?lE(t,s,e):!1},FB=(t,e,n)=>{let r=uE(t,n);if(!r)return!1;let s=J0(r);return s?lE(t,s,e):!1};function lE(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let u=ch(t.doc,i,l,W.empty);if(!u||u.from!=i||u instanceof Ie&&u.slice.size>=l-i)return!1;if(n){let d=t.tr.step(u);d.setSelection(Q.create(d.doc,i)),n(d.scrollIntoView())}return!0}function ro(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const cE=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=q0(r)}let o=i&&i.nodeBefore;return!o||!Z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Z.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function q0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function uE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const dE=(t,e,n)=>{let r=uE(t,n);if(!r)return!1;let s=J0(r);if(!s)return!1;let i=s.nodeAfter;if(gE(t,s,e,1))return!0;if(r.parent.content.size==0&&(ro(i,"start")||Z.isSelectable(i))){let o=ch(t.doc,r.before(),r.after(),W.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(ro(i,"start")?ie.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):Z.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},hE=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=J0(r)}let o=i&&i.nodeAfter;return!o||!Z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Z.create(t.doc,i.pos)).scrollIntoView()),!0)};function J0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const VB=(t,e)=>{let n=t.selection,r=n instanceof Z,s;if(r){if(n.node.isTextblock||!us(t.doc,n.from))return!1;s=n.from}else if(s=lh(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(Z.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},$B=(t,e)=>{let n=t.selection,r;if(n instanceof Z){if(n.node.isTextblock||!us(t.doc,n.to))return!1;r=n.to}else if(r=lh(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},HB=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&wo(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},fE=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
`).scrollIntoView()),!0)};function Y0(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const WB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=Y0(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ie.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},pE=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Vt||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Y0(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(Q.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},mE=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ir(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&wo(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function UB(t){return(e,n)=>{if(e.selection instanceof Z&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!ir(e.doc,p.pos)?!1:(n&&n(e.tr.split(p.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof Q||e.selection instanceof Vt)&&r.deleteSelection();let{$from:s}=r.selection,i=r.steps.length,o=[],a,l,u=!1,d=!1;for(let p=s.depth;;p--)if(s.node(p).isBlock){u=s.end(p)==s.pos+(s.depth-p),d=s.start(p)==s.pos-(s.depth-p),l=Y0(s.node(p-1).contentMatchAt(s.indexAfter(p-1))),o.unshift(u&&l?{type:l}:null),a=p;break}else{if(p==1)return!1;o.unshift(null)}let h=s.pos,f=ir(r.doc,h,o.length,o);if(f||(o[0]=l?{type:l}:null,f=ir(r.doc,h,o.length,o)),!f)return!1;if(r.split(h,o.length,o),!u&&d&&s.node(a).type!=l){let p=r.mapping.slice(i),m=p.map(s.before(a)),g=r.doc.resolve(m);l&&s.node(a-1).canReplaceWith(g.index(),g.index()+1,l)&&r.setNodeMarkup(p.map(s.before(a)),l)}return n&&n(r.scrollIntoView()),!0}}const KB=UB(),GB=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(Z.create(t.doc,s))),!0)};function qB(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||us(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function gE(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&qB(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,m=z.empty;for(let y=o.length-1;y>=0;y--)m=z.from(o[y].create(null,m));m=z.from(s.copy(m));let g=t.tr.step(new Ze(e.pos-1,p,e.pos,p,new W(m,1,0),o.length,!0)),x=g.doc.resolve(p+2*o.length);x.nodeAfter&&x.nodeAfter.type==s.type&&us(g.doc,x.pos)&&g.join(x.pos),n(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&l?null:ie.findFrom(e,1),h=d&&d.$from.blockRange(d.$to),f=h&&wo(h);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(h,f).scrollIntoView()),!0;if(u&&ro(i,"start",!0)&&ro(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=i,x=1;for(;!g.isTextblock;g=g.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let y=z.empty;for(let k=m.length-1;k>=0;k--)y=z.from(m[k].copy(y));let b=t.tr.step(new Ze(e.pos-m.length,e.pos+i.nodeSize,e.pos+x,e.pos+i.nodeSize-x,new W(y,m.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function xE(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(Q.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const JB=xE(-1),YB=xE(1);function XB(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&K0(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function xk(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(l,u)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let d=n.doc.resolve(u),h=d.index();s=d.parent.canReplaceWith(h,h+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function X0(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}X0(iE,aE,cE);X0(iE,dE,hE);X0(fE,pE,mE,KB);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ZB(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return QB(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function QB(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);i=new Vu(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Vu(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=K0(i,n,r,e);return a?(t&&e6(t,e,a,s,n),!0):!1}function e6(t,e,n,r,s){let i=z.empty;for(let d=n.length-1;d>=0;d--)i=z.from(n[d].type.create(n[d].attrs,i));t.step(new Ze(e.start-(r?2:0),e.end,e.start,e.end,new W(i,0,0),n.length,!0));let o=0;for(let d=0;d<n.length;d++)n[d].type==s&&(o=d+1);let a=n.length-o,l=e.start+n.length-(r?2:0),u=e.parent;for(let d=e.startIndex,h=e.endIndex,f=!0;d<h;d++,f=!1)!f&&ir(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(d).nodeSize;return t}function t6(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?n6(e,n,t,i):r6(e,n,i):!0:!1}}function n6(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Ze(i-1,o,i,o,new W(z.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Vu(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=wo(r);if(a==null)return!1;s.lift(r,a);let l=s.doc.resolve(s.mapping.map(i,-1)-1);return us(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function r6(t,e,n){let r=t.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(a?0:1),d+1,o.content.append(l?z.empty:z.from(s))))return!1;let h=i.pos,f=h+o.nodeSize;return r.step(new Ze(h-(a?1:0),f+(l?1:0),h+1,f-1,new W((a?z.empty:z.from(s.copy(z.empty))).append(l?z.empty:z.from(s.copy(z.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function s6(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,d=z.from(u?t.create():null),h=new W(z.from(t.create(null,z.from(a.type.create(null,d)))),u?3:1,0),f=i.start,p=i.end;n(e.tr.step(new Ze(f-(u?3:1),p,f,p,h,1,!0)).scrollIntoView())}return!0}}const st=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},so=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Vm=null;const Yn=function(t,e,n){let r=Vm||(Vm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},i6=function(){Vm=null},Xs=function(t,e,n,r){return n&&(yk(t,e,n,r,-1)||yk(t,e,n,r,1))},o6=/^(img|br|input|textarea|hr)$/i;function yk(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Qt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Nl(t)||o6.test(t.nodeName)||t.contentEditable=="false")return!1;e=st(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Qt(t):0}else return!1}}function Qt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function a6(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Qt(t)}else if(t.parentNode&&!Nl(t))e=st(t),t=t.parentNode;else return null}}function l6(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Nl(t))e=st(t)+1,t=t.parentNode;else return null}}function c6(t,e,n){for(let r=e==0,s=e==Qt(t);r||s;){if(t==n)return!0;let i=st(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==Qt(t)}}function Nl(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const dh=function(t){return t.focusNode&&Xs(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ks(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function u6(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function d6(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Qt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Qt(r.startContainer),r.startOffset)}}}const Fn=typeof navigator<"u"?navigator:null,bk=typeof document<"u"?document:null,ds=Fn&&Fn.userAgent||"",$m=/Edge\/(\d+)/.exec(ds),yE=/MSIE \d/.exec(ds),Hm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ds),_t=!!(yE||Hm||$m),Gr=yE?document.documentMode:Hm?+Hm[1]:$m?+$m[1]:0,rn=!_t&&/gecko\/(\d+)/i.test(ds);rn&&+(/Firefox\/(\d+)/.exec(ds)||[0,0])[1];const Wm=!_t&&/Chrome\/(\d+)/.exec(ds),ot=!!Wm,bE=Wm?+Wm[1]:0,gt=!_t&&!!Fn&&/Apple Computer/.test(Fn.vendor),io=gt&&(/Mobile\/\w+/.test(ds)||!!Fn&&Fn.maxTouchPoints>2),Yt=io||(Fn?/Mac/.test(Fn.platform):!1),vE=Fn?/Win/.test(Fn.platform):!1,tr=/Android \d/.test(ds),Cl=!!bk&&"webkitFontSmoothing"in bk.documentElement.style,h6=Cl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function f6(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Hn(t,e){return typeof t=="number"?t:t[e]}function p6(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function vk(t,e,n){if(!Um(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=so(o);continue}let a=o,l=a==i.body,u=l?f6(i):p6(a),d=0,h=0;if(e.top<u.top+Hn(r,"top")?h=-(u.top-e.top+Hn(s,"top")):e.bottom>u.bottom-Hn(r,"bottom")&&(h=e.bottom-e.top>u.bottom-u.top?e.top+Hn(s,"top")-u.top:e.bottom-u.bottom+Hn(s,"bottom")),e.left<u.left+Hn(r,"left")?d=-(u.left-e.left+Hn(s,"left")):e.right>u.right-Hn(r,"right")&&(d=e.right-u.right+Hn(s,"right")),d||h)if(l)i.defaultView.scrollBy(d,h);else{let p=a.scrollLeft,m=a.scrollTop;h&&(a.scrollTop+=h),d&&(a.scrollLeft+=d);let g=a.scrollLeft-p,x=a.scrollTop-m;e={left:e.left-g,top:e.top-x,right:e.right-g,bottom:e.bottom-x}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:so(o)}}function m6(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:kE(t.dom)}}function kE(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=so(r));return e}function g6({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;wE(n,r==0?0:r-e)}function wE(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let li=null;function x6(t){if(t.setActive)return t.setActive();if(li)return t.focus(li);let e=kE(t);t.focus(li==null?{get preventScroll(){return li={preventScroll:!0},!0}}:void 0),li||(li=!1,wE(e,0))}function SE(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,u;for(let d=t.firstChild,h=0;d;d=d.nextSibling,h++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=Yn(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){n=d,r=g,s=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(i=h+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=h+1)}}return!n&&l&&(n=l,s=u,r=0),n&&n.nodeType==3?y6(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:SE(n,s)}function y6(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=vr(r,1);if(o.top!=o.bottom&&Z0(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Z0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function b6(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function v6(t,e,n){let{node:r,offset:s}=SE(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function k6(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?s=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function NE(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(Z0(e,u))return NE(o,e,u)}}if((i=(i+1)%r)==s)break}return t}function w6(t,e){let n=t.dom.ownerDocument,r,s=0,i=d6(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!Z0(e,u)||(o=NE(t.dom,e,u),!o))return null}if(gt)for(let u=o;r&&u;u=so(u))u.draggable&&(r=void 0);if(o=b6(o,e),r){if(rn&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let d=r.childNodes[s],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&s++}let u;Cl&&s&&r.nodeType==1&&(u=r.childNodes[s-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=k6(t,r,s,e))}a==null&&(a=v6(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Um(t){return t.top<t.bottom||t.left<t.right}function vr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Um(r))return r}return Array.prototype.find.call(n,Um)||t.getBoundingClientRect()}const S6=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function CE(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Cl||rn;if(r.nodeType==3)if(o&&(S6.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=vr(Yn(r,s,s),n);if(rn&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=vr(Yn(r,s-1,s-1),-1);if(u.top==l.top){let d=vr(Yn(r,s,s+1),-1);if(d.top!=l.top)return _o(d,d.left<u.left)}}return l}else{let l=s,u=s,d=n<0?1:-1;return n<0&&!s?(u++,d=-1):n>=0&&s==r.nodeValue.length?(l--,d=1):n<0?l--:u++,_o(vr(Yn(r,l,u),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Qt(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return Pf(l.getBoundingClientRect(),!1)}if(i==null&&s<Qt(r)){let l=r.childNodes[s];if(l.nodeType==1)return Pf(l.getBoundingClientRect(),!0)}return Pf(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Qt(r))){let l=r.childNodes[s-1],u=l.nodeType==3?Yn(l,Qt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return _o(vr(u,1),!1)}if(i==null&&s<Qt(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?Yn(l,0,o?0:1):l.nodeType==1?l:null:null;if(u)return _o(vr(u,-1),!0)}return _o(vr(r.nodeType==3?Yn(r):r,-n),n>=0)}function _o(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Pf(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function jE(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function N6(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return jE(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=CE(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Yn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let d=l[u];if(d.bottom>d.top+1&&(n=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const C6=/[\u0590-\u08ac]/;function j6(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!C6.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:jE(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:d,anchorOffset:h}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),x=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==g;try{a.collapse(d,h),l&&(l!=d||u!=h)&&a.extend&&a.extend(l,u)}catch{}return f!=null&&(a.caretBidiLevel=f),x}):r.pos==r.start()||r.pos==r.end()}let kk=null,wk=null,Sk=!1;function E6(t,e,n){return kk==e&&wk==n?Sk:(kk=e,wk=n,Sk=n=="up"||n=="down"?N6(t,e,n):j6(t,e,n))}const sn=0,Nk=1,Ts=2,Sn=3;class jl{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=sn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>st(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof TE){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof EE&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?st(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?st(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],u=o+l.size;if(s==-1&&e<=u){let d=o+l.border;if(e>=d&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,d);e=o;for(let h=a;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=st(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(u>n||a==this.children.length-1)){n=u;for(let d=a+1;d<this.children.length;d++){let h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){i=st(h.dom);break}n+=h.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],x=m+g.size;if(i>m&&o<x)return g.setSelection(e-m-g.border,n-m-g.border,r,s);m=x}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),h=!1;if((rn||gt)&&e==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(h=!!(m&&p.nodeValue[m-1]==`
`),h&&m==p.nodeValue.length)for(let g=p,x;g;g=g.parentNode){if(x=g.nextSibling){x.nodeName=="BR"&&(a=l={node:x.parentNode,offset:st(x)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=p.childNodes[m-1];h=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(rn&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||h&&gt)&&Xs(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Xs(l.node,l.offset,d.focusNode,d.focusOffset))return;let f=!1;if((u.extend||e==n)&&!(h&&rn)){u.collapse(a.node,a.offset);try{e!=n&&u.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+i.border,l=o-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Ts:Nk,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Sn:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ts:Sn}r=o}this.dirty=Ts}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ts:Nk;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class EE extends jl{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.hasAttribute("contenteditable")||(o.contentEditable="false"),o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==sn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class T6 extends jl{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class qr extends jl{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=ni.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new qr(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Sn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Sn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=sn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=sn}}slice(e,n,r){let s=qr.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Gm(i,n,o,r)),e>0&&(i=Gm(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Jr extends jl{constructor(e,n,r,s,i,o,a){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,u=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),d=u&&u.dom,h=u&&u.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:h}=ni.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!h&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=AE(d,r,n),u?l=new M6(e,n,r,s,d,h||null,f,u):n.isText?new hh(e,n,r,s,d,f):new Jr(e,n,r,s,d,h||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){n.contentElement=s.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(s=>s.nodeType==1&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?n.contentElement=r:n.getContent=()=>z.empty}}return n}matchesNode(e,n,r){return this.dirty==sn&&e.eq(this.node)&&Hu(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new A6(this,o&&o.node,e);R6(this.node,this.innerDeco,(u,d,h)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e,d):u.type.side>=0&&!h&&l.syncToMarks(d==this.node.childCount?ye.none:this.node.child(d).marks,r,e,d),l.placeWidget(u,e,s)},(u,d,h,f)=>{l.syncToMarks(u.marks,r,e,f);let p;l.findNodeMatch(u,d,h,f)||a&&e.state.selection.from>s&&e.state.selection.to<s+u.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(u,d,h,p,e)||l.updateNextNode(u,d,h,e,f,s)||l.addNode(u,d,h,e,s),s+=u.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ts)&&(o&&this.protectLocalComposition(e,o),ME(this.contentDOM,this.children,e),io&&_6(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Q)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=I6(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new T6(this,i,n,s);e.input.compositionNodes.push(o),this.children=Gm(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Sn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=sn}updateOuterDeco(e){if(Hu(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=PE(this.dom,this.nodeDOM,Km(this.outerDeco,this.node,n),Km(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ck(t,e,n,r,s){AE(r,e,t);let i=new Jr(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class hh extends Jr{constructor(e,n,r,s,i,o){super(e,n,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==Sn||this.dirty!=sn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=sn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=sn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new hh(this.parent,s,this.outerDeco,this.innerDeco,i,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Sn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class TE extends jl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==sn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class M6 extends Jr{constructor(e,n,r,s,i,o,a,l){super(e,n,r,s,i,o,a),this.spec=l}update(e,n,r,s){if(this.dirty==Sn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ME(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=jk(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof qr){let l=r?r.previousSibling:t.lastChild;ME(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=jk(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const ma=function(t){t&&(this.nodeName=t)};ma.prototype=Object.create(null);const Ms=[new ma];function Km(t,e,n){if(t.length==0)return Ms;let r=n?Ms[0]:new ma,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new ma(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new ma(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function PE(t,e,n,r){if(n==Ms&&r==Ms)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=Ms[0]),s=l}P6(s,a||Ms[0],o)}return s}function P6(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function AE(t,e,n){return PE(t,t,Ms,Km(e,n,t.nodeType!=1))}function Hu(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function jk(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class A6{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=D6(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=sn,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,u=this.top.children.length;s<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let h=this.top.children[d];if(h.matchesMark(e[o])&&!this.isLocked(h.dom)){l=d;break}}if(l<0&&this.index<this.top.children.length){let d=this.top.children[this.index];d instanceof qr&&d.dirty!=Sn&&d.mark.type==e[o].type&&d.spec.update&&!this.isLocked(d.dom)&&d.spec.update(e[o])&&(d.mark=e[o],l=this.index,this.changed=!0)}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=qr.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==Sn&&o.dom==o.contentDOM&&(o.dirty=Ts),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Jr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=i)return!1;let d=l.dom,h,f=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Sn&&Hu(n,l.outerDeco));if(!f&&l.update(e,n,r,s))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(l,e,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=Ts,h.updateChildren(s,o+1),h.dirty=sn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Hu(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=Jr.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=Jr.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new EE(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof qr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof hh)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((gt||ot)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new TE(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function D6(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof qr)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function L6(t,e){return t.type.side-e.type.side}function R6(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let u=0;u<t.childCount;u++){let d=t.child(u);r(d,s,e.forChild(i,d),u),i+=d.nodeSize}return}let o=0,a=[],l=null;for(let u=0;;){let d,h;for(;o<s.length&&s[o].to==i;){let x=s[o++];x.widget&&(d?(h||(h=[d])).push(x):d=x)}if(d)if(h){h.sort(L6);for(let x=0;x<h.length;x++)n(h[x],u,!!l)}else n(d,u,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(u<t.childCount)p=u,f=t.child(u++);else break;for(let x=0;x<a.length;x++)a[x].to<=i&&a.splice(x--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let m=i+f.nodeSize;if(f.isText){let x=m;o<s.length&&s[o].from<x&&(x=s[o].from);for(let y=0;y<a.length;y++)a[y].to<x&&(x=a[y].to);x<m&&(l=f.cut(x-i),f=f.cut(0,x-i),m=x,p=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=f.isInline&&!f.isLeaf?a.filter(x=>!x.inline):a.slice();r(f,g,e.forChild(i,f),p),i=m}}function _6(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function I6(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let u=t.child(s++);if(i+=u.nodeSize,!u.isText)break;l+=u.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?l.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Gm(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],u=a,d=a+=l.size;u>=n||d<=e?i.push(l):(u<e&&i.push(l.slice(0,e-u,r)),s&&(i.push(s),s=void 0),d>n&&i.push(l.slice(n-u,l.size,r)))}return i}function Q0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,u;if(dh(n)){for(l=o;s&&!s.node;)s=s.parent;let h=s.node;if(s&&h.isAtom&&Z.isSelectable(h)&&s.parent&&!(h.isInline&&c6(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;u=new Z(o==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let h=o,f=o;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);h=Math.min(h,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(h<0)return null;[l,o]=f==t.state.selection.anchor?[f,h]:[h,f],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!u){let h=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;u=ex(t,d,a,h)}return u}function DE(t){return t.editable?t.hasFocus():RE(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function or(t,e=!1){let n=t.state.selection;if(LE(t,n),!DE(t))return;let r=t.input.mouseDown;if(!e&&ot&&r){let s=t.domSelectionRange(),i=t.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&Xs(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)B6(t);else{let{anchor:s,head:i}=n,o,a;Ek&&!(n instanceof Q)&&(n.$from.parent.inlineContent||(o=Tk(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=Tk(t,n.to))),t.docView.setSelection(s,i,t,e),Ek&&(o&&Mk(o),a&&Mk(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&O6(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const Ek=gt||ot&&bE<63;function Tk(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(gt&&s&&s.contentEditable=="false")return Af(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Af(s);if(i)return Af(i)}}function Af(t){return t.contentEditable="true",gt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Mk(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function O6(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!DE(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function B6(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,st(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&_t&&Gr<=11&&(n.disabled=!0,n.disabled=!1)}function LE(t,e){if(e instanceof Z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Pk(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Pk(t)}function Pk(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ex(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||Q.between(e,n,r)}function Ak(t){return t.editable&&!t.hasFocus()?!1:RE(t)}function RE(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function z6(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Xs(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qm(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&ie.findFrom(i,e)}function Nr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Dk(t,e,n){let r=t.state.selection;if(r instanceof Q)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Nr(t,new Q(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=qm(t.state,e);return s&&s instanceof Z?Nr(t,s):!1}else if(!(Yt&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?Z.isSelectable(i)?Nr(t,new Z(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Cl?Nr(t,new Q(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Z&&r.node.isInline)return Nr(t,new Q(e>0?r.$to:r.$from));{let s=qm(t.state,e);return s?Nr(t,s):!1}}}function Wu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ga(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ci(t,e){return e<0?F6(t):V6(t)}function F6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(rn&&n.nodeType==1&&r<Wu(n)&&ga(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(ga(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(_E(n))break;{let a=n.previousSibling;for(;a&&ga(a,-1);)s=n.parentNode,i=st(a),a=a.previousSibling;if(a)n=a,r=Wu(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Jm(t,n,r):s&&Jm(t,s,i)}function V6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=Wu(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(ga(a,1))i=n,o=++r;else break}else{if(_E(n))break;{let a=n.nextSibling;for(;a&&ga(a,1);)i=a.parentNode,o=st(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=Wu(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Jm(t,i,o)}function _E(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function $6(t,e){for(;t&&e==t.childNodes.length&&!Nl(t);)e=st(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function H6(t,e){for(;t&&!e&&!Nl(t);)e=st(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Jm(t,e,n){if(e.nodeType!=3){let i,o;(o=$6(e,n))?(e=o,n=0):(i=H6(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(dh(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&or(t)},50)}function Lk(t,e){let n=t.state.doc.resolve(e);if(!(ot||vE)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Rk(t,e,n){let r=t.state.selection;if(r instanceof Q&&!r.empty||n.indexOf("s")>-1||Yt&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=qm(t.state,e);if(o&&o instanceof Z)return Nr(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Vt?ie.near(o,e):ie.findFrom(o,e);return a?Nr(t,a):!1}return!1}function _k(t,e){if(!(t.state.selection instanceof Q))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Ik(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function W6(t){if(!gt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ik(t,r,"true"),setTimeout(()=>Ik(t,r,"false"),20)}return!1}function U6(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function K6(t,e){let n=e.keyCode,r=U6(e);if(n==8||Yt&&n==72&&r=="c")return _k(t,-1)||ci(t,-1);if(n==46&&!e.shiftKey||Yt&&n==68&&r=="c")return _k(t,1)||ci(t,1);if(n==13||n==27)return!0;if(n==37||Yt&&n==66&&r=="c"){let s=n==37?Lk(t,t.state.selection.from)=="ltr"?-1:1:-1;return Dk(t,s,r)||ci(t,s)}else if(n==39||Yt&&n==70&&r=="c"){let s=n==39?Lk(t,t.state.selection.from)=="ltr"?1:-1:1;return Dk(t,s,r)||ci(t,s)}else{if(n==38||Yt&&n==80&&r=="c")return Rk(t,-1,r)||ci(t,-1);if(n==40||Yt&&n==78&&r=="c")return W6(t)||Rk(t,1,r)||ci(t,1);if(r==(Yt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function tx(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||ni.fromSchema(t.state.schema),a=VE(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let u=l.firstChild,d,h=0;for(;u&&u.nodeType==1&&(d=FE[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=a.createElement(d[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),h++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
`);return{dom:l,text:f,slice:e}}function IE(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return a=new W(z.from(t.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let h=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(h)a=h;else{let f=s.marks(),{schema:p}=t.state,m=ni.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let x=o.appendChild(document.createElement("p"));g&&x.appendChild(m.serializeNode(p.text(g,f)))})}}else t.someProp("transformPastedHTML",h=>{n=h(n,t)}),o=Y6(n),Cl&&X6(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let h=+d[3];h>0;h--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Kr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!G6.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Z6(Ok(a,+d[1],+d[2]),d[4]);else if(a=W.maxOpen(q6(a.content,s),!0),a.openStart||a.openEnd){let h=0,f=0;for(let p=a.content.firstChild;h<a.openStart&&!p.type.spec.isolating;h++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=Ok(a,h,f)}return t.someProp("transformPasted",h=>{a=h(a,t,l)}),a}const G6=/^(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 q6(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&i.length&&BE(l,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=zE(o[o.length-1],i.length));let d=OE(a,l);o.push(d),s=s.matchType(d.type),i=l}}),o)return z.from(o)}return t}function OE(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,z.from(t));return t}function BE(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=BE(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(z.from(OE(n,t,s+1))))}}function zE(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,zE(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(z.empty,!0);return t.copy(n.append(r))}function Ym(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=Ym(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(z.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Ok(t,e,n){return e<t.openStart&&(t=new W(Ym(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new W(Ym(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const FE={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function VE(){return document.implementation.createHTMLDocument("title")}let Io=null;function J6(t){let e=window.trustedTypes;if(!e)return t;if(!Io){if(Io=e.defaultPolicy)try{return Io.createHTML(t)}catch{}Io=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Io.createHTML(t)}function Y6(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=VE(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&FE[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=J6(t),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<n.styleSheets.length;o++){let a=n.styleSheets[o];for(let l=0;l<a.rules.length;l++){let u=a.rules[l];if(u instanceof CSSStyleRule){let d=r.querySelectorAll(u.selectorText);for(let h=0;h<d.length;h++)d[h].style.cssText+=u.style.cssText}}}return r}function X6(t){let e=t.querySelectorAll(ot?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Z6(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;try{l.checkAttrs(r[a+1])}catch{break}s=z.from(l.create(r[a+1],s)),i++,o++}return new W(s,i,o)}const Nt={},Ct={},Q6={touchstart:!0,touchmove:!0};class ez{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function tz(t){for(let e in Nt){let n=Nt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{rz(t,r)&&!nx(t,r)&&(t.editable||!(r.type in Ct))&&n(t,r)},Q6[e]?{passive:!0}:void 0)}gt&&t.dom.addEventListener("input",()=>null),Xm(t)}function nr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function nz(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Xm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>nx(t,r))})}function nx(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function rz(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function sz(t,e){!nx(t,e)&&Nt[e.type]&&(t.editable||!(e.type in Ct))&&Nt[e.type](t,e)}Ct.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!UE(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(tr&&ot&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),io&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,ks(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||K6(t,n)?n.preventDefault():nr(t,"key")};Ct.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ct.keypress=(t,e)=>{let n=e;if(UE(t)||!n.charCode||n.ctrlKey&&!n.altKey||Yt&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Q)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function El(t){return{left:t.clientX,top:t.clientY}}function iz(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function rx(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Tl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function oz(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Z.isSelectable(r)?(Tl(t,new Z(n)),!0):!1}function az(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Z&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(Z.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Tl(t,Z.create(t.state.doc,s)),!0):!1}function lz(t,e,n,r,s){return rx(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?az(t,n):oz(t,n))}function cz(t,e,n,r){return rx(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function uz(t,e,n,r){return rx(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||dz(t,n,r)}function dz(t,e,n){if(n.button!=0)return!1;let r=$E(t,e,!0),s=t.state.doc;return r?(Tl(t,r),r instanceof Q&&s.eq(t.state.doc)&&(t.input.mouseDown=new fz(t,r)),!0):!1}function $E(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?Q.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)return Q.create(r,a+1,a+1+o.content.size);if(n&&Z.isSelectable(o))return Z.create(r,a)}return null}function sx(t){return Uu(t)}const HE=Yt?"metaKey":"ctrlKey";Nt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=sx(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&iz(n,t.input.lastClick)&&!n[HE]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(El(n));o&&(i=="singleClick"?t.input.mouseDown=new hz(t,o,n,!!r):(i=="doubleClick"?cz:uz)(t,o.pos,o.inside,n)?n.preventDefault():nr(t,"pointer"))};class WE{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class hz extends WE{constructor(e,n,r,s){super(e),this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[HE],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Z&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&rn&&!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()),nr(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||or(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(El(e))),this.updateAllowDefault(e),this.allowDefault||!n?nr(this.view,"pointer"):lz(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||gt&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Tl(this.view,ie.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):nr(this.view,"pointer")}move(e){this.updateAllowDefault(e),nr(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class fz extends WE{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),nr(this.view,"pointer");let n=this.view.posAtCoords(El(e)),r=n&&$E(this.view,n.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,a]=r.from<i.from?[i.to,r.from]:[i.from,r.to];Tl(this.view,Q.create(s,o,a))}}Nt.touchstart=t=>{t.input.lastTouch=Date.now(),sx(t),nr(t,"pointer")};Nt.touchmove=t=>{t.input.lastTouch=Date.now(),nr(t,"pointer")};Nt.contextmenu=t=>sx(t);function UE(t,e){return t.composing?!0:gt&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const pz=tr?5e3:-1;Ct.compositionstart=Ct.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Q&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&vE&&mz(t)))t.markCursor=t.state.storedMarks||n.marks(),Uu(t,!0),t.markCursor=null;else if(Uu(t,!e.selection.empty),rn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}KE(t,pz)};function mz(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ct.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,KE(t,20))};function KE(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Uu(t),e))}function GE(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function gz(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=a6(e.focusNode,e.focusOffset),r=l6(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Uu(t,e=!1){if(!(tr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),GE(t),e||t.docView&&t.docView.dirty){let n=Q0(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function xz(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const sl=_t&&Gr<15||io&&h6<604;Nt.copy=Ct.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=sl?null:n.clipboardData,o=r.content(),{dom:a,text:l}=tx(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):xz(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yz(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function bz(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?il(t,r.value,null,s,e):il(t,r.textContent,r.innerHTML,s,e)},50)}function il(t,e,n,r,s){let i=IE(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||W.empty)))return!0;if(!i)return!1;let o=yz(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function qE(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ct.paste=(t,e)=>{let n=e;if(t.composing&&!tr)return;let r=sl?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&il(t,qE(r),r.getData("text/html"),s,n)?n.preventDefault():bz(t,n)};class JE{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const vz=Yt?"altKey":"ctrlKey";function YE(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[vz]}Nt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(El(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Z?s.to-1:s.to))){if(r&&r.mightDrag)o=Z.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let h=t.docView.nearestDesc(n.target,!0);h&&h.node.type.spec.draggable&&h!=t.docView&&(o=Z.create(t.state.doc,h.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:u,slice:d}=tx(t,a);(!n.dataTransfer.files.length||!ot||bE>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(sl?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",sl||n.dataTransfer.setData("text/plain",u),t.dragging=new JE(d,YE(t,n),o)};Nt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ct.dragover=Ct.dragenter=(t,e)=>e.preventDefault();Ct.drop=(t,e)=>{try{kz(t,e,t.dragging)}finally{t.dragging=null}};function kz(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(El(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=IE(t,qE(e.dataTransfer),sl?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&YE(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||W.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Xj(t.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let l=t.state.tr;if(o){let{node:p}=n;p?p.replace(l):l.deleteSelection()}let u=l.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,h=l.doc;if(d?l.replaceRangeWith(u,u,i.content.firstChild):l.replaceRange(u,u,i),l.doc.eq(h))return;let f=l.doc.resolve(u);if(d&&Z.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Z(f));else{let p=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,x,y)=>p=y),l.setSelection(ex(t,f,l.doc.resolve(p)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}Nt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&or(t)},20))};Nt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Nt.beforeinput=(t,e)=>{if(tr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,ks(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Ct)Nt[t]=Ct[t];function ol(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ku{constructor(e,n){this.toDOM=e,this.spec=n||Vs,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new wt(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ku&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ol(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Yr{constructor(e,n){this.attrs=e,this.spec=n||Vs}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new wt(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Yr&&ol(this.attrs,e.attrs)&&ol(this.spec,e.spec)}static is(e){return e.type instanceof Yr}destroy(){}}class ix{constructor(e,n){this.attrs=e,this.spec=n||Vs}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new wt(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof ix&&ol(this.attrs,e.attrs)&&ol(this.spec,e.spec)}destroy(){}}class wt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new wt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new wt(e,e,new Ku(n,r))}static inline(e,n,r,s){return new wt(e,n,new Yr(r,s))}static node(e,n,r,s){return new wt(e,n,new ix(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Yr}get widget(){return this.type instanceof Ku}}const pi=[],Vs={};class de{constructor(e,n){this.local=e.length?e:pi,this.children=n.length?n:pi}static create(e,n){return n.length?Gu(n,e,0,Vs):ft}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==ft||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Vs)}mapInner(e,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(n,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?wz(this.children,o||[],e,n,r,s,i):o?new de(o.sort($s),pi):ft}add(e,n){return n.length?this==ft?de.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let u=l+r,d;if(d=ZE(n,a,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,d,u+1):s.splice(i,0,l,l+a.nodeSize,Gu(d,a,u+1,Vs)),i+=3}});let o=XE(i?QE(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new de(o.length?this.local.concat(o).sort($s):this.local,s||this.children)}remove(e){return e.length==0||this==ft?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let d=0,h;d<e.length;d++)(h=e[d])&&h.from>a&&h.to<l&&(e[d]=null,(o||(o=[])).push(h));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,a+1);u!=ft?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new de(s,r):ft}forChild(e,n){if(this==ft)return this;if(n.isLeaf)return de.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof Yr){let u=Math.max(i,l.from)-i,d=Math.min(o,l.to)-i;u<d&&(s||(s=[])).push(l.copy(u,d))}}if(s){let a=new de(s.sort($s),pi);return r?new Mr([a,r]):a}return r||ft}eq(e){if(this==e)return!0;if(!(e instanceof de)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return ox(this.localsInner(e))}localsInner(e){if(this==ft)return pi;if(e.inlineContent||!this.local.some(Yr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Yr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}de.empty=new de([],[]);de.removeOverlap=ox;const ft=de.empty;class Mr{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,Vs));return Mr.from(r)}forChild(e,n){if(n.isLeaf)return de.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=ft&&(i instanceof Mr?r=r.concat(i.members):r.push(i))}return Mr.from(r)}eq(e){if(!(e instanceof Mr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?ox(r?n:n.sort($s)):pi}static from(e){switch(e.length){case 0:return ft;case 1:return e[0];default:return new Mr(e.every(n=>n instanceof de)?e:e.reduce((n,r)=>n.concat(r instanceof de?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function wz(t,e,n,r,s,i,o){let a=t.slice();for(let u=0,d=i;u<n.maps.length;u++){let h=0;n.maps[u].forEach((f,p,m,g)=>{let x=g-m-(p-f);for(let y=0;y<a.length;y+=3){let b=a[y+1];if(b<0||f>b+d-h)continue;let k=a[y]+d-h;p>=k?a[y+1]=f<=k?-2:-1:f>=d&&x&&(a[y]+=x,a[y+1]+=x)}h+=x}),d=n.maps[u].map(d,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let d=n.map(t[u]+i),h=d-s;if(h<0||h>=r.content.size){l=!0;continue}let f=n.map(t[u+1]+i,-1),p=f-s,{index:m,offset:g}=r.content.findIndex(h),x=r.maybeChild(m);if(x&&g==h&&g+x.nodeSize==p){let y=a[u+2].mapInner(n,x,d+1,t[u]+i+1,o);y!=ft?(a[u]=h,a[u+1]=p,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=Sz(a,t,e,n,s,i,o),d=Gu(u,r,0,o);e=d.local;for(let h=0;h<a.length;h+=3)a[h+1]<0&&(a.splice(h,3),h-=3);for(let h=0,f=0;h<d.children.length;h+=3){let p=d.children[h];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,d.children[h],d.children[h+1],d.children[h+2])}}return new de(e.sort($s),a)}function XE(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new wt(s.from+e,s.to+e,s.type))}return n}function Sz(t,e,n,r,s,i,o){function a(l,u){for(let d=0;d<l.local.length;d++){let h=l.local[d].map(r,s,u);h?n.push(h):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function ZE(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function QE(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Gu(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let u=ZE(t,a,l+n);if(u){i=!0;let d=Gu(u,a,n+l+1,r);d!=ft&&s.push(l,l+a.nodeSize,d)}});let o=XE(i?QE(t):t,-n).sort($s);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new de(o,s):ft}function $s(t,e){return t.from-e.from||t.to-e.to}function ox(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Bk(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Bk(e,s,r.copy(i.from,r.to)));break}}}return e}function Bk(t,e,n){for(;e<t.length&&$s(n,t[e])>0;)e++;t.splice(e,0,n)}function Df(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ft&&e.push(r)}),t.cursorWrapper&&e.push(de.create(t.state.doc,[t.cursorWrapper.deco])),Mr.from(e)}const Nz={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Cz=_t&&Gr<=11;class jz{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 Ez{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new jz,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);_t&&Gr<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():gt&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Cz&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,Nz)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);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(Ak(this.view)){if(this.suppressingSelectionUpdates)return or(this.view);if(_t&&Gr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xs(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=so(i))n.add(i);for(let i=e.anchorNode;i;i=so(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ak(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<n.length;d++){let h=this.registerMutation(n[d],l);h&&(i=i<0?h.from:Math.min(h.from,i),o=o<0?h.to:Math.max(h.to,o),h.typeOver&&(a=!0))}if(l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||ot&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let h=d.nextSibling;for(;h&&h.nodeType==1;){if(h.contentEditable=="false"){d.parentNode.removeChild(d);break}h=h.firstChild}}}else if(rn&&l.length){let d=l.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,f]=d;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!h||Pz(e,h)!=p)&&f.remove()}}}let u=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&dh(r)&&(u=Q0(e))&&u.eq(ie.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,or(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),Tz(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Az(e,l)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||or(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let h=e.addedNodes[d];n.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(_t&&Gr<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:h,nextSibling:f}=e.addedNodes[d];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?st(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?st(i):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let zk=new WeakMap,Fk=!1;function Tz(t){if(!zk.has(t)&&(zk.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=rn,Fk)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."),Fk=!0}}function Vk(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Xs(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function Mz(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Vk(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Vk(t,n):null}function Pz(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Az(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(i,a.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function Dz(t,e,n,r){let{node:s,fromOffset:i,toOffset:o,from:a,to:l}=t.docView.parseRange(e,n),u=t.domSelectionRange(),d,h=u.anchorNode;if(h&&t.dom.contains(h.nodeType==1?h:h.parentNode)&&(d=[{node:h,offset:u.anchorOffset}],dh(u)||d.push({node:u.focusNode,offset:u.focusOffset})),ot&&t.input.lastKeyCode===8)for(let y=o;y>i;y--){let b=s.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){o=y;break}if(!k||k.size)break}let f=t.state.doc,p=t.someProp("domParser")||Kr.fromSchema(t.state.schema),m=f.resolve(a),g=null,x=p.parse(s,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:i,to:o,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Lz(r),context:m});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),g={anchor:y+a,head:b+a}}return{doc:x,sel:g,from:a,to:l}}const Lz=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(gt&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||gt&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},Rz=/^(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 _z(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=Q0(t,S);if(N&&!t.state.selection.eq(N)){if(ot&&tr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",E=>E(t,ks(13,"Enter"))))return;let T=t.state.tr.setSelection(N);S=="pointer"?T.setMeta("pointer",!0):S=="key"&&T.scrollIntoView(),i&&T.setMeta("composition",i),t.dispatch(T)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=Dz(t,e,n,s),d=t.state.doc,h=d.slice(u.from,u.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=Bz(h.content,u.doc.content,u.from,f,p);if(m&&t.input.domChangeCount++,(io&&t.input.lastIOSEnter>Date.now()-225||tr)&&s.some(S=>S.nodeType==1&&!Rz.test(S.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",S=>S(t,ks(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Q&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let S=$k(t,t.state.doc,u.sel);if(S&&!S.eq(t.state.selection)){let N=t.state.tr.setSelection(S);i&&N.setMeta("composition",i),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Q&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),_t&&Gr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),x=u.doc.resolveNoCache(m.endB-u.from),y=d.resolve(m.start),b=g.sameParent(x)&&g.parent.inlineContent&&y.end()>=m.endA;if((io&&t.input.lastIOSEnter>Date.now()-225&&(!b||s.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!b&&g.pos<u.doc.content.size&&(!g.sameParent(x)||!g.parent.inlineContent)&&g.pos<x.pos&&!/\S/.test(u.doc.textBetween(g.pos,x.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,ks(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&Oz(d,m.start,m.endA,g,x)&&t.someProp("handleKeyDown",S=>S(t,ks(8,"Backspace")))){tr&&ot&&t.domObserver.suppressSelectionUpdates();return}ot&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),tr&&!b&&g.start()!=x.start()&&x.parentOffset==0&&g.depth==x.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,x=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,ks(13,"Enter"))})},20));let k=m.start,w=m.endA,C=S=>{let N=S||t.state.tr.replace(k,w,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let T=$k(t,N.doc,u.sel);T&&!(ot&&t.composing&&T.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(T.head==k||T.head==N.mapping.map(w)-1)||_t&&T.empty&&T.head==k)&&N.setSelection(T)}return i&&N.setMeta("composition",i),N.scrollIntoView()},j;if(b)if(g.pos==x.pos){_t&&Gr<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>or(t),20));let S=C(t.state.tr.delete(k,w)),N=d.resolve(m.start).marksAcross(d.resolve(m.endA));N&&S.ensureMarks(N),t.dispatch(S)}else if(m.endA==m.endB&&(j=Iz(g.parent.content.cut(g.parentOffset,x.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let S=C(t.state.tr);j.type=="add"?S.addMark(k,w,j.mark):S.removeMark(k,w,j.mark),t.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==x.index()-(x.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,x.parentOffset),N=()=>C(t.state.tr.insertText(S,k,w));t.someProp("handleTextInput",T=>T(t,k,w,S,N))||t.dispatch(N())}else t.dispatch(C());else t.dispatch(C())}function $k(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ex(t,e.resolve(n.anchor),e.resolve(n.head))}function Iz(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(l(e.child(d)));if(z.from(u).eq(t))return{mark:a,type:o}}function Oz(t,e,n,r,s){if(n-e<=s.pos-r.pos||Lf(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(Lf(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Lf(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Lf(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function Bz(t,e,n,r,s){let i=t.findDiffStart(e,n),o=n+t.size,a=n+e.size;if(i==null)return null;let{a:l,b:u}=t.findDiffEnd(e,o,a);if(s=="end"){let d=Math.max(0,i-Math.min(l,u));r-=l+d-i}if(l<i&&o<a){let d=r<=i&&r>=l?i-r:0;i-=d,u=i+(u-l),l=i}else if(u<i){let d=r<=i&&r>=u?i-r:0;i-=d,l=i+(l-u),u=i}return{start:i,endA:l,endB:u}}class eT{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ez,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Gk),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Uk(this),Wk(this),this.nodeViews=Kk(this),this.docView=Ck(this.state.doc,Hk(this),Df(this),this.dom,this),this.domObserver=new Ez(this,(r,s,i,o)=>_z(this,r,s,i,o)),this.domObserver.start(),tz(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Xm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Gk),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(GE(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Kk(this);Fz(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Xm(this),this.editable=Uk(this),Wk(this);let l=Df(this),u=Hk(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",h=i||!this.docView.matchesNode(e.doc,u,l);(h||!e.selection.eq(s.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&m6(this);if(o){this.domObserver.stop();let p=h&&(_t||ot)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&zz(s.selection,e.selection);if(h){let g=ot?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=gz(this)),(i||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Ck(e.doc,u,l,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let m=this.input.mouseDown;p||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&z6(this)&&m.delaySelUpdate())?or(this,p):(LE(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&g6(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&vk(this,n.getBoundingClientRect(),e)}else vk(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new JE(e.slice,e.move,s<0?void 0:Z.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(_t){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(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&x6(this.dom),or(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return w6(this,e)}coordsAtPos(e,n=1){return CE(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return E6(this,n||this.state,e)}pasteHTML(e,n){return il(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return il(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return tx(this,e)}destroy(){this.docView&&(nz(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Df(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,i6())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return sz(this,e)}domSelectionRange(){let e=this.domSelection();return e?gt&&this.root.nodeType===11&&u6(this.dom.ownerDocument)==this.dom&&Mz(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}eT.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Hk(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[wt.node(0,t.state.doc.content.size,e)]}function Wk(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:wt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Uk(t){return!t.someProp("editable",e=>e(t.state)===!1)}function zz(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Kk(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Fz(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function Gk(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ns={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:"'"},qu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Vz=typeof navigator<"u"&&/Mac/.test(navigator.platform),$z=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var it=0;it<10;it++)ns[48+it]=ns[96+it]=String(it);for(var it=1;it<=24;it++)ns[it+111]="F"+it;for(var it=65;it<=90;it++)ns[it]=String.fromCharCode(it+32),qu[it]=String.fromCharCode(it);for(var Rf in ns)qu.hasOwnProperty(Rf)||(qu[Rf]=ns[Rf]);function Hz(t){var e=Vz&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||$z&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?qu:ns)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Wz=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Uz=typeof navigator<"u"&&/Win/.test(navigator.platform);function Kz(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Wz?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Gz(t){let e=Object.create(null);for(let n in t)e[Kz(n)]=t[n];return e}function _f(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function qz(t){return new Se({props:{handleKeyDown:tT(t)}})}function tT(t){let e=Gz(t);return function(n,r){let s=Hz(r),i,o=e[_f(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[_f(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Uz&&r.ctrlKey&&r.altKey)&&(i=ns[r.keyCode])&&i!=s){let a=e[_f(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function fh(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Vi=class nT{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:s}=n,{tr:i}=r,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...d)=>{const h=l(...d)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(i),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a=[],l=!!e,u=e||i.tr,d=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(f=>f===!0)),h={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...g)=>{const x=this.buildProps(u,n),y=p(...g)(x);return a.push(y),h}])),run:d};return h}static createFakeChain(){const e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:n,state:r}=this,s=!1,i=e||r.tr,o=this.buildProps(i,s);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...u)=>l(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,s)}}static createFallbackCan(){const e=nT.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a={tr:e,editor:s,view:o,state:fh({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...d)=>u(...d)(a)]))}};return a}};const Jz=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{if(!t.isDestroyed){var n;e.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),Yz=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Xz=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:d}=e,h=u.resolve(d.map(l)),f=u.resolve(d.map(l+a.nodeSize)),p=h.blockRange(f);if(!p)return;const m=wo(p);if(a.type.isTextblock){const{defaultType:g}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},Zz=t=>e=>t(e),Qz=()=>({state:t,dispatch:e})=>pE(t,e),eF=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Q(r.doc.resolve(Math.max(o-1,0)))),!0},tF=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const o=s.before(i),a=s.after(i);t.delete(o,a).scrollIntoView()}return!0}return!1};function Ge(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}const nF=t=>({tr:e,state:n,dispatch:r})=>{const s=Ge(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),l=i.after(o);e.delete(a,l).scrollIntoView()}return!0}return!1},rF=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},sF=t=>t.content?/^text(\*|\+)/.test(t.content):!1,qk=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return sF(r)?n==="left"?t.start()-1:t.end()+1:t.pos},iF=(t,e,n)=>({from:qk(t,n,"left"),to:qk(e,n,"right")}),oF=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,s=n.steps.length;r.forEach(i=>{const o=n.mapping.slice(s),a=n.doc.resolve(o.map(i.$from.pos)),l=n.doc.resolve(o.map(i.$to.pos)),{from:u,to:d}=iF(a,l,t.schema);n.deleteRange(u,d)}),n.selection.empty||n.setSelection(Q.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},aF=()=>({commands:t})=>t.keyboardShortcut("Enter"),lF=()=>({state:t,dispatch:e})=>WB(t,e);function ax(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ju(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:ax(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function rT(t,e,n={}){return t.find(r=>r.type===e&&Ju(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Jk(t,e,n={}){return!!rT(t,e,n)}function lx(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(l=>l.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(l=>l.type===e))return;if(!n){const l=r.node.marks.find(u=>u.type===e);l&&(n=l.attrs)}if(!rT([...r.node.marks],e,n))return;let s=r.index,i=t.start()+r.offset,o=s+1,a=i+r.node.nodeSize;for(;s>0&&Jk([...t.parent.child(s-1).marks],e,n);)s-=1,i-=t.parent.child(s).nodeSize;for(;o<t.parent.childCount&&Jk([...t.parent.child(o).marks],e,n);)a+=t.parent.child(o).nodeSize,o+=1;return{from:i,to:a}}function pr(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const cF=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=pr(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:u,to:d}=a;if(s){const h=lx(l,i,e);if(h&&h.from<=u&&h.to>=d){const f=Q.create(o,h.from,h.to);n.setSelection(f)}}return!0},uF=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function sT(t){return t instanceof Q}function Ps(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Zm(t,e=null){if(!e)return null;const n=ie.atStart(t),r=ie.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?Q.create(t,Ps(0,s,i),Ps(t.content.size,s,i)):Q.create(t,Ps(e,s,i),Ps(e,s,i))}function Yk(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Yu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function dF(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const hF=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Yu()||Yk())&&r.dom.focus(),dF()&&!Yu()&&!Yk()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!sT(n.state.selection))return o(),!0;const a=Zm(s.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},fF=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),pF=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),iT=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&iT(r)}return t};function pc(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return iT(n)}function oT(t){return typeof(t==null?void 0:t.nodesBetween)=="function"}function oo(t,e,n){if(oT(t))return t;const r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};const s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return z.fromArray(t.map(o=>e.nodeFromJSON(o)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),oo("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new Fj({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?Kr.fromSchema(l).parseSlice(pc(t),n.parseOptions):Kr.fromSchema(l).parse(pc(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Kr.fromSchema(e);return n.slice?i.parseSlice(pc(t),n.parseOptions).content:i.parse(pc(t),n.parseOptions)}return oo("",e,n)}function aT(t){return!("type"in t)}function lT(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof Ie||s instanceof Ze))return;const i=t.mapping.maps[r];let o=0;i.forEach((a,l,u,d)=>{o===0&&(o=d)}),t.setSelection(ie.near(t.doc.resolve(o),n))}const mF=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=x=>{i.emit("contentError",{editor:i,error:x,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{oo(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(x){l(x)}try{var o;a=oo(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(x){return l(x),!1}let{from:d,to:h}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;const m=aT(a)?a.content:[a];if(m.forEach(x=>{x.check(),f=f?x.isText&&x.marks.length===0:!1,p=p?x.isBlock:!1}),d===h&&p){const{parent:x}=r.doc.resolve(d);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(d-=1,h+=1)}let g;if(f)Array.isArray(e)?g=e.map(x=>x.text||"").join(""):oT(e)?g=m.map(x=>{var y;return(y=x.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?g=e.text:g=e,r.insertText(g,d,h);else{g=z.from(m);const x=r.doc.resolve(d),y=x.node(),b=x.parentOffset===0,k=y.isText||y.isTextblock,w=y.content.size>0;b&&k&&w&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,h,m)}n.updateSelection&&lT(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0};function cT(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const gF=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:a=!0}=t;let l;typeof s=="number"?l=e.doc.resolve(s):s?l=s:l=e.selection.$from;const u=cT(l.parent.contentMatchAt(l.index()));if(!u)return!1;const d=Object.keys(u.spec.attrs||{}),h=i?Object.fromEntries(Object.entries(i).filter(([p])=>d.includes(p))):{};let f;if(o){const p=oo(o,r.schema);f=u.createAndFill(h,p)}else f=u.createAndFill(h);return f?(n&&(e.insert(l.pos,f),a&&lT(e,e.steps.length-1,-1)),!0):!1},xF=()=>({state:t,dispatch:e})=>VB(t,e),yF=()=>({state:t,dispatch:e})=>$B(t,e),bF=()=>({state:t,dispatch:e})=>aE(t,e),vF=()=>({state:t,dispatch:e})=>dE(t,e),kF=()=>({state:t,dispatch:e,tr:n})=>{try{const r=lh(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},wF=()=>({state:t,dispatch:e,tr:n})=>{try{const r=lh(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},SF=()=>({state:t,dispatch:e})=>zB(t,e),NF=()=>({state:t,dispatch:e})=>FB(t,e);function uT(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function CF(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Yu()||uT()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}const jF=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=CF(t).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l==null||l.steps.forEach(u=>{const d=u.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function dr(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Ge(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(s,h+d.nodeSize);a.push({node:d,from:f,to:p})});const l=s-r,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Ju(d.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((d,h)=>d+h.to-h.from,0)>=l}const EF=(t,e={})=>({state:n,dispatch:r})=>dr(n,Ge(t,n.schema),e)?HB(n,r):!1,TF=()=>({state:t,dispatch:e})=>mE(t,e),MF=t=>({state:e,dispatch:n})=>{const r=Ge(t,e.schema);return t6(r)(e,n)},PF=()=>({state:t,dispatch:e})=>fE(t,e);function ph(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Xk(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}const AF=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=ph(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Ge(t,r.schema)),a==="mark"&&(o=pr(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,h)=>{i&&i===d.type&&(l=!0,s&&n.setNodeMarkup(h,void 0,Xk(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(f=>{o===f.type&&(l=!0,s&&n.addMark(h,h+d.nodeSize,o.create(Xk(f.attrs,e))))})})}),l},DF=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),LF=()=>({tr:t,dispatch:e})=>{if(e){const n=new Vt(t.doc);t.setSelection(n)}return!0},RF=()=>({state:t,dispatch:e})=>cE(t,e),_F=()=>({state:t,dispatch:e})=>hE(t,e),IF=()=>({state:t,dispatch:e})=>GB(t,e),OF=()=>({state:t,dispatch:e})=>YB(t,e),BF=()=>({state:t,dispatch:e})=>JB(t,e);function Qm(t,e,n={},r={}){return oo(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const zF=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const u=Qm(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});if(o){const d=aT(u)?u.content:[u];i.replaceWith(0,l.content.size,d).setMeta("preventUpdate",!n)}return!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function dT(t,e){const n=pr(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function hT(t,e){const n=new nE(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function FF(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function VF(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function mh(t){return e=>VF(e.$from,t)}function J(t,e,n){return t.config[e]===void 0&&t.parent?J(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?J(t.parent,e,n):null}):t.config[e]}function cx(t){return t.map(e=>{const n=J(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...cx(n())]:e}).flat(10)}function ux(t,e){const n=ni.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function fT(t){return typeof t=="function"}function he(t,e=void 0,...n){return fT(t)?e?t.bind(e)(...n):t(...n):t}function $F(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ao(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function pT(t){const e=[],{nodeExtensions:n,markExtensions:r}=ao(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),l=[...o,...a];return t.forEach(u=>{const d=J(u,"addGlobalAttributes",{name:u.name,options:u.options,storage:u.storage,extensions:s});d&&d().forEach(h=>{let f;Array.isArray(h.types)?f=h.types:h.types==="*"?f=l:h.types==="nodes"?f=o:h.types==="marks"?f=a:f=[],f.forEach(p=>{Object.entries(h.attributes).forEach(([m,g])=>{e.push({type:p,name:m,attribute:{...i,...g}})})})})}),s.forEach(u=>{const d=J(u,"addAttributes",{name:u.name,options:u.options,storage:u.storage});if(!d)return;const h=d();Object.entries(h).forEach(([f,p])=>{const m={...i,...p};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:u.name,name:f,attribute:m})})}),e}function HF(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!s){r=!r,n+=l;continue}if(l==='"'&&!r){s=!s,n+=l;continue}if(!r&&!s){if(l==="("){i+=1,n+=l;continue}if(l===")"&&i>0){i-=1,n+=l;continue}if(l===";"&&i===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function Zk(t){const e=[],n=HF(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),l=i.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function Ve(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(s==="__proto__"){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[s]){r[s]=i;return}if(s==="class"){const o=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],l=o.filter(u=>!a.includes(u));r[s]=[...a,...l].join(" ")}else if(s==="style"){const o=new Map([...Zk(r[s]),...Zk(i)]);r[s]=Array.from(o.entries()).map(([a,l])=>`${a}: ${l}`).join("; ")}else r[s]=i}),r},{})}function al(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ve(n,r),{})}function WF(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Qk(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):WF(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function ew(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&$F(n)?!1:n!=null))}function tw(t){var e,n;const r={};return!(!(t==null||(e=t.attribute)===null||e===void 0)&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),(t==null||(n=t.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function UF(t,e){var n;const r=pT(t),{nodeExtensions:s,markExtensions:i}=ao(t),o=(n=s.find(u=>J(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(s.map(u=>{const d=r.filter(x=>x.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},f=ew({...t.reduce((x,y)=>{const b=J(y,"extendNodeSchema",h);return{...x,...b?b(u):{}}},{}),content:he(J(u,"content",h)),marks:he(J(u,"marks",h)),group:he(J(u,"group",h)),inline:he(J(u,"inline",h)),atom:he(J(u,"atom",h)),selectable:he(J(u,"selectable",h)),draggable:he(J(u,"draggable",h)),code:he(J(u,"code",h)),whitespace:he(J(u,"whitespace",h)),linebreakReplacement:he(J(u,"linebreakReplacement",h)),defining:he(J(u,"defining",h)),isolating:he(J(u,"isolating",h)),attrs:Object.fromEntries(d.map(tw))}),p=he(J(u,"parseHTML",h));p&&(f.parseDOM=p.map(x=>Qk(x,d)));const m=J(u,"renderHTML",h);m&&(f.toDOM=x=>m({node:x,HTMLAttributes:al(x,d)}));const g=J(u,"renderText",h);return g&&(f.toText=g),[u.name,f]})),l=Object.fromEntries(i.map(u=>{const d=r.filter(g=>g.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},f=ew({...t.reduce((g,x)=>{const y=J(x,"extendMarkSchema",h);return{...g,...y?y(u):{}}},{}),inclusive:he(J(u,"inclusive",h)),excludes:he(J(u,"excludes",h)),group:he(J(u,"group",h)),spanning:he(J(u,"spanning",h)),code:he(J(u,"code",h)),attrs:Object.fromEntries(d.map(tw))}),p=he(J(u,"parseHTML",h));p&&(f.parseDOM=p.map(g=>Qk(g,d)));const m=J(u,"renderHTML",h);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:al(g,d)})),[u.name,f]}));return new Fj({topNode:o,nodes:a,marks:l})}function KF(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function xa(t){return t.sort((n,r)=>{const s=J(n,"priority")||100,i=J(r,"priority")||100;return s>i?-1:s<i?1:0})}function mT(t){const e=xa(cx(t)),n=KF(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function gT(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(l,u,d,h)=>{l.isBlock&&u>r&&(a+=i);const f=o==null?void 0:o[l.type.name];if(f)return d&&(a+=f({node:l,pos:u,parent:d,index:h,range:e})),!1;if(l.isText){var p;a+=l==null||(p=l.text)===null||p===void 0?void 0:p.slice(Math.max(r,u)-u,s-u)}}),a}function GF(t,e){return gT(t,{from:0,to:t.content.size},e)}function xT(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function qF(t,e){const n=Ge(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function yT(t,e){const n=ph(typeof e=="string"?e:e.name,t.schema);return n==="node"?qF(t,e):n==="mark"?dT(t,e):{}}function JF(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function YF(t){const e=JF(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,i)=>i!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function gh(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(i).map(a,-1),d=e.slice(i).map(l),h=e.invert().map(u,-1),f=e.invert().map(d);r.push({oldRange:{from:h,to:f},newRange:{from:u,to:d}})})}),YF(r)}function dx(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=lx(n.resolve(t),s.type);i&&r.push({mark:s,...i})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}const XF=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);(a==null?void 0:a.type.name)===e?o=a:i-=1}return[o,i]},ZF=t=>{const e=t.depth-1;if(e<0)return null;const n=t.index(e);return n===0?null:t.node(e).child(n-1)};function ui(t,e){return e.nodes[t]||e.marks[t]||null}function Zc(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}const QF=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,u;const d=((l=(u=s.type.spec).toText)===null||l===void 0?void 0:l.call(u,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),n};function eg(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?pr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Ju(d.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(m,g)=>{if(i&&m.inlineContent&&!m.type.allowsMarkType(i))return!1;if(!m.isText&&!m.marks.length)return;const x=Math.max(f,g),y=Math.min(p,g+m.nodeSize),b=y-x;o+=b,a.push(...m.marks.map(k=>({mark:k,from:x,to:y})))})}),o===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Ju(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),u=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+u:l)>=o}function eV(t,e,n={}){if(!e)return dr(t,null,n)||eg(t,null,n);const r=ph(e,t.schema);return r==="node"?dr(t,e,n):r==="mark"?eg(t,e,n):!1}const tV=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=mh(a=>a.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},nV=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function nw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function If(t,e){const{nodeExtensions:n}=ao(e),r=n.find(i=>i.name===t);if(!r)return!1;const s=he(J(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function Ml(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;if(t.isText){var r;return!/\S/.test((r=t.text)!==null&&r!==void 0?r:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(Ml(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function bT(t){return t instanceof Z}var vT=class kT{constructor(e){this.position=e}static fromJSON(e){return new kT(e.position)}toJSON(){return{position:this.position}}};function rV(t,e){const n=e.mapping.mapResult(t.position);return{position:new vT(n.pos),mapResult:n}}function sV(t){return new vT(t)}function iV(t,e,n){const{selection:r}=e;let s=null;if(sT(r)&&(s=r.$cursor),s){var i;const a=(i=t.storedMarks)!==null&&i!==void 0?i:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(l=>l.type.excludes(n)))}const{ranges:o}=r;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(d,h,f)=>{if(u)return!1;if(d.isInline){const p=!f||f.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(n));u=p&&m}return!u}),u})}const oV=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=pr(t,r.schema);if(s)if(o){const u=dT(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;r.doc.nodesBetween(d,h,(f,p)=>{const m=Math.max(p,d),g=Math.min(p+f.nodeSize,h);f.marks.find(x=>x.type===l)?f.marks.forEach(x=>{l===x.type&&n.addMark(m,g,l.create({...x.attrs,...e}))}):n.addMark(m,g,l.create(e))})});return iV(r,n,l)},aV=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),lV=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Ge(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>xk(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>xk(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},cV=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Ps(t,0,r.content.size),i=Z.create(r,s);e.setSelection(i)}return!0},uV=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&n.doc.nodesBetween(o,a,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},dV=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Q.atStart(r).from,a=Q.atEnd(r).to,l=Ps(s,o,a),u=Ps(i,o,a),d=Q.create(r,l,u);e.setSelection(d)}return!0},hV=t=>({state:e,dispatch:n})=>{const r=Ge(t,e.schema);return s6(r)(e,n)};function rw(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}const fV=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,u=s.extensionManager.attributes,d=Zc(u,a.node().type.name,a.node().attrs);if(i instanceof Z&&i.node.isBlock)return!a.parentOffset||!ir(o,a.pos)?!1:(r&&(t&&rw(n,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const h=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:cT(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=h&&f?[{type:f,attrs:d}]:void 0,m=ir(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&ir(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(m&&(i instanceof Q&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!h&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),x=e.doc.resolve(g);a.node(-1).canReplaceWith(x.index(),x.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&rw(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},pV=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{const o=Ge(t,r.schema),{$from:a,$to:l}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const d=a.node(-1);if(d.type!==o)return!1;const h=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){var f;let y=z.empty;const b=a.index(-1)?1:a.index(-2)?2:3;for(let N=a.depth-b;N>=a.depth-3;N-=1)y=z.from(a.node(N).copy(y));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Zc(h,a.node().type.name,a.node().attrs),...e},C=((f=o.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(w))||void 0;y=y.append(z.from(o.createAndFill(null,C)||void 0));const j=a.before(a.depth-(b-1));n.replace(j,a.after(-k),new W(y,4-b,0));let S=-1;n.doc.nodesBetween(j,n.doc.content.size,(N,T)=>{if(S>-1)return!1;N.isTextblock&&N.content.size===0&&(S=T+1)}),S>-1&&n.setSelection(Q.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const p=l.pos===a.end()?d.contentMatchAt(0).defaultType:null,m={...Zc(h,d.type.name,d.attrs),...e},g={...Zc(h,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,l.pos);const x=p?[{type:o,attrs:m},{type:p,attrs:g}]:[{type:o,attrs:m}];if(!ir(n.doc,a.pos,2))return!1;if(s){const{selection:y,storedMarks:b}=r,{splittableMarks:k}=i.extensionManager,w=b||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,x).scrollIntoView(),!w||!s)return!0;const C=w.filter(j=>k.includes(j.type.name));n.ensureMarks(C)}return!0};function sw(t){return!t||t==="1"?null:t}function wT(t,e){return sw(t)===sw(e)}const Of=(t,e)=>{const n=mh(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&us(t.doc,n.pos))||!wT(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(n.pos),!0},Bf=(t,e)=>{const n=mh(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&us(t.doc,r))||!wT(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(r),!0};function mV(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return Q.between(r,s)}const gV=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:u,can:d})=>{const{extensions:h,splittableMarks:f}=s.extensionManager,p=Ge(t,o.schema),m=Ge(e,o.schema),{selection:g,storedMarks:x}=o,{$from:y,$to:b}=g,k=y.blockRange(b),w=x||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const C=mh(O=>If(O.type.name,h))(g),j=g.from===0&&g.to===o.doc.content.size,S=o.doc.content.content,N=S.length===1?S[0]:null,T=j&&N&&If(N.type.name,h)?{node:N,pos:0}:null,E=C??T,D=!!C&&k.depth>=1&&k.depth-C.depth<=1,P=!!T;if((D||P)&&E){if(E.node.type===p)return j&&P?l().command(({tr:O,dispatch:I})=>{const H=mV(O);return H?(O.setSelection(H),I&&I(O),!0):!1}).liftListItem(m).run():u.liftListItem(m);if(If(E.node.type.name,h)&&p.validContent(E.node.content))return l().command(()=>(i.setNodeMarkup(E.pos,p),!0)).command(()=>Of(i,p)).command(()=>Bf(i,p)).run()}return!n||!w||!a?l().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Of(i,p)).command(()=>Bf(i,p)).run():l().command(()=>{const O=d().wrapInList(p,r),I=w.filter(H=>f.includes(H.type.name));return i.ensureMarks(I),O?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Of(i,p)).command(()=>Bf(i,p)).run()},xV=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=pr(t,r.schema);return eg(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},yV=(t,e,n={})=>({state:r,commands:s})=>{const i=Ge(t,r.schema),o=Ge(e,r.schema),a=dr(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},bV=(t,e={})=>({state:n,commands:r})=>{const s=Ge(t,n.schema);return dr(n,s,e)?r.lift(s):r.wrapIn(s,e)},vV=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},kV=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:a}=i;if(o)return!0;const{nonClearableMarks:l}=r.extensionManager;if(n){const u=Object.values(r.schema.marks).filter(d=>s||!l.includes(d.name));a.forEach(d=>{for(const h of u)e.removeMark(d.$from.pos,d.$to.pos,h)})}return!0},wV=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=n,a=pr(t,r.schema),{$from:l,empty:u,ranges:d}=o;if(!s)return!0;if(u&&i){var h;let{from:f,to:p}=o;const m=lx(l,a,(h=l.marks().find(g=>g.type===a))===null||h===void 0?void 0:h.attrs);m&&(f=m.from,p=m.to),n.removeMark(f,p,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},SV=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,l)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},NV=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=ph(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Ge(t,r.schema)),a==="mark"&&(o=pr(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;let f,p,m,g;n.selection.empty?r.doc.nodesBetween(d,h,(x,y)=>{i&&i===x.type&&(l=!0,m=Math.max(y,d),g=Math.min(y+x.nodeSize,h),f=y,p=x)}):r.doc.nodesBetween(d,h,(x,y)=>{y<d&&i&&i===x.type&&(l=!0,m=Math.max(y,d),g=Math.min(y+x.nodeSize,h),f=y,p=x),y>=d&&y<=h&&(i&&i===x.type&&(l=!0,s&&n.setNodeMarkup(y,void 0,{...x.attrs,...e})),o&&x.marks.length&&x.marks.forEach(b=>{if(o===b.type&&(l=!0,s)){const k=Math.max(y,d),w=Math.min(y+x.nodeSize,h);n.addMark(k,w,o.create({...b.attrs,...e}))}}))}),p&&(f!==void 0&&s&&n.setNodeMarkup(f,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(x=>{o===x.type&&s&&n.addMark(m,g,o.create({...x.attrs,...e}))}))}),l},mi=new $e("__tiptap_decorations__"),CV=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(mi,{type:"force",name:t}),!0),jV=(t,e={})=>({state:n,dispatch:r})=>{const s=Ge(t,n.schema);return XB(s,e)(n,r)},EV=(t,e={})=>({state:n,dispatch:r})=>{const s=Ge(t,n.schema);return ZB(s,e)(n,r)};var TV=H5({blur:()=>Jz,clearContent:()=>Yz,clearNodes:()=>Xz,command:()=>Zz,createParagraphNear:()=>Qz,cut:()=>eF,deleteCurrentNode:()=>tF,deleteNode:()=>nF,deleteRange:()=>rF,deleteSelection:()=>oF,enter:()=>aF,exitCode:()=>lF,extendMarkRange:()=>cF,first:()=>uF,focus:()=>hF,forEach:()=>fF,insertContent:()=>pF,insertContentAt:()=>mF,insertDefaultBlock:()=>gF,joinBackward:()=>bF,joinDown:()=>yF,joinForward:()=>vF,joinItemBackward:()=>kF,joinItemForward:()=>wF,joinTextblockBackward:()=>SF,joinTextblockForward:()=>NF,joinUp:()=>xF,keyboardShortcut:()=>jF,lift:()=>EF,liftEmptyBlock:()=>TF,liftListItem:()=>MF,newlineInCode:()=>PF,resetAttributes:()=>AF,scrollIntoView:()=>DF,selectAll:()=>LF,selectNodeBackward:()=>RF,selectNodeForward:()=>_F,selectParentNode:()=>IF,selectTextblockEnd:()=>OF,selectTextblockStart:()=>BF,setContent:()=>zF,setMark:()=>oV,setMeta:()=>aV,setNode:()=>lV,setNodeSelection:()=>cV,setTextDirection:()=>uV,setTextSelection:()=>dV,sinkListItem:()=>hV,splitBlock:()=>fV,splitListItem:()=>pV,toggleList:()=>gV,toggleMark:()=>xV,toggleNode:()=>yV,toggleWrap:()=>bV,undoInputRule:()=>vV,unsetAllMarks:()=>kV,unsetMark:()=>wV,unsetTextDirection:()=>SV,updateAttributes:()=>NV,updateDecorations:()=>CV,wrapIn:()=>jV,wrapInList:()=>EV});const Oo=new WeakMap;function MV(t,e){var n;Oo.set(t,((n=Oo.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;const s=((r=Oo.get(t))!==null&&r!==void 0?r:1)-1;s>0?Oo.set(t,s):Oo.delete(t)}}var PV=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function AV(t){return t.kind==="widget"}function ST(t,e){const n=[],r=new Set;for(const s of t)s.kind==="widget"&&AV(s)&&r.add(s.key),n.push(s.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function DV(t,e,n){const{decorations:r,widgetKeys:s}=ST(e,n);return{set:de.create(t,r),widgetKeys:s}}function NT({position:t,from:e,to:n,docSize:r}){return t<e?!1:t<n?!0:t===n&&n===r}function LV({decorations:t,from:e,to:n,docSize:r,extensionName:s,warnedExtensions:i}){return t.filter(o=>NT({position:o.anchor,from:e,to:n,docSize:r})?!0:(o.anchor===n||i.has(s)||(i.add(s),console.warn(`[tiptap warn]: Extension "${s}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function RV(t){var e;const n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function CT(t){return t.jsonID==="attr"}function _V(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||CT(t))return!0;const n=t;return typeof n.from=="number"&&typeof n.to=="number"}function IV(t,e){let n=null,r=0,s=0;for(let i=0;i<t.childCount&&!(s>e.to);i+=1){const o=s+t.child(i).nodeSize;o>=e.from&&(n===null&&(n=s),r=o),s=o}return n===null?null:{from:n,to:r}}function OV(t,e){if(t.steps.some(i=>!_V(i)))return{type:"full"};const n=gh(t).map(({newRange:i})=>i);t.steps.forEach((i,o)=>{if(!CT(i))return;const a=t.mapping.slice(o);n.push({from:a.map(i.pos,-1),to:a.map(i.pos+1)})});const r=[];for(const i of n){const o=IV(e,i);o&&r.push(o)}r.sort((i,o)=>i.from-o.from);const s=[];for(const i of r){const o=s[s.length-1];o&&i.from<=o.to?o.to=Math.max(o.to,i.to):s.push({...i})}return{type:"ranges",ranges:s}}function jT(t,e,n,r){return t.map(e,n,{onRemove:s=>{const i=s==null?void 0:s.key;typeof i=="string"&&r.delete(i)}})}function BV(t,e,n){var r,s;const i=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:de.empty,o=new Set((s=e.widgetKeysByExtension[t])!==null&&s!==void 0?s:[]);return{set:jT(i,n.mapping,n.doc,o),widgetKeys:o}}function iw(t,e){const n=Object.values(e).flatMap(r=>r.find());return de.create(t,n)}function ow(t){const e=new Set;for(const n of Object.values(t))for(const r of n)e.add(r);return e}function zV(t,e){var n;switch((n=e.update)!==null&&n!==void 0?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function FV(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}const VV=new Set;var $V=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const n=mi.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>zV(e,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return(t=(e=mi.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:VV}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){const e=[];for(const{name:n,addDecorations:r}of t){const s=r();s&&e.push({name:n,spec:s})}return e}createPlugin(){const{editor:t,entries:e}=this;return new Se({key:mi,state:{init:(n,r)=>{const s={},i={};for(const{name:a,spec:l}of e){const{set:u,widgetKeys:d}=this.buildFullSet(a,l,r);s[a]=u,i[a]=d}const o={decorationSetsByExtension:s,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:ow(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(n,r,s,i)=>{const o=n.getMeta(mi),a=(o==null?void 0:o.type)==="force"&&!o.name,l=(o==null?void 0:o.type)==="force"?o.name:void 0,u={},d={},h=new Set;return MV(t,()=>{for(const{name:f,spec:p}of e){const m=a||l===f;if(FV(p,{editor:t,tr:n,oldState:s,newState:i},m))if(p.update==="changedRanges"&&n.docChanged&&!m){const g=this.applyChangedRangesRecompute(f,p,r,n,i);u[f]=g.set,d[f]=g.widgetKeys,h.add(f)}else{const{set:g,widgetKeys:x}=this.buildFullSet(f,p,i);u[f]=g,d[f]=x,h.add(f)}else{const g=BV(f,r,n);u[f]=g.set,d[f]=g.widgetKeys}}}),h.size===0&&!n.docChanged?r:{decorationSetsByExtension:u,widgetKeysByExtension:d,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:u,recomputedNames:h}),widgetKeys:ow(d)}}},props:{decorations(n){var r,s;return(r=(s=mi.getState(n))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:de.empty}}})}applyChangedRangesRecompute(t,e,n,r,s){const i=OV(r,s.doc);return i.type==="full"?this.buildFullSet(t,e,s):this.rebuildRanges(t,e,n,r,s,i.ranges)}rebuildRanges(t,e,n,r,s,i){var o,a;const l=(o=n.decorationSetsByExtension[t])!==null&&o!==void 0?o:de.empty,u=new Set((a=n.widgetKeysByExtension[t])!==null&&a!==void 0?a:[]);let d=jT(l,r.mapping,r.doc,u);const h=s.doc.content.size;for(const{from:f,to:p}of i){const m=d.find(f,p).filter(y=>NT({position:y.from,from:f,to:p,docSize:h}));for(const y of m){const b=RV(y);b&&u.delete(b)}d=d.remove(m);const{decorations:g,widgetKeys:x}=ST(LV({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:s,view:this.mountedView,from:f,to:p})),from:f,to:p,docSize:h,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);d=d.add(s.doc,g);for(const y of x)u.add(y)}return{set:d,widgetKeys:u}}buildFullSet(t,e,n){const r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return DV(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(t){}buildMergedSet(t,e){const n=Object.keys(e);return n.length===1?e[n[0]]:iw(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:s}){return t.length===1?r[t[0].name]:s.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):iw(n.doc,r)}};function HV(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Z){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function WV(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}function Pl(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map(i=>i.trim()).filter(Boolean),s=e.toLowerCase();for(let i=r.length-1;i>=0;i-=1){const o=r[i],a=o.indexOf(":");if(a!==-1&&o.slice(0,a).trim().toLowerCase()===s)return o.slice(a+1).trim()}return null}function UV(t){return typeof t=="number"}function KV(t){return Object.prototype.toString.call(t).slice(8,-1)}function mc(t){return KV(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function aw(t,e,n){const r=t.split(`
`),s=[];let i="",o=0;const a=e.baseIndentSize||2;for(;o<r.length;){const d=r[o],h=d.match(e.itemPattern);if(!h){if(s.length>0)break;if(d.trim()===""){o+=1,i=`${i}${d}
`;continue}else return}const f=e.extractItemData(h),{indentLevel:p,mainContent:m}=f;i=`${i}${d}
`;const g=[m];for(o+=1;o<r.length;){var l;const k=r[o];if(k.trim()===""){var u;const w=r.slice(o+1).findIndex(C=>C.trim()!=="");if(w===-1)break;if((((u=r[o+1+w].match(/^(\s*)/))===null||u===void 0||(u=u[1])===null||u===void 0?void 0:u.length)||0)>p){g.push(k),i=`${i}${k}
`,o+=1;continue}else break}if((((l=k.match(/^(\s*)/))===null||l===void 0||(l=l[1])===null||l===void 0?void 0:l.length)||0)>p)g.push(k),i=`${i}${k}
`,o+=1;else break}let x;const y=g.slice(1);if(y.length>0){const k=y.map(w=>w.slice(p+a)).join(`
`);k.trim()&&(e.customNestedParser?x=e.customNestedParser(k):x=n.blockTokens(k))}const b=e.createToken(f,x);s.push(b)}if(s.length!==0)return{items:s,raw:i}}const lw=4;function cw(t){let e=0;for(const n of t)e=n===" "?e+lw-e%lw:e+1;return e}function ET(t,e,n,r,s){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[o,...a]=t.content;let l=`${i}${e.renderChildren([o])}`;return a&&a.length>0&&a.forEach((u,d)=>{var h,f;const p=(h=(f=e.renderChild)===null||f===void 0?void 0:f.call(e,u,d+1))!==null&&h!==void 0?h:e.renderChildren([u]);if(p!=null){const m=x=>{if(!(s!=null&&s.alignNestedToPrefix))return e.indent(x);const y=e.indent(""),b=cw(i);return(cw(y)>=b?y:" ".repeat(b))+x},g=p.split(`
`).map(x=>m(x||"")).join(`
`);l+=u.type==="paragraph"?`
${g}`:`
${g}`}}),l}function TT(t,e){const n={...t};return mc(t)&&mc(e)&&Object.keys(e).forEach(r=>{mc(e[r])&&mc(t[r])?n[r]=TT(t[r],e[r]):n[r]=e[r]}),n}function GV(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,l)=>{const u=i.mapping.map(l),d=i.mapping.map(l)+a.nodeSize;let h=null;if(a.marks.forEach(p=>{if(p!==o)return!1;h=p}),!h)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==h.attrs[p]&&(f=!0)}),f){const p=t.type.create({...t.attrs,...n});i.removeMark(u,d,t.type),i.addMark(u,d,p)}}),i.docChanged&&e.view.dispatch(i)}var Al=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}};const qV=(t,e)=>{if(ax(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function gc(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const h=QF(u)+i;return o.forEach(f=>{if(d)return;const p=qV(h,f.find);if(!p)return;const m=p[0].length-i.length;if(m>0){const C=u.parentOffset-m;if(C<0||u.parent.textBetween(C,u.parentOffset)!==p[0].slice(0,m))return}const g=l.state.tr,x=fh({state:l.state,transaction:g}),y={from:r-(p[0].length-i.length),to:s},{commands:b,chain:k,can:w}=new Vi({editor:n,state:x});f.handler({state:x,range:y,match:p,commands:b,chain:k,can:w})===null||!g.steps.length||(f.undoable&&g.setMeta(a,{transform:g,from:r,to:s,text:i}),l.dispatch(g),d=!0)}),d}function JV(t){const{editor:e,rules:n}=t,r=new Se({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=ux(z.from(u),o.schema);const{from:d}=l,h=d+u.length;gc({editor:e,from:d,to:h,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return gc({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&gc({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?gc({editor:e,from:o.pos,to:o.pos,text:`
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var hx=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...he(J(this,"addOptions",{name:this.name}))}}get storage(){return{...he(J(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>TT(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},hs=class MT extends hx{constructor(...e){super(...e),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new MT(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!i.find(a=>(a==null?void 0:a.type.name)===n.name))return!1;const o=i.find(a=>(a==null?void 0:a.type.name)===n.name);return o&&r.removeStoredMark(o),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},PT=class{constructor(t){this.find=t.find,this.handler=t.handler}};const YV=(t,e,n)=>{if(ax(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function XV(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:u,can:d}=new Vi({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,s,(f,p)=>{var m,g,x,y;if(!((m=f.type)===null||m===void 0||(m=m.spec)===null||m===void 0)&&m.code||!(f.isText||f.isTextblock||f.isInline))return;const b=(g=(x=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&x!==void 0?x:f.nodeSize)!==null&&g!==void 0?g:0,k=Math.max(r,p),w=Math.min(s,p+b);if(k>=w)return;const C=f.isText?f.text||"":f.textBetween(k-p,w-p,void 0,"");YV(C,i.find,o).forEach(j=>{if(j.index===void 0)return;const S=k+j.index+1,N=S+j[0].length,T={from:n.tr.mapping.map(S),to:n.tr.mapping.map(N)},E=i.handler({state:n,range:T,match:j,commands:l,chain:u,can:d,pasteEvent:o,dropEvent:a});h.push(E)})}),h.every(f=>f!==null)}let xc=null;const ZV=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function QV(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:h,rule:f,pasteEvt:p})=>{const m=u.tr,g=fh({state:u,transaction:m});if(!(!XV({editor:e,state:g,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new Se({view(d){const h=p=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,r&&(xc=e)},f=()=>{xc&&(xc=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(i=r===d.dom.parentElement,a=h,!i){const f=xc;f!=null&&f.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=h,s=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!s,g=p.getMeta("uiEvent")==="drop"&&!i,x=p.getMeta("applyPasteRules"),y=!!x;if(!m&&!g&&!y)return;if(y){let{text:w}=x;typeof w=="string"?w=w:w=ux(z.from(w),f.schema);const{from:C}=x,j=C+w.length,S=ZV(w);return l({rule:u,state:f,from:C,to:{b:j},pasteEvt:S})}const b=h.doc.content.findDiffStart(f.doc.content),k=h.doc.content.findDiffEnd(f.doc.content);if(!(!UV(b)||!k||b===k.b))return l({rule:u,state:f,from:b,to:k,pasteEvt:o})}}))}var xh=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=mT(t),this.schema=UF(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=J(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ui(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=xa([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ui(r.name,this.schema)},i=[],o=J(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&J(r,"exitable",s)&&(a.ArrowRight=()=>hs.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:t})]));a={...a,...f}}const l=qz(a);i.push(l);const u=J(r,"addInputRules",s);if(nw(r,t.options.enableInputRules)&&u){const f=u();if(f&&f.length){const p=JV({editor:t,rules:f}),m=Array.isArray(p)?p:[p];i.push(...m)}}const d=J(r,"addPasteRules",s);if(nw(r,t.options.enablePasteRules)&&d){const f=d();if(f&&f.length){const p=QV({editor:t,rules:f});i.push(...p)}}const h=J(r,"addProseMirrorPlugins",s);if(h){const f=h();i.push(...f)}return i}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;const{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();const n=[];return this.extensions.forEach(r=>{const s=J(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ui(r.name,this.schema)});s&&n.push({name:r.name,addDecorations:s})}),this.decorationManager=new $V({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){return pT(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ao(this.extensions);return Object.fromEntries(e.filter(n=>!!J(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s=J(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ge(n.name,this.schema)});if(!s)return[];const i=s();if(!i)return[];const o=(a,l,u,d,h)=>{const f=al(a,r);return i({node:a,view:l,getPos:u,decorations:d,innerDecorations:h,editor:t,extension:n,HTMLAttributes:f})};return[n.name,o]}))}dispatchTransaction(t){const{editor:e}=this;return xa([...this.extensions].reverse()).reduceRight((n,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ui(r.name,this.schema)},i=J(r,"dispatchTransaction",s);return i?o=>{i.call(s,{transaction:o,next:n})}:n},t)}transformPastedHTML(t){const{editor:e}=this;return xa([...this.extensions]).reduce((n,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ui(r.name,this.schema)},i=J(r,"transformPastedHTML",s);return i?(o,a)=>{const l=n(o,a);return i.call(s,l)}:n},t||(n=>n))}get markViews(){const{editor:t}=this,{markExtensions:e}=ao(this.extensions);return Object.fromEntries(e.filter(n=>!!J(n,"addMarkView")).map(n=>{const r=this.attributes.filter(o=>o.type===n.name),s=J(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:pr(n.name,this.schema)});if(!s)return[];const i=(o,a,l)=>{const u=al(o,r);return s()({mark:o,view:a,inline:l,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{GV(o,t,d)}})};return[n.name,i]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ui(e.name,this.schema)};if(e.type==="mark"){var r,s;(!((r=he(J(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((s=he(J(e,"clearable",n)))!==null&&s!==void 0)||s||this.nonClearableMarks.push(e.name)}const i=J(e,"onBeforeCreate",n),o=J(e,"onCreate",n),a=J(e,"onUpdate",n),l=J(e,"onSelectionUpdate",n),u=J(e,"onTransaction",n),d=J(e,"onFocus",n),h=J(e,"onBlur",n),f=J(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),h&&this.editor.on("blur",h),f&&this.editor.on("destroy",f)})}};xh.resolve=mT;xh.sort=xa;xh.flatten=cx;var me=class AT extends hx{constructor(...e){super(...e),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new AT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};const e8=me.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Se({key:new $e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=xT(n),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((l,u)=>l.$from.pos-u.$from.pos).map(({$from:l,$to:u})=>gT(r,{from:l.pos,to:u.pos},a)).join(o??`
`)}}})]}}),t8=me.create({name:"commands",addCommands(){return{...TV}}}),n8=me.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;const s=()=>{var i,o,a;if((i=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(a=o.filterTransaction)===null||a===void 0?void 0:a.call(o,t))!==null&&i!==void 0?i:t.getMeta("y-sync$"))return;const l=hT(t.before,[t,...e]);gh(l).forEach(d=>{l.mapping.mapResult(d.oldRange.from).deletedAfter&&l.mapping.mapResult(d.oldRange.to).deletedBefore&&l.before.nodesBetween(d.oldRange.from,d.oldRange.to,(h,f)=>{const p=f+h.nodeSize-2,m=d.oldRange.from<=f&&p<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:f,to:p,newFrom:l.mapping.map(f),newTo:l.mapping.map(p),deletedRange:d.oldRange,newRange:d.newRange,partial:!m,editor:this.editor,transaction:t,combinedTransform:l})})});const u=l.mapping;l.steps.forEach((d,h)=>{if(d instanceof bn){var f,p;const m=u.slice(h).map(d.from,-1),g=u.slice(h).map(d.to),x=u.invert().map(m,-1),y=u.invert().map(g),b=m>0?(f=l.doc.nodeAt(m-1))===null||f===void 0?void 0:f.marks.some(w=>w.eq(d.mark)):!1,k=(p=l.doc.nodeAt(g))===null||p===void 0?void 0:p.marks.some(w=>w.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:x,to:y},newRange:{from:m,to:g},partial:!!(k||b),editor:this.editor,transaction:t,combinedTransform:l})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(s,0):s()}}),r8=me.create({name:"drop",addProseMirrorPlugins(){return[new Se({key:new $e("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),s8=me.create({name:"editable",addProseMirrorPlugins(){return[new Se({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),i8=new $e("focusEvents"),o8=me.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Se({key:i8,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),a8=me.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:d,$anchor:h}=l,{pos:f,parent:p}=h,m=h.parent.isTextblock&&f>0?a.doc.resolve(f-1):h,g=m.parent.type.spec.isolating,x=h.pos-h.parentOffset,y=g&&m.parent.childCount===1?x===h.pos:ie.atStart(u).from===f;return!d||!p.type.isTextblock||p.textContent.length||!y||y&&h.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Yu()||uT()?i:s},addProseMirrorPlugins(){return[new Se({key:new $e("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(p=>p.getMeta("composition")))return;const r=t.some(p=>p.docChanged)&&!e.doc.eq(n.doc),s=t.some(p=>p.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=ie.atStart(e.doc).from,u=ie.atEnd(e.doc).to;if(i||!(o===l&&a===u)||!Ml(n.doc))return;const d=n.tr,h=fh({state:n,transaction:d}),{commands:f}=new Vi({editor:this.editor,state:h});if(f.clearNodes(),!!d.steps.length)return d}})]}}),l8=me.create({name:"paste",addProseMirrorPlugins(){return[new Se({key:new $e("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),c8=me.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Se({key:new $e("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),u8=me.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ao(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Se({key:new $e("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});let uw=!1;function d8(t){if(uw)return;uw=!0;let e;try{e=Ie.fromJSON(t,{from:0,to:0}).slice.content}catch{return}e instanceof z||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var h8=class Yo{get name(){return this.node.type.name}constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Yo(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Yo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Yo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!s&&!o&&l.depth<=this.depth)return;const u=new Yo(l,this.editor,s,s||o?n:null);s&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==n[l])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(a=>n[a]===o.node.attrs[a])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}};const f8=`.ProseMirror {
position: relative;
}
.ProseMirror {
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}
.ProseMirror [contenteditable="false"] {
white-space: normal;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 0 !important;
height: 0 !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}`;var p8=class extends PV{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?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:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:rV,createMappablePosition:sV},this.setOptions(t),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",({event:n,slice:r,moved:s})=>this.options.onDrop(n,r,s)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=Zm(e,this.options.autofocus);this.editorState=Es.create({doc:e,schema:this.schema,selection:n||void 0})}d8(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Vi.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Vi.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=WV(f8,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=fT(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[s8,e8.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),t8,o8,a8,c8.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),r8,l8,n8,u8.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new xh(n,this)}createCommandManager(){this.commandManager=new Vi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Qm(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=Qm(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Es.create({doc:n,schema:this.schema,selection:Zm(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new eT(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(u=>{var d;return(d=this.capturedTransaction)===null||d===void 0?void 0:d.step(u)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return yT(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return eV(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ux(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
`,textSerializers:n={}}=t||{};return GF(this.state.doc,{blockSeparator:e,textSerializers:{...xT(this.schema),...n}})}get isEmpty(){return Ml(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new h8(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Zs(t){return new Al({find:t.find,handler:({state:e,range:n,match:r})=>{const s=he(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),u=n.from+a.indexOf(o),d=u+o.length;if(dx(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(p=>p===t.type&&p!==f.mark.type)).filter(f=>f.to>u).length)return null;d<n.to&&i.delete(d,n.to),u>n.from&&i.delete(n.from+l,u);const h=n.from+l+o.length;i.addMark(n.from+l,h,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function m8(t){return new Al({find:t.find,handler:({state:e,range:n,match:r})=>{const s=he(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let a=n.to;const l=t.type.create(s);if(r[1]){let u=o+r[0].lastIndexOf(r[1]);u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,l)}else if(r[0]){const u=t.type.isInline?o:o-1;i.insert(u,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:t.undoable})}function tg(t){return new Al({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=he(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function lo(t){return new Al({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=he(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),l=a&&K0(a,t.type,i);if(!l)return null;if(o.wrap(a,l),t.keepMarks&&t.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=t.editor.extensionManager,p=h||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&us(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}var Kt=class DT extends hx{constructor(...e){super(...e),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new DT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function rs(t){return new PT({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=he(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let u=n.to;if(a){const d=l.search(/\S/),h=n.from+l.indexOf(a),f=h+a.length;if(dx(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>h).length)return null;f<n.to&&o.delete(f,n.to),h>n.from&&o.delete(n.from+d,h),u=n.from+d+a.length,o.addMark(n.from+d,u,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:g8,getOwnPropertySymbols:x8}=Object,{hasOwnProperty:y8}=Object.prototype;function Bo(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function zo(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),a=i.get(r);if(o&&a)return o===r&&a===n;i.set(n,r),i.set(r,n);const l=t(n,r,s);return i.delete(n),i.delete(r),l}}function b8(t){return t!=null?t[Symbol.toStringTag]:void 0}function dw(t){return g8(t).concat(x8(t))}const v8=Object.hasOwn||((t,e)=>y8.call(t,e));function ri(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const k8="__v",w8="__o",S8="_owner",N8=typeof Float16Array<"u",{getOwnPropertyDescriptor:hw,keys:fw}=Object;function C8(t,e){return t.byteLength===e.byteLength&&Xu(new Uint8Array(t),new Uint8Array(e))}function j8(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function E8(t,e){return t.byteLength===e.byteLength&&Xu(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function T8(t,e){return ri(t.getTime(),e.getTime())}function pw(t,e,n){return t.name===e.name&&t.message===e.message&&t.stack===e.stack&&n.equals(t.cause,e.cause,"cause","cause",t,e,n)}function M8(t,e){return t===e}function mw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,a,l=0;for(;(o=i.next())&&!o.done;){const u=e.entries();let d=!1,h=0;for(;(a=u.next())&&!a.done;){if(s[h]){h++;continue}const f=o.value,p=a.value;if(n.equals(f[0],p[0],l,h,t,e,n)&&n.equals(f[1],p[1],f[0],p[0],t,e,n)){d=s[h]=!0;break}h++}if(!d)return!1;l++}return!0}const P8=ri;function gw(t,e,n){const r=fw(t);let s=r.length;if(fw(e).length!==s)return!1;for(;s-- >0;)if(!LT(t,e,n,r[s]))return!1;return!0}function di(t,e,n){const r=dw(t);let s=r.length;if(dw(e).length!==s)return!1;let i,o,a;for(;s-- >0;)if(i=r[s],!LT(t,e,n,i)||(o=hw(t,i),a=hw(e,i),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function A8(t,e){return ri(t.valueOf(),e.valueOf())}function D8(t,e){return t.source===e.source&&t.flags===e.flags}function xw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,a;for(;(o=i.next())&&!o.done;){const l=e.values();let u=!1,d=0;for(;(a=l.next())&&!a.done;){if(!s[d]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function Xu(t,e){let n=t.length;if(e.length!==n||t.byteOffset!==e.byteOffset)return!1;if(t instanceof Float64Array||t instanceof Float32Array||N8&&t instanceof Float16Array){for(;n-- >0;)if(t[n]!==e[n]&&(t[n]===t[n]||e[n]===e[n]))return!1;return!0}for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function L8(t,e){return t.href===e.href?!0:t.protocol===e.protocol&&t.username===e.username&&t.password===e.password&&t.host===e.host&&t.pathname===e.pathname&&t.hash===e.hash&&R8(t.searchParams,e.searchParams)}function R8(t,e){const n=t.toString(),r=e.toString();return n===r||yw(n)===yw(r)}function yw(t){return t.split("&").sort().join("&")}function LT(t,e,n,r){return(r===S8||r===w8||r===k8)&&(t.$$typeof||e.$$typeof)?!0:v8(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const _8="[object ArrayBuffer]",I8="[object Arguments]",O8="[object Boolean]",B8="[object DataView]",z8="[object Date]",F8="[object Error]",V8="[object Map]",$8="[object Number]",H8="[object Object]",W8="[object RegExp]",U8="[object Set]",K8="[object String]",G8={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},q8="[object URL]",J8=Object.prototype.toString;function Y8({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:h,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(x,y,b){if(x===y)return!0;if(x==null||y==null)return!1;const k=typeof x;if(k!==typeof y)return!1;if(k!=="object")return k==="number"?a(x,y,b):k==="function"?i(x,y,b):!1;const w=x.constructor;if(w!==y.constructor)return!1;if(w===Object)return l(x,y,b);if(Array.isArray(x))return e(x,y,b);if(w===Date)return r(x,y,b);if(w===RegExp)return d(x,y,b);if(w===Map)return o(x,y,b);if(w===Set)return h(x,y,b);const C=J8.call(x);if(C===z8)return r(x,y,b);if(C===W8)return d(x,y,b);if(C===V8)return o(x,y,b);if(C===U8)return h(x,y,b);if(C===H8)return typeof x.then!="function"&&typeof y.then!="function"&&l(x,y,b);if(C===q8)return p(x,y,b);if(C===F8)return s(x,y,b);if(C===I8)return l(x,y,b);if(G8[C])return f(x,y,b);if(C===_8)return t(x,y,b);if(C===B8)return n(x,y,b);if(C===O8||C===$8||C===K8)return u(x,y,b);if(m){let j=m[C];if(!j){const S=b8(x);S&&(j=m[S])}if(j)return j(x,y,b)}return!1}}function X8({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:C8,areArraysEqual:n?di:j8,areDataViewsEqual:E8,areDatesEqual:T8,areErrorsEqual:n?Bo(pw,di):Bo(pw,gw),areFunctionsEqual:M8,areMapsEqual:n?Bo(mw,di):mw,areNumbersEqual:P8,areObjectsEqual:n?di:gw,arePrimitiveWrappersEqual:A8,areRegExpsEqual:D8,areSetsEqual:n?Bo(xw,di):xw,areTypedArraysEqual:n?Bo(Xu,di):Xu,areUrlsEqual:L8,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=zo(r.areArraysEqual),i=zo(r.areErrorsEqual),o=zo(r.areMapsEqual),a=zo(r.areObjectsEqual),l=zo(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areErrorsEqual:i,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:l})}return r}function Z8(t){return function(e,n,r,s,i,o,a){return t(e,n,a)}}function Q8({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(a,l){const{cache:u=t?new WeakMap:void 0,meta:d}=n();return e(a,l,{cache:u,equals:r,meta:d,strict:s})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,l){return e(a,l,i)}}const e$=fs();fs({strict:!0});fs({circular:!0});fs({circular:!0,strict:!0});fs({createInternalComparator:()=>ri});fs({strict:!0,createInternalComparator:()=>ri});fs({circular:!0,createInternalComparator:()=>ri});fs({circular:!0,createInternalComparator:()=>ri,strict:!0});function fs(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=X8(t),o=Y8(i),a=n?n(o):Z8(o);return Q8({circular:e,comparator:o,createState:r,equals:a,strict:s})}var RT={exports:{}},_T={};/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var yh=v,t$=H0;function n$(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var r$=typeof Object.is=="function"?Object.is:n$,s$=t$.useSyncExternalStore,i$=yh.useRef,o$=yh.useEffect,a$=yh.useMemo,l$=yh.useDebugValue;_T.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=i$(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=a$(function(){function l(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var m=o.value;if(s(m,p))return h=m}return h=p}if(m=h,r$(d,p))return m;var g=r(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,h=g)}var u=!1,d,h,f=n===void 0?null:n;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,n,r,s]);var a=s$(t,i[0],i[1]);return o$(function(){o.hasValue=!0,o.value=a},[a]),l$(a),a};RT.exports=_T;var c$=RT.exports;const u$=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},d$=({contentComponent:t})=>{const e=H0.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return c.jsx(c.Fragment,{children:Object.values(e)})};function h$(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:xA.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var f$=class extends Xr.Component{constructor(t){super(t),this.editorContentRef=Xr.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=h$(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:u$(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&c.jsx(d$,{contentComponent:t.contentComponent})]})}};const p$=v.forwardRef((t,e)=>{const n=Xr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Xr.createElement(f$,{key:n,innerRef:e,...t})}),IT=Xr.memo(p$),m$=typeof window<"u"?v.useLayoutEffect:v.useEffect;var g$=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=s=>{(s==null?void 0:s.transaction)!==void 0&&s.transaction===e||(e=s==null?void 0:s.transaction,this.transactionNumber+=1,this.subscribers.forEach(i=>i()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function x$(t){var e;const[n]=v.useState(()=>new g$(t.editor)),r=c$.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:e$);return m$(()=>n.watch(t.editor),[t.editor,n]),v.useDebugValue(r),r}const y$=!1,OT=typeof window>"u",b$=OT||!!(typeof window<"u"&&window.next);var v$=class BT{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return OT?(n&&y$&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):b$&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(s,...n)},onBlur:(...n)=>{var r,s;return(r=(s=this.options.current).onBlur)===null||r===void 0?void 0:r.call(s,...n)},onCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onCreate)===null||r===void 0?void 0:r.call(s,...n)},onDestroy:(...n)=>{var r,s;return(r=(s=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(s,...n)},onFocus:(...n)=>{var r,s;return(r=(s=this.options.current).onFocus)===null||r===void 0?void 0:r.call(s,...n)},onSelectionUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(s,...n)},onTransaction:(...n)=>{var r,s;return(r=(s=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(s,...n)},onUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(s,...n)},onContentError:(...n)=>{var r,s;return(r=(s=this.options.current).onContentError)===null||r===void 0?void 0:r.call(s,...n)},onDrop:(...n)=>{var r,s;return(r=(s=this.options.current).onDrop)===null||r===void 0?void 0:r.call(s,...n)},onPaste:(...n)=>{var r,s;return(r=(s=this.options.current).onPaste)===null||r===void 0?void 0:r.call(s,...n)},onDelete:(...n)=>{var r,s;return(r=(s=this.options.current).onDelete)===null||r===void 0?void 0:r.call(s,...n)},onMount:(...n)=>{var r,s;return(r=(s=this.options.current).onMount)===null||r===void 0?void 0:r.call(s,...n)},onUnmount:(...n)=>{var r,s;return(r=(s=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(s,...n)}};return new p8(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)===null||o===void 0?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?BT.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,r)=>n===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function k$(t={},e=[]){const n=v.useRef(t);n.current=t;const[r]=v.useState(()=>new v$(n)),s=H0.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return v.useDebugValue(s),v.useEffect(r.onRender(e)),x$({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}const zT=v.createContext({editor:null});zT.Consumer;const w$=v.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),S$=()=>v.useContext(w$);Xr.forwardRef((t,e)=>{const{onDragStart:n}=S$(),r=t.as||"div";return c.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Xr.createContext({markViewContentRef:()=>{}});const fx=v.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});fx.displayName="TiptapContext";const N$=()=>v.useContext(fx);function FT({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=v.useMemo(()=>({editor:n}),[n]),s=v.useMemo(()=>({editor:n}),[n]);return c.jsx(zT.Provider,{value:s,children:c.jsx(fx.Provider,{value:r,children:t})})}FT.displayName="Tiptap";function VT({...t}){const{editor:e}=N$();return c.jsx(IT,{editor:e,...t})}VT.displayName="Tiptap.Content";Object.assign(FT,{Content:VT});const $T=new WeakSet,HT=new WeakSet;function gs(t){const e=t;return $T.add(e),e}function ng(t){return Array.isArray(t)&&$T.has(t)}function WT(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&HT.has(e)&&!ng(e)?WT(e):[e])}function C$(t,e){if(t==="slot")return 0;if(t instanceof Function){const s=t(e);return Array.isArray(s)&&!ng(s)&&!HT.has(s)?gs(s):s}const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(ng(n))return gs([t,r,n]);if(n.length===0)return gs([t,r]);const s=WT(n);return s.length===0?gs([t,r]):gs([t,r,...s])}return n!=null?gs([t,r,n]):gs([t,r])}const Zu=(t,e)=>C$(t,e),j$=(t,e)=>{var n;const{state:r}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0)return!1;const o=i.depth-1;if(o<0)return!1;const a=i.node(o),l=i.index(o);if(l===0)return!1;if(a.type===e)return t.commands.lift(e.name);const u=a.child(l-1);if(u.type!==e||!(!((n=u.lastChild)===null||n===void 0)&&n.isTextblock))return!1;const d=i.before()-1-1;return t.commands.command(({tr:h,dispatch:f})=>{if(!f)return!0;const p=i.parent.content,m=new W(p,0,0);return h.replace(d,i.after(),m),h.setSelection(Q.create(h.doc,d+p.size)),h.scrollIntoView(),f(h),!0})},E$=/^\s*>\s$/,T$=Kt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Zu("blockquote",{...Ve(this.options.HTMLAttributes,t),children:Zu("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,i)=>{var o,a;const l=((o=(a=e.renderChild)===null||a===void 0?void 0:a.call(e,s,i))!==null&&o!==void 0?o:e.renderChildren([s])).split(`
`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(l.join(`
`))}),r.join(`
${n}
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>j$(this.editor,this.type)}},addInputRules(){return[lo({find:E$,type:this.type})]}}),M$=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,P$=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,A$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,D$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,L$=hs.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Zu("strong",{...Ve(this.options.HTMLAttributes,t),children:Zu("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Zs({find:M$,type:this.type}),Zs({find:A$,type:this.type})]},addPasteRules(){return[rs({find:P$,type:this.type}),rs({find:D$,type:this.type})]}}),R$=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},_$=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},I$=hs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ve(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Zs({find:R$,type:this.type})]},addPasteRules(){return[rs({find:_$,type:this.type})]}}),zf=4,O$=/^```([a-z]+)?[\s\n]$/,B$=/^~~~([a-z]+)?[\s\n]$/,z$=Kt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:zf,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ve(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
`):r=`\`\`\`${s}
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:zf,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:u,to:d}=s,h=r.doc.textBetween(u,d,`
`,`
`).split(`
`).map(f=>a+f).join(`
`);return l.replaceWith(u,d,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:zf,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var l;const{pos:u}=i,d=i.start(),h=i.end(),f=r.doc.textBetween(d,h,`
`,`
`).split(`
`);let p=0,m=0;const g=u-d;for(let k=0;k<f.length;k+=1){if(m+f[k].length>=g){p=k;break}m+=f[k].length+1}const x=((l=f[p].match(/^ */))===null||l===void 0?void 0:l[0])||"",y=Math.min(x.length,n);if(y===0)return!0;let b=d;for(let k=0;k<p;k+=1)b+=f[k].length+1;return a.delete(b,b+y),u-b<=y&&a.setSelection(Q.create(a.doc,b)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:u}=s,d=r.doc.textBetween(l,u,`
`,`
`).split(`
`).map(h=>{var f;const p=((f=h.match(/^ */))===null||f===void 0?void 0:f[0])||"",m=Math.min(p.length,n);return h.slice(m)}).join(`
`);return a.replaceWith(l,u,r.schema.text(d)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
`);return!i||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type||r.parentOffset!==0)return!1;const i=r.before();return i>0?!1:t.commands.insertDefaultBlock({pos:i})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||s.parentOffset!==s.parent.nodeSize-2)return!1;const o=s.after();return o===void 0?!1:r.nodeAt(o)?t.commands.command(({tr:a})=>(a.setSelection(ie.near(r.resolve(o))),!0)):t.commands.exitCode()}}},addInputRules(){return[tg({find:O$,type:this.type,getAttributes:t=>({language:t[1]})}),tg({find:B$,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Se({key:new $e("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
`));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(Q.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),F$=Kt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):""}),V$=Kt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ve(this.options.HTMLAttributes,t)]},renderText(){return`
`},renderMarkdown:()=>`
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&l&&o){const h=l.filter(f=>a.includes(f.type.name));u.ensureMarks(h)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),$$=Kt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ve(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>tg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),H$=Kt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ve(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!HV(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return bT(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,u=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(Q.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(Z.create(o.doc,l.pos)):o.setSelection(Q.create(o.doc,l.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,h=d==null?void 0:d.create();h&&(o.insert(u,h),o.setSelection(Q.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[m8({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),W$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,U$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,K$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,G$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,q$=hs.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ve(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Zs({find:W$,type:this.type}),Zs({find:K$,type:this.type})]},addPasteRules(){return[rs({find:U$,type:this.type}),rs({find:G$,type:this.type})]}}),J$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Y$="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",rg="numeric",sg="ascii",ig="alpha",ya="asciinumeric",Xo="alphanumeric",og="domain",UT="emoji",X$="scheme",Z$="slashscheme",Ff="whitespace";function Q$(t,e){return t in e||(e[t]=[]),e[t]}function As(t,e,n){e[rg]&&(e[ya]=!0,e[Xo]=!0),e[sg]&&(e[ya]=!0,e[ig]=!0),e[ya]&&(e[Xo]=!0),e[ig]&&(e[Xo]=!0),e[Xo]&&(e[og]=!0),e[UT]&&(e[og]=!0);for(const r in e){const s=Q$(r,n);s.indexOf(t)<0&&s.push(t)}}function e9(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Mt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Mt.groups={};Mt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Mt.groups;let s;return e&&e.j?s=e:(s=new Mt(e),n&&r&&As(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Mt.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new Mt,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Mt,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(e9(o.t,r),n);As(i,l,r)}else n&&As(i,n,r);o.t=i}return s.j[t]=o,o}};const oe=(t,e,n,r,s)=>t.ta(e,n,r,s),Pe=(t,e,n,r,s)=>t.tr(e,n,r,s),bw=(t,e,n,r,s)=>t.ts(e,n,r,s),V=(t,e,n,r,s)=>t.tt(e,n,r,s),qn="WORD",ag="UWORD",KT="ASCIINUMERICAL",GT="ALPHANUMERICAL",ll="LOCALHOST",lg="TLD",cg="UTLD",Qc="SCHEME",gi="SLASH_SCHEME",px="NUM",ug="WS",mx="NL",ba="OPENBRACE",va="CLOSEBRACE",Qu="OPENBRACKET",ed="CLOSEBRACKET",td="OPENPAREN",nd="CLOSEPAREN",rd="OPENANGLEBRACKET",sd="CLOSEANGLEBRACKET",id="FULLWIDTHLEFTPAREN",od="FULLWIDTHRIGHTPAREN",ad="LEFTCORNERBRACKET",ld="RIGHTCORNERBRACKET",cd="LEFTWHITECORNERBRACKET",ud="RIGHTWHITECORNERBRACKET",dd="FULLWIDTHLESSTHAN",hd="FULLWIDTHGREATERTHAN",fd="AMPERSAND",pd="APOSTROPHE",md="ASTERISK",Cr="AT",gd="BACKSLASH",xd="BACKTICK",yd="CARET",Ds="COLON",gx="COMMA",bd="DOLLAR",Dn="DOT",vd="EQUALS",xx="EXCLAMATION",Jt="HYPHEN",ka="PERCENT",kd="PIPE",wd="PLUS",Sd="POUND",wa="QUERY",yx="QUOTE",qT="FULLWIDTHMIDDLEDOT",bx="SEMI",Ln="SLASH",Sa="TILDE",Nd="UNDERSCORE",JT="EMOJI",Cd="SYM";var YT=Object.freeze({__proto__:null,ALPHANUMERICAL:GT,AMPERSAND:fd,APOSTROPHE:pd,ASCIINUMERICAL:KT,ASTERISK:md,AT:Cr,BACKSLASH:gd,BACKTICK:xd,CARET:yd,CLOSEANGLEBRACKET:sd,CLOSEBRACE:va,CLOSEBRACKET:ed,CLOSEPAREN:nd,COLON:Ds,COMMA:gx,DOLLAR:bd,DOT:Dn,EMOJI:JT,EQUALS:vd,EXCLAMATION:xx,FULLWIDTHGREATERTHAN:hd,FULLWIDTHLEFTPAREN:id,FULLWIDTHLESSTHAN:dd,FULLWIDTHMIDDLEDOT:qT,FULLWIDTHRIGHTPAREN:od,HYPHEN:Jt,LEFTCORNERBRACKET:ad,LEFTWHITECORNERBRACKET:cd,LOCALHOST:ll,NL:mx,NUM:px,OPENANGLEBRACKET:rd,OPENBRACE:ba,OPENBRACKET:Qu,OPENPAREN:td,PERCENT:ka,PIPE:kd,PLUS:wd,POUND:Sd,QUERY:wa,QUOTE:yx,RIGHTCORNERBRACKET:ld,RIGHTWHITECORNERBRACKET:ud,SCHEME:Qc,SEMI:bx,SLASH:Ln,SLASH_SCHEME:gi,SYM:Cd,TILDE:Sa,TLD:lg,UNDERSCORE:Nd,UTLD:cg,UWORD:ag,WORD:qn,WS:ug});const Wn=/[a-z]/,Fo=new RegExp("\\p{L}","u"),Vf=new RegExp("\\p{Emoji}","u"),Un=/\d/,$f=/\s/,vw="\r",Hf=`
`,t9="️",n9="‍",Wf="";let yc=null,bc=null;function r9(t=[]){const e={};Mt.groups=e;const n=new Mt;yc==null&&(yc=kw(J$)),bc==null&&(bc=kw(Y$)),V(n,"'",pd),V(n,"{",ba),V(n,"}",va),V(n,"[",Qu),V(n,"]",ed),V(n,"(",td),V(n,")",nd),V(n,"<",rd),V(n,">",sd),V(n,"(",id),V(n,")",od),V(n,"「",ad),V(n,"」",ld),V(n,"『",cd),V(n,"』",ud),V(n,"<",dd),V(n,">",hd),V(n,"&",fd),V(n,"*",md),V(n,"@",Cr),V(n,"`",xd),V(n,"^",yd),V(n,":",Ds),V(n,",",gx),V(n,"$",bd),V(n,".",Dn),V(n,"=",vd),V(n,"!",xx),V(n,"-",Jt),V(n,"%",ka),V(n,"|",kd),V(n,"+",wd),V(n,"#",Sd),V(n,"?",wa),V(n,'"',yx),V(n,"/",Ln),V(n,";",bx),V(n,"~",Sa),V(n,"_",Nd),V(n,"\\",gd),V(n,"・",qT);const r=Pe(n,Un,px,{[rg]:!0});Pe(r,Un,r);const s=Pe(r,Wn,KT,{[ya]:!0}),i=Pe(r,Fo,GT,{[Xo]:!0}),o=Pe(n,Wn,qn,{[sg]:!0});Pe(o,Un,s),Pe(o,Wn,o),Pe(s,Un,s),Pe(s,Wn,s);const a=Pe(n,Fo,ag,{[ig]:!0});Pe(a,Wn),Pe(a,Un,i),Pe(a,Fo,a),Pe(i,Un,i),Pe(i,Wn),Pe(i,Fo,i);const l=V(n,Hf,mx,{[Ff]:!0}),u=V(n,vw,ug,{[Ff]:!0}),d=Pe(n,$f,ug,{[Ff]:!0});V(n,Wf,d),V(u,Hf,l),V(u,Wf,d),Pe(u,$f,d),V(d,vw),V(d,Hf),Pe(d,$f,d),V(d,Wf,d);const h=Pe(n,Vf,JT,{[UT]:!0});V(h,"#"),Pe(h,Vf,h),V(h,t9,h);const f=V(h,n9);V(f,"#"),Pe(f,Vf,h);const p=[[Wn,o],[Un,s]],m=[[Wn,null],[Fo,a],[Un,i]];for(let g=0;g<yc.length;g++)xr(n,yc[g],lg,qn,p);for(let g=0;g<bc.length;g++)xr(n,bc[g],cg,ag,m);As(lg,{tld:!0,ascii:!0},e),As(cg,{utld:!0,alpha:!0},e),xr(n,"file",Qc,qn,p),xr(n,"mailto",Qc,qn,p),xr(n,"http",gi,qn,p),xr(n,"https",gi,qn,p),xr(n,"ftp",gi,qn,p),xr(n,"ftps",gi,qn,p),As(Qc,{scheme:!0,ascii:!0},e),As(gi,{slashscheme:!0,ascii:!0},e),t=t.sort((g,x)=>g[0]>x[0]?1:-1);for(let g=0;g<t.length;g++){const x=t[g][0],b=t[g][1]?{[X$]:!0}:{[Z$]:!0};x.indexOf("-")>=0?b[og]=!0:Wn.test(x)?Un.test(x)?b[ya]=!0:b[sg]=!0:b[rg]=!0,bw(n,x,x,b)}return bw(n,"localhost",ll,{ascii:!0}),n.jd=new Mt(Cd),{start:n,tokens:Object.assign({groups:e},YT)}}function XT(t,e){const n=s9(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,l=null,u=0,d=null,h=-1,f=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(h=0,f=0,d=a):h>=0&&(h+=n[o].length,f++),u+=n[o].length,i+=n[o].length,o++;i-=h,o-=f,u-=h,s.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return s}function s9(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function xr(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Mt(r),i.jr=s.slice(),t.j[l]=i),t=i}return i=new Mt(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function kw(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const cl={defaultProtocol:"http",events:null,format:ww,formatHref:ww,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function vx(t,e=null){let n=Object.assign({},cl);t&&(n=Object.assign(n,t instanceof vx?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}vx.prototype={o:cl,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:cl[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function ww(t){return t}function ZT(t,e){this.t="token",this.v=t,this.tk=e}ZT.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=cl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),d=t.getObj("attributes",n,e),h=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:s,attributes:o,content:i,eventListeners:h}}};function bh(t,e){class n extends ZT{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const i9=bh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sw=bh("text"),o9=bh("nl"),vc=bh("url",{isLink:!0,toHref(t=cl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ll&&t[1].t===Ds}}),qt=t=>new Mt(t);function a9({groups:t}){const e=t.domain.concat([fd,md,Cr,gd,xd,yd,bd,vd,Jt,px,ka,kd,wd,Sd,Ln,Cd,Sa,Nd]),n=[pd,Ds,gx,Dn,xx,ka,wa,yx,bx,rd,sd,ba,va,ed,Qu,td,nd,id,od,ad,ld,cd,ud,dd,hd],r=[fd,pd,md,gd,xd,yd,bd,vd,Jt,ba,va,ka,kd,wd,Sd,wa,Ln,Cd,Sa,Nd],s=qt(),i=V(s,Sa);oe(i,r,i),oe(i,t.domain,i);const o=qt(),a=qt(),l=qt();oe(s,t.domain,o),oe(s,t.scheme,a),oe(s,t.slashscheme,l),oe(o,r,i),oe(o,t.domain,o);const u=V(o,Cr);V(i,Cr,u),V(a,Cr,u),V(l,Cr,u);const d=V(i,Dn);oe(d,r,i),oe(d,t.domain,i);const h=qt();oe(u,t.domain,h),oe(h,t.domain,h);const f=V(h,Dn);oe(f,t.domain,h);const p=qt(i9);oe(f,t.tld,p),oe(f,t.utld,p),V(u,ll,p);const m=V(h,Jt);V(m,Jt,m),oe(m,t.domain,h),oe(p,t.domain,h),V(p,Dn,f),V(p,Jt,m);const g=V(o,Jt),x=V(o,Dn);V(g,Jt,g),oe(g,t.domain,o),oe(x,r,i),oe(x,t.domain,o);const y=qt(vc);oe(x,t.tld,y),oe(x,t.utld,y),oe(y,t.domain,o),oe(y,r,i),V(y,Dn,x),V(y,Jt,g),V(y,Cr,u);const b=V(y,Ds),k=qt(vc);oe(b,t.numeric,k);const w=qt(vc),C=qt();oe(w,e,w),oe(w,n,C),oe(C,e,w),oe(C,n,C),V(y,Ln,w),V(k,Ln,w);const j=V(a,Ds),S=V(l,Ds),N=V(S,Ln),T=V(N,Ln);oe(a,t.domain,o),V(a,Dn,x),V(a,Jt,g),oe(l,t.domain,o),V(l,Dn,x),V(l,Jt,g),oe(j,t.domain,w),V(j,Ln,w),V(j,wa,w),oe(T,t.domain,w),oe(T,e,w),V(T,Ln,w);const E=[[ba,va],[Qu,ed],[td,nd],[rd,sd],[id,od],[ad,ld],[cd,ud],[dd,hd]];for(let D=0;D<E.length;D++){const[P,O]=E[D],I=V(w,P);V(C,P,I);const H=qt(vc);oe(I,e,H);const B=qt();oe(I,n,B),V(I,O,w),oe(H,e,H),oe(H,n,B),oe(B,e,H),oe(B,n,B),V(H,O,w),V(B,O,w)}return V(s,ll,y),V(s,mx,o9),{start:s,tokens:YT}}function l9(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let a=t,l=null,u=null,d=0,h=null,f=-1;for(;s<r&&!(l=a.go(n[s].t));)o.push(n[s++]);for(;s<r&&(u=l||a.go(n[s].t));)l=null,a=u,a.accepts()?(f=0,h=a):f>=0&&f++,s++,d++;if(f<0)s-=d,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(Uf(Sw,e,o)),o=[]),s-=f,d-=f;const p=h.t,m=n.slice(s-d,s);i.push(Uf(p,e,m))}}return o.length>0&&i.push(Uf(Sw,e,o)),i}function Uf(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const c9=typeof console<"u"&&console&&console.warn||(()=>{}),u9="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ke={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function d9(){return Mt.groups={},ke.scanner=null,ke.parser=null,ke.tokenQueue=[],ke.pluginQueue=[],ke.customSchemes=[],ke.initialized=!1,ke}function Nw(t,e=!1){if(ke.initialized&&c9(`linkifyjs: already initialized - will not register custom scheme "${t}" ${u9}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);ke.customSchemes.push([t,e])}function h9(){ke.scanner=r9(ke.customSchemes);for(let t=0;t<ke.tokenQueue.length;t++)ke.tokenQueue[t][1]({scanner:ke.scanner});ke.parser=a9(ke.scanner.tokens);for(let t=0;t<ke.pluginQueue.length;t++)ke.pluginQueue[t][1]({scanner:ke.scanner,parser:ke.parser});return ke.initialized=!0,ke}function kx(t){return ke.initialized||h9(),l9(ke.parser.start,t,XT(ke.scanner.start,t))}kx.scan=XT;function QT(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new vx(n),s=kx(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const wx="[\0-   ᠎ -\u2029  ]",f9=new RegExp(wx),p9=new RegExp(`${wx}$`),m9=new RegExp(wx,"g");function g9(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function x9(t){return new Se({key:new $e("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),i=e.some(l=>l.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=hT(n.doc,[...e]);if(gh(a).forEach(({newRange:l})=>{const u=FF(r.doc,l,f=>f.isTextblock);let d,h;if(u.length>1)d=u[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const f=r.doc.textBetween(l.from,l.to," "," ");if(!p9.test(f))return;d=u[0],h=r.doc.textBetween(d.pos,l.to,void 0," ")}if(d&&h){const f=h.split(f9).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const g=kx(p).map(x=>x.toObject(t.defaultProtocol));if(!g9(g))return!1;g.filter(x=>x.isLink).map(x=>({...x,from:m+x.start+1,to:m+x.end+1})).filter(x=>r.schema.marks.code?!r.doc.rangeHasMark(x.from,x.to,r.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{dx(x.from,x.to,r.doc).some(y=>y.mark.type===t.type)||o.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!o.steps.length)return o}})}function y9(t){return new Se({key:new $e("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const l=r.target;if(!l)return!1;const u=t.editor.view.dom;s=l.closest("a"),s&&!u.contains(s)&&(s=null)}if(!s)return!1;let i=!1;if(t.enableClickSelection&&(i=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var o,a;const l=yT(e.state,t.type.name),u=(o=s.href)!==null&&o!==void 0?o:l.href,d=(a=s.target)!==null&&a!==void 0?a:l.target;u&&(window.open(u,d),i=!0)}return i}}})}const b9=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,v9=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function e2(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function k9(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&e2(t,r)){r+=1;continue}let s=0;for(;r<e&&t[r]==="`";)s+=1,r+=1;n===0?n=s:s===n&&(n=0)}return n>0}function t2(t,e,n){var r,s;const[,i,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||e2(t,(r=e.index)!==null&&r!==void 0?r:0)||k9(t,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&n(o)}function n2(t){var e,n;const[r,s,i,,o,a,l]=t,u=(e=o??a)!==null&&e!==void 0?e:l;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:s,data:{href:i,title:u||null,markdown:!0}}}function w9(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function r2(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function S9(t){const e=Zs({find:n=>{const r=b9.exec(n);return!r||!t2(n,r,t.isAllowedHref)?null:n2(r)},type:t.type,getAttributes:r2});return new Al({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function N9(t){const e=rs({find:n=>{var r,s;const i=[];for(const a of n.matchAll(v9))t2(n,a,t.isAllowedHref)&&i.push(n2(a));const o=((r=(s=t.findPlainUrls)===null||s===void 0?void 0:s.call(t,n))!==null&&r!==void 0?r:[]).filter(a=>!i.some(l=>w9(l,a)));return[...i,...o]},type:t.type,getAttributes:r2});return new PT({find:e.find,handler:n=>{var r;const s=e.handler(n);return s!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),s}})}function C9(t){return new Se({key:new $e("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const u=QT(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!u||s!==void 0&&!s(u.value)?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Kn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(m9,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const s2=hs.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Nw(t);return}Nw(t.scheme,t.optionalSlashes)})},onDestroy(){d9()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Kn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!==null&&t!==void 0?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(n=this.options.HTMLAttributes.class)!==null&&n!==void 0?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Kn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Kn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ve(this.options.HTMLAttributes,t),0]:["a",Ve(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(n=(r=t.attrs)===null||r===void 0?void 0:r.href)!==null&&n!==void 0?n:"",a=(s=(i=t.attrs)===null||i===void 0?void 0:i.title)!==null&&s!==void 0?s:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[S9({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!Kn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;QT(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Kn(o,r),protocols:r,defaultProtocol:s})).forEach(i=>{this.options.shouldAutoLink(i.value)&&n.push({text:i.value,data:{href:i.href},index:i.start})})}return n};return this.options.markdownLinks?[N9({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!Kn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[rs({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)===null||n===void 0?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(x9({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Kn(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(y9({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(C9({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),j9="listItem",Cw="textStyle",jw=/^\s*([-+*])\s$/,i2=Kt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ve(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(j9,this.editor.getAttributes(Cw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=lo({find:jw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=lo({find:jw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Cw),editor:this.editor})),[t]}}),E9=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let p=s.depth;p>0;p-=1)if(s.node(p).type.name===e){i=p;break}if(i<0)return null;const o=s.node(i),a=s.index(i);if(a+1>=o.childCount)return null;const l=o.child(a+1);if(!n.includes(l.type.name))return null;const u=t.schema.nodes[e];let d=!1;if(l.forEach(p=>{p.type===u&&p.childCount>1&&(d=!0)}),!d)return null;const h=t.doc.resolve(s.after()).nodeAfter;if(!h||!n.includes(h.type.name))return null;const f=[];return h.forEach(p=>{f.push(p)}),f.length===0?null:{listItemDepth:i,nestedList:h,nestedListPos:s.after(),insertPos:s.after(i),items:f}},T9=(t,e,n,r)=>{const s=E9(t,n,r);if(!s)return!1;const{selection:i}=t,{nestedList:o,nestedListPos:a,insertPos:l,items:u}=s,d=t.tr;d.delete(a,a+o.nodeSize);const h=d.mapping.map(l);return d.insert(h,z.from(u)),d.setSelection(i.map(d.doc,d.mapping)),e&&e(d),!0},M9=(t,e,n)=>T9(t.state,t.view.dispatch,e,n),o2=(t,e)=>me.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>M9(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),a2=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],kc="abcdefghijklmnopqrstuvwxyz",l2=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function vh(t){let e=t,n="";for(const[r,s]of a2)for(;e>=r;)n+=s,e-=r;return n}function Sx(t){return vh(t).toUpperCase()}function c2(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let s=!1;for(const[i,o]of a2)if(e.startsWith(o,n)){r+=i,n+=o.length,s=!0;break}if(!s)return 0}return r}function P9(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=c2(t);return e<=0?!1:(t===t.toLowerCase()?vh(e):Sx(e))===t}function A9(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function jd(t){if(t<=26)return kc[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?kc[n]:kc[e]+kc[n]}function kh(t){if(!(!t||/^\d+$/.test(t))){if(P9(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function Nx(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=kh(t);if(e==="i"||e==="I")return c2(t);if(e==="a"||e==="A"){const r=A9(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function D9(t,e){if(t==="numeric")return String(e);switch(t){case"a":return jd(e);case"A":return jd(e).toUpperCase();case"i":return vh(e);case"I":return Sx(e);default:return String(e)}}function L9(t){var e;if(t.length===0)return!1;const n=(e=kh(t[0]))!==null&&e!==void 0?e:"numeric",r=Nx(t[0]);if(r<1)return!1;for(let s=0;s<t.length;s++){const i=D9(n,r+s);if(t[s]!==i)return!1}return!0}function R9(t){return{type:kh(t),start:Nx(t)}}function _9(t){const{type:e,start:n}=R9(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function I9(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${jd(r)}${n}`;case"A":return`${jd(r).toUpperCase()}${n}`;case"i":return`${vh(r)}${n}`;case"I":return`${Sx(r)}${n}`;default:return`${r}${n}`}}function O9(t){var e,n;const r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function B9(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}const u2=Kt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ve(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(O9(t))return{type:"listItem",content:[{type:"paragraph",content:B9(t.text||"",e)}]};if(t.tokens.some(i=>i.type==="paragraph"))s=r(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){const o=r(t.tokens.slice(1));s.push(...o)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>ET(t,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var s,i;const o=((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.start)||1;return I9((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.type,o-1+(r.index||0),". ")}return"- "},n,{alignNestedToPrefix:(n==null?void 0:n.parentType)==="orderedList"}),addExtensions(){return[o2(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Cx=(t,e)=>{const{$from:n}=e.selection,r=Ge(t,e.schema);let s=null,i=n.depth,o=n.pos,a=null;for(;i>0&&a===null;)s=n.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},d2=(t,e)=>{const n=Cx(t,e);if(!n)return!1;const[,r]=XF(e,t,n.$pos.pos+4);return r},z9=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},Ew=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!dr(t.state,e)&&z9(t.state,e,n)){const{$anchor:i}=t.state.selection,o=t.state.doc.resolve(i.before()-1),a=[];o.node().descendants((d,h)=>{d.type.name===e&&a.push({node:d,pos:h})});const l=a.at(-1);if(!l)return!1;const u=t.state.doc.resolve(o.start()+l.pos+1);return t.chain().cut({from:i.start()-1,to:i.end()+1},u.end()).joinForward().run()}if(!dr(t.state,e)||!nV(t.state))return!1;const{$from:r}=t.state.selection,s=r.depth-1;return r.node(s).type!==t.schema.nodes[e]||r.index(s)!==0?!1:t.chain().liftListItem(e).run()},F9=(t,e)=>{const n=d2(t,e),r=Cx(t,e);return!r||!n?!1:n>r.depth},V9=(t,e)=>{const n=d2(t,e),r=Cx(t,e);return!r||!n?!1:n<r.depth},Tw=(t,e)=>{if(!dr(t.state,e)||!tV(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:F9(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():V9(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},$9=(t,e,n)=>{const{state:r}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0||!i.parent.isTextblock||dr(r,e))return!1;const o=ZF(i);if(!o||!n.includes(o.type.name))return!1;const a=o.lastChild;if(!a||a.type.name!==e)return!1;const l=i.parent;if(!a.canReplace(a.childCount,a.childCount,z.from(l)))return!1;const u=i.before(),d=i.after(),h=u-2;return t.commands.command(({tr:f,dispatch:p})=>(p&&(f.delete(u,d).insert(h,z.from(l)),f.setSelection(Q.create(f.doc,h+1)),f.scrollIntoView()),!0))},h2=me.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Tw(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Tw(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ew(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ew(t,n,r)&&(e=!0)}),e},Tab:({editor:t})=>{for(const{itemName:e,wrapperNames:n}of this.options.listTypes)if(t.state.schema.nodes[e]!==void 0&&$9(t,e,n))return!0;return!1}}}}),dg=new RegExp(`^(\\s*)(${l2})([.)])\\s+(.*)$`),H9=/^\s/,xi={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function W9(t){return dg.test(t.trimStart())}function U9(t){const e=t.trimStart();return xi.bulletItem.test(e)||W9(e)||xi.heading.test(e)||xi.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||xi.codeFence.test(e)||xi.blockMath.test(e)}function K9(t){return Object.values(xi).some(e=>e.test(t))}function G9(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&U9(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function q9(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(dg);if(!i)break;const[,o,a,l,u]=i,d=o.length,h=parseInt(a,10),f=isNaN(h)?kh(a):void 0,p=isNaN(h)?Nx(a):h,m=[u];let g=n+1;const x=[s];let y=!1;for(;g<t.length;){const b=t[g];if(b.match(dg))break;if(b.trim()==="")x.push(b),m.push(""),y=!0,g+=1;else if(b.match(H9)){const k=b.length-b.trimStart().length,w=d+a.length+1;x.push(b),m.push(b.slice(Math.min(k,w))),g+=1}else{if(y||K9(b))break;x.push(b),m.push(b),g+=1}}e.push({indent:d,number:p,type:f,content:m.join(`
`).trim(),contentLines:m,raw:x.join(`
`)}),r=g,n=g}return[e,r]}const J9=new RegExp(`^(${l2})([.)])\\s+(.+)$`);function Y9(t){const e=t.split(`
`).filter(r=>r.trim().length>0);if(e.length===0)return null;const n=[];for(const r of e){const s=r.trim().match(J9);if(!s)return null;n.push({marker:s[1],content:s[3]})}return L9(n.map(r=>r.marker))?{type:"orderedList",attrs:_9(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function f2(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:a}=G9(i.contentLines),l=o.join(`
`).trim(),u=[];l&&u.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const d=a.join(`
`).trim();if(d){const p=n.blockTokens(d);u.push(...p)}let h=s+1;const f=[];for(;h<t.length&&t[h].indent>e;)f.push(t[h]),h+=1;if(f.length>0){const p=f2(f,Math.min(...f.map(m=>m.indent)),n);u.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:p,raw:f.map(m=>m.raw).join(`
`)})}r.push({type:"list_item",raw:i.raw,tokens:u}),s=h}else s+=1}return r}function X9(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}const Z9="listItem",Mw="textStyle",Pw=/^(\d+)\.\s$/;function Aw(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const p2=Kt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const s=Aw(n);if(s)return s}const r=t.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=Aw(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,s=Ve(this.options.HTMLAttributes,r);return e!==1&&(s.start=e),n&&n!=="1"&&(s.type=n),["ol",s,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,s=t.items?X9(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:s}:{type:"orderedList",content:s}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,s;const i=t.split(`
`),[o,a]=q9(i);if(o.length===0)return;const l=f2(o,o[0].indent,n);if(l.length!==0)return{type:"list",ordered:!0,start:((r=o[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(s=o[0])===null||s===void 0?void 0:s.type,items:l,raw:i.slice(0,a).join(`
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Z9,this.editor.getAttributes(Mw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Se({props:{handlePaste:(t,e)=>{var n,r;const s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(s!=null&&s.trim())return!1;const i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;const o=Y9(i);if(!o)return!1;try{const a=t.state.schema.nodeFromJSON(o),l=t.state.tr.replaceSelectionWith(a);return t.dispatch(l),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];let e=lo({find:Pw,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=lo({find:Pw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(Mw)}),joinPredicate:t,editor:this.editor})),[e]}}),Q9=/^\s*(\[([( |x])?\])\s$/,eH="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",tH=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},nH=Kt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ve(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return ET(t,e,r)},addExtensions(){return this.options.nested?[o2(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");o.style.cssText=eH;const u=h=>{const f=tH(h,h.attrs.checked,this.options.a11y);a.setAttribute("aria-label",f),o.textContent=f};u(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",h=>h.preventDefault()),a.addEventListener("change",h=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=h.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([h,f])=>{s.setAttribute(h,f)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([h,f])=>{s.setAttribute(h,f)});let d=new Set(Object.keys(e));return{dom:s,contentDOM:l,update:h=>{if(h.type!==this.type)return!1;s.dataset.checked=h.attrs.checked,a.checked=h.attrs.checked,u(h);const f=r.extensionManager.attributes,p=al(h,f),m=new Set(Object.keys(p)),g=this.options.HTMLAttributes;return d.forEach(x=>{m.has(x)||(x in g?s.setAttribute(x,g[x]):s.removeAttribute(x))}),Object.entries(p).forEach(([x,y])=>{y==null?x in g?s.setAttribute(x,g[x]):s.removeAttribute(x):s.setAttribute(x,y)}),d=m,!0}}}},addInputRules(){return[lo({find:Q9,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),rH=Kt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ve(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=aw(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);if(o){const a={type:"taskList",raw:o.raw,items:o.items},l=i.slice(o.raw.length);return l.trim()?[a,...n.blockTokens(l)]:[a]}return n.blockTokens(i)},s=aw(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});me.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(i2.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(u2.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(h2.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(p2.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(nH.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(rH.configure(this.options.taskList)),t}});const wc="&nbsp;",Kf=" ",sH=Kt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ve(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===wc||n[0].text===wc||n[0].raw===Kf||n[0].text===Kf)&&r.length===1&&r[0].type==="text"&&(r[0].text===wc||r[0].text===Kf)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";const r=Array.isArray(t.content)?t.content:[];if(r.length===0){var s,i;const o=Array.isArray(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.content)?n.previousNode.content:[];return(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&o.length===0?wc:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,oH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,aH=hs.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ve(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Zs({find:iH,type:this.type})]},addPasteRules(){return[rs({find:oH,type:this.type})]}}),lH=Kt.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),m2=hs.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Ve(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function cH(t={}){return new Se({view(e){return new uH(e,t)}})}class uH{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let h=e.nodeBefore,f=e.nodeAfter;if(h||f){let p=this.editorView.nodeDOM(this.cursorPos-(h?h.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=h?m.bottom:m.top;h&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*a;r={left:m.left,right:m.right,top:g-x,bottom:g+x}}}}if(!r){let h=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:h.left-f,right:h.left+f,top:h.top,bottom:h.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,d=-pageYOffset;else{let h=l.getBoundingClientRect(),f=h.width/l.offsetWidth,p=h.height/l.offsetHeight;u=h.left-l.scrollLeft*f,d=h.top-l.scrollTop*p}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(!n||i)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Xj(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Le extends ie{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Le.valid(r)?new Le(r):ie.near(r)}content(){return W.empty}eq(e){return e instanceof Le&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Le(e.resolve(n.pos))}getBookmark(){return new jx(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!dH(e)||!hH(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Le.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(Le.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Z.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(Le.valid(a))return a}return null}}}Le.prototype.visible=!1;Le.findFrom=Le.findGapCursorFrom;ie.jsonID("gapcursor",Le);class jx{constructor(e){this.pos=e}map(e){return new jx(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Le.valid(n)?new Le(n):ie.near(n)}}function g2(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function dH(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||g2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function hH(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||g2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function fH(){return new Se({props:{decorations:xH,createSelectionBetween(t,e,n){return e.pos==n.pos&&Le.valid(n)?new Le(n):null},handleClick:mH,handleKeyDown:pH,handleDOMEvents:{beforeinput:gH}}})}const pH=tT({ArrowLeft:Sc("horiz",-1),ArrowRight:Sc("horiz",1),ArrowUp:Sc("vert",-1),ArrowDown:Sc("vert",1)});function Sc(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof Q){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=Le.findGapCursorFrom(a,e,l);return u?(s&&s(r.tr.setSelection(new Le(u))),!0):!1}}function mH(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Le.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Z.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Le(r))),!0)}function gH(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Le))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=z.empty;for(let o=r.length-1;o>=0;o--)s=z.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new W(s,0,0));return i.setSelection(Q.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function xH(t){if(!(t.selection instanceof Le))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",de.create(t.doc,[wt.widget(t.selection.head,e,{key:"gapcursor"})])}var Ed=200,Qe=function(){};Qe.prototype.append=function(e){return e.length?(e=Qe.from(e),!this.length&&e||e.length<Ed&&this.leafAppend(e)||this.length<Ed&&e.leafPrepend(this)||this.appendInner(e)):this};Qe.prototype.prepend=function(e){return e.length?Qe.from(e).append(this):this};Qe.prototype.appendInner=function(e){return new yH(this,e)};Qe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Qe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Qe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Qe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Qe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};Qe.from=function(e){return e instanceof Qe?e:e&&e.length?new x2(e):Qe.empty};var x2=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Ed)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Ed)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Qe);Qe.empty=new x2([]);var yH=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Qe);const bH=500;class xn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,u=[],d=[];return this.items.forEach((h,f)=>{if(!h.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,d.push(h);return}if(s){d.push(new Rn(h.map));let p=h.step.map(s.slice(i)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new Rn(m,void 0,void 0,u.length+d.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(h.step);if(h.selection)return a=s?h.selection.map(s.slice(i)):h.selection,l=new xn(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let h=e.steps[d].invert(e.docs[d]),f=new Rn(e.mapping.maps[d],h,n),p;(p=l&&l.merge(f))&&(f=p,d?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(o++,n=void 0),s||(l=f)}let u=o-r.depth;return u>kH&&(a=vH(a,u),o-=u),new xn(a.append(i),o)}remapping(e,n){let r=new nl;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new xn(this.items.append(e.map(n=>new Rn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},s);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=i.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),x=f.selection&&f.selection.map(i.slice(l+1,p));x&&a++,r.push(new Rn(m,g,x))}else r.push(new Rn(m))},s);let u=[];for(let f=n;f<o;f++)u.push(new Rn(i.maps[f]));let d=this.items.slice(0,s).append(u).append(r),h=new xn(d,a);return h.emptyItemCount()>bH&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let d=o.selection&&o.selection.map(n.slice(r));d&&i++;let h=new Rn(u.invert(),l,d),f,p=s.length-1;(f=s.length&&s[p].merge(h))?s[p]=f:s.push(h)}}else o.map&&r--},this.items.length,0),new xn(Qe.from(s.reverse()),i)}}xn.empty=new xn(Qe.empty,0);function vH(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class Rn{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Rn(n.getMap().invert(),n,this.selection)}}}class jr{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const kH=20;function wH(t,e,n,r){let s=n.getMeta(Hs),i;if(s)return s.historyState;n.getMeta(CH)&&(t=new jr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Hs))return o.getMeta(Hs).redo?new jr(t.done.addTransform(n,void 0,r,eu(e)),t.undone,Dw(n.mapping.maps),t.prevTime,t.prevComposition):new jr(t.done,t.undone.addTransform(n,void 0,r,eu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!SH(n,t.prevRanges)),u=o?Gf(t.prevRanges,n.mapping):Dw(n.mapping.maps);return new jr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,eu(e)),xn.empty,u,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new jr(t.done.rebased(n,i),t.undone.rebased(n,i),Gf(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new jr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Gf(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function SH(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Dw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function Gf(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function NH(t,e,n){let r=eu(e),s=Hs.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new jr(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(Hs,{redo:n,historyState:l})}let qf=!1,Lw=null;function eu(t){let e=t.plugins;if(Lw!=e){qf=!1,Lw=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){qf=!0;break}}return qf}const Hs=new $e("history"),CH=new $e("closeHistory");function jH(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Se({key:Hs,state:{init(){return new jr(xn.empty,xn.empty,null,0,-1)},apply(e,n,r){return wH(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?b2:r=="historyRedo"?v2:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function y2(t,e){return(n,r)=>{let s=Hs.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=NH(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const b2=y2(!1,!0),v2=y2(!0,!0);me.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Se({key:new $e("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const a=o-s,l=0,u=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,u);return t=!0,d}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,a=o-(i-r),l=o;return e.deleteRange(a,l),!(this.storage.characters({node:e.doc})>r)}})]}});const EH=me.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[cH(this.options)]}});me.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Se({key:new $e("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return de.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,u)=>{if(!l.isText){if(!(s>=u&&s<=u+l.nodeSize-1))return!1;o+=1}});let a=0;return t.descendants((l,u)=>{if(l.isText||!(s>=u&&s<=u+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(wt.node(u,u+l.nodeSize,{class:this.options.className}))}),de.create(t,i)}}})]}});const TH=me.create({name:"gapCursor",addProseMirrorPlugins(){return[fH()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=he(J(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),k2="placeholder",Rw=new $e("tiptap__placeholder");function w2(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:u}}=t,d=[l];return o&&d.push(u),wt.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:a}):n})}function S2(t,e){return typeof t=="function"?t(e):t}function N2({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:i,to:o}){const{anchor:a}=s,l=[],u=t.isEmpty;return r.nodesBetween(i,o,(d,h)=>{const f=a>=h&&a<=h+d.nodeSize,p=!d.isLeaf&&Ml(d);return d.type.isTextblock&&(f||!e.showOnlyCurrent)&&p&&l.push(w2({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:S2(e.emptyNodeClass,{editor:t,node:d,pos:h,hasAnchor:f})},node:d,pos:h})),e.includeChildren}),l}function C2({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:i}=s,o=[],a=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const l=r.resolve(i),u=l.depth>0?l.node(1):l.nodeAfter,d=l.depth>0?l.before(1):i;if(u&&u.type.isTextblock&&Ml(u)){const h=i>=d&&i<=d+u.nodeSize;o.push(w2({editor:t,isEmptyDoc:a,dataAttribute:n,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:S2(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:h})},node:u,pos:d}))}}else o.push(...N2({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:0,to:r.content.size}));return de.create(r,o)}function Na(t,e){const n=t.resolve(e);if(n.depth===0){var r;const i=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!i)return{from:e,to:e};const o=n.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}const s=n.before(1);return{from:s,to:s+n.node(1).nodeSize}}function Ca(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function MH(t,e,n){const r=[];return t.forEach((s,i)=>{const o=i,a=o+s.nodeSize,l=o+1,u=a+1;l<n&&u>e&&r.push({from:o,to:a})}),r}function PH(t){if(t.length===0)return[];const e=[...t].sort((r,s)=>r.from-s.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=n[n.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):n.push({...i})}return n}function AH(t,e){const n=MH(t,e.from,e.to);return n.push(Ca(t,Na(t,e.from))),e.to>e.from?n.push(Ca(t,Na(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Ca(t,Na(t,Math.min(e.from+1,t.content.size)))),n}function DH(t,e,n){const r=[];if(t.docChanged){const s=gh(t);for(const i of s)r.push(...AH(n.doc,i.newRange))}return t.selectionSet&&(r.push(Ca(n.doc,Na(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Ca(n.doc,Na(n.doc,n.selection.anchor)))),PH(r)}function LH(t,e,n){const r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function RH({decorations:t,ranges:e,editor:n,options:r,dataAttribute:s,doc:i,selection:o}){let a=t;for(const l of e){const{from:u,to:d}=LH(l.from,l.to,i),h=a.find(u,d).filter(p=>p.from>=u&&p.to<=d);h.length&&(a=a.remove(h));const f=N2({editor:n,options:r,dataAttribute:s,doc:i,selection:o,from:u,to:d});f.length&&(a=a.add(i,f))}return a}function _H({editor:t,options:e,dataAttribute:n}){return{init(r,s){const i=C2({editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection});return i??de.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:RH({decorations:s.map(r.mapping,r.doc),ranges:DH(r,i,o),editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function IH(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function OH({editor:t,options:e}){const n=e.dataAttribute?`data-${IH(e.dataAttribute)}`:`data-${k2}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Se({key:Rw,...r?{}:{state:_H({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:s,selection:i})=>C2({editor:t,options:e,dataAttribute:n,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?de.empty:(i=Rw.getState(s))!==null&&i!==void 0?i:de.empty}}})}me.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:k2,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[OH({editor:this.editor,options:this.options})]}});function hg(t,e){return!t.selection.empty&&!bT(t.selection)&&e.isEditable}function BH(t,e){return hg(t,e)&&!e.isFocused&&!e.view.dragging}function zH(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function FH(t){t.focus()}me.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Se({key:new $e("selection"),props:{decorations(n){return BH(n,t)?de.create(n.doc,[wt.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return hg(n.state,t)&&zH(),!1},focus(n){return hg(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&FH(n)}),!1}}}})]}});function _w({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}const VH=me.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new $e(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Se({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:l,schema:u}=o,d=e.getState(o),h=a.content.size,f=u.nodes[n];if(!s.some(p=>p.getMeta("skipTrailingNode"))&&d)return l.insert(h,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!_w({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!_w({node:o,types:r})}}})]}}),$H=me.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>b2(t,e),redo:()=>({state:t,dispatch:e})=>v2(t,e)}},addProseMirrorPlugins(){return[jH(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),HH=me.create({name:"starterKit",addExtensions(){const t=[];if(this.options.bold!==!1&&t.push(L$.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(T$.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(i2.configure(this.options.bulletList)),this.options.code!==!1&&t.push(I$.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(z$.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(F$.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(EH.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(TH.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(V$.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push($$.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push($H.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(H$.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(q$.configure(this.options.italic)),this.options.listItem!==!1&&t.push(u2.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(h2.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(s2.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(p2.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(sH.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(aH.configure(this.options.strike)),this.options.text!==!1&&t.push(lH.configure(this.options.text)),this.options.underline!==!1){var r;t.push(m2.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;t.push(VH.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return t}}),WH=20,j2=(t,e=0)=>{const n=[];return!t.children.length||e>WH||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...j2(r,e+1))}),n},UH=t=>{if(!t.children.length)return;const e=j2(t);e&&e.forEach(n=>{var r;const s=n.getAttribute("style"),i=(r=n.parentElement)===null||r===void 0||(r=r.closest("span"))===null||r===void 0?void 0:r.getAttribute("style");n.setAttribute("style",`${i};${s}`)})},E2=hs.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&UH(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Ve(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(!n.isInline)return!0;n.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),KH=me.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=(e=Pl(t,"background-color"))!==null&&e!==void 0?e:t.style.backgroundColor;return n==null?void 0:n.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),GH=me.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=(e=Pl(t,"color"))!==null&&e!==void 0?e:t.style.color;return n==null?void 0:n.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),T2=me.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=Pl(t,"font-family"))!==null&&e!==void 0?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),qH=me.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=Pl(t,"font-size"))!==null&&e!==void 0?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),JH=me.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=Pl(t,"line-height"))!==null&&e!==void 0?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});me.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(KH.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(GH.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(T2.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(qH.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(JH.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(E2.configure(this.options.textStyle)),t}});function yr({active:t,onClick:e,title:n,children:r}){return c.jsx("button",{type:"button",onClick:e,title:n,className:`rounded px-2 py-1 text-sm font-semibold ${t?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:r})}function Td({value:t,onChange:e,label:n}){const r=k$({extensions:[HH,m2,E2,T2,s2.configure({openOnClick:!1})],content:t||"",onUpdate:({editor:o})=>e(o.getHTML()),editorProps:{attributes:{class:"rte-content min-h-[10rem] px-3 py-2 text-sm text-neutral-800 focus:outline-none dark:text-neutral-100"}}});if(v.useEffect(()=>{if(!r)return;const o=t||"";o!==r.getHTML()&&r.commands.setContent(o)},[t,r]),!r)return null;const s=r.getAttributes("textStyle").fontFamily||"",i=()=>{const o=r.getAttributes("link").href||"",a=window.prompt("Link-Ziel (URL):",o);if(a!==null){if(a===""){r.chain().focus().extendMarkRange("link").unsetLink().run();return}r.chain().focus().extendMarkRange("link").setLink({href:a}).run()}};return c.jsxs("div",{children:[n&&c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:n}),c.jsxs("div",{className:"overflow-hidden rounded-md border border-neutral-300 dark:border-neutral-700",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-neutral-200 bg-neutral-50 px-2 py-1.5 dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx(yr,{active:r.isActive("bold"),onClick:()=>r.chain().focus().toggleBold().run(),title:"Fett",children:"F"}),c.jsx(yr,{active:r.isActive("italic"),onClick:()=>r.chain().focus().toggleItalic().run(),title:"Kursiv",children:c.jsx("span",{className:"italic",children:"K"})}),c.jsx(yr,{active:r.isActive("underline"),onClick:()=>r.chain().focus().toggleUnderline().run(),title:"Unterstrichen",children:c.jsx("span",{className:"underline",children:"U"})}),c.jsx(yr,{active:r.isActive("code"),onClick:()=>r.chain().focus().toggleCode().run(),title:"Code (Inline)",children:c.jsx("span",{className:"font-mono",children:"</>"})}),c.jsx("span",{className:"mx-1 h-5 w-px bg-neutral-300 dark:bg-neutral-600"}),c.jsx(yr,{active:r.isActive("heading",{level:2}),onClick:()=>r.chain().focus().toggleHeading({level:2}).run(),title:"Überschrift",children:"H2"}),c.jsx("span",{className:"mx-1 h-5 w-px bg-neutral-300 dark:bg-neutral-600"}),c.jsx(yr,{active:r.isActive("bulletList"),onClick:()=>r.chain().focus().toggleBulletList().run(),title:"Aufzählung",children:"•≡"}),c.jsx(yr,{active:r.isActive("orderedList"),onClick:()=>r.chain().focus().toggleOrderedList().run(),title:"Nummerierte Liste",children:"1≡"}),c.jsx("span",{className:"mx-1 h-5 w-px bg-neutral-300 dark:bg-neutral-600"}),c.jsx(yr,{active:r.isActive("link"),onClick:i,title:"Link setzen/entfernen",children:"🔗"}),c.jsx("span",{className:"mx-1 h-5 w-px bg-neutral-300 dark:bg-neutral-600"}),c.jsx("select",{value:s,onChange:o=>{const a=o.target.value;a===""?r.chain().focus().unsetFontFamily().run():r.chain().focus().setFontFamily(a).run()},className:"rounded border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:oh.map(o=>c.jsx("option",{value:o.value,children:o.label},o.label))})]}),c.jsx(IT,{editor:r,className:"bg-white dark:bg-neutral-950"})]})]})}const Iw=[{slug:"hero",label:"Hero (ganz oben)"},{slug:"youtube",label:"YouTube-Sektion"},{slug:"craft",label:"Handwerk"},{slug:"advice",label:"Beratung"},{slug:"insights",label:"Einblicke (Bildergalerie-Intro)"},{slug:"more",label:"Mehr als Car-Hifi"}],YH=["hero","youtube"],XH=[{value:"left",label:"Links"},{value:"center",label:"Mittig"},{value:"right",label:"Rechts"}],ZH={left:"text-left",center:"text-center",right:"text-right"};function QH(t){const e=document.createElement("div");return e.innerHTML=t||"",e.textContent||""}function e7(){var O;const[t,e]=v.useState(null),[n,r]=v.useState("hero"),[s,i]=v.useState("de"),[o,a]=v.useState(!1),[l,u]=v.useState(""),[d,h]=v.useState(!1),[f,p]=v.useState(""),m=v.useRef(null),[g,x]=v.useState(!1);if(v.useEffect(()=>{A.get("/home-sections").then(e),A.get("/site-settings").then(I=>p(I.hero_image_path||""))},[]),!t)return c.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const y=t[n],b=YH.includes(n),k=(I,H)=>{e(B=>({...B,[n]:{...B[n],[I]:H}})),h(!1)},w=(I,H)=>{e(B=>({...B,[n]:{...B[n],text_align_x:I,text_align_y:H}})),h(!1)},C=(I,H)=>{const B=m.current.getBoundingClientRect();return{x:Math.max(0,Math.min(100,Math.round((I-B.left)/B.width*100))),y:Math.max(0,Math.min(100,Math.round((H-B.top)/B.height*100)))}},j=I=>{I.preventDefault(),I.currentTarget.setPointerCapture(I.pointerId),x(!0);const{x:H,y:B}=C(I.clientX,I.clientY);w(H,B)},S=I=>{if(!g)return;const{x:H,y:B}=C(I.clientX,I.clientY);w(H,B)},N=I=>{x(!1),I.currentTarget.releasePointerCapture(I.pointerId)},T=async()=>{a(!0),u(""),h(!1);try{await A.put(`/home-sections/${n}`,y),h(!0)}catch(I){u(I.message)}finally{a(!1)}},E=y[`eyebrow_${s}`]||"",D=y[`title_${s}`]||((O=Iw.find(I=>I.slug===n))==null?void 0:O.label)||"",P=QH(y[`body_html_${s}`]);return c.jsxs("div",{className:"max-w-3xl space-y-6",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Startseite"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Text, Position/Ausrichtung und (falls vorhanden) Button-Ziel der wichtigsten Textabschnitte auf der Startseite. Bilder, Statistik-Kacheln, Marken-Streifen, Bewertungen und FAQ werden an anderer Stelle verwaltet."})]}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:Iw.map(I=>c.jsx("button",{type:"button",onClick:()=>{r(I.slug),h(!1),u("")},className:`rounded-md px-3 py-1.5 text-sm font-medium transition ${n===I.slug?"bg-brand-500 text-white":"border border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:I.label},I.slug))}),c.jsx("div",{className:"mb-4 flex gap-1 border-b border-neutral-200 pb-4 dark:border-neutral-800",children:[["de","Deutsch"],["en","English"]].map(([I,H])=>c.jsx("button",{type:"button",onClick:()=>i(I),className:`rounded-md px-3 py-1 text-sm font-medium transition ${s===I?"bg-neutral-800 text-white dark:bg-neutral-100 dark:text-neutral-900":"text-neutral-500 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800"}`,children:H},I))}),b?c.jsxs("div",{className:"mb-5 grid gap-4 border-b border-neutral-200 pb-5 dark:border-neutral-800 sm:grid-cols-[16rem_1fr] sm:items-start",children:[c.jsxs("div",{children:[c.jsxs("div",{ref:m,className:"relative aspect-video select-none overflow-hidden rounded-xl bg-neutral-900 shadow-sm",children:[n==="hero"&&f?c.jsx("img",{src:f,alt:"",draggable:!1,className:"h-full w-full object-cover"}):c.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-to-br from-neutral-700 to-neutral-900 text-xs uppercase tracking-wide text-neutral-500",children:n==="youtube"?"Video-Hintergrund":"Hero-Bild"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-black/40"}),c.jsxs("div",{onPointerDown:j,onPointerMove:S,onPointerUp:N,style:{...Qi(y.text_align_x,y.text_align_y,{x:50,y:50}),touchAction:"none"},className:`absolute max-w-[85%] select-none whitespace-nowrap rounded p-2 text-center transition-colors ${g?"cursor-grabbing bg-white/10 ring-2 ring-brand-400":"cursor-grab hover:bg-white/10"}`,children:[E&&c.jsx("p",{className:"truncate text-[10px] font-semibold uppercase tracking-wide text-brand-300",children:E}),c.jsx("p",{className:"truncate text-sm font-extrabold text-white",children:D})]})]}),c.jsx("p",{className:"mt-1.5 text-center text-xs text-neutral-400",children:"Zum Verschieben ziehen"})]}),c.jsxs("div",{className:"flex flex-col gap-3 sm:pt-1",children:[c.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:["Position:"," ",c.jsxs("span",{className:"font-mono font-semibold text-neutral-700 dark:text-neutral-200",children:[y.text_align_x,"% / ",y.text_align_y,"%"]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wide text-neutral-400",children:"Schnellauswahl waagerecht"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>w(0,y.text_align_y),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Links"}),c.jsx("button",{type:"button",onClick:()=>w(50,y.text_align_y),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Mittig"}),c.jsx("button",{type:"button",onClick:()=>w(100,y.text_align_y),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Rechts"})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wide text-neutral-400",children:"Schnellauswahl senkrecht"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>w(y.text_align_x,0),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Oben"}),c.jsx("button",{type:"button",onClick:()=>w(y.text_align_x,50),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Mittig"}),c.jsx("button",{type:"button",onClick:()=>w(y.text_align_x,100),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Unten"})]})]})]})]}):c.jsxs("div",{className:"mb-5 grid gap-4 border-b border-neutral-200 pb-5 dark:border-neutral-800 sm:grid-cols-[10rem_1fr] sm:items-center",children:[c.jsx("div",{className:"aspect-square rounded-xl bg-neutral-100 dark:bg-neutral-800","aria-hidden":!0}),c.jsxs("div",{children:[c.jsxs("div",{className:`rounded-lg border border-neutral-200 p-3 dark:border-neutral-700 ${ZH[y.text_align]||"text-left"}`,children:[E&&c.jsx("p",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:E}),c.jsx("p",{className:"mb-1 font-bold text-neutral-900 dark:text-white",children:D}),c.jsx("p",{className:"line-clamp-2 text-xs text-neutral-500 dark:text-neutral-400",children:P||"Text erscheint hier…"})]}),c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:XH.map(I=>c.jsx("button",{type:"button",onClick:()=>k("text_align",I.value),className:`rounded-md border px-3 py-1.5 text-sm font-medium transition ${y.text_align===I.value?"border-brand-500 bg-brand-500 text-white":"border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:I.label},I.value))})]})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Kurzer Vorspann (optional)"}),c.jsx("input",{value:y[`eyebrow_${s}`]||"",onChange:I=>k(`eyebrow_${s}`,I.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx(Os,{fieldKey:`home_sections.${n}.eyebrow`,previewText:y[`eyebrow_${s}`]||"Beispieltext"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Überschrift"}),c.jsx("input",{value:y[`title_${s}`]||"",onChange:I=>k(`title_${s}`,I.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx(Os,{fieldKey:`home_sections.${n}.title`,previewText:y[`title_${s}`]||"Beispieltext"})]}),c.jsx(Td,{label:"Text",value:y[`body_html_${s}`]||"",onChange:I=>k(`body_html_${s}`,I)}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Button-Beschriftung (optional)"}),c.jsx("input",{value:y[`button_label_${s}`]||"",onChange:I=>k(`button_label_${s}`,I.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx(Os,{fieldKey:`home_sections.${n}.button_label`,previewText:y[`button_label_${s}`]||"Beispieltext"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Button-Ziel (Link, für beide Sprachen gleich)"}),c.jsx("input",{value:y.button_url||"",onChange:I=>k("button_url",I.target.value),placeholder:"/leistungen oder https://…",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:'Ohne Beschriftung UND Ziel wird kein Button angezeigt. Mit "/" beginnende Ziele bleiben innerhalb der Seite, alles andere öffnet extern in einem neuen Tab.'})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Schriftart (für beide Sprachen gleich)"}),c.jsxs("select",{value:y.font_family||"",onChange:I=>k("font_family",I.target.value||null),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Standard (globale Schriftart)"}),oh.filter(I=>I.value).map(I=>c.jsx("option",{value:I.value,children:I.label},I.label))]})]})]}),y.updated_at&&c.jsxs("p",{className:"mt-3 text-xs text-neutral-400",children:["Zuletzt geändert: ",new Date(y.updated_at.replace(" ","T")).toLocaleString("de-DE")]}),l&&c.jsx("p",{className:"mt-3 text-sm text-red-600",children:l}),d&&c.jsx("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),c.jsx("button",{type:"button",onClick:T,disabled:o,className:"mt-4 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:o?"Speichere…":"Speichern"})]})]})}const t7=t=>t==null?"–":new Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(t),n7={ok:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",pending:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",error:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"};function r7(){const{packageId:t}=ti(),[e,n]=v.useState([]),[r,s]=v.useState(""),[i,o]=v.useState(""),[a,l]=v.useState(""),[u,d]=v.useState(!1),h=()=>A.get(`/packages/${t}/products`).then(n);v.useEffect(()=>{h()},[t]);const f=async g=>{g.preventDefault(),l(""),d(!0);try{await A.post("/products",{package_id:Number(t),source_url:r,name_override:i||null}),s(""),o(""),h()}catch(x){l(x.message)}finally{d(!1)}},p=async g=>{d(!0);try{await A.post(`/products/${g}/refresh-price`,{}),h()}finally{d(!1)}},m=async g=>{confirm("Produkt wirklich entfernen?")&&(await A.delete(`/products/${g}`),h())};return c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-sm",children:c.jsx(ne,{to:"/admin/packages",className:"text-brand-600 hover:underline",children:"← Zurück zu den Paketen"})}),c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Produkte im Paket"}),c.jsxs("form",{onSubmit:f,className:"mb-6 flex flex-wrap items-end gap-3 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"flex-1 min-w-[240px]",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"audio4cars.de Produkt-URL *"}),c.jsx("input",{required:!0,type:"url",placeholder:"https://www.audio4cars.de/produkt/...",value:r,onChange:g=>s(g.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{className:"w-56",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name überschreiben (optional)"}),c.jsx("input",{value:i,onChange:g=>o(g.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx("button",{disabled:u,type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"Hinzufügen"})]}),a&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:a}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Produkt"}),c.jsx("th",{className:"px-4 py-2",children:"Preis"}),c.jsx("th",{className:"px-4 py-2",children:"Status"}),c.jsx("th",{className:"px-4 py-2",children:"Zuletzt aktualisiert"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[e.map(g=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsxs("td",{className:"px-4 py-2",children:[c.jsx("a",{href:g.source_url,target:"_blank",rel:"noreferrer",className:"font-medium text-neutral-800 hover:underline dark:text-neutral-100",children:g.name_override||g.scraped_name||g.source_url}),g.scrape_status==="error"&&c.jsx("p",{className:"text-xs text-red-500",children:g.scrape_error})]}),c.jsx("td",{className:"px-4 py-2",children:t7(g.scraped_price)}),c.jsx("td",{className:"px-4 py-2",children:c.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${n7[g.scrape_status]}`,children:g.scrape_status})}),c.jsx("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:g.price_updated_at?new Date(g.price_updated_at.replace(" ","T")).toLocaleString("de-DE"):"–"}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{disabled:u,onClick:()=>p(g.id),className:"mr-3 text-brand-600 hover:underline disabled:opacity-60",children:"Preis aktualisieren"}),c.jsx("button",{onClick:()=>m(g.id),className:"text-red-600 hover:underline",children:"Entfernen"})]})]},g.id)),e.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:5,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Produkte im Paket."})})]})]})})]})}const s7=t=>new Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(t),Ow={name:"",description:"",price:0,sort_order:0};function i7(){const{packageId:t}=ti(),[e,n]=v.useState([]),[r,s]=v.useState(Ow),[i,o]=v.useState(null),[a,l]=v.useState(""),u=()=>A.get(`/packages/${t}/upgrades`).then(n);v.useEffect(()=>{u()},[t]);const d=m=>{o(m.id),s({name:m.name,description:m.description||"",price:m.price,sort_order:m.sort_order})},h=()=>{o(null),s(Ow)},f=async m=>{m.preventDefault(),l("");const g={...r,package_id:Number(t),price:Number(r.price)};try{i?await A.put(`/package-upgrades/${i}`,g):await A.post("/package-upgrades",g),h(),u()}catch(x){l(x.message)}},p=async m=>{confirm("Upgrade wirklich löschen?")&&(await A.delete(`/package-upgrades/${m}`),u())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("p",{className:"mb-2 text-sm",children:c.jsx(ne,{to:"/admin/packages",className:"text-brand-600 hover:underline",children:"← Zurück zu den Paketen"})}),c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Optionale Upgrades"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Diese Upgrades erscheinen nicht in der öffentlichen Paketübersicht, sondern erst als Auswahl im Kontaktformular."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Preis"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[e.map(m=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsxs("td",{className:"px-4 py-2",children:[c.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:m.name}),m.description&&c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:m.description})]}),c.jsx("td",{className:"px-4 py-2",children:s7(m.price)}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>d(m),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>p(m.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},m.id)),e.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Upgrades hinterlegt."})})]})]})})]}),c.jsxs("form",{onSubmit:f,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:i?"Upgrade bearbeiten":"Neues Upgrade"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:r.name,onChange:m=>s({...r,name:m.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),c.jsx("textarea",{rows:2,value:r.description,onChange:m=>s({...r,description:m.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Preis (€) *"}),c.jsx("input",{required:!0,type:"number",step:"0.01",min:"0",value:r.price,onChange:m=>s({...r,price:m.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:r.sort_order,onChange:m=>s({...r,sort_order:Number(m.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),a&&c.jsx("p",{className:"text-sm text-red-600",children:a}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:i?"Speichern":"Anlegen"}),i&&c.jsx("button",{type:"button",onClick:h,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const o7=t=>new Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(t),a7={new:"Neu",in_progress:"In Bearbeitung",done:"Erledigt"},l7={new:"bg-brand-100 text-brand-700 dark:bg-brand-900/40 dark:text-brand-300",in_progress:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",done:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"},c7=()=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"h-4 w-4",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0-.8 12.1a1 1 0 0 1-1 .9H7.8a1 1 0 0 1-1-.9L6 7h12ZM10 11v6M14 11v6"})});function u7(){const{hasPermission:t}=jn(),[e,n]=v.useState([]),[r,s]=v.useState("all"),i=()=>A.get("/contact").then(n);v.useEffect(()=>{i()},[]);const o=async(h,f)=>{await A.patch(`/contact/${h}`,{status:f}),i()},a=async h=>{confirm("Diese Kontaktanfrage wirklich unwiderruflich löschen?")&&(await A.delete(`/contact/${h}`),i())},l=v.useMemo(()=>({all:e.length,new:e.filter(h=>h.status==="new").length,in_progress:e.filter(h=>h.status==="in_progress").length,done:e.filter(h=>h.status==="done").length}),[e]),u=r==="all"?e:e.filter(h=>h.status===r),d=[{value:"all",label:"Alle"},{value:"new",label:"Neu"},{value:"in_progress",label:"In Bearbeitung"},{value:"done",label:"Erledigt"}];return c.jsxs("div",{children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Kontaktanfragen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Alle Anfragen deiner Kunden. Wähle oben einen Reiter, um nur bestimmte Anfragen zu sehen."}),c.jsx("div",{className:"mb-5 flex flex-wrap gap-2",children:d.map(h=>c.jsxs("button",{onClick:()=>s(h.value),className:`rounded-full px-4 py-1.5 text-sm font-medium transition ${r===h.value?"bg-brand-500 text-white":"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"}`,children:[h.label," (",l[h.value],")"]},h.value))}),c.jsxs("div",{className:"space-y-3",children:[u.map(h=>{var f;return c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:[c.jsxs("div",{children:[c.jsxs("p",{className:"font-semibold text-neutral-800 dark:text-neutral-100",children:[h.name," · ",h.email,h.phone?` · ${h.phone}`:""]}),h.vin&&c.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["FIN: ",c.jsx("span",{className:"font-mono",children:h.vin})]}),c.jsx("p",{className:"text-xs text-neutral-400",children:new Date(h.created_at.replace(" ","T")).toLocaleString("de-DE")})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("select",{value:h.status,onChange:p=>o(h.id,p.target.value),className:`rounded-full border-0 px-3 py-1 text-xs font-medium ${l7[h.status]}`,children:Object.entries(a7).map(([p,m])=>c.jsx("option",{value:p,children:m},p))}),t("contact.delete")&&c.jsx("button",{onClick:()=>a(h.id),"aria-label":"Anfrage löschen",title:"Anfrage löschen",className:"rounded-md p-1.5 text-neutral-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20",children:c.jsx(c7,{})})]})]}),(h.brand_name||h.model_name||h.package_name||h.product_name)&&c.jsx("p",{className:"mb-2 text-sm text-neutral-500 dark:text-neutral-400",children:[h.brand_name,h.model_name,h.package_name,h.product_name].filter(Boolean).join(" · ")}),((f=h.selected_upgrades)==null?void 0:f.length)>0&&c.jsxs("div",{className:"mb-2 rounded-md bg-brand-50 p-2 text-sm text-brand-800 dark:bg-brand-900/20 dark:text-brand-200",children:[c.jsx("p",{className:"font-semibold",children:"Gewünschte Upgrades:"}),c.jsx("ul",{className:"list-disc pl-5",children:h.selected_upgrades.map(p=>c.jsxs("li",{children:[p.name," – ",o7(p.price)]},p.id))})]}),h.message&&c.jsx("p",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:h.message})]},h.id)}),u.length===0&&c.jsx("p",{className:"text-neutral-400",children:r==="all"?"Noch keine Kontaktanfragen eingegangen.":"Keine Anfragen mit diesem Status."})]})]})}var Dl={},d7=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},M2={},Gt={};let Ex;const h7=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Gt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Gt.getSymbolTotalCodewords=function(e){return h7[e]};Gt.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Gt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');Ex=e};Gt.isKanjiModeEnabled=function(){return typeof Ex<"u"};Gt.toSJIS=function(e){return Ex(e)};var wh={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,s){if(t.isValid(r))return r;try{return e(r)}catch{return s}}})(wh);function P2(){this.buffer=[],this.length=0}P2.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n<e;n++)this.putBit((t>>>e-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var f7=P2;function Ll(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Ll.prototype.set=function(t,e,n,r){const s=t*this.size+e;this.data[s]=n,r&&(this.reservedBit[s]=!0)};Ll.prototype.get=function(t,e){return this.data[t*this.size+e]};Ll.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};Ll.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var p7=Ll,A2={};(function(t){const e=Gt.getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const s=Math.floor(r/7)+2,i=e(r),o=i===145?26:Math.ceil((i-13)/(2*s-2))*2,a=[i-7];for(let l=1;l<s-1;l++)a[l]=a[l-1]-o;return a.push(6),a.reverse()},t.getPositions=function(r){const s=[],i=t.getRowColCoords(r),o=i.length;for(let a=0;a<o;a++)for(let l=0;l<o;l++)a===0&&l===0||a===0&&l===o-1||a===o-1&&l===0||s.push([i[a],i[l]]);return s}})(A2);var D2={};const m7=Gt.getSymbolSize,Bw=7;D2.getPositions=function(e){const n=m7(e);return[[0,0],[n-Bw,0],[0,n-Bw]]};var L2={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},t.from=function(s){return t.isValid(s)?parseInt(s,10):void 0},t.getPenaltyN1=function(s){const i=s.size;let o=0,a=0,l=0,u=null,d=null;for(let h=0;h<i;h++){a=l=0,u=d=null;for(let f=0;f<i;f++){let p=s.get(h,f);p===u?a++:(a>=5&&(o+=e.N1+(a-5)),u=p,a=1),p=s.get(f,h),p===d?l++:(l>=5&&(o+=e.N1+(l-5)),d=p,l=1)}a>=5&&(o+=e.N1+(a-5)),l>=5&&(o+=e.N1+(l-5))}return o},t.getPenaltyN2=function(s){const i=s.size;let o=0;for(let a=0;a<i-1;a++)for(let l=0;l<i-1;l++){const u=s.get(a,l)+s.get(a,l+1)+s.get(a+1,l)+s.get(a+1,l+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(s){const i=s.size;let o=0,a=0,l=0;for(let u=0;u<i;u++){a=l=0;for(let d=0;d<i;d++)a=a<<1&2047|s.get(u,d),d>=10&&(a===1488||a===93)&&o++,l=l<<1&2047|s.get(d,u),d>=10&&(l===1488||l===93)&&o++}return o*e.N3},t.getPenaltyN4=function(s){let i=0;const o=s.data.length;for(let l=0;l<o;l++)i+=s.data[l];return Math.abs(Math.ceil(i*100/o/5)-10)*e.N4};function n(r,s,i){switch(r){case t.Patterns.PATTERN000:return(s+i)%2===0;case t.Patterns.PATTERN001:return s%2===0;case t.Patterns.PATTERN010:return i%3===0;case t.Patterns.PATTERN011:return(s+i)%3===0;case t.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(i/3))%2===0;case t.Patterns.PATTERN101:return s*i%2+s*i%3===0;case t.Patterns.PATTERN110:return(s*i%2+s*i%3)%2===0;case t.Patterns.PATTERN111:return(s*i%3+(s+i)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(s,i){const o=i.size;for(let a=0;a<o;a++)for(let l=0;l<o;l++)i.isReserved(l,a)||i.xor(l,a,n(s,l,a))},t.getBestMask=function(s,i){const o=Object.keys(t.Patterns).length;let a=0,l=1/0;for(let u=0;u<o;u++){i(u),t.applyMask(u,s);const d=t.getPenaltyN1(s)+t.getPenaltyN2(s)+t.getPenaltyN3(s)+t.getPenaltyN4(s);t.applyMask(u,s),d<l&&(l=d,a=u)}return a}})(L2);var Sh={};const Ir=wh,Nc=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Cc=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Sh.getBlocksCount=function(e,n){switch(n){case Ir.L:return Nc[(e-1)*4+0];case Ir.M:return Nc[(e-1)*4+1];case Ir.Q:return Nc[(e-1)*4+2];case Ir.H:return Nc[(e-1)*4+3];default:return}};Sh.getTotalCodewordsCount=function(e,n){switch(n){case Ir.L:return Cc[(e-1)*4+0];case Ir.M:return Cc[(e-1)*4+1];case Ir.Q:return Cc[(e-1)*4+2];case Ir.H:return Cc[(e-1)*4+3];default:return}};var R2={},Nh={};const ja=new Uint8Array(512),Md=new Uint8Array(256);(function(){let e=1;for(let n=0;n<255;n++)ja[n]=e,Md[e]=n,e<<=1,e&256&&(e^=285);for(let n=255;n<512;n++)ja[n]=ja[n-255]})();Nh.log=function(e){if(e<1)throw new Error("log("+e+")");return Md[e]};Nh.exp=function(e){return ja[e]};Nh.mul=function(e,n){return e===0||n===0?0:ja[Md[e]+Md[n]]};(function(t){const e=Nh;t.mul=function(r,s){const i=new Uint8Array(r.length+s.length-1);for(let o=0;o<r.length;o++)for(let a=0;a<s.length;a++)i[o+a]^=e.mul(r[o],s[a]);return i},t.mod=function(r,s){let i=new Uint8Array(r);for(;i.length-s.length>=0;){const o=i[0];for(let l=0;l<s.length;l++)i[l]^=e.mul(s[l],o);let a=0;for(;a<i.length&&i[a]===0;)a++;i=i.slice(a)}return i},t.generateECPolynomial=function(r){let s=new Uint8Array([1]);for(let i=0;i<r;i++)s=t.mul(s,new Uint8Array([1,e.exp(i)]));return s}})(R2);const _2=R2;function Tx(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}Tx.prototype.initialize=function(e){this.degree=e,this.genPoly=_2.generateECPolynomial(this.degree)};Tx.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(e.length+this.degree);n.set(e);const r=_2.mod(n,this.genPoly),s=this.degree-r.length;if(s>0){const i=new Uint8Array(this.degree);return i.set(r,s),i}return r};var g7=Tx,I2={},ps={},Mx={};Mx.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var $n={};const O2="[0-9]+",x7="[A-Z $%*+\\-./:]+";let ul="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ul=ul.replace(/u/g,"\\u");const y7="(?:(?![A-Z0-9 $%*+\\-./:]|"+ul+`)(?:.|[\r
]))+`;$n.KANJI=new RegExp(ul,"g");$n.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");$n.BYTE=new RegExp(y7,"g");$n.NUMERIC=new RegExp(O2,"g");$n.ALPHANUMERIC=new RegExp(x7,"g");const b7=new RegExp("^"+ul+"$"),v7=new RegExp("^"+O2+"$"),k7=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");$n.testKanji=function(e){return b7.test(e)};$n.testNumeric=function(e){return v7.test(e)};$n.testAlphanumeric=function(e){return k7.test(e)};(function(t){const e=Mx,n=$n;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(i,o){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?i.ccBits[0]:o<27?i.ccBits[1]:i.ccBits[2]},t.getBestModeForData=function(i){return n.testNumeric(i)?t.NUMERIC:n.testAlphanumeric(i)?t.ALPHANUMERIC:n.testKanji(i)?t.KANJI:t.BYTE},t.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},t.isValid=function(i){return i&&i.bit&&i.ccBits};function r(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+s)}}t.from=function(i,o){if(t.isValid(i))return i;try{return r(i)}catch{return o}}})(ps);(function(t){const e=Gt,n=Sh,r=wh,s=ps,i=Mx,o=7973,a=e.getBCHDigit(o);function l(f,p,m){for(let g=1;g<=40;g++)if(p<=t.getCapacity(g,m,f))return g}function u(f,p){return s.getCharCountIndicator(f,p)+4}function d(f,p){let m=0;return f.forEach(function(g){const x=u(g.mode,p);m+=x+g.getBitsLength()}),m}function h(f,p){for(let m=1;m<=40;m++)if(d(f,m)<=t.getCapacity(m,p,s.MIXED))return m}t.from=function(p,m){return i.isValid(p)?parseInt(p,10):m},t.getCapacity=function(p,m,g){if(!i.isValid(p))throw new Error("Invalid QR Code version");typeof g>"u"&&(g=s.BYTE);const x=e.getSymbolTotalCodewords(p),y=n.getTotalCodewordsCount(p,m),b=(x-y)*8;if(g===s.MIXED)return b;const k=b-u(g,p);switch(g){case s.NUMERIC:return Math.floor(k/10*3);case s.ALPHANUMERIC:return Math.floor(k/11*2);case s.KANJI:return Math.floor(k/13);case s.BYTE:default:return Math.floor(k/8)}},t.getBestVersionForData=function(p,m){let g;const x=r.from(m,r.M);if(Array.isArray(p)){if(p.length>1)return h(p,x);if(p.length===0)return 1;g=p[0]}else g=p;return l(g.mode,g.getLength(),x)},t.getEncodedBits=function(p){if(!i.isValid(p)||p<7)throw new Error("Invalid QR Code version");let m=p<<12;for(;e.getBCHDigit(m)-a>=0;)m^=o<<e.getBCHDigit(m)-a;return p<<12|m}})(I2);var B2={};const fg=Gt,z2=1335,w7=21522,zw=fg.getBCHDigit(z2);B2.getEncodedBits=function(e,n){const r=e.bit<<3|n;let s=r<<10;for(;fg.getBCHDigit(s)-zw>=0;)s^=z2<<fg.getBCHDigit(s)-zw;return(r<<10|s)^w7};var F2={};const S7=ps;function co(t){this.mode=S7.NUMERIC,this.data=t.toString()}co.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};co.prototype.getLength=function(){return this.data.length};co.prototype.getBitsLength=function(){return co.getBitsLength(this.data.length)};co.prototype.write=function(e){let n,r,s;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),s=parseInt(r,10),e.put(s,10);const i=this.data.length-n;i>0&&(r=this.data.substr(n),s=parseInt(r,10),e.put(s,i*3+1))};var N7=co;const C7=ps,Jf=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function uo(t){this.mode=C7.ALPHANUMERIC,this.data=t}uo.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};uo.prototype.getLength=function(){return this.data.length};uo.prototype.getBitsLength=function(){return uo.getBitsLength(this.data.length)};uo.prototype.write=function(e){let n;for(n=0;n+2<=this.data.length;n+=2){let r=Jf.indexOf(this.data[n])*45;r+=Jf.indexOf(this.data[n+1]),e.put(r,11)}this.data.length%2&&e.put(Jf.indexOf(this.data[n]),6)};var j7=uo;const E7=ps;function ho(t){this.mode=E7.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}ho.getBitsLength=function(e){return e*8};ho.prototype.getLength=function(){return this.data.length};ho.prototype.getBitsLength=function(){return ho.getBitsLength(this.data.length)};ho.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};var T7=ho;const M7=ps,P7=Gt;function fo(t){this.mode=M7.KANJI,this.data=t}fo.getBitsLength=function(e){return e*13};fo.prototype.getLength=function(){return this.data.length};fo.prototype.getBitsLength=function(){return fo.getBitsLength(this.data.length)};fo.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=P7.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};var A7=fo,V2={exports:{}};(function(t){var e={single_source_shortest_paths:function(n,r,s){var i={},o={};o[r]=0;var a=e.PriorityQueue.make();a.push(r,0);for(var l,u,d,h,f,p,m,g,x;!a.empty();){l=a.pop(),u=l.value,h=l.cost,f=n[u]||{};for(d in f)f.hasOwnProperty(d)&&(p=f[d],m=h+p,g=o[d],x=typeof o[d]>"u",(x||g>m)&&(o[d]=m,a.push(d,m),i[d]=u))}if(typeof s<"u"&&typeof o[s]>"u"){var y=["Could not find a path from ",r," to ",s,"."].join("");throw new Error(y)}return i},extract_shortest_path_from_predecessor_list:function(n,r){for(var s=[],i=r;i;)s.push(i),n[i],i=n[i];return s.reverse(),s},find_path:function(n,r,s){var i=e.single_source_shortest_paths(n,r,s);return e.extract_shortest_path_from_predecessor_list(i,s)},PriorityQueue:{make:function(n){var r=e.PriorityQueue,s={},i;n=n||{};for(i in r)r.hasOwnProperty(i)&&(s[i]=r[i]);return s.queue=[],s.sorter=n.sorter||r.default_sorter,s},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var s={value:n,cost:r};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(V2);var D7=V2.exports;(function(t){const e=ps,n=N7,r=j7,s=T7,i=A7,o=$n,a=Gt,l=D7;function u(y){return unescape(encodeURIComponent(y)).length}function d(y,b,k){const w=[];let C;for(;(C=y.exec(k))!==null;)w.push({data:C[0],index:C.index,mode:b,length:C[0].length});return w}function h(y){const b=d(o.NUMERIC,e.NUMERIC,y),k=d(o.ALPHANUMERIC,e.ALPHANUMERIC,y);let w,C;return a.isKanjiModeEnabled()?(w=d(o.BYTE,e.BYTE,y),C=d(o.KANJI,e.KANJI,y)):(w=d(o.BYTE_KANJI,e.BYTE,y),C=[]),b.concat(k,w,C).sort(function(S,N){return S.index-N.index}).map(function(S){return{data:S.data,mode:S.mode,length:S.length}})}function f(y,b){switch(b){case e.NUMERIC:return n.getBitsLength(y);case e.ALPHANUMERIC:return r.getBitsLength(y);case e.KANJI:return i.getBitsLength(y);case e.BYTE:return s.getBitsLength(y)}}function p(y){return y.reduce(function(b,k){const w=b.length-1>=0?b[b.length-1]:null;return w&&w.mode===k.mode?(b[b.length-1].data+=k.data,b):(b.push(k),b)},[])}function m(y){const b=[];for(let k=0;k<y.length;k++){const w=y[k];switch(w.mode){case e.NUMERIC:b.push([w,{data:w.data,mode:e.ALPHANUMERIC,length:w.length},{data:w.data,mode:e.BYTE,length:w.length}]);break;case e.ALPHANUMERIC:b.push([w,{data:w.data,mode:e.BYTE,length:w.length}]);break;case e.KANJI:b.push([w,{data:w.data,mode:e.BYTE,length:u(w.data)}]);break;case e.BYTE:b.push([{data:w.data,mode:e.BYTE,length:u(w.data)}])}}return b}function g(y,b){const k={},w={start:{}};let C=["start"];for(let j=0;j<y.length;j++){const S=y[j],N=[];for(let T=0;T<S.length;T++){const E=S[T],D=""+j+T;N.push(D),k[D]={node:E,lastCount:0},w[D]={};for(let P=0;P<C.length;P++){const O=C[P];k[O]&&k[O].node.mode===E.mode?(w[O][D]=f(k[O].lastCount+E.length,E.mode)-f(k[O].lastCount,E.mode),k[O].lastCount+=E.length):(k[O]&&(k[O].lastCount=E.length),w[O][D]=f(E.length,E.mode)+4+e.getCharCountIndicator(E.mode,b))}}C=N}for(let j=0;j<C.length;j++)w[C[j]].end=0;return{map:w,table:k}}function x(y,b){let k;const w=e.getBestModeForData(y);if(k=e.from(b,w),k!==e.BYTE&&k.bit<w.bit)throw new Error('"'+y+'" cannot be encoded with mode '+e.toString(k)+`.
Suggested mode is: `+e.toString(w));switch(k===e.KANJI&&!a.isKanjiModeEnabled()&&(k=e.BYTE),k){case e.NUMERIC:return new n(y);case e.ALPHANUMERIC:return new r(y);case e.KANJI:return new i(y);case e.BYTE:return new s(y)}}t.fromArray=function(b){return b.reduce(function(k,w){return typeof w=="string"?k.push(x(w,null)):w.data&&k.push(x(w.data,w.mode)),k},[])},t.fromString=function(b,k){const w=h(b,a.isKanjiModeEnabled()),C=m(w),j=g(C,k),S=l.find_path(j.map,"start","end"),N=[];for(let T=1;T<S.length-1;T++)N.push(j.table[S[T]].node);return t.fromArray(p(N))},t.rawSplit=function(b){return t.fromArray(h(b,a.isKanjiModeEnabled()))}})(F2);const Ch=Gt,Yf=wh,L7=f7,R7=p7,_7=A2,I7=D2,pg=L2,mg=Sh,O7=g7,Pd=I2,B7=B2,z7=ps,Xf=F2;function F7(t,e){const n=t.size,r=I7.getPositions(e);for(let s=0;s<r.length;s++){const i=r[s][0],o=r[s][1];for(let a=-1;a<=7;a++)if(!(i+a<=-1||n<=i+a))for(let l=-1;l<=7;l++)o+l<=-1||n<=o+l||(a>=0&&a<=6&&(l===0||l===6)||l>=0&&l<=6&&(a===0||a===6)||a>=2&&a<=4&&l>=2&&l<=4?t.set(i+a,o+l,!0,!0):t.set(i+a,o+l,!1,!0))}}function V7(t){const e=t.size;for(let n=8;n<e-8;n++){const r=n%2===0;t.set(n,6,r,!0),t.set(6,n,r,!0)}}function $7(t,e){const n=_7.getPositions(e);for(let r=0;r<n.length;r++){const s=n[r][0],i=n[r][1];for(let o=-2;o<=2;o++)for(let a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?t.set(s+o,i+a,!0,!0):t.set(s+o,i+a,!1,!0)}}function H7(t,e){const n=t.size,r=Pd.getEncodedBits(e);let s,i,o;for(let a=0;a<18;a++)s=Math.floor(a/3),i=a%3+n-8-3,o=(r>>a&1)===1,t.set(s,i,o,!0),t.set(i,s,o,!0)}function Zf(t,e,n){const r=t.size,s=B7.getEncodedBits(e,n);let i,o;for(i=0;i<15;i++)o=(s>>i&1)===1,i<6?t.set(i,8,o,!0):i<8?t.set(i+1,8,o,!0):t.set(r-15+i,8,o,!0),i<8?t.set(8,r-i-1,o,!0):i<9?t.set(8,15-i-1+1,o,!0):t.set(8,15-i-1,o,!0);t.set(r-8,8,1,!0)}function W7(t,e){const n=t.size;let r=-1,s=n-1,i=7,o=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!t.isReserved(s,a-l)){let u=!1;o<e.length&&(u=(e[o]>>>i&1)===1),t.set(s,a-l,u),i--,i===-1&&(o++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function U7(t,e,n){const r=new L7;n.forEach(function(l){r.put(l.mode.bit,4),r.put(l.getLength(),z7.getCharCountIndicator(l.mode,t)),l.write(r)});const s=Ch.getSymbolTotalCodewords(t),i=mg.getTotalCodewordsCount(t,e),o=(s-i)*8;for(r.getLengthInBits()+4<=o&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const a=(o-r.getLengthInBits())/8;for(let l=0;l<a;l++)r.put(l%2?17:236,8);return K7(r,t,e)}function K7(t,e,n){const r=Ch.getSymbolTotalCodewords(e),s=mg.getTotalCodewordsCount(e,n),i=r-s,o=mg.getBlocksCount(e,n),a=r%o,l=o-a,u=Math.floor(r/o),d=Math.floor(i/o),h=d+1,f=u-d,p=new O7(f);let m=0;const g=new Array(o),x=new Array(o);let y=0;const b=new Uint8Array(t.buffer);for(let S=0;S<o;S++){const N=S<l?d:h;g[S]=b.slice(m,m+N),x[S]=p.encode(g[S]),m+=N,y=Math.max(y,N)}const k=new Uint8Array(r);let w=0,C,j;for(C=0;C<y;C++)for(j=0;j<o;j++)C<g[j].length&&(k[w++]=g[j][C]);for(C=0;C<f;C++)for(j=0;j<o;j++)k[w++]=x[j][C];return k}function G7(t,e,n,r){let s;if(Array.isArray(t))s=Xf.fromArray(t);else if(typeof t=="string"){let u=e;if(!u){const d=Xf.rawSplit(t);u=Pd.getBestVersionForData(d,n)}s=Xf.fromString(t,u||40)}else throw new Error("Invalid data");const i=Pd.getBestVersionForData(s,n);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=i;else if(e<i)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+i+`.
`);const o=U7(e,n,s),a=Ch.getSymbolSize(e),l=new R7(a);return F7(l,e),V7(l),$7(l,e),Zf(l,n,0),e>=7&&H7(l,e),W7(l,o),isNaN(r)&&(r=pg.getBestMask(l,Zf.bind(null,l,n))),pg.applyMask(r,l),Zf(l,n,r),{modules:l,version:e,errorCorrectionLevel:n,maskPattern:r,segments:s}}M2.create=function(e,n){if(typeof e>"u"||e==="")throw new Error("No input text");let r=Yf.M,s,i;return typeof n<"u"&&(r=Yf.from(n.errorCorrectionLevel,Yf.M),s=Pd.from(n.version),i=pg.from(n.maskPattern),n.toSJISFunc&&Ch.setToSJISFunction(n.toSJISFunc)),G7(e,s,r,i)};var $2={},Px={};(function(t){function e(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(i){return[i,i]}))),r.length===6&&r.push("F","F");const s=parseInt(r.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+r.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const s=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,i=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:i,scale:i?4:o,margin:s,color:{dark:e(r.color.dark||"#000000ff"),light:e(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},t.getScale=function(r,s){return s.width&&s.width>=r+s.margin*2?s.width/(r+s.margin*2):s.scale},t.getImageWidth=function(r,s){const i=t.getScale(r,s);return Math.floor((r+s.margin*2)*i)},t.qrToImageData=function(r,s,i){const o=s.modules.size,a=s.modules.data,l=t.getScale(o,i),u=Math.floor((o+i.margin*2)*l),d=i.margin*l,h=[i.color.light,i.color.dark];for(let f=0;f<u;f++)for(let p=0;p<u;p++){let m=(f*u+p)*4,g=i.color.light;if(f>=d&&p>=d&&f<u-d&&p<u-d){const x=Math.floor((f-d)/l),y=Math.floor((p-d)/l);g=h[a[x*o+y]?1:0]}r[m++]=g.r,r[m++]=g.g,r[m++]=g.b,r[m]=g.a}}})(Px);(function(t){const e=Px;function n(s,i,o){s.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=o,i.width=o,i.style.height=o+"px",i.style.width=o+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(i,o,a){let l=a,u=o;typeof l>"u"&&(!o||!o.getContext)&&(l=o,o=void 0),o||(u=r()),l=e.getOptions(l);const d=e.getImageWidth(i.modules.size,l),h=u.getContext("2d"),f=h.createImageData(d,d);return e.qrToImageData(f.data,i,l),n(h,u,d),h.putImageData(f,0,0),u},t.renderToDataURL=function(i,o,a){let l=a;typeof l>"u"&&(!o||!o.getContext)&&(l=o,o=void 0),l||(l={});const u=t.render(i,o,l),d=l.type||"image/png",h=l.rendererOpts||{};return u.toDataURL(d,h.quality)}})($2);var H2={};const q7=Px;function Fw(t,e){const n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function Qf(t,e,n){let r=t+e;return typeof n<"u"&&(r+=" "+n),r}function J7(t,e,n){let r="",s=0,i=!1,o=0;for(let a=0;a<t.length;a++){const l=Math.floor(a%e),u=Math.floor(a/e);!l&&!i&&(i=!0),t[a]?(o++,a>0&&l>0&&t[a-1]||(r+=i?Qf("M",l+n,.5+u+n):Qf("m",s,0),s=0,i=!1),l+1<e&&t[a+1]||(r+=Qf("h",o),o=0)):s++}return r}H2.render=function(e,n,r){const s=q7.getOptions(n),i=e.modules.size,o=e.modules.data,a=i+s.margin*2,l=s.color.light.a?"<path "+Fw(s.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",u="<path "+Fw(s.color.dark,"stroke")+' d="'+J7(o,i,s.margin)+'"/>',d='viewBox="0 0 '+a+" "+a+'"',f='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+d+' shape-rendering="crispEdges">'+l+u+`</svg>
`;return typeof r=="function"&&r(null,f),f};const Y7=d7,gg=M2,W2=$2,X7=H2;function Ax(t,e,n,r,s){const i=[].slice.call(arguments,1),o=i.length,a=typeof i[o-1]=="function";if(!a&&!Y7())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(s=n,n=e,e=r=void 0):o===3&&(e.getContext&&typeof s>"u"?(s=r,r=void 0):(s=r,r=n,n=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(n=e,e=r=void 0):o===2&&!e.getContext&&(r=n,n=e,e=void 0),new Promise(function(l,u){try{const d=gg.create(n,r);l(t(d,e,r))}catch(d){u(d)}})}try{const l=gg.create(n,r);s(null,t(l,e,r))}catch(l){s(l)}}Dl.create=gg.create;Dl.toCanvas=Ax.bind(null,W2.render);Dl.toDataURL=Ax.bind(null,W2.renderToDataURL);Dl.toString=Ax.bind(null,function(t,e,n){return X7.render(t,n)});const Vw={current_password:"",new_password:"",new_password_confirmation:"",two_factor_code:""};function Z7(){const{user:t,refreshUser:e}=jn(),[n,r]=v.useState("idle"),[s,i]=v.useState(""),[o,a]=v.useState(""),[l,u]=v.useState(""),[d,h]=v.useState(""),[f,p]=v.useState([]),[m,g]=v.useState(""),[x,y]=v.useState(!1),[b,k]=v.useState(Vw),[w,C]=v.useState(""),[j,S]=v.useState(""),[N,T]=v.useState(!1),E=async B=>{if(B.preventDefault(),C(""),S(""),b.new_password!==b.new_password_confirmation){C("Die neuen Passwörter stimmen nicht überein");return}T(!0);try{await A.post("/auth/change-password",b),k(Vw),S("Passwort erfolgreich geändert.")}catch(re){C(re.message)}finally{T(!1)}},D=async()=>{g(""),y(!0);try{const B=await A.get("/auth/2fa/setup");a(B.secret),i(await Dl.toDataURL(B.otpauth_url)),u(""),r("setup")}catch(B){g(B.message)}finally{y(!1)}},P=async B=>{B.preventDefault(),g(""),y(!0);try{const re=await A.post("/auth/2fa/enable",{code:l});p(re.recovery_codes),r("recovery-codes"),await e()}catch(re){g(re.message)}finally{y(!1)}},O=()=>{r("idle"),p([]),h("")},I=async B=>{B.preventDefault(),g(""),y(!0);try{await A.post("/auth/2fa/disable",{password:d}),h(""),r("idle"),await e()}catch(re){g(re.message)}finally{y(!1)}},H=async B=>{B.preventDefault(),g(""),y(!0);try{const re=await A.post("/auth/2fa/recovery-codes",{password:d});p(re.recovery_codes),r("recovery-codes")}catch(re){g(re.message)}finally{y(!1)}};return c.jsxs("div",{className:"max-w-xl",children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Mein Konto"}),c.jsxs("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:["Angemeldet als ",c.jsx("strong",{children:t==null?void 0:t.username}),t!=null&&t.is_super_admin?" (Super-Admin)":"","."]}),c.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Passwort ändern"}),c.jsxs("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:["Vergib ein neues Passwort für dein Konto.",(t==null?void 0:t.two_factor_enabled)&&" Da 2FA aktiv ist, musst du die Änderung zusätzlich mit deinem Code bestätigen."]}),c.jsxs("form",{onSubmit:E,children:[c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Aktuelles Passwort"}),c.jsx("input",{type:"password",value:b.current_password,onChange:B=>k({...b,current_password:B.target.value}),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Neues Passwort"}),c.jsx("input",{type:"password",value:b.new_password,onChange:B=>k({...b,new_password:B.target.value}),required:!0,minLength:8,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Neues Passwort wiederholen"}),c.jsx("input",{type:"password",value:b.new_password_confirmation,onChange:B=>k({...b,new_password_confirmation:B.target.value}),required:!0,minLength:8,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),(t==null?void 0:t.two_factor_enabled)&&c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"2FA-Code zur Bestätigung"}),c.jsx("input",{value:b.two_factor_code,onChange:B=>k({...b,two_factor_code:B.target.value}),required:!0,inputMode:"numeric",placeholder:"123456 oder Wiederherstellungscode",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),w&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:w}),j&&c.jsx("p",{className:"mb-4 text-sm text-green-600 dark:text-green-400",children:j}),c.jsx("button",{type:"submit",disabled:N,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:N?"Wird geändert…":"Passwort ändern"})]})]}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Zwei-Faktor-Authentifizierung"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Schützt dein Konto zusätzlich mit einem Code aus der Google Authenticator App."}),n==="idle"&&c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"mb-4 text-sm",children:["Status:"," ",t!=null&&t.two_factor_enabled?c.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:"Aktiv"}):c.jsx("span",{className:"font-semibold text-neutral-500 dark:text-neutral-400",children:"Nicht aktiv"})]}),t!=null&&t.two_factor_enabled?c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{onClick:()=>{r("regenerate"),g("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:"Neue Wiederherstellungscodes erzeugen"}),c.jsx("button",{onClick:()=>{r("disable"),g("")},className:"rounded-md border border-red-300 px-4 py-2 text-sm font-medium text-red-600 hover:bg-red-50 dark:border-red-900 dark:hover:bg-red-900/20",children:"2FA deaktivieren"})]}):c.jsx("button",{onClick:D,disabled:x,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"2FA aktivieren"})]}),n==="setup"&&c.jsxs("form",{onSubmit:P,children:[c.jsxs("ol",{className:"mb-4 list-decimal space-y-2 pl-5 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("li",{children:"Öffne die Google Authenticator App (oder eine kompatible App)."}),c.jsx("li",{children:"Scanne den folgenden QR-Code:"})]}),c.jsx("div",{className:"mb-4 flex justify-center",children:s&&c.jsx("img",{src:s,alt:"QR-Code für Zwei-Faktor-Authentifizierung",className:"h-48 w-48 rounded-lg border border-neutral-200 dark:border-neutral-700"})}),c.jsxs("p",{className:"mb-4 text-center text-xs text-neutral-500 dark:text-neutral-400",children:["Geht das Scannen nicht? Gib diesen Code manuell ein: ",c.jsx("br",{}),c.jsx("code",{className:"mt-1 inline-block rounded bg-neutral-100 px-2 py-1 font-mono tracking-wider dark:bg-neutral-800",children:o})]}),c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Bestätigungscode aus der App"}),c.jsx("input",{value:l,onChange:B=>u(B.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest dark:border-neutral-700 dark:bg-neutral-900"})]}),m&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:m}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",disabled:x,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"Bestätigen & aktivieren"}),c.jsx("button",{type:"button",onClick:()=>r("idle"),className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]}),n==="recovery-codes"&&c.jsxs("div",{children:[c.jsx("p",{className:"mb-3 text-sm font-semibold text-neutral-900 dark:text-white",children:"Wiederherstellungscodes – jetzt sicher speichern!"}),c.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Jeder Code funktioniert einmalig, falls du keinen Zugriff mehr auf die Authenticator-App hast. Diese Codes werden nur jetzt angezeigt."}),c.jsx("div",{className:"mb-4 grid grid-cols-2 gap-2 rounded-md bg-neutral-100 p-4 font-mono text-sm dark:bg-neutral-800",children:f.map(B=>c.jsx("span",{children:B},B))}),c.jsx("button",{onClick:O,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:"Ich habe die Codes gespeichert"})]}),n==="disable"&&c.jsxs("form",{onSubmit:I,children:[c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),c.jsx("input",{type:"password",value:d,onChange:B=>h(B.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),m&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:m}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",disabled:x,className:"rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-700 disabled:opacity-60",children:"2FA jetzt deaktivieren"}),c.jsx("button",{type:"button",onClick:()=>{r("idle"),h("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]}),n==="regenerate"&&c.jsxs("form",{onSubmit:H,children:[c.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Die bisherigen Wiederherstellungscodes werden ungültig."}),c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),c.jsx("input",{type:"password",value:d,onChange:B=>h(B.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),m&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:m}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",disabled:x,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"Neue Codes erzeugen"}),c.jsx("button",{type:"button",onClick:()=>{r("idle"),h("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})]})}const $w={username:"",password:"",is_super_admin:!1,permissions:[],group_ids:[]};function Q7(t){return t?new Date(t.replace(" ","T")).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):"Noch nie"}function eW(){const{user:t,hasPermission:e}=jn(),[n,r]=v.useState([]),[s,i]=v.useState([]),[o,a]=v.useState([]),[l,u]=v.useState($w),[d,h]=v.useState(null),[f,p]=v.useState(!1),[m,g]=v.useState(""),x=()=>{A.get("/admin-users").then(r),A.get("/permissions/catalog").then(i),(e("permission_groups.manage")||e("users.manage"))&&A.get("/permission-groups").then(a)};v.useEffect(x,[]);const y=S=>{h(S.id),p(S.is_primary),u({username:S.username,password:"",is_super_admin:S.is_super_admin,permissions:S.permissions,group_ids:S.groups.map(N=>N.id)})},b=()=>{h(null),p(!1),u($w)},k=S=>{u(N=>({...N,permissions:N.permissions.includes(S)?N.permissions.filter(T=>T!==S):[...N.permissions,S]}))},w=S=>{u(N=>({...N,group_ids:N.group_ids.includes(S)?N.group_ids.filter(T=>T!==S):[...N.group_ids,S]}))},C=async S=>{S.preventDefault(),g("");try{if(d)await A.put(`/admin-users/${d}`,l);else{if(l.password.length<8){g("Passwort muss mindestens 8 Zeichen lang sein");return}await A.post("/admin-users",l)}b(),x()}catch(N){g(N.message)}},j=async S=>{if(confirm("Diesen Benutzer wirklich löschen?"))try{await A.delete(`/admin-users/${S}`),x()}catch(N){alert(N.message)}};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Benutzer"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Jeder Mitarbeiter bekommt ein eigenes Konto mit genau den Rechten, die er braucht."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Benutzername"}),c.jsx("th",{className:"px-4 py-2",children:"Rolle"}),c.jsx("th",{className:"px-4 py-2",children:"Berechtigungsgruppen"}),c.jsx("th",{className:"px-4 py-2",children:"Zuletzt aktiv"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[n.map(S=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsxs("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:[S.username,S.id===(t==null?void 0:t.id)&&c.jsx("span",{className:"ml-1 text-xs text-neutral-400",children:"(du)"}),S.is_primary&&c.jsx("span",{className:"ml-1 text-xs text-neutral-400",children:"(Erst-Administrator)"})]}),c.jsx("td",{className:"px-4 py-2",children:S.is_super_admin?c.jsx("span",{className:"rounded-full bg-brand-100 px-2 py-0.5 text-xs font-medium text-brand-700 dark:bg-brand-900/40 dark:text-brand-300",children:"Super-Admin"}):c.jsxs("span",{className:"text-neutral-500 dark:text-neutral-400",children:[S.permissions.length," Einzelrechte"]})}),c.jsx("td",{className:"px-4 py-2",children:c.jsxs("div",{className:"flex flex-wrap gap-1",children:[S.groups.map(N=>c.jsx("span",{className:"rounded-full bg-neutral-100 px-2 py-0.5 text-xs text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",children:N.name},N.id)),S.groups.length===0&&"–"]})}),c.jsx("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:Q7(S.last_active_at)}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>y(S),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),S.id!==(t==null?void 0:t.id)&&!S.is_primary&&c.jsx("button",{onClick:()=>j(S.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},S.id)),n.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:5,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Benutzer angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:C,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:d?"Benutzer bearbeiten":"Neuer Benutzer"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername *"}),c.jsx("input",{required:!0,value:l.username,onChange:S=>u({...l,username:S.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:["Passwort ",d?"(leer lassen = unverändert)":"*"]}),c.jsx("input",{type:"password",required:!d,value:l.password,onChange:S=>u({...l,password:S.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),(t==null?void 0:t.is_super_admin)&&c.jsxs("div",{children:[c.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:l.is_super_admin,disabled:f,onChange:S=>u({...l,is_super_admin:S.target.checked}),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500 disabled:opacity-50"}),"Super-Admin (hat automatisch alle Rechte)"]}),f&&c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"Der Erst-Administrator behält immer den Super-Admin-Status."})]}),!l.is_super_admin&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("p",{className:"mb-1 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Einzelne Berechtigungen"}),c.jsx("div",{className:"space-y-1.5 rounded-md border border-neutral-200 p-3 dark:border-neutral-700",children:s.map(S=>c.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:l.permissions.includes(S.key),onChange:()=>k(S.key),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),S.label]},S.key))})]}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-1 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Berechtigungsgruppen"}),c.jsxs("div",{className:"space-y-1.5 rounded-md border border-neutral-200 p-3 dark:border-neutral-700",children:[o.map(S=>c.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:l.group_ids.includes(S.id),onChange:()=>w(S.id),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),S.name]},S.id)),o.length===0&&c.jsx("p",{className:"text-sm text-neutral-400",children:"Noch keine Berechtigungsgruppen angelegt."})]})]})]}),m&&c.jsx("p",{className:"text-sm text-red-600",children:m}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:d?"Speichern":"Anlegen"}),d&&c.jsx("button",{type:"button",onClick:b,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const Hw={name:"",description:"",permissions:[]};function tW(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(Hw),[o,a]=v.useState(null),[l,u]=v.useState(""),d=()=>{A.get("/permission-groups").then(e),A.get("/permissions/catalog").then(r)};v.useEffect(d,[]);const h=x=>{a(x.id),i({name:x.name,description:x.description||"",permissions:x.permissions})},f=()=>{a(null),i(Hw)},p=x=>{i(y=>({...y,permissions:y.permissions.includes(x)?y.permissions.filter(b=>b!==x):[...y.permissions,x]}))},m=async x=>{x.preventDefault(),u("");try{o?await A.put(`/permission-groups/${o}`,s):await A.post("/permission-groups",s),f(),d()}catch(y){u(y.message)}},g=async x=>{confirm("Diese Berechtigungsgruppe wirklich löschen? Benutzer behalten ihre sonstigen Rechte.")&&(await A.delete(`/permission-groups/${x}`),d())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Berechtigungsgruppen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Fasse mehrere Berechtigungen zu einer Gruppe zusammen (z. B. „Werkstatt"), die du dann bequem einem oder mehreren Benutzern zuweisen kannst.'}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Berechtigungen"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(x=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsxs("td",{className:"px-4 py-2",children:[c.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:x.name}),x.description&&c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:x.description})]}),c.jsxs("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:[x.permissions.length," von ",n.length]}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>h(x),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>g(x.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},x.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Berechtigungsgruppen angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:m,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:o?"Gruppe bearbeiten":"Neue Gruppe"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:s.name,onChange:x=>i({...s,name:x.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),c.jsx("textarea",{rows:2,value:s.description,onChange:x=>i({...s,description:x.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-1 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Berechtigungen"}),c.jsx("div",{className:"space-y-1.5 rounded-md border border-neutral-200 p-3 dark:border-neutral-700",children:n.map(x=>c.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:s.permissions.includes(x.key),onChange:()=>p(x.key),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),x.label]},x.key))})]}),l&&c.jsx("p",{className:"text-sm text-red-600",children:l}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:o?"Speichern":"Anlegen"}),o&&c.jsx("button",{type:"button",onClick:f,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const nW=[{to:"/admin/settings/website",label:"Website"},{to:"/admin/settings/legal",label:"Rechtstexte"},{to:"/admin/settings/email",label:"E-Mail"},{to:"/admin/settings/database",label:"Datenbank"},{to:"/admin/settings/export-import",label:"Export & Import"},{to:"/admin/settings/maintenance",label:"Wartungsmodus"},{to:"/admin/settings/update",label:"Updates",permission:"system.update"},{to:"/admin/settings/reset",label:"Zurücksetzen"}];function rW(){const{hasPermission:t}=jn(),e=nW.filter(r=>!r.permission||t(r.permission)),n=({isActive:r})=>`rounded-md px-4 py-2 text-sm font-medium transition ${r?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`;return c.jsxs("div",{children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Einstellungen"}),c.jsx("p",{className:"mb-5 text-sm text-neutral-500 dark:text-neutral-400",children:"Werkzeuge rund um Datenbank, Server-Umzug und Zurücksetzen dieser Seite."}),c.jsx("nav",{className:"mb-6 flex flex-wrap gap-2",children:e.map(r=>c.jsx(aN,{to:r.to,className:n,children:r.label},r.to))}),c.jsx(Xd,{})]})}const U2=[{key:"mon",label:"Montag"},{key:"tue",label:"Dienstag"},{key:"wed",label:"Mittwoch"},{key:"thu",label:"Donnerstag"},{key:"fri",label:"Freitag"},{key:"sat",label:"Samstag"},{key:"sun",label:"Sonntag"}],K2=Object.fromEntries(U2.map(t=>[t.key,{open:"09:00",close:"18:00",closed:!1}])),sW={phone:"",whatsapp:"",contact_email:"",address_street:"",address_zip:"",address_city:"",logo_path:"",logo_dark_path:"",business_hours:K2,hero_image_path:"",ga_measurement_id:"",package_card_theme:"graphite",package_card_layout:"strip",package_wheel_hint_interval:8,gallery_card_text_x:0,gallery_card_text_y:100,site_font:""},iW=[{value:"graphite",label:"Graphite Green",description:"Graphit über Bronze/Silber/Gold/Platin bis zur Onyx-Krönung."},{value:"deep-blue",label:"Deep Blue Luxury",description:"Kühles Blau, das sich über Grün zu Gold erwärmt."},{value:"warm-bronze",label:"Warm Bronze",description:"Durchgehend warmes Kupfer/Bronze/Amber bis zum Gold."}],oW=[{value:"grid",label:"Raster",description:"Breite Kacheln, die responsiv in mehrere Zeilen umbrechen."},{value:"strip",label:"Scroll-Band",description:"Schmale, hochkant Kacheln in einer horizontal scrollbaren Reihe."},{value:"coverflow",label:"3D-Coverflow",description:"Kacheln drehen sich beim Wischen räumlich – die mittlere steht im Fokus."}];function aW(){const[t,e]=v.useState(sW),[n,r]=v.useState(!0),[s,i]=v.useState(!1),[o,a]=v.useState(!1),[l,u]=v.useState(""),[d,h]=v.useState(null),f=v.useRef(null),[p,m]=v.useState(!1),g=(L,ge)=>{const pe=f.current.getBoundingClientRect();return{x:Math.max(0,Math.min(100,Math.round((L-pe.left)/pe.width*100))),y:Math.max(0,Math.min(100,Math.round((ge-pe.top)/pe.height*100)))}},x=(L,ge)=>{const{x:pe,y:_e}=g(L,ge);e(Tn=>({...Tn,gallery_card_text_x:pe,gallery_card_text_y:_e})),a(!1)},y=L=>{L.preventDefault(),L.currentTarget.setPointerCapture(L.pointerId),m(!0),x(L.clientX,L.clientY)},b=L=>{p&&x(L.clientX,L.clientY)},k=L=>{m(!1),L.currentTarget.releasePointerCapture(L.pointerId)},[w,C]=v.useState(""),[j,S]=v.useState(""),[N,T]=v.useState(!1),[E,D]=v.useState(!1),[P,O]=v.useState(""),[I,H]=v.useState(!1),[B,re]=v.useState(""),[R,_]=v.useState(""),[$,te]=v.useState(!1),[Y,U]=v.useState(null),[X,ae]=v.useState(!1),[ue,Re]=v.useState(""),[mr,si]=v.useState(!1),[Rl,_l]=v.useState(!1);v.useEffect(()=>{A.get("/site-settings").then(L=>e({phone:L.phone||"",whatsapp:L.whatsapp||"",contact_email:L.contact_email||"",address_street:L.address_street||"",address_zip:L.address_zip||"",address_city:L.address_city||"",logo_path:L.logo_path||"",logo_dark_path:L.logo_dark_path||"",business_hours:L.business_hours||K2,hero_image_path:L.hero_image_path||"",ga_measurement_id:L.ga_measurement_id||"",package_card_theme:L.package_card_theme||"graphite",package_card_layout:L.package_card_layout||"strip",package_wheel_hint_interval:L.package_wheel_hint_interval||8,gallery_card_text_x:L.gallery_card_text_x??0,gallery_card_text_y:L.gallery_card_text_y??100,site_font:L.site_font||""})).finally(()=>r(!1)),A.get("/gallery-brands").then(L=>h(L.find(ge=>ge.cover_image_path)||null)).catch(()=>{}),A.get("/settings/analytics").then(L=>{C(L.ga_property_id||""),T(L.has_credentials)}),ii()},[]);const ii=()=>{A.get("/settings/google-reviews").then(L=>{re(L.place_id||""),te(L.has_api_key),U(L)})},Il=async()=>{ae(!0),Re(""),si(!1);try{const L=await A.post("/settings/google-reviews",{place_id:B,api_key:R});te(L.has_api_key),U(L),_(""),si(!0)}catch(L){Re(L.message)}finally{ae(!1)}},M=async()=>{_l(!0),Re("");try{const L=await A.post("/settings/google-reviews/refresh",{});U(L)}catch(L){Re(L.message),ii()}finally{_l(!1)}},ee=async()=>{D(!0),O(""),H(!1);try{const L=await A.post("/settings/analytics",{ga_property_id:w,service_account_json:j});T(L.has_credentials),S(""),H(!0)}catch(L){O(L.message)}finally{D(!1)}},q=(L,ge)=>{e(pe=>({...pe,[L]:ge})),a(!1)},Me=(L,ge,pe)=>{e(_e=>({..._e,business_hours:{..._e.business_hours,[L]:{..._e.business_hours[L],[ge]:pe}}})),a(!1)},En=async L=>{L.preventDefault(),i(!0),u(""),a(!1);try{await A.post("/site-settings",t),a(!0)}catch(ge){u(ge.message)}finally{i(!1)}};return n?c.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):c.jsxs("form",{onSubmit:En,className:"max-w-2xl space-y-6",children:[c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Startseiten-Bild"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Das große Hero-Bild ganz oben auf der Startseite. Ohne eigenes Bild wird das Standardbild verwendet."}),c.jsx(sr,{value:t.hero_image_path,onChange:L=>q("hero_image_path",L),label:"Bild",aspect:16/9})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Firmenlogo"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Ohne eigenes Logo wird das Standard-Logo dieser Vorlage angezeigt. Für den Dunkelmodus kann eine eigene Variante hinterlegt werden (z. B. mit heller statt dunkler Wortmarke)."}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsx(sr,{value:t.logo_path,onChange:L=>q("logo_path",L),label:"Logo (Hellmodus)"}),c.jsx(sr,{value:t.logo_dark_path,onChange:L=>q("logo_dark_path",L),label:"Logo (Dunkelmodus)"})]})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Schriftart"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Gilt für die gesamte Website. Einzelne Startseiten-Sektionen können unter „Startseite“ davon abweichen."}),c.jsx("select",{value:t.site_font,onChange:L=>q("site_font",L.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:oh.map(L=>c.jsx("option",{value:L.value,children:L.label},L.label))})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Kontaktdaten"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Wird im Header, Footer und auf der Kontaktseite angezeigt."}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Telefon"}),c.jsx("input",{value:t.phone,onChange:L=>q("phone",L.target.value),placeholder:"09373 20 62 390",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"WhatsApp Business Nummer"}),c.jsx("input",{value:t.whatsapp,onChange:L=>q("whatsapp",L.target.value),placeholder:"z. B. 09373 20 62 390",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"Leer lassen, um den WhatsApp-Link im Header auszublenden."})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"E-Mail"}),c.jsx("input",{type:"email",value:t.contact_email,onChange:L=>q("contact_email",L.target.value),placeholder:"info@hifi-planet-amorbach.de",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-[1fr_120px_1fr]",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Straße & Hausnummer"}),c.jsx("input",{value:t.address_street,onChange:L=>q("address_street",L.target.value),placeholder:"Boxbrunner Str. 20a",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"PLZ"}),c.jsx("input",{value:t.address_zip,onChange:L=>q("address_zip",L.target.value),placeholder:"63916",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Ort"}),c.jsx("input",{value:t.address_city,onChange:L=>q("address_city",L.target.value),placeholder:"Amorbach",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]})]})]})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Öffnungszeiten"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Wird im Footer und auf der Kontaktseite angezeigt, inklusive dem "Geöffnet/Geschlossen"-Hinweis im Footer, der live gegen diese Zeiten rechnet.'}),c.jsx("div",{className:"space-y-2",children:U2.map(L=>{const ge=t.business_hours[L.key]||{open:"",close:"",closed:!1};return c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx("span",{className:"w-24 shrink-0 text-sm text-neutral-600 dark:text-neutral-300",children:L.label}),c.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-neutral-500 dark:text-neutral-400",children:[c.jsx("input",{type:"checkbox",checked:!ge.closed,onChange:pe=>Me(L.key,"closed",!pe.target.checked),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),"geöffnet"]}),!ge.closed&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"time",value:ge.open,onChange:pe=>Me(L.key,"open",pe.target.value),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("span",{className:"text-neutral-400",children:"–"}),c.jsx("input",{type:"time",value:ge.close,onChange:pe=>Me(L.key,"close",pe.target.value),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]})]},L.key)})})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Paket-Kachel-Design"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Bestimmt die Farbgebung der Paket-Stufen auf jeder Fahrzeug-Modell-Seite (von der günstigsten bis zur teuersten Option)."}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:iW.map(L=>c.jsxs("label",{className:`cursor-pointer rounded-lg border p-3 text-sm transition ${t.package_card_theme===L.value?"border-brand-500 ring-2 ring-brand-500/40":"border-neutral-300 hover:border-neutral-400 dark:border-neutral-700 dark:hover:border-neutral-600"}`,children:[c.jsx("input",{type:"radio",name:"package_card_theme",value:L.value,checked:t.package_card_theme===L.value,onChange:ge=>q("package_card_theme",ge.target.value),className:"sr-only"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:L.label}),c.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:L.description})]},L.value))})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Kachel-Layout"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Bestimmt, wie die Paket-Stufen auf jeder Fahrzeug-Modell-Seite angeordnet werden."}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:oW.map(L=>c.jsxs("label",{className:`cursor-pointer rounded-lg border p-3 text-sm transition ${t.package_card_layout===L.value?"border-brand-500 ring-2 ring-brand-500/40":"border-neutral-300 hover:border-neutral-400 dark:border-neutral-700 dark:hover:border-neutral-600"}`,children:[c.jsx("input",{type:"radio",name:"package_card_layout",value:L.value,checked:t.package_card_layout===L.value,onChange:ge=>q("package_card_layout",ge.target.value),className:"sr-only"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:L.label}),c.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:L.description})]},L.value))}),c.jsxs("div",{className:"mt-5 max-w-xs",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Mausrad-Hinweis: Wiederholung (Sekunden)"}),c.jsx("input",{type:"number",min:"2",max:"120",value:t.package_wheel_hint_interval,onChange:L=>q("package_wheel_hint_interval",L.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:'Nur bei Scroll-Band/3D-Coverflow: Solange ein Besucher noch auf der ersten Kachel steht, wird der "mit dem Mausrad blättern"-Hinweis in diesem Abstand wiederholt.'})]})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Bildergalerie-Kacheln"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Position des Marken-/Projekt-Namens auf den Kacheln der Bildergalerie-Übersicht und der Marken-Detailseite."}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-[16rem_1fr] sm:items-start",children:[c.jsxs("div",{children:[c.jsxs("div",{ref:f,className:"relative aspect-[4/3] select-none overflow-hidden rounded-xl bg-neutral-900 shadow-sm",children:[d?c.jsx("img",{src:d.cover_image_path,alt:"",draggable:!1,className:"h-full w-full object-cover"}):c.jsx("div",{className:"h-full w-full bg-gradient-to-br from-neutral-700 to-neutral-900"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent"}),c.jsx("span",{onPointerDown:y,onPointerMove:b,onPointerUp:k,style:{...Qi(t.gallery_card_text_x,t.gallery_card_text_y,{x:0,y:100}),touchAction:"none"},className:`absolute select-none whitespace-nowrap rounded p-3 text-sm font-extrabold text-white transition-colors ${p?"cursor-grabbing bg-white/10 ring-2 ring-brand-400":"cursor-grab hover:bg-white/10"}`,children:d?d.name:"Beispiel-Marke"})]}),c.jsx("p",{className:"mt-1.5 text-center text-xs text-neutral-400",children:"Namen zum Verschieben ziehen"})]}),c.jsxs("div",{className:"flex flex-col gap-3 sm:pt-1",children:[c.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:["Position:"," ",c.jsxs("span",{className:"font-mono font-semibold text-neutral-700 dark:text-neutral-200",children:[t.gallery_card_text_x,"% / ",t.gallery_card_text_y,"%"]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wide text-neutral-400",children:"Schnellauswahl waagerecht"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>q("gallery_card_text_x",0),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Links"}),c.jsx("button",{type:"button",onClick:()=>q("gallery_card_text_x",50),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Mittig"}),c.jsx("button",{type:"button",onClick:()=>q("gallery_card_text_x",100),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Rechts"})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wide text-neutral-400",children:"Schnellauswahl senkrecht"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>q("gallery_card_text_y",0),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Oben"}),c.jsx("button",{type:"button",onClick:()=>q("gallery_card_text_y",50),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Mittig"}),c.jsx("button",{type:"button",onClick:()=>q("gallery_card_text_y",100),className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Unten"})]})]})]})]})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google Analytics"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Wird erst geladen, nachdem ein Besucher der Statistik-Kategorie im Cookie-Banner zugestimmt hat. Leer lassen, um Google Analytics zu deaktivieren."}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Measurement-ID"}),c.jsx("input",{value:t.ga_measurement_id,onChange:L=>q("ga_measurement_id",L.target.value),placeholder:"G-XXXXXXXXXX",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{className:"mt-5 border-t border-neutral-200 pt-5 dark:border-neutral-800",children:[c.jsx("h3",{className:"mb-1 text-sm font-semibold text-neutral-900 dark:text-white",children:"Dashboard-Anbindung (optional)"}),c.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Zeigt Besucherzahlen direkt in deinem Admin-Dashboard an. Braucht ein Google-Cloud-Service-Account mit Lesezugriff auf diese GA4-Property."}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Property-ID"}),c.jsx("input",{value:w,onChange:L=>{C(L.target.value),H(!1)},placeholder:"z. B. 123456789",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"Nicht die Measurement-ID (G-...) - zu finden unter GA4 → Verwaltung → Property-Details."})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:["Service-Account-JSON-Schlüssel ",N?"(leer lassen = unverändert)":""]}),c.jsx("textarea",{rows:4,value:j,onChange:L=>{S(L.target.value),H(!1)},placeholder:N?'{ "type": "service_account", ... } (bereits hinterlegt)':'{ "type": "service_account", ... }',className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 font-mono text-xs dark:border-neutral-700 dark:bg-neutral-900"})]})]}),P&&c.jsx("p",{className:"mt-2 text-sm text-red-600",children:P}),I&&c.jsx("p",{className:"mt-2 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),c.jsx("button",{type:"button",onClick:ee,disabled:E,className:"mt-3 rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:E?"Speichere…":"Dashboard-Anbindung speichern"})]})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google-Rezensionen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Zeigt die echte Google-Bewertung und die aktuellsten Rezensionen auf der Startseite an, statt der fest eingetragenen Beispiel-Texte. Wird einmal täglich automatisch aktualisiert (nie bei einem Seitenbesuch selbst) – die Seite zeigt also immer den letzten erfolgreich abgerufenen Stand."}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Place-ID"}),c.jsx("input",{value:B,onChange:L=>{re(L.target.value),si(!1)},placeholder:"z. B. ChIJN1t_tDeuEmsRUsoyG83frY4",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsxs("p",{className:"mt-1 text-xs text-neutral-400",children:["Eindeutige Google-Kennung eures Eintrags – zu finden über den"," ",c.jsx("a",{href:"https://developers.google.com/maps/documentation/places/web-service/place-id#find-id",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-brand-600",children:"Google Place ID Finder"}),"."]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:["Places-API-Key ",$?"(leer lassen = unverändert)":""]}),c.jsx("input",{value:R,onChange:L=>{_(L.target.value),si(!1)},placeholder:$?"••••••••••••••••••••• (bereits hinterlegt)":"AIzaSy…",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 font-mono text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"Aus der Google-Cloud-Console, mit aktivierter „Places API (New)“."})]})]}),ue&&c.jsx("p",{className:"mt-3 text-sm text-red-600",children:ue}),mr&&c.jsx("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[c.jsx("button",{type:"button",onClick:Il,disabled:X,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:X?"Speichere…":"Google-Rezensionen-Einstellungen speichern"}),c.jsx("button",{type:"button",onClick:M,disabled:Rl||!B||!$,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:Rl?"Aktualisiere…":"Jetzt aktualisieren"})]}),Y&&c.jsxs("div",{className:"mt-4 rounded-md bg-neutral-50 p-3 text-sm dark:bg-neutral-800/50",children:[Y.rating!=null?c.jsxs("p",{className:"text-neutral-700 dark:text-neutral-300",children:["Aktuell hinterlegt: ",c.jsxs("strong",{children:[Y.rating," ★"]})," (",Y.rating_count," Bewertungen)",Y.updated_at&&c.jsxs(c.Fragment,{children:[" – zuletzt aktualisiert am ",new Date(Y.updated_at.replace(" ","T")).toLocaleString("de-DE")]})]}):c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:"Noch keine erfolgreiche Aktualisierung – die Startseite zeigt bis dahin weiter die Beispiel-Rezensionen."}),Y.error&&c.jsxs("p",{className:"mt-1 text-red-600",children:["Letzter Fehler: ",Y.error]})]})]}),l&&c.jsx("p",{className:"text-sm text-red-600",children:l}),o&&c.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),c.jsx("button",{type:"submit",disabled:s,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s?"Speichere…":"Speichern"})]})}const lW=[{slug:"impressum",label:"Impressum"},{slug:"datenschutz",label:"Datenschutzerklärung"},{slug:"agb",label:"AGB"}];function cW(){const[t,e]=v.useState(null),[n,r]=v.useState("impressum"),[s,i]=v.useState(!1),[o,a]=v.useState(""),[l,u]=v.useState(!1);if(v.useEffect(()=>{A.get("/legal-pages").then(e)},[]),!t)return c.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const d=t[n],h=(p,m)=>{e(g=>({...g,[n]:{...g[n],[p]:m}})),u(!1)},f=async()=>{i(!0),a(""),u(!1);try{await A.put(`/legal-pages/${n}`,{title:d.title,body_html:d.body_html}),u(!0)}catch(p){a(p.message)}finally{i(!1)}};return c.jsx("div",{className:"max-w-3xl space-y-6",children:c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Rechtstexte"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Impressum, Datenschutzerklärung und AGB direkt hier pflegen, statt einen Deploy für jede Textänderung zu brauchen. Bitte bei Rechtstexten im Zweifel rechtlich beraten lassen, bevor du größere Änderungen veröffentlichst."}),c.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:lW.map(p=>c.jsx("button",{type:"button",onClick:()=>{r(p.slug),u(!1),a("")},className:`rounded-md px-3 py-1.5 text-sm font-medium transition ${n===p.slug?"bg-brand-500 text-white":"border border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:p.label},p.slug))}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Überschrift"}),c.jsx("input",{value:d.title,onChange:p=>h("title",p.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(Td,{label:"Inhalt",value:d.body_html,onChange:p=>h("body_html",p)})]}),d.updated_at&&c.jsxs("p",{className:"mt-3 text-xs text-neutral-400",children:["Zuletzt geändert: ",new Date(d.updated_at.replace(" ","T")).toLocaleString("de-DE")]}),o&&c.jsx("p",{className:"mt-3 text-sm text-red-600",children:o}),l&&c.jsx("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),c.jsx("button",{type:"button",onClick:f,disabled:s,className:"mt-4 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s?"Speichere…":"Speichern"})]})})}const uW={download:"Herunterladen",extract:"Entpacken",backup:"Sichern",apply:"Installieren"};function Ww(t){return t?t.slice(0,7):"–"}function dW(t){return t?new Date(t).toLocaleString("de-DE"):"–"}function hW(){const[t,e]=v.useState(null),[n,r]=v.useState(null),[s,i]=v.useState(!0),[o,a]=v.useState(""),[l,u]=v.useState(!1),[d,h]=v.useState({download:null,extract:null,backup:null,apply:null}),[f,p]=v.useState(""),[m,g]=v.useState(null),x=()=>{i(!0),a(""),Promise.all([A.get("/settings/update-status"),A.get("/settings/update-check")]).then(([C,j])=>{e(C),r(j)}).catch(C=>a(C.message)).finally(()=>i(!1))};v.useEffect(x,[]);const y=async()=>{u(!0),p(""),g(null),h({download:"busy",extract:null,backup:null,apply:null});try{const j=(await A.post("/settings/update-download",{})).run_id;h(N=>({...N,download:"done",extract:"busy"})),await A.post("/settings/update-extract",{run_id:j}),h(N=>({...N,extract:"done",backup:"busy"})),await A.post("/settings/update-backup",{}),h(N=>({...N,backup:"done",apply:"busy"}));const S=await A.post("/settings/update-apply",{run_id:j});h(N=>({...N,apply:"done"})),g(S.log||[]),x()}catch(C){h(j=>{const S=Object.keys(j).find(N=>j[N]==="busy");return S?{...j,[S]:"error"}:j}),p(C.message)}finally{u(!1)}};if(s)return c.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const b=(t==null?void 0:t.capabilities)||{},k=b.zip?b.http_client?b.writable?null:"Das Website-Verzeichnis ist für PHP nicht beschreibbar - bitte Dateiberechtigungen prüfen.":"Diese Funktion benötigt ausgehende HTTPS-Verbindungen (curl oder allow_url_fopen), die auf diesem Server aktuell nicht verfügbar sind.":'Diese Funktion benötigt die PHP-Erweiterung "zip", die auf diesem Server aktuell nicht aktiviert ist. Bitte beim Hoster aktivieren lassen.',w=n==null?void 0:n.update_available;return c.jsx("div",{className:"max-w-2xl space-y-6",children:c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Updates aus Git"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Zieht den aktuellen Stand direkt vom Code-Repository und installiert ihn hier - ohne manuellen FTP-Upload. Passiert nur, wenn du unten aktiv auf "Update installieren" klickst, nie automatisch im Hintergrund.'}),o&&c.jsx("p",{className:"mb-3 text-sm text-red-600",children:o}),k?c.jsx("p",{className:"rounded-md bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:k}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3 text-sm",children:[c.jsxs("div",{className:"rounded-md bg-neutral-50 p-3 dark:bg-neutral-800/50",children:[c.jsx("p",{className:"text-xs uppercase tracking-wide text-neutral-400",children:"Installiert"}),c.jsx("p",{className:"font-mono text-neutral-800 dark:text-neutral-100",children:Ww(t==null?void 0:t.deployed_sha)}),c.jsx("p",{className:"text-xs text-neutral-400",children:dW(t==null?void 0:t.deployed_at)})]}),c.jsxs("div",{className:"rounded-md bg-neutral-50 p-3 dark:bg-neutral-800/50",children:[c.jsx("p",{className:"text-xs uppercase tracking-wide text-neutral-400",children:"Neuester Stand"}),c.jsx("p",{className:"font-mono text-neutral-800 dark:text-neutral-100",children:Ww(n==null?void 0:n.latest_sha)}),(n==null?void 0:n.latest_message)&&c.jsx("p",{className:"truncate text-xs text-neutral-400",title:n.latest_message,children:n.latest_message})]})]}),w?c.jsx("p",{className:"mb-3 text-sm font-medium text-brand-600 dark:text-brand-400",children:"Update verfügbar."}):c.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Bereits auf dem neuesten Stand."}),c.jsxs("div",{className:"mb-3 flex gap-2",children:[c.jsx("button",{type:"button",onClick:x,disabled:l,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:"Nach Updates suchen"}),c.jsx("button",{type:"button",onClick:y,disabled:l||!w,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:l?"Installiere…":"Update installieren"})]}),(l||f)&&c.jsx("ul",{className:"mb-3 space-y-1 text-sm",children:Object.entries(uW).map(([C,j])=>c.jsxs("li",{className:"flex items-center gap-2",children:[c.jsx("span",{className:d[C]==="done"?"text-green-600 dark:text-green-400":d[C]==="error"?"text-red-600":d[C]==="busy"?"text-brand-600 dark:text-brand-400":"text-neutral-300 dark:text-neutral-600",children:d[C]==="done"?"✓":d[C]==="error"?"✕":d[C]==="busy"?"…":"○"}),j]},C))}),f&&c.jsx("p",{className:"text-sm text-red-600",children:f}),m&&c.jsxs("div",{className:"mt-3 rounded-md bg-green-50 p-3 text-sm text-green-800 dark:bg-green-900/20 dark:text-green-300",children:[c.jsx("p",{className:"mb-1 font-semibold",children:"Update installiert."}),m.length>0&&c.jsxs("details",{children:[c.jsx("summary",{className:"cursor-pointer text-xs",children:"Details anzeigen"}),c.jsx("ul",{className:"mt-2 list-disc pl-5 text-xs",children:m.map((C,j)=>c.jsx("li",{children:C},j))})]})]})]})]})})}function jc(t){if(!t)return"";if(/<[a-z][\s\S]*>/i.test(t))return t;const e=document.createElement("div");return e.textContent=t,`<p>${e.innerHTML.replace(/\n/g,"<br>")}</p>`}const fW={mail_host:"",mail_port:587,mail_username:"",mail_password:"",mail_encryption:"tls",mail_from_email:"",mail_from_name:"",mail_notify_email:"",mail_customer_subject:"",mail_customer_body:"",mail_owner_subject:"",mail_owner_body:""},pW=[["{{name}}","Name des Kunden"],["{{email}}","E-Mail des Kunden"],["{{phone}}","Telefonnummer"],["{{vin}}","Fahrgestellnummer (FIN)"],["{{message}}","Nachricht des Kunden"],["{{brand}}","Marke"],["{{model}}","Modell"],["{{package}}","Paket"],["{{product}}","Produkt"],["{{upgrades}}","Gewählte Upgrades"]];function Uw(){return c.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:pW.map(([t,e])=>c.jsx("span",{title:e,className:"rounded-md bg-neutral-100 px-2 py-1 font-mono text-xs text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",children:t},t))})}function mW(){const[t,e]=v.useState(fW),[n,r]=v.useState(!1),[s,i]=v.useState(!0),[o,a]=v.useState(!1),[l,u]=v.useState(!1),[d,h]=v.useState(""),[f,p]=v.useState(!1),[m,g]=v.useState(!1),[x,y]=v.useState(""),[b,k]=v.useState(""),[w,C]=v.useState(""),[j,S]=v.useState(null);v.useEffect(()=>{A.get("/settings/mail").then(D=>{e({...D,mail_password:"",mail_customer_body:jc(D.mail_customer_body),mail_owner_body:jc(D.mail_owner_body)}),r(D.has_password)}).finally(()=>i(!1))},[]);const N=(D,P)=>{e(O=>({...O,[D]:P})),p(!1)},T=async D=>{D.preventDefault(),u(!0),h(""),p(!1);try{const P=await A.post("/settings/mail",t);e({...P,mail_password:"",mail_customer_body:jc(P.mail_customer_body),mail_owner_body:jc(P.mail_owner_body)}),r(P.has_password),p(!0)}catch(P){h(P.message)}finally{u(!1)}},E=async()=>{g(!0),y(""),k(""),C(""),S(null);try{const D=await A.post("/settings/mail/test",t);k(`Testmail gesendet an ${D.sent_to}. Der Server hat die Mail angenommen - prüfe auch den Spam-Ordner, das ist noch keine Garantie für die Zustellung.`),C(D.warning||""),S(D.smtp_log||null)}catch(D){y(D.message)}finally{g(!1)}};return s?c.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):c.jsxs("form",{onSubmit:T,className:"max-w-2xl space-y-6",children:[c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"SMTP-Server"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Zugangsdaten deines Mail-Postfachs oder Transactional-Mail-Anbieters. Solange kein Server eingetragen ist, werden keine E-Mails verschickt (Kontaktanfragen werden trotzdem in der Datenbank gespeichert)."}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-[1fr_120px]",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Server (Host)"}),c.jsx("input",{value:t.mail_host,onChange:D=>N("mail_host",D.target.value),placeholder:"smtp.beispiel.de",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Port"}),c.jsx("input",{type:"number",value:t.mail_port,onChange:D=>N("mail_port",D.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Verschlüsselung"}),c.jsxs("select",{value:t.mail_encryption,onChange:D=>N("mail_encryption",D.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"tls",children:"STARTTLS"}),c.jsx("option",{value:"ssl",children:"SSL"}),c.jsx("option",{value:"none",children:"Keine"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername"}),c.jsx("input",{value:t.mail_username,onChange:D=>N("mail_username",D.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:["Passwort ",n?"(leer lassen = unverändert)":""]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:o?"text":"password",value:t.mail_password,onChange:D=>N("mail_password",D.target.value),placeholder:n?"••••••••":"",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("button",{type:"button",onClick:()=>a(D=>!D),className:"shrink-0 rounded-md border border-neutral-300 px-3 text-sm dark:border-neutral-700",children:o?"Verbergen":"Anzeigen"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Absender-E-Mail"}),c.jsx("input",{type:"email",value:t.mail_from_email,onChange:D=>N("mail_from_email",D.target.value),placeholder:"info@hifi-planet-amorbach.de",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Absender-Name"}),c.jsx("input",{value:t.mail_from_name,onChange:D=>N("mail_from_name",D.target.value),placeholder:"HifiPlanet",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]})]}),c.jsxs("div",{className:"mt-4 border-t border-neutral-200 pt-4 dark:border-neutral-800",children:[x&&c.jsx("p",{className:"mb-2 whitespace-pre-wrap text-sm text-red-600",children:x}),b&&c.jsx("p",{className:"mb-2 text-sm text-green-600 dark:text-green-400",children:b}),w&&c.jsx("p",{className:"mb-2 rounded-md bg-amber-50 p-2 text-sm text-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:w}),c.jsx("button",{type:"button",onClick:E,disabled:m,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:m?"Sende Testmail…":"Verbindung testen"}),j&&j.length>0&&c.jsxs("details",{className:"mt-3",children:[c.jsx("summary",{className:"cursor-pointer text-xs text-neutral-500 dark:text-neutral-400",children:"SMTP-Protokoll anzeigen"}),c.jsx("pre",{className:"mt-2 max-h-64 overflow-auto rounded-md bg-neutral-900 p-3 text-xs text-neutral-200",children:j.join(`
`)})]})]})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Empfänger"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"An diese Adresse geht die Benachrichtigung bei jeder neuen Kontaktanfrage."}),c.jsx("input",{type:"email",value:t.mail_notify_email,onChange:D=>N("mail_notify_email",D.target.value),placeholder:"info@hifi-planet-amorbach.de",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"E-Mail an den Kunden (Bestätigung)"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Geht automatisch an den Kunden, sobald er eine Kontaktanfrage abschickt."}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Betreff"}),c.jsx("input",{value:t.mail_customer_subject,onChange:D=>N("mail_customer_subject",D.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(Td,{label:"Text",value:t.mail_customer_body,onChange:D=>N("mail_customer_body",D)})]}),c.jsx(Uw,{})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"E-Mail an den Shop (Benachrichtigung)"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Geht an die oben eingestellte Empfänger-Adresse, sobald eine neue Kontaktanfrage eingeht."}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Betreff"}),c.jsx("input",{value:t.mail_owner_subject,onChange:D=>N("mail_owner_subject",D.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(Td,{label:"Text",value:t.mail_owner_body,onChange:D=>N("mail_owner_body",D)})]}),c.jsx(Uw,{})]}),d&&c.jsx("p",{className:"text-sm text-red-600",children:d}),f&&c.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),c.jsx("button",{type:"submit",disabled:l,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:l?"Speichere…":"Speichern"})]})}function gW(){const[t,e]=v.useState({host:"",name:"",user:"",password:"",charset:"utf8mb4"}),[n,r]=v.useState(!1),[s,i]=v.useState(!0),[o,a]=v.useState(!1),[l,u]=v.useState(!1),[d,h]=v.useState(""),[f,p]=v.useState(!1),[m,g]=v.useState(null),[x,y]=v.useState(!0),[b,k]=v.useState(!1),[w,C]=v.useState(null),j=()=>{i(!0),A.get("/settings/database").then(E=>{e({...E.config,password:""}),r(E.has_password)}).finally(()=>i(!1))},S=()=>{y(!0),A.get("/settings/schema-check").then(g).catch(E=>g({ok:!1,error:E.message,tables:[]})).finally(()=>y(!1))};v.useEffect(()=>{j(),S()},[]);const N=async()=>{k(!0),C(null);try{const E=await A.post("/settings/schema-migrate",{});C(E.actions),g(E.report)}catch(E){C(["Fehler: "+E.message])}finally{k(!1)}},T=async E=>{E.preventDefault(),u(!0),h(""),p(!1);try{await A.post("/settings/database",t),p(!0),e(D=>({...D,password:""})),r(!0),S()}catch(D){h(D.message)}finally{u(!1)}};return c.jsxs("div",{className:"max-w-2xl space-y-6",children:[c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Datenbank-Zugangsdaten"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Wichtig für einen Umzug auf einen anderen Server/Webspace: Trage hier die Zugangsdaten der dortigen Datenbank ein. Die Verbindung wird vor dem Speichern getestet, damit du dich nicht aussperrst."}),s?c.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):c.jsxs("form",{onSubmit:T,className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Host *"}),c.jsx("input",{required:!0,value:t.host,onChange:E=>e({...t,host:E.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Datenbankname *"}),c.jsx("input",{required:!0,value:t.name,onChange:E=>e({...t,name:E.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzer *"}),c.jsx("input",{required:!0,value:t.user,onChange:E=>e({...t,user:E.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:["Passwort ",n?"(leer lassen = unverändert)":""]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:o?"text":"password",value:t.password,onChange:E=>e({...t,password:E.target.value}),placeholder:n?"••••••••":"",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("button",{type:"button",onClick:()=>a(E=>!E),className:"shrink-0 rounded-md border border-neutral-300 px-3 text-sm dark:border-neutral-700",children:o?"Verbergen":"Anzeigen"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Zeichensatz"}),c.jsx("input",{value:t.charset,onChange:E=>e({...t,charset:E.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),d&&c.jsx("p",{className:"text-sm text-red-600",children:d}),f&&c.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Verbindung erfolgreich getestet und gespeichert."}),c.jsx("button",{type:"submit",disabled:l,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:l?"Teste & speichere…":"Verbindung testen & speichern"})]})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[c.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:"Datenbankstruktur"}),!x&&m&&c.jsx("span",{className:`rounded-full px-3 py-1 text-xs font-semibold ${m.ok?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300":"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"}`,children:m.ok?"Datenbank OK":"Datenbank nicht OK"})]}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Prüft, ob diese Datenbank alle Tabellen und Spalten hat, die der aktuelle Code-Stand braucht – wichtig, wenn deine Live-Version auf einem anderen Server einen älteren Stand hat."}),x&&c.jsx("p",{className:"text-sm text-neutral-400",children:"Prüfe…"}),!x&&m&&!m.ok&&c.jsx("ul",{className:"mb-4 space-y-1 rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-300",children:m.tables.filter(E=>!E.ok).map(E=>c.jsx("li",{children:E.exists?c.jsxs(c.Fragment,{children:["Tabelle ",c.jsx("code",{className:"font-mono",children:E.table}),": Spalte(n) fehlen – ",E.missing_columns.join(", ")]}):c.jsxs(c.Fragment,{children:["Tabelle ",c.jsx("code",{className:"font-mono",children:E.table})," fehlt komplett"]})},E.table))}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{onClick:S,disabled:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:"Erneut prüfen"}),m&&!m.ok&&c.jsx("button",{onClick:N,disabled:b,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:b?"Aktualisiere…":"Datenbankstruktur aktualisieren"})]}),w&&c.jsx("ul",{className:"mt-3 space-y-1 rounded-md bg-neutral-50 p-3 text-sm text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300",children:w.map((E,D)=>c.jsx("li",{children:E},D))})]})]})}const Ec=[{key:"catalog",label:"Fahrzeug-Katalog",hint:"Marken, Modelle (inkl. Bilder), Pakete, Produkte, Upgrades",tables:["brands","car_models","packages","package_products","package_upgrades"]},{key:"services",label:"Leistungen",hint:"Die Leistungen-Übersicht",tables:["services"]},{key:"faqs",label:"FAQs",hint:"Häufig gestellte Fragen",tables:["faqs"]},{key:"gallery",label:"Bildergalerie",hint:"Galerie-Marken, Projekte und Fotos (inkl. Bilder)",tables:["gallery_brands","gallery_projects","gallery_photos"]},{key:"settings",label:"Einstellungen",hint:"Telefon/Adresse/Öffnungszeiten, Logo, Wartungsmodus-Texte, Kachel-Design, Mail-Vorlagen (ohne Zugangsdaten)",tables:["app_settings"]},{key:"legal",label:"Rechtstexte",hint:"Impressum, Datenschutzerklärung, AGB",tables:["legal_pages"]},{key:"home",label:"Startseiten-Texte",hint:'Hero, YouTube-Sektion, Handwerk, Beratung, Einblicke, "Mehr als Car-Hifi"',tables:["home_sections"]},{key:"partners",label:"Partner",hint:"Marken-Logozeile auf der Startseite (inkl. Logos)",tables:["partners"]},{key:"permissions",label:"Berechtigungsgruppen",hint:"Rollen-Vorlagen und ihre Rechte (ohne Benutzerkonten selbst)",tables:["permission_groups","permission_group_permissions"]}],G2={brands:"Marken",car_models:"Modelle",packages:"Pakete",package_products:"Produkte",package_upgrades:"Upgrades",services:"Leistungen",faqs:"FAQs",gallery_brands:"Galerie-Marken",gallery_projects:"Galerie-Projekte",gallery_photos:"Galerie-Fotos",app_settings:"Einstellungen",legal_pages:"Rechtstexte",home_sections:"Startseiten-Texte",partners:"Partner",permission_groups:"Berechtigungsgruppen",permission_group_permissions:"Berechtigungsgruppen-Rechte",admin_users:"Benutzerkonten",admin_user_permissions:"Benutzer-Einzelrechte",admin_user_groups:"Benutzer-Gruppenzuweisungen"},xW=(t,e)=>{if(!t)return null;const n=e.map(r=>[r,Array.isArray(t[r])?t[r].length:0]).filter(([,r])=>r>0).map(([r,s])=>`${s} ${G2[r]||r}`);return n.length?n.join(", "):"leer in dieser Datei"};function yW(){const[t,e]=v.useState(null),[n,r]=v.useState(null),[s,i]=v.useState(""),[o,a]=v.useState(()=>new Set(Ec.map(N=>N.key))),[l,u]=v.useState(!1),[d,h]=v.useState(!1),[f,p]=v.useState(!1),[m,g]=v.useState(!1),[x,y]=v.useState(null),[b,k]=v.useState(""),w=async N=>{var E;const T=((E=N.target.files)==null?void 0:E[0])||null;if(e(T),y(null),k(""),r(null),i(""),a(new Set(Ec.map(D=>D.key))),h(!1),!!T)try{const D=await T.text(),P=JSON.parse(D);if(!P||typeof P.data!="object")throw new Error("kein gültiges Export-Format");r(P.data)}catch{i("Datei konnte nicht gelesen werden – Vorschau der Inhalte nicht möglich. Import würde trotzdem versucht (alle Bereiche).")}},C=N=>{a(T=>{const E=new Set(T);return E.has(N)?E.delete(N):E.add(N),E})},j=async N=>{if(N.preventDefault(),!(!t||!f||o.size===0)){g(!0),k(""),y(null);try{const T=new FormData;T.append("file",t),T.append("sections",JSON.stringify([...o])),T.append("include_accounts",d?"1":"0");const E=await A.post("/settings/import",T);y(E),e(null),r(null),p(!1),h(!1),N.target.reset()}catch(T){k(T.message)}finally{g(!1)}}},S=Ec.filter(N=>o.has(N.key)).map(N=>N.label);return d&&S.push("Benutzerkonten"),c.jsxs("div",{className:"max-w-2xl space-y-6",children:[c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Daten exportieren"}),c.jsxs("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:["Lädt eine Datei mit allen Marken, Modellen, Paketen, Produkten, Upgrades, Leistungen, FAQs, der kompletten Bildergalerie (inkl. Bilder), den Einstellungen und den Berechtigungsgruppen herunter (ohne Zugangsdaten wie SMTP-Passwort oder API-Keys – die müssen auf jedem Server neu eingetragen werden). Kontaktanfragen sind bewusst ",c.jsx("strong",{children:"nicht"})," enthalten."]}),c.jsxs("label",{className:"mb-3 flex items-start gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:l,onChange:N=>u(N.target.checked),className:"mt-0.5 h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),"Benutzerkonten mit exportieren (enthält Passwort-Hashes und 2FA-Geheimnisse – nur für Backups an einem vertrauenswürdigen Ort)"]}),c.jsx("a",{href:`${lN}/settings/export${l?"?include_accounts=1":""}`,className:"inline-block rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:"Jetzt exportieren"})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Daten importieren"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Lädt eine zuvor exportierte Datei auf diesen Server. Ersetzt dabei die ausgewählten Bereiche komplett durch den Inhalt der Datei – das kann nicht rückgängig gemacht werden. Kontaktanfragen bleiben immer unangetastet, Benutzerkonten nur wenn unten explizit angehakt."}),c.jsxs("form",{onSubmit:j,className:"space-y-4",children:[c.jsx("input",{type:"file",accept:"application/json,.json",onChange:w,className:"text-sm"}),t&&c.jsxs("div",{className:"rounded-lg border border-neutral-200 dark:border-neutral-700",children:[c.jsx("div",{className:"border-b border-neutral-200 px-4 py-2 text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:border-neutral-700 dark:text-neutral-400",children:"Was soll importiert werden?"}),s&&c.jsx("p",{className:"px-4 pt-3 text-sm text-amber-600 dark:text-amber-400",children:s}),c.jsxs("div",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[Ec.map(N=>c.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-neutral-50 dark:hover:bg-neutral-800/50",children:[c.jsx("input",{type:"checkbox",checked:o.has(N.key),onChange:()=>C(N.key),className:"mt-0.5 h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),c.jsxs("span",{className:"flex-1",children:[c.jsx("span",{className:"block text-sm font-medium text-neutral-800 dark:text-neutral-100",children:N.label}),c.jsx("span",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:n?xW(n,N.tables):N.hint})]})]},N.key)),c.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-neutral-50 dark:hover:bg-neutral-800/50",children:[c.jsx("input",{type:"checkbox",checked:d,onChange:N=>h(N.target.checked),className:"mt-0.5 h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),c.jsxs("span",{className:"flex-1",children:[c.jsx("span",{className:"block text-sm font-medium text-neutral-800 dark:text-neutral-100",children:"Benutzerkonten"}),c.jsx("span",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:'Nur wenn die Datei mit "Benutzerkonten mit exportieren" erstellt wurde. Ersetzt auch dein eigenes Konto – danach ggf. mit den Zugangsdaten aus der Export-Datei neu einloggen.'})]})]})]})]}),c.jsxs("label",{className:"flex items-start gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:f,onChange:N=>p(N.target.checked),className:"mt-0.5 h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),"Mir ist bewusst, dass dies"," ",S.length?c.jsx("strong",{children:S.join(", ")}):"die ausgewählten Bereiche"," auf diesem Server unwiderruflich ersetzt."]}),c.jsx("button",{type:"submit",disabled:!t||!f||m||o.size===0,className:"rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-700 disabled:opacity-50",children:m?"Importiere…":"Importieren"})]}),b&&c.jsx("p",{className:"mt-3 text-sm text-red-600",children:b}),x&&c.jsxs("div",{className:"mt-3 rounded-md bg-green-50 p-3 text-sm text-green-800 dark:bg-green-900/20 dark:text-green-300",children:[c.jsx("p",{className:"mb-1 font-semibold",children:"Import erfolgreich:"}),c.jsxs("ul",{className:"list-disc pl-5",children:[Object.entries(x.counts).map(([N,T])=>c.jsxs("li",{children:[T," ",G2[N]||N]},N)),x.images_restored>0&&c.jsxs("li",{children:[x.images_restored," Bilder wiederhergestellt"]})]})]})]})]})}const bW={global:{enabled:!1,message:""},services:{enabled:!1,message:""},vehicles:{enabled:!1,message:""}};function vW(){const[t,e]=v.useState(bW),[n,r]=v.useState(!0),[s,i]=v.useState(!1),[o,a]=v.useState(!1),[l,u]=v.useState("");v.useEffect(()=>{A.get("/maintenance").then(p=>{e({global:{enabled:p.global.enabled,message:p.global.message||""},services:{enabled:p.services.enabled,message:p.services.message||""},vehicles:{enabled:p.vehicles.enabled,message:p.vehicles.message||""}})}).finally(()=>r(!1))},[]);const d=(p,m,g)=>{e(x=>({...x,[p]:{...x[p],[m]:g}})),a(!1)},h=async p=>{p.preventDefault(),i(!0),u(""),a(!1);try{const m=await A.post("/maintenance",t);e({global:{enabled:m.global.enabled,message:m.global.message||""},services:{enabled:m.services.enabled,message:m.services.message||""},vehicles:{enabled:m.vehicles.enabled,message:m.vehicles.message||""}}),a(!0)}catch(m){u(m.message)}finally{i(!1)}},f=[{key:"global",title:"Gesamte Seite",hint:"Besucher sehen nur noch eine Wartungsmeldung – egal welche Seite sie aufrufen. Das Admin-Panel bleibt für dich erreichbar."},{key:"services",title:"Nur Leistungen",hint:"Nur die Leistungen-Seite zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."},{key:"vehicles",title:"Nur Fahrzeugkatalog",hint:"Nur die Fahrzeugauswahl (Marke → Modell → Pakete) zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."}];return n?c.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):c.jsxs("form",{onSubmit:h,className:"max-w-2xl space-y-6",children:[c.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:'Ist "Gesamte Seite" aktiv, gewinnt das immer – die beiden anderen Schalter spielen dann keine Rolle mehr.'}),f.map(p=>c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[c.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:p.title}),c.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[c.jsx("input",{type:"checkbox",checked:t[p.key].enabled,onChange:m=>d(p.key,"enabled",m.target.checked),className:"peer sr-only"}),c.jsx("div",{className:"h-6 w-11 rounded-full bg-neutral-200 transition peer-checked:bg-brand-500 dark:bg-neutral-700"}),c.jsx("div",{className:"absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition peer-checked:translate-x-5"})]})]}),c.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:p.hint}),c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Eigene Nachricht (optional)"}),c.jsx("textarea",{rows:2,value:t[p.key].message,onChange:m=>d(p.key,"message",m.target.value),placeholder:"z. B. Wir aktualisieren gerade unser Angebot. Schau bald wieder vorbei!",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]},p.key)),l&&c.jsx("p",{className:"text-sm text-red-600",children:l}),o&&c.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),c.jsx("button",{type:"submit",disabled:s,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s?"Speichere…":"Speichern"})]})}function kW(){const[t,e]=v.useState(!1),[n,r]=v.useState(""),[s,i]=v.useState(!1),[o,a]=v.useState(""),[l,u]=v.useState(!1),[d,h]=v.useState(""),[f,p]=v.useState(!1),[m,g]=v.useState(""),[x,y]=v.useState(!1),[b,k]=v.useState(""),w=async()=>{if(confirm("Alle aktuellen Leistungen werden gelöscht und durch die 8 Standard-Leistungen ersetzt. Fortfahren?")){e(!0),r("");try{const T=await A.post("/settings/reset-services",{});r(`${T.count} Standard-Leistungen wiederhergestellt.`)}catch(T){r("Fehler: "+T.message)}finally{e(!1)}}},C=async()=>{if(confirm("Alle aktuellen FAQ-Einträge werden gelöscht und durch die 6 Standard-Fragen ersetzt. Fortfahren?")){i(!0),a("");try{const T=await A.post("/settings/reset-faqs",{});a(`${T.count} Standard-Fragen wiederhergestellt.`)}catch(T){a("Fehler: "+T.message)}finally{i(!1)}}},j=async()=>{if(confirm("Die komplette Bildergalerie wird gelöscht und durch die 13 Marken/29 Projekte/207 Fotos der alten hifi-planet.de-Seite ersetzt. Fortfahren?")){u(!0),h("");try{const T=await A.post("/settings/reset-gallery",{});h(`${T.photos} Fotos wiederhergestellt.`)}catch(T){h("Fehler: "+T.message)}finally{u(!1)}}},S=async()=>{if(confirm("Alle Marken, Modelle, Pakete, Produkte und Upgrades werden unwiderruflich gelöscht. Leistungen und Kontaktanfragen bleiben erhalten. Fortfahren?")){p(!0),g("");try{const T=await A.post("/settings/reset-catalog",{});g(`Fahrzeugkatalog geleert (${T.brands_removed} Marken entfernt).`)}catch(T){g("Fehler: "+T.message)}finally{p(!1)}}},N=async()=>{if(confirm("WIRKLICH ALLES zurücksetzen? Marken, Modelle, Pakete, Produkte und Upgrades werden gelöscht, Leistungen, FAQs und die Bildergalerie auf Standard zurückgesetzt. Kontaktanfragen und Benutzerkonten bleiben erhalten. Das kann nicht rückgängig gemacht werden!")){y(!0),k("");try{const T=await A.post("/settings/reset-all",{});k(`Erledigt: ${T.brands_removed} Marken entfernt, ${T.services_reset} Standard-Leistungen, ${T.faqs_reset} Standard-Fragen und ${T.gallery_photos_reset} Galerie-Fotos wiederhergestellt.`)}catch(T){k("Fehler: "+T.message)}finally{y(!1)}}};return c.jsxs("div",{className:"max-w-2xl space-y-6",children:[c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Nur Leistungen zurücksetzen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Löscht alle aktuellen Leistungen-Karten und stellt die 8 mitgelieferten Standard-Leistungen wieder her. Marken, Modelle und Pakete bleiben unangetastet."}),c.jsx("button",{onClick:w,disabled:t,className:"rounded-md border border-red-300 px-4 py-2 text-sm font-semibold text-red-600 hover:bg-red-50 disabled:opacity-50 dark:border-red-900 dark:hover:bg-red-900/20",children:t?"Setze zurück…":"Leistungen auf Standard zurücksetzen"}),n&&c.jsx("p",{className:"mt-3 text-sm text-neutral-600 dark:text-neutral-300",children:n})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Nur FAQs zurücksetzen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Löscht alle aktuellen Fragen und stellt die 6 mitgelieferten Standard-Fragen (Deutsch & Englisch) wieder her. Leistungen, Marken, Modelle und Pakete bleiben unangetastet."}),c.jsx("button",{onClick:C,disabled:s,className:"rounded-md border border-red-300 px-4 py-2 text-sm font-semibold text-red-600 hover:bg-red-50 disabled:opacity-50 dark:border-red-900 dark:hover:bg-red-900/20",children:s?"Setze zurück…":"FAQs auf Standard zurücksetzen"}),o&&c.jsx("p",{className:"mt-3 text-sm text-neutral-600 dark:text-neutral-300",children:o})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Nur Bildergalerie zurücksetzen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Löscht alle aktuellen Galerie-Marken, -Projekte und -Fotos und stellt die komplette Galerie der alten hifi-planet.de-Seite wieder her (13 Marken, 29 Projekte, 207 Fotos). Fahrzeugkatalog, Leistungen und FAQs bleiben unangetastet."}),c.jsx("button",{onClick:j,disabled:l,className:"rounded-md border border-red-300 px-4 py-2 text-sm font-semibold text-red-600 hover:bg-red-50 disabled:opacity-50 dark:border-red-900 dark:hover:bg-red-900/20",children:l?"Setze zurück…":"Galerie auf Standard zurücksetzen"}),d&&c.jsx("p",{className:"mt-3 text-sm text-neutral-600 dark:text-neutral-300",children:d})]}),c.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Nur Fahrzeugkatalog leeren"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Löscht alle Marken, Modelle, Pakete, Produkte und Upgrades unwiderruflich. Leistungen, Kontaktanfragen und Benutzerkonten bleiben erhalten."}),c.jsx("button",{onClick:S,disabled:f,className:"rounded-md border border-red-300 px-4 py-2 text-sm font-semibold text-red-600 hover:bg-red-50 disabled:opacity-50 dark:border-red-900 dark:hover:bg-red-900/20",children:f?"Leere…":"Fahrzeugkatalog leeren"}),m&&c.jsx("p",{className:"mt-3 text-sm text-neutral-600 dark:text-neutral-300",children:m})]}),c.jsxs("section",{className:"rounded-xl border border-red-300 bg-red-50/40 p-6 dark:border-red-900 dark:bg-red-900/10",children:[c.jsx("h2",{className:"mb-1 font-semibold text-red-700 dark:text-red-300",children:"Alles zurücksetzen"}),c.jsxs("p",{className:"mb-4 text-sm text-neutral-600 dark:text-neutral-300",children:["Kombiniert alles: Fahrzeugkatalog wird komplett geleert ",c.jsx("strong",{children:"und"})," Leistungen, FAQs sowie die Bildergalerie werden auf Standard zurückgesetzt. Kontaktanfragen und Benutzerkonten bleiben erhalten. Nicht rückgängig zu machen."]}),c.jsx("button",{onClick:N,disabled:x,className:"rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-700 disabled:opacity-50",children:x?"Setze zurück…":"Wirklich alles zurücksetzen"}),b&&c.jsx("p",{className:"mt-3 text-sm text-neutral-700 dark:text-neutral-300",children:b})]})]})}function wW(){return c.jsxs(c.Fragment,{children:[c.jsx(C3,{}),c.jsx(T3,{}),c.jsx(M3,{children:c.jsxs(c3,{children:[c.jsx(se,{path:"/setup",element:c.jsx(DO,{})}),c.jsxs(se,{element:c.jsx(AI,{}),children:[c.jsx(se,{path:"/",element:c.jsx(ZI,{})}),c.jsx(se,{path:"/fahrzeuge",element:c.jsx(QI,{})}),c.jsx(se,{path:"/fahrzeuge/:brandSlug",element:c.jsx(eO,{})}),c.jsx(se,{path:"/fahrzeuge/:brandSlug/:modelSlug",element:c.jsx(mO,{})}),c.jsx(se,{path:"/galerie",element:c.jsx(gO,{})}),c.jsx(se,{path:"/galerie/:brandSlug",element:c.jsx(xO,{})}),c.jsx(se,{path:"/galerie/:brandSlug/:projectSlug",element:c.jsx(bO,{})}),c.jsx(se,{path:"/leistungen",element:c.jsx(vO,{})}),c.jsx(se,{path:"/kontakt",element:c.jsx(jO,{})}),c.jsx(se,{path:"/impressum",element:c.jsx(EO,{})}),c.jsx(se,{path:"/datenschutz",element:c.jsx(TO,{})}),c.jsx(se,{path:"/agb",element:c.jsx(MO,{})})]}),c.jsx(se,{path:"/admin/login",element:c.jsx(LO,{})}),c.jsx(se,{path:"/admin",element:c.jsx(_I,{}),children:c.jsxs(se,{element:c.jsx(RI,{}),children:[c.jsx(se,{index:!0,element:c.jsx(OO,{})}),c.jsx(se,{path:"account",element:c.jsx(Z7,{})}),c.jsx(se,{path:"brands",element:c.jsx(et,{permission:"brands.manage",children:c.jsx(x5,{})})}),c.jsx(se,{path:"models",element:c.jsx(et,{permission:"models.manage",children:c.jsx(y5,{})})}),c.jsx(se,{path:"gallery-brands",element:c.jsx(et,{permission:"gallery.manage",children:c.jsx(b5,{})})}),c.jsx(se,{path:"gallery-projects",element:c.jsx(et,{permission:"gallery.manage",children:c.jsx(v5,{})})}),c.jsx(se,{path:"gallery-projects/:projectId/photos",element:c.jsx(et,{permission:"gallery.manage",children:c.jsx(k5,{})})}),c.jsx(se,{path:"packages",element:c.jsx(et,{permission:"packages.manage",children:c.jsx(E5,{})})}),c.jsx(se,{path:"packages/:packageId/products",element:c.jsx(et,{permission:"packages.manage",children:c.jsx(r7,{})})}),c.jsx(se,{path:"packages/:packageId/upgrades",element:c.jsx(et,{permission:"packages.manage",children:c.jsx(i7,{})})}),c.jsx(se,{path:"services",element:c.jsx(et,{permission:"services.manage",children:c.jsx(A5,{})})}),c.jsx(se,{path:"faqs",element:c.jsx(et,{permission:"content.manage",children:c.jsx(D5,{})})}),c.jsx(se,{path:"partners",element:c.jsx(et,{permission:"content.manage",children:c.jsx(L5,{})})}),c.jsx(se,{path:"home-sections",element:c.jsx(et,{permission:"content.manage",children:c.jsx(e7,{})})}),c.jsx(se,{path:"contact-requests",element:c.jsx(et,{permission:"contact.manage",children:c.jsx(u7,{})})}),c.jsx(se,{path:"users",element:c.jsx(et,{permission:"users.manage",children:c.jsx(eW,{})})}),c.jsx(se,{path:"permission-groups",element:c.jsx(et,{permission:"permission_groups.manage",children:c.jsx(tW,{})})}),c.jsxs(se,{path:"settings",element:c.jsx(et,{permission:"settings.manage",children:c.jsx(rW,{})}),children:[c.jsx(se,{index:!0,element:c.jsx(Ka,{to:"website",replace:!0})}),c.jsx(se,{path:"website",element:c.jsx(aW,{})}),c.jsx(se,{path:"legal",element:c.jsx(cW,{})}),c.jsx(se,{path:"email",element:c.jsx(mW,{})}),c.jsx(se,{path:"database",element:c.jsx(gW,{})}),c.jsx(se,{path:"export-import",element:c.jsx(yW,{})}),c.jsx(se,{path:"maintenance",element:c.jsx(vW,{})}),c.jsx(se,{path:"update",element:c.jsx(et,{permission:"system.update",children:c.jsx(hW,{})})}),c.jsx(se,{path:"reset",element:c.jsx(kW,{})})]})]})})]})})]})}ep.createRoot(document.getElementById("root")).render(c.jsx(Xr.StrictMode,{children:c.jsx(y3,{basename:"/".replace(/\/$/,"")||"/",children:c.jsx(A3,{children:c.jsx(I3,{children:c.jsx(W3,{children:c.jsx(wW,{})})})})})}));