From 9f5919eb45595691aed6827d7c432609830d3b1f Mon Sep 17 00:00:00 2001 From: Maaxxs <61059039+MaaxxsDev@users.noreply.github.com> Date: Wed, 9 Sep 2026 23:56:27 +0200 Subject: [PATCH] Show brand/model images on the public vehicle-select pages image_path was stored correctly since the brand/model image feature was added, but VehicleSelect.jsx and BrandPage.jsx rendered cards as plain text links and never read the column. Falls back to the existing text-only look when no image is set. Co-Authored-By: Claude Sonnet 5 --- hifi-src/src/pages/public/BrandPage.jsx | 5 ++++- hifi-src/src/pages/public/VehicleSelect.jsx | 5 ++++- hifi/assets/{index-B_Zex33k.js => index-CWyHp-JT.js} | 2 +- hifi/index.html | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) rename hifi/assets/{index-B_Zex33k.js => index-CWyHp-JT.js} (98%) diff --git a/hifi-src/src/pages/public/BrandPage.jsx b/hifi-src/src/pages/public/BrandPage.jsx index eb5ed88..9a775ac 100644 --- a/hifi-src/src/pages/public/BrandPage.jsx +++ b/hifi-src/src/pages/public/BrandPage.jsx @@ -59,8 +59,11 @@ export default function BrandPage() { + {model.image_path && ( + + )} {model.name} ))} diff --git a/hifi-src/src/pages/public/VehicleSelect.jsx b/hifi-src/src/pages/public/VehicleSelect.jsx index 044ba5f..18956d3 100644 --- a/hifi-src/src/pages/public/VehicleSelect.jsx +++ b/hifi-src/src/pages/public/VehicleSelect.jsx @@ -47,8 +47,11 @@ export default function VehicleSelect() { + {brand.image_path && ( + + )} {brand.name} ))} diff --git a/hifi/assets/index-B_Zex33k.js b/hifi/assets/index-CWyHp-JT.js similarity index 98% rename from hifi/assets/index-B_Zex33k.js rename to hifi/assets/index-CWyHp-JT.js index d28b9b5..48fd1f9 100644 --- a/hifi/assets/index-B_Zex33k.js +++ b/hifi/assets/index-CWyHp-JT.js @@ -64,7 +64,7 @@ Error generating stack: `+i.message+` ${C}px !important; ${j}px !important; } - `),()=>{var M;(M=a.current)==null||M.removeAttribute("data-motion-pop-id"),N.contains(S)&&N.removeChild(S)}},[e]),c.jsx(UL,{isPresent:e,childRef:a,sizeRef:l,pop:i,children:i===!1?t:v.cloneElement(t,{ref:h})})}const KL=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:a,anchorY:l,root:u})=>{const d=Gr(GL),h=v.useId(),f=v.useRef(n),p=v.useRef(r);ll(()=>{f.current=n,p.current=r});let m=!0,g=v.useMemo(()=>(m=!1,{id:h,initial:e,isPresent:n,custom:s,onExitComplete:b=>{d.set(b,!0);for(const y of d.values())if(!y)return;r&&r()},register:b=>(d.set(b,!1),()=>{var y;d.delete(b),!f.current&&!d.size&&((y=p.current)==null||y.call(p))})}),[n,d,r]);return i&&m&&(g={...g}),v.useMemo(()=>{d.forEach((b,y)=>d.set(y,!1))},[n]),v.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),t=c.jsx(WL,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:u,children:t}),c.jsx(Id.Provider,{value:g,children:t})};function GL(){return new Map}function rC(t=!0){const e=v.useContext(Id);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 Ul=t=>t.key||"";function Cb(t){const e=[];return v.Children.forEach(t,n=>{v.isValidElement(n)&&e.push(n)}),e}const qL=({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]=rC(o),f=v.useMemo(()=>Cb(t),[t]),p=o&&!d?[]:f.map(Ul),m=v.useRef(!0),g=v.useRef(f),b=Gr(()=>new Map),y=v.useRef(new Set),[x,k]=v.useState(f),[w,C]=v.useState(f);ll(()=>{m.current=!1,g.current=f;for(let N=0;N{const M=Ul(N),T=o&&!d?!1:f===w||p.includes(M),E=()=>{if(y.current.has(M))return;if(b.has(M))y.current.add(M),b.set(M,!0);else return;let I=!0;b.forEach($=>{$||(I=!1)}),I&&(S==null||S(),C(g.current),o&&(h==null||h()),r&&r())};return c.jsx(KL,{isPresent:T,initial:!m.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:u,onExitComplete:T?void 0:E,anchorX:a,anchorY:l,children:N},M)})})},sC=v.createContext({strict:!1}),jb={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 Eb=!1;function JL(){if(Eb)return;const t={};for(const e in jb)t[e]={isEnabled:n=>jb[e].some(r=>!!n[r])};RN(t),Eb=!0}function iC(){return JL(),D4()}function YL(t){const e=iC();for(const n in t)e[n]={...e[n],...t[n]};RN(e)}const XL=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 ku(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||XL.has(t)}let oC=t=>!ku(t);function ZL(t){typeof t=="function"&&(oC=e=>e.startsWith("on")?!ku(e):t(e))}try{ZL(require("@emotion/is-prop-valid").default)}catch{}function QL(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||Ue(t[s])||(oC(s)||n===!0&&ku(s)||!e&&!ku(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const Fd=v.createContext({});function eR(t,e){if(zd(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Ha(n)?n:void 0,animate:Ha(r)?r:void 0}}return t.inherit!==!1?e:{}}function tR(t){const{initial:e,animate:n}=eR(t,v.useContext(Fd));return v.useMemo(()=>({initial:e,animate:n}),[Tb(e),Tb(n)])}function Tb(t){return Array.isArray(t)?t.join(" "):t}const d0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function aC(t,e,n){for(const r in e)!Ue(e[r])&&!VN(r,n)&&(t[r]=e[r])}function nR({transformTemplate:t},e){return v.useMemo(()=>{const n=d0();return c0(n,e,t),Object.assign({},n.vars,n.style)},[e])}function rR(t,e){const n=t.style||{},r={};return aC(r,n,t),Object.assign(r,nR(t,e)),r}function sR(t,e){const n={},r=rR(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 lC=()=>({...d0(),attrs:{}});function iR(t,e,n,r){const s=v.useMemo(()=>{const i=lC();return $N(i,e,UN(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};aC(i,t.style,t),s.style={...i,...s.style}}return s}const oR=["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 h0(t){return typeof t!="string"||t.includes("-")?!1:!!(oR.indexOf(t)>-1||/[A-Z]/u.test(t))}function aR(t,e,n,{latestValues:r},s,i=!1,o){const l=(o??h0(t)?iR:sR)(e,r,s,t),u=QL(e,typeof t=="string",i),d=t!==v.Fragment?{...u,...l,ref:n}:{},{children:h}=e,f=v.useMemo(()=>Ue(h)?h.get():h,[h]);return v.createElement(t,{...d,children:f})}function lR({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:cR(n,r,s,t),renderState:e()}}function cR(t,e,n,r){const s={},i=r(t,{});for(const f in i)s[f]=Dc(i[f]);let{initial:o,animate:a}=t;const l=zd(t),u=DN(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"&&!Bd(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p(e,n)=>{const r=v.useContext(Fd),s=v.useContext(Id),i=()=>lR(t,e,r,s);return n?i():Gr(i)},uR=cC({scrapeMotionValuesFromProps:u0,createRenderState:d0}),dR=cC({scrapeMotionValuesFromProps:WN,createRenderState:lC}),hR=Symbol.for("motionComponentSymbol");function fR(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 uC=v.createContext({});function oi(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function pR(t,e,n,r,s,i){var k,w;const{visualElement:o}=v.useContext(Fd),a=v.useContext(sC),l=v.useContext(Id),u=v.useContext(hl),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(uC);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&mR(f.current,n,s,g);const b=v.useRef(!1);v.useInsertionEffect(()=>{m&&b.current&&m.update(n,l)});const y=n[yN],x=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 ll(()=>{p.current=!0,m&&(b.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),x.current&&m.animationState&&m.animationState.animateChanges())}),v.useEffect(()=>{m&&(!x.current&&m.animationState&&m.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var C;(C=window.MotionHandoffMarkAsComplete)==null||C.call(window,y)}),x.current=!1),m.enteringChildren=void 0)}),m}function mR(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:dC(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&oi(a),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:u,layoutAnchor:d})}function dC(t){if(t)return t.options.allowProjection!==!1?t.projection:dC(t.parent)}function qh(t,{forwardMotionProps:e=!1,type:n}={},r,s){r&&YL(r);const i=n?n==="svg":h0(t),o=i?dR:uR;function a(u,d){let h;const f={...v.useContext(hl),...u,layoutId:gR(u)},{isStatic:p}=f,m=tR(u),g=o(u,p);if(!p&&typeof window<"u"){xR();const b=yR(f);h=b.MeasureLayout,m.visualElement=pR(t,g,f,s,b.ProjectionNode,i)}return c.jsxs(Fd.Provider,{value:m,children:[h&&m.visualElement?c.jsx(h,{visualElement:m.visualElement,...f}):null,aR(t,u,fR(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[hR]=t,l}function gR({layoutId:t}){const e=v.useContext(Og).id;return e&&t!==void 0?e+"-"+t:t}function xR(t,e){v.useContext(sC).strict}function yR(t){const e=iC(),{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 bR(t,e){if(typeof Proxy>"u")return qh;const n=new Map,r=(i,o)=>qh(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,qh(o,void 0,t,e)),n.get(o))})}const vR=(t,e)=>e.isSVG??h0(t)?new J4(e):new H4(e,{allowProjection:t!==v.Fragment});class kR extends ts{constructor(e){super(e),e.animationState||(e.animationState=eL(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Bd(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 wR=0;class SR extends ts{constructor(){super(...arguments),this.id=wR++,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=As(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 NR={animation:{Feature:kR},exit:{Feature:SR}};function fl(t){return{point:{x:t.pageX,y:t.pageY}}}const CR=t=>e=>i0(e)&&t(e,fl(e));function ia(t,e,n,r){return Ua(t,e,CR(n),r)}const hC=({current:t})=>t?t.ownerDocument.defaultView:null,Mb=(t,e)=>Math.abs(t-e);function jR(t,e){const n=Mb(t.x,e.x),r=Mb(t.y,e.y);return Math.sqrt(n**2+r**2)}const Pb=new Set(["auto","scroll"]);class fC{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=Wl(this.lastRawMoveEventInfo,this.transformPagePoint));const m=Jh(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,b=jR(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!b)return;const{point:y}=m,{timestamp:x}=Ke;this.history.push({...y,timestamp:x});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=Wl(g,this.transformPagePoint),ae.update(this.updatePoint,!0)},this.handlePointerUp=(m,g)=>{this.end();const{onEnd:b,onSessionEnd:y,resumeAnimation:x}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Jh(m.type==="pointercancel"?this.lastMoveEventInfo:Wl(g,this.transformPagePoint),this.history);this.startEvent&&b&&b(m,k),y&&y(m,k)},!i0(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=fl(e),u=Wl(l,this.transformPagePoint),{point:d}=u,{timestamp:h}=Ke;this.history=[{...d,timestamp:h}];const{onSessionStart:f}=n;f&&f(e,Jh(u,this.history));const p={passive:!0,capture:!0};this.removeListeners=cl(ia(this.contextWindow,"pointermove",this.handlePointerMove,p),ia(this.contextWindow,"pointerup",this.handlePointerUp,p),ia(this.contextWindow,"pointercancel",this.handlePointerUp,p)),a&&this.startScrollTracking(a)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(Pb.has(r.overflowX)||Pb.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),ae.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),sn(this.updatePoint)}}function Wl(t,e){return e?{point:e(t.point)}:t}function Ab(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Jh({point:t},e){return{point:t,delta:Ab(t,pC(e)),offset:Ab(t,ER(e)),velocity:TR(e,.1)}}function ER(t){return t[0]}function pC(t){return t[t.length-1]}function TR(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=pC(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Ot(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&s.timestamp-r.timestamp>Ot(e)*2&&(r=t[1]);const i=Zt(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 MR(t,{min:e,max:n},r){return e!==void 0&&tn&&(t=r?pe(n,t,r.max):Math.min(t,n)),t}function Db(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 PR(t,{top:e,left:n,bottom:r,right:s}){return{x:Db(t.x,n,s),y:Db(t.y,e,r)}}function Lb(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.minr?n=Ui(e.min,e.max-r,t.min):r>s&&(n=Ui(t.min,t.max-s,e.min)),kn(0,1,n)}function LR(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 RR(t=sm){return t===!1?t=0:t===!0&&(t=sm),{x:Rb(t,"left","right"),y:Rb(t,"top","bottom")}}function Rb(t,e,n){return{min:_b(t,e),max:_b(t,n)}}function _b(t,e){return typeof t=="number"?t:t[e]||0}const _R=new WeakMap;class IR{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=Ve(),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(fl(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=o4(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),Cn(y=>{let x=this.getAxisMotionValue(y).get()||0;if(Ln.test(x)){const{projection:k}=this.visualElement;if(k&&k.layout){const w=k.layout.layoutBox[y];w&&(x=yt(w)*(parseFloat(x)/100))}}this.originPoint[y]=x}),g&&ae.update(()=>g(h,f),!1,!0),Gp(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:m,onDirectionLock:g,onDrag:b}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=f;if(m&&this.currentDirection===null){this.currentDirection=BR(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),b&&ae.update(()=>b(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 fC(e,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:hC(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&&ae.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||!Kl(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=MR(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&&oi(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=PR(r.layoutBox,e):this.constraints=!1,this.elastic=RR(n),s!==this.constraints&&!oi(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&Cn(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=LR(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!oi(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=O4(r,s.root,this.visualElement.getTransformPagePoint());let o=AR(s.layout.layoutBox,i);if(n){const a=n(R4(o));this.hasMutatedConstraints=!!a,a&&(o=IN(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Cn(d=>{if(!Kl(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 Gp(this.visualElement,e),r.start(t0(e,r,0,n,this.visualElement,!1))}stopAnimation(){Cn(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){Cn(n=>{const{drag:r}=this.getProps();if(!Kl(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]-pe(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!oi(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Cn(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=DR({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(),Cn(o=>{if(!Kl(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(pe(l,u,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;_R.set(this.visualElement,this);const e=this.visualElement.current,n=ia(e,"pointerdown",u=>{const{drag:d,dragListener:h=!0}=this.getProps(),f=u.target,p=f!==e&&h4(f);d&&h&&!p&&this.start(u)});let r;const s=()=>{const{dragConstraints:u}=this.getProps();oi(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=OR(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),ae.read(s);const a=Ua(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Cn(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 Ib(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function OR(t,e,n){const r=Zp(t,Ib(n)),s=Zp(e,Ib(n));return()=>{r(),s()}}function Kl(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function BR(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class zR extends ts{constructor(e){super(e),this.removeGroupControls=At,this.removeListeners=At,this.controls=new IR(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||At}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 Yh=t=>(e,n)=>{t&&ae.update(()=>t(e,n),!1,!0)};class FR extends ts{constructor(){super(...arguments),this.removePointerDownListener=At}onPointerDown(e){this.session=new fC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:hC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Yh(e),onStart:Yh(n),onMove:Yh(r),onEnd:(i,o)=>{delete this.session,s&&ae.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=ia(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 Xh=!1;class VR 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),Xh&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Lc.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}),Xh=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||ae.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(),Ki.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;Xh=!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 mC(t){const[e,n]=rC(),r=v.useContext(Og);return c.jsx(VR,{...t,layoutGroup:r,switchLayoutGroup:v.useContext(uC),isPresent:e,safeToRemove:n})}const $R={pan:{Feature:FR},drag:{Feature:zR,ProjectionNode:nC,MeasureLayout:mC}};function Ob(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&&ae.postRender(()=>i(e,fl(e)))}class HR extends ts{mount(){const{current:e}=this.node;e&&(this.unmount=l4(e,(n,r)=>(Ob(this.node,r,"Start"),s=>Ob(this.node,s,"End"))))}unmount(){}}class UR extends ts{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=cl(Ua(this.node.current,"focus",()=>this.onFocus()),Ua(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Bb(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&&ae.postRender(()=>i(e,fl(e)))}class WR extends ts{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=p4(e,(s,i)=>(Bb(this.node,i,"Start"),(o,{success:a})=>Bb(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const im=new WeakMap,Zh=new WeakMap,KR=t=>{const e=im.get(t.target);e&&e(t)},GR=t=>{t.forEach(KR)};function qR({root:t,...e}){const n=t||document;Zh.has(n)||Zh.set(n,{});const r=Zh.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(GR,{root:t,...e})),r[s]}function JR(t,e,n){const r=qR(e);return im.set(t,n),r.observe(t),()=>{im.delete(t),r.unobserve(t)}}const YR={some:0,all:1};class XR extends ts{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:YR[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=JR(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(ZR(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function ZR({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const QR={inView:{Feature:XR},tap:{Feature:WR},focus:{Feature:UR},hover:{Feature:HR}},e_={layout:{ProjectionNode:nC,MeasureLayout:mC}},t_={...NR,...QR,...$R,...e_},qn=bR(t_,vR);function wu(t){return typeof window>"u"?!1:t?aN():Qg()}const n_=50,zb=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),r_=()=>({time:0,x:zb(),y:zb()}),s_={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Fb(t,e,n,r){const s=n[e],{length:i,position:o}=s_[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=Ui(0,s.scrollLength,s.current);const u=r-l;s.velocity=u>n_?0:Vg(s.current-a,u)}function i_(t,e,n){Fb(t,"x",e,n),Fb(t,"y",e,n),e.time=n}function o_(t,e){const n={x:0,y:0};let r=t;for(;r&&r!==e;)if(ra(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 om={start:0,center:.5,end:1};function Vb(t,e,n=0){let r=0;if(t in om&&(t=om[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 a_=[0,0];function l_(t,e,n,r){let s=Array.isArray(t)?t:a_,i=0,o=0;return typeof t=="number"?s=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?s=t.split(" "):s=[t,om[t]?t:"0"]),i=Vb(s[0],n,r),o=Vb(s[1],e),i-o}const zo={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},c_={x:0,y:0};function u_(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function d_(t,e,n){const{offset:r=zo.All}=n,{target:s=t,axis:i="y"}=n,o=i==="y"?"height":"width",a=s!==t?o_(s,t):c_,l=s===t?{width:t.scrollWidth,height:t.scrollHeight}:u_(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_(t,r.target,n),i_(t,n,s),(r.offset||r.target)&&d_(t,n,r)},notify:()=>e(n)}}const ti=new WeakMap,$b=new WeakMap,Qh=new WeakMap,Hb=new WeakMap,Gl=new WeakMap,Ub=t=>t===document.scrollingElement?window:t;function gC(t,{container:e=document.scrollingElement,trackContentSize:n=!1,...r}={}){if(!e)return At;let s=Qh.get(e);s||(s=new Set,Qh.set(e,s));const i=r_(),o=f_(e,t,i,r);if(s.add(o),!ti.has(e)){const l=()=>{for(const f of s)f.measure(Ke.timestamp);ae.preUpdate(u)},u=()=>{for(const f of s)f.notify()},d=()=>ae.read(l);ti.set(e,d);const h=Ub(e);window.addEventListener("resize",d),e!==document.documentElement&&$b.set(e,Zp(e,d)),h.addEventListener("scroll",d),d()}if(n&&!Gl.has(e)){const l=ti.get(e),u={width:e.scrollWidth,height:e.scrollHeight};Hb.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=ae.read(d,!0);Gl.set(e,h)}const a=ti.get(e);return ae.read(a,!1,!0),()=>{var h;sn(a);const l=Qh.get(e);if(!l||(l.delete(o),l.size))return;const u=ti.get(e);ti.delete(e),u&&(Ub(e).removeEventListener("scroll",u),(h=$b.get(e))==null||h(),window.removeEventListener("resize",u));const d=Gl.get(e);d&&(sn(d),Gl.delete(e)),Hb.delete(e)}}const p_=[[zo.Enter,"entry"],[zo.Exit,"exit"],[zo.Any,"cover"],[zo.All,"contain"]],Wb={start:0,end:1};function m_(t){const e=t.trim().split(/\s+/);if(e.length!==2)return;const n=Wb[e[0]],r=Wb[e[1]];if(!(n===void 0||r===void 0))return[n,r]}function g_(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=m_(n);if(!r)return;e.push(r)}else return;return e}function x_(t,e){const n=g_(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 p_)if(x_(t,e))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const Kb=new Map;function Gb(t){const e={value:0},n=gC(r=>{e.value=r[t.axis].progress*100},t);return{currentTime:e,cancel:n}}function xC({source:t,container:e,...n}){const{axis:r}=n;t&&(e=t);let s=Kb.get(e);s||(s=new Map,Kb.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&&wu(n.target)?f0(n.offset)?o[a]=new ViewTimeline({subject:n.target,axis:r}):o[a]=Gb({container:e,...n}):wu()?o[a]=new ScrollTimeline({source:e,axis:r}):o[a]=Gb({container:e,...n})),o[a]}function y_(t,e){const n=xC(e),r=e.target?f0(e.offset):void 0,s=e.target?wu(e.target)&&!!r:wu();return t.attachTimeline({timeline:s?n:void 0,...r&&s&&{rangeStart:r.rangeStart,rangeEnd:r.rangeEnd},observe:i=>(i.pause(),AN(o=>{i.time=i.iterationDuration*o},n))})}function b_(t){return t&&(t.target||t.offset)}function v_(t){return t.length===2}function k_(t,e){return v_(t)||b_(e)?gC(n=>{t(n[e.axis].progress,n)},e):AN(t,xC(e))}function yC(t,{axis:e="y",container:n=document.scrollingElement,...r}={}){if(!n)return At;const s={axis:e,container:n,...r};return typeof t=="function"?k_(t,s):y_(t,s)}const w_=()=>({scrollX:pn(0),scrollY:pn(0),scrollXProgress:pn(0),scrollYProgress:pn(0)}),Ei=t=>t?!t.current:!1;function qb(t,e,n,r){return{factory:s=>{let i;const o=()=>{if(Ei(n)||Ei(r)){Ki.read(o);return}i=yC(s,{...e,axis:t,container:(n==null?void 0:n.current)||void 0,target:(r==null?void 0:r.current)||void 0})};return Ki.read(o),()=>{jN(o),i==null||i()}},times:[0,1],keyframes:[0,1],ease:s=>s,duration:1}}function S_(t,e){return typeof window>"u"?!1:t?aN()&&!!f0(e):Qg()}function bC({container:t,target:e,...n}={}){const r=Gr(w_);S_(e,n.offset)&&(r.scrollXProgress.accelerate=qb("x",n,t,e),r.scrollYProgress.accelerate=qb("y",n,t,e));const s=v.useRef(null),i=v.useRef(!1),o=v.useCallback(()=>(s.current=yC((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 ll(()=>{if(i.current=!1,Ei(t)||Ei(e)){i.current=!0;return}else return o()},[o]),v.useEffect(()=>{if(!i.current)return;let a;const l=()=>{const u=Ei(t),d=Ei(e);!u&&!d&&(a=o())};return Ki.read(l),()=>{jN(l),a==null||a()}},[o]),r}function vC(t){const e=Gr(()=>pn(t)),{isStatic:n}=v.useContext(hl);if(n){const[,r]=v.useState(t);v.useEffect(()=>e.on("change",r),[])}return e}function kC(t,e){const n=vC(e()),r=()=>n.set(e());return r(),ll(()=>{const s=()=>ae.preRender(r,!1,!0),i=t.map(o=>o.on("change",s));return()=>{i.forEach(o=>o()),sn(r)}}),n}function N_(t){na.current=[],t();const e=kC(na.current,t);return na.current=void 0,e}function mr(t,e,n,r){if(typeof t=="function")return N_(t);if(n!==void 0&&!Array.isArray(n)&&typeof e!="function")return C_(t,e,n,r);const o=typeof e=="function"?e:N4(e,n,r),a=Array.isArray(t)?Jb(t,o):Jb([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 Jb(t,e){const n=Gr(()=>[]);return kC(t,()=>{n.length=0;const r=t.length;for(let s=0;sObject.keys(n)),i=Gr(()=>({}));for(const o of s)i[o]=mr(t,e,n[o],r);return i}function j_(t,e={}){const{isStatic:n}=v.useContext(hl),r=()=>Ue(t)?t.get():t;if(n)return mr(r);const s=vC(r());return v.useInsertionEffect(()=>C4(s,t,e),[s,JSON.stringify(e)]),s}function E_(t,e={}){return j_(t,{type:"spring",...e})}function T_(){const{scrollYProgress:t}=bC(),e=E_(t,{stiffness:200,damping:30,restDelta:.001});return c.jsx(qn.div,{style:{scaleX:e},className:"fixed left-0 top-0 z-40 h-0.5 w-full origin-left bg-brand-500"})}const M_=()=>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 pl({message:t,fullScreen:e=!1}){const{t:n}=it(),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(M_,{})}),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.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white px-4 dark:bg-neutral-950",children:r}):c.jsx("div",{className:"mx-auto max-w-6xl px-4 py-20 sm:px-6",children:r})}const Yb=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 ml({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:Yb}):c.jsx("div",{className:"bg-amber-500 px-4 py-2 text-center text-xs font-semibold text-white",children:Yb})}function P_({onClose:t}){const{consent:e,saveCustom:n}=uo(),[r,s]=v.useState(e.external),[i,o]=v.useState(e.analytics),{t:a}=it();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(Q,{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 A_(){const{decided:t,settingsOpen:e,acceptAll:n,rejectNonEssential:r,openSettings:s,closeSettings:i}=uo(),{t:o}=it();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(Q,{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(P_,{onClose:i})]})}function D_(){const{consent:t}=uo(),{ga_measurement_id:e}=es(),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 wC=v.createContext({global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null},bypass:!1}),L_=wC.Provider;function Vd(){return v.useContext(wC)}const R_={global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null}},__={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}},I_={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:__,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},O_=["/impressum","/datenschutz","/agb"];function B_(){const[t,e]=v.useState(null),[n,r]=v.useState(I_),{loading:s,hasPermission:i}=wn(),o=on();if(v.useEffect(()=>{A.get("/maintenance").then(e).catch(()=>e(R_)),A.get("/site-settings").then(r).catch(()=>{})},[]),t===null||s)return c.jsx("div",{className:"min-h-screen bg-white dark:bg-neutral-950"});const a=i("maintenance.bypass"),l=O_.includes(o.pathname);return t.global.enabled&&!a&&!l?c.jsx(by,{children:c.jsx(pl,{message:t.global.message,fullScreen:!0})}):c.jsx(by,{children:c.jsx(L_,{value:{...t,bypass:a},children:c.jsx(WA,{value:n,children:c.jsxs("div",{className:"page-texture flex min-h-screen flex-col text-neutral-900 dark:text-neutral-100",children:[a&&t.global.enabled&&c.jsx(ml,{}),c.jsx(T_,{}),c.jsx(XA,{}),c.jsx("main",{className:"flex-1",children:c.jsx(_d,{})}),c.jsx(s3,{}),c.jsx(A_,{}),c.jsx(D_,{})]})})})})}const z_={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"},F_=({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 V_(){const{logout:t,user:e,hasPermission:n}=wn(),r=al(),[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"}]},{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(kS,{to:g.to,end:g.end,className:d,onClick:f,children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx(F_,{path:z_[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("span",{className:"rounded-lg px-2 py-1",children:[c.jsx("img",{src:Fa,alt:"HifiPlanet",className:"h-7 w-auto dark:hidden"}),c.jsx("img",{src:hu,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("span",{className:"rounded-lg px-1.5 py-0.5",children:[c.jsx("img",{src:Fa,alt:"HifiPlanet",className:"h-6 w-auto dark:hidden"}),c.jsx("img",{src:hu,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(CS,{}),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(_d,{})})]})]})}function $_(){const{user:t,loading:e}=wn();return e?c.jsx("div",{className:"flex min-h-screen items-center justify-center text-neutral-500",children:"Lädt…"}):t?c.jsx(_d,{}):c.jsx(za,{to:"/admin/login",replace:!0})}function ut({permission:t,children:e}){const{hasPermission:n}=wn();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 ef(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 H_(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 $t({title:t,description:e,path:n}){v.useEffect(()=>{t&&(document.title=`${t} | HifiPlanet`,ef("og:title",`${t} | HifiPlanet`,"property")),e&&(ef("description",e),ef("og:description",e,"property")),n&&H_(n)},[t,e,n])}const U_=[.16,1,.3,1],Xb={up:{y:40},left:{x:-56},right:{x:56}};function W_(t){return{hidden:{opacity:0,scale:.96,filter:"blur(8px)",...Xb[t]||Xb.up},visible:{opacity:1,scale:1,x:0,y:0,filter:"blur(0px)"}}}const K_={hidden:{x:"-130%"},visible:{x:"230%",transition:{duration:1.1,ease:"easeInOut",delay:.4}}};function Xe({children:t,direction:e="up",className:n="",index:r=0,shine:s=!1}){const i=Math.min(r*.09,.45);return c.jsxs(qn.div,{className:n,style:{position:"relative",overflow:"hidden"},initial:"hidden",whileInView:"visible",viewport:{once:!0,amount:.25,margin:"-100px"},variants:W_(e),transition:{duration:.75,ease:U_,delay:i},children:[t,s&&c.jsx(qn.div,{"aria-hidden":!0,variants:K_,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 G_({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(qn.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(qL,{initial:!1,children:i&&c.jsx(qn.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 SC({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 q_=70;function J_({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=x=>{if(r.half<=0)return x;for(;x>0;)x-=r.half;for(;x<=-r.half;)x+=r.half;return x},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=x=>{r.lastTime===null&&(r.lastTime=x);const k=(x-r.lastTime)/1e3;r.lastTime=x,!r.dragging&&!r.hovering&&!o&&(r.pos=l(r.pos+q_*k),a()),r.rafId=requestAnimationFrame(h)};r.rafId=requestAnimationFrame(h);const f=e.current,p=()=>{r.hovering=!0},m=()=>{r.hovering=!1},g=x=>{r.dragging=!0,r.dragStartX=x.clientX,r.dragStartPos=r.pos,f.setPointerCapture(x.pointerId),f.classList.add("cursor-grabbing"),f.classList.remove("cursor-grab")},b=x=>{r.dragging&&(r.pos=l(r.dragStartPos+(x.clientX-r.dragStartX)),a())},y=x=>{r.dragging&&(r.dragging=!1,f.hasPointerCapture(x.pointerId)&&f.releasePointerCapture(x.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",b),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",b),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(SC,{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 Gi(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 Y_="/assets/gallery-dash2-CEVCErVK.webp",NC="/assets/gallery-amp-purple-CESAKuOf.webp",X_="/assets/gallery-speaker-CUXQZ49Q.webp",CC="/assets/gallery-subs-COSd4seJ.webp",jC="/assets/gallery-dash-Cg-7v9qo.webp",Z_="/assets/hero-trunk-Dp4_JHDh.webp",Q_="/assets/gallery-rear-8cIXPC7T.webp",eI="/assets/hero-highlight-Co4f1Kj5.webp",tI="/assets/youtube-hintergrund-C0osNxn7.mp4",nI=["Ground Zero Audio","Audison","Hertz","Helix","Brax","Gladen","Alpine","Pioneer","Kenwood","JVC"],ql={left:"text-left",center:"text-center",right:"text-right"},rI={left:"",center:"mx-auto",right:"ml-auto"},sI={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:""};function Zb({label:t,url:e,className:n}){return!t||!e?null:e.startsWith("/")?c.jsx(Q,{to:e,className:n,children:t}):c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:n,children:t})}const iI=[{src:CC,width:900,height:600},{src:NC,width:900,height:600},{src:X_,width:900,height:1200},{src:jC,width:900,height:814},{src:Q_,width:900,height:1200},{src:Z_,width:1920,height:1280}];function oI(){const{hero_image_path:t}=es(),e=t||Y_,{t:n,language:r}=it(),s=n("home.stats"),i=n("home.galleryAlts"),o=iI.map((S,N)=>({...S,alt:i[N]})),[a,l]=v.useState([]),[u,d]=v.useState({}),h=S=>{const N=u[S]||sI;return{eyebrow:N[`eyebrow_${r}`]||"",title:N[`title_${r}`]||"",bodyHtml:N[`body_html_${r}`]||"",align:N.text_align||"center",alignX:N.text_align_x,alignY:N.text_align_y,buttonLabel:N[`button_label_${r}`]||"",buttonUrl:N.button_url||""}};v.useEffect(()=>{A.get("/home-sections").then(d).catch(()=>{})},[]);const[f,p]=v.useState(null),m=f?f.reviews.filter(S=>S.review_text).map(S=>({name:S.author_name,text:S.review_text,rating:S.rating,photo:S.profile_photo_url})):n("home.testimonials");v.useEffect(()=>{A.get("/faqs").then(S=>{l(S.map(N=>({question:r==="de"?N.question_de:N.question_en,answer:r==="de"?N.answer_de:N.answer_en})))}).catch(()=>{})},[r]),v.useEffect(()=>{A.get("/google-reviews").then(S=>{S.rating!=null&&S.reviews.some(N=>N.review_text)&&p(S)}).catch(()=>{})},[]),$t({title:n("home.metaTitle"),description:n("home.metaDescription"),path:"/"}),v.useEffect(()=>{if(a.length===0)return;const S=document.createElement("script");return S.type="application/ld+json",S.text=JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:a.map(N=>({"@type":"Question",name:N.question,acceptedAnswer:{"@type":"Answer",text:N.answer}}))}),document.head.appendChild(S),()=>document.head.removeChild(S)},[a]);const g=v.useRef(null),{scrollYProgress:b}=bC({target:g,offset:["start start","end start"]}),y=mr(b,[0,1],["-6%","6%"]),x=mr(b,[0,1],["0%","60%"]),k=mr(b,[0,.8],[1,0]),w=mr(b,[.5,1],[0,1]),C=mr(w,S=>S>.05?"auto":"none"),j=mr(b,[.5,1],[16,0]);return c.jsxs("div",{children:[c.jsx(qn.div,{style:{opacity:w,pointerEvents:C,y:j},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(Q,{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(Q,{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:g,className:"relative -mt-[89px] h-dvh min-h-[560px] overflow-hidden sm:-mt-[97px]",children:[c.jsx(qn.img,{style:{y,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(qn.div,{style:{y:x,opacity:k},className:"absolute inset-0",children:c.jsx("div",{className:"absolute w-full max-w-2xl px-4 text-center sm:px-6",style:Gi(h("hero").alignX,h("hero").alignY,{x:50,y:50}),children:c.jsxs(qn.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.7,ease:"easeOut"},children:[h("hero").eyebrow&&c.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-wide text-brand-400",children:h("hero").eyebrow}),c.jsx("h1",{className:"text-3xl font-extrabold tracking-tight text-white sm:text-5xl",children:h("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:h("hero").bodyHtml}}),c.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-3",children:[c.jsx(Q,{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(Q,{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((S,N)=>c.jsxs(Xe,{index:N,children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-400 sm:text-3xl",children:S.value}),c.jsx("p",{className:"text-sm text-neutral-400",children:S.label})]},S.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:nI.map((S,N)=>c.jsx(Xe,{index:N,className:"text-lg font-bold text-neutral-400 dark:text-neutral-600",children:S},S))})]})}),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:jC,className:"absolute inset-0 h-full w-full object-cover",children:c.jsx("source",{src:tI,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:Gi(h("youtube").alignX,h("youtube").alignY,{x:50,y:50}),children:c.jsxs(Xe,{children:[h("youtube").eyebrow&&c.jsx("p",{className:"mb-4 text-xs font-semibold uppercase tracking-[0.2em] text-neutral-200 sm:text-sm",children:h("youtube").eyebrow}),c.jsx("h2",{className:"text-3xl font-bold uppercase tracking-wide text-white sm:text-5xl",children:h("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:h("youtube").bodyHtml}}),c.jsx(Zb,{label:h("youtube").buttonLabel,url:h("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"})]})})]}),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(Xe,{direction:"left",shine:!0,className:"rounded-xl shadow-lg",children:c.jsx("img",{src:CC,alt:n("home.craftImageAlt"),width:900,height:600,className:"w-full rounded-xl object-cover",style:{maxHeight:380}})}),c.jsxs(Xe,{direction:"right",index:1,className:ql[h("craft").align],children:[h("craft").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("craft").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",children:h("craft").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:h("craft").bodyHtml}})]})]}),c.jsxs("div",{className:"grid items-center gap-8 md:grid-cols-2",children:[c.jsxs(Xe,{direction:"left",className:`order-2 md:order-1 ${ql[h("advice").align]}`,children:[h("advice").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("advice").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",children:h("advice").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:h("advice").bodyHtml}})]}),c.jsx(Xe,{direction:"right",index:1,shine:!0,className:"order-1 md:order-2 rounded-xl shadow-lg",children:c.jsx("img",{src:NC,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(Xe,{className:`mb-8 ${ql[h("insights").align]}`,children:[h("insights").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("insights").eyebrow}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:h("insights").title}),c.jsx("div",{className:"legal-content mt-2 text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:h("insights").bodyHtml}})]}),c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:o.map((S,N)=>c.jsx(Xe,{index:N%3,shine:!0,className:"aspect-square overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsx("img",{src:S.src,alt:S.alt,width:S.width,height:S.height,loading:"lazy",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})},S.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(Xe,{className:"mb-10 text-center",children:[c.jsx("div",{className:"mb-2 flex items-center justify-center gap-2",children:c.jsx(SC,{className:"h-6 w-6",count:f?Math.round(f.rating):5})}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:f?n("home.reviewsRatingDynamic")(f.rating,f.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(Xe,{children:c.jsx(J_,{testimonials:m})})]})}),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(Xe,{direction:"left",shine:!0,className:"overflow-hidden rounded-xl shadow-lg",children:c.jsx("img",{src:eI,alt:n("home.moreImageAlt"),width:1600,height:905,className:"h-full w-full object-cover",loading:"lazy"})}),c.jsxs(Xe,{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 ${ql[h("more").align]}`,children:[h("more").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("more").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",children:h("more").title}),c.jsx("div",{className:`legal-content mb-8 max-w-2xl text-neutral-600 dark:text-neutral-300 ${rI[h("more").align]}`,dangerouslySetInnerHTML:{__html:h("more").bodyHtml}}),c.jsx(Zb,{label:h("more").buttonLabel,url:h("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"})]})]})}),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(Xe,{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(Xe,{index:1,children:c.jsx(G_,{items:a})})]})})]})}function aI(){const[t,e]=v.useState([]),[n,r]=v.useState(""),s=Vd(),{t:i}=it();return $t({title:i("vehicleSelect.metaTitle"),description:i("vehicleSelect.metaDescription"),path:"/fahrzeuge"}),v.useEffect(()=>{s.vehicles.enabled&&!s.bypass||A.get("/brands").then(e).catch(o=>r(o.message))},[s.vehicles.enabled,s.bypass]),s.vehicles.enabled&&!s.bypass?c.jsx(pl,{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(ml,{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(o=>c.jsx(Q,{to:`/fahrzeuge/${o.slug}`,className:"flex items-center justify-center 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:o.name},o.id))})]})}function lI(){const{brandSlug:t}=Js(),[e,n]=v.useState(null),[r,s]=v.useState(""),i=Vd(),{t:o}=it();return v.useEffect(()=>{i.vehicles.enabled&&!i.bypass||A.get(`/brands/${t}/models`).then(n).catch(a=>s(a.message))},[t,i.vehicles.enabled,i.bypass]),$t({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(pl,{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(ml,{inline:!0}),c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(Q,{to:"/fahrzeuge",className:"hover:text-brand-500",children:o("brandPage.breadcrumbVehicles")})," / ",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," – ",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(a=>c.jsx(Q,{to:`/fahrzeuge/${t}/${a.slug}`,className:"flex items-center justify-center 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.name},a.id))})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:o("brandPage.loading")})}const Qb="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==",cI="/assets/base-BKOm0Bib.webp",uI="/assets/clear-DZZMSrMX.webp",dI="/assets/drive-BE2W1yna.webp",hI="/assets/prime-BTVNe2Gb.webp",fI="/assets/elite_r-BRvz_pyr.webp",pI="/assets/apex-CFy2qup8.webp",mI="/assets/statement-pTO-wTPx.webp",gI="/assets/limitless-DDs0S_PU.webp",xI=(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)]},tf=(t,e,n)=>`rgb(${xI(t,e,n).join(", ")})`,ev=t=>t.map(([e,n,r,s,i,o])=>({bgTop:tf(e,n,r),border:tf(e,n,r+8),accent:tf(s,i,o),img:null})),tv={graphite:[{accent:"#b6b6b6",border:"#2a2a2a",bgTop:"#1c1c1c",img:cI},{accent:"#d3d3d3",border:"#2e2e2e",bgTop:"#212121",img:uI},{accent:"#8fb8bd",border:"#26383b",bgTop:"#16282b",img:dI},{accent:"#6fbf73",border:"#1f3a24",bgTop:"#122916",img:hI},{accent:"#63d34f",border:"#204a1c",bgTop:"#123312",img:fI},{accent:"#8bea3c",border:"#2b5518",bgTop:"#173a0f",img:pI},{accent:"#d9a83c",border:"#4a3a16",bgTop:"#33270d",img:mI},{accent:"#f2c14e",border:"#5a4718",bgTop:"#3d2f0c",img:gI}],"deep-blue":ev([[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":ev([[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]])},yI="#f2f2f2",bI="#8a8a8a",vI="#c4c4c4",nv=5;function kI({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-nv,h=l?s:s.slice(0,nv),f=e.img?null:{backgroundColor:e.accent,WebkitMaskImage:`url(${Qb})`,maskImage:`url(${Qb})`,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:{...f,opacity:.2+n*.45,filter:"blur(18px)"},"aria-hidden":"true"}),c.jsx("div",{className:"pointer-events-none absolute inset-0",style:{...f,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((p,m)=>c.jsxs("li",{className:"flex items-start gap-2",style:{fontSize:"13px",color:vI},children:[c.jsx(Et,{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:p})]},m))}),d>0&&c.jsxs("button",{type:"button",onClick:()=>u(p=>!p),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(Et,{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:bI},children:a("modelPage.totalPrice")}),c.jsx("div",{style:{marginTop:"4px",fontFamily:"'Barlow Condensed', sans-serif",fontSize:"30px",fontWeight:600,letterSpacing:"1px",color:yI},children:t.price_text||i(t.total_price)}),c.jsx(Q,{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 wI(){const{brandSlug:t,modelSlug:e}=Js(),[n,r]=v.useState(null),[s,i]=v.useState(""),o=Vd(),{t:a,language:l}=it(),{package_card_theme:u,package_card_layout:d,package_wheel_hint_interval:h}=es(),f=tv[u]||tv.graphite,p=["grid","strip","coverflow"].includes(d)?d:"strip",m=Math.max(2,Number(h)||8)*1e3,g=v.useRef(null),b=v.useRef(null),y=v.useRef(null),[x,k]=v.useState(!1),w=E=>new Intl.NumberFormat(l==="de"?"de-DE":"en-US",{style:"currency",currency:"EUR"}).format(E);if(v.useEffect(()=>{o.vehicles.enabled&&!o.bypass||A.get(`/models/${t}/${e}/packages`).then(r).catch(E=>i(E.message))},[t,e,o.vehicles.enabled,o.bypass]),v.useEffect(()=>{const E=g.current;if(p!=="coverflow"||!E)return;let I=0;const $=()=>{I=0;const B=E.scrollLeft+E.clientWidth/2;for(const Z of E.children){const R=Z.offsetLeft+Z.offsetWidth/2,_=Math.max(-1,Math.min(1,(R-B)/(Z.offsetWidth*1.4))),V=Math.abs(_);Z.style.transform=`rotateY(${(-_*35).toFixed(2)}deg) scale(${(1-V*.13).toFixed(3)}) translateZ(${(-V*60).toFixed(1)}px)`,Z.style.zIndex=String(100-Math.round(V*50))}},L=()=>{I||(I=requestAnimationFrame($))};$(),E.addEventListener("scroll",L,{passive:!0});const U=new ResizeObserver(L);return U.observe(E),()=>{E.removeEventListener("scroll",L),U.disconnect(),cancelAnimationFrame(I)}},[p,n]),v.useEffect(()=>{const E=g.current;if(p==="grid"||!E)return;const I=window.matchMedia("(pointer: coarse)").matches;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let L=[],U=0;const B=()=>{const R=Math.min(E.clientWidth*.4,160);L.push(setTimeout(()=>E.scrollTo({left:R,behavior:"smooth"}),500)),L.push(setTimeout(()=>E.scrollTo({left:0,behavior:"smooth"}),1250)),I||(L.push(setTimeout(()=>k(!0),450)),L.push(setTimeout(()=>k(!1),1700)))},Z=new IntersectionObserver(([R])=>{R.isIntersecting&&(Z.disconnect(),B(),U=setInterval(()=>{E.scrollLeft<=1&&B()},m))},{threshold:.35});return Z.observe(E),()=>{Z.disconnect(),clearInterval(U),L.forEach(clearTimeout)}},[p,n,m]),v.useEffect(()=>{const E=g.current;if(p==="grid"||!E)return;let I=0,$=0,L=!1,U=0,B=0;const Z=()=>[...E.children].map(K=>K.offsetLeft+K.offsetWidth/2),R=(K,te)=>{let Se=0,se=1/0;return K.forEach((he,Te)=>{const ot=Math.abs(he-te);ot{L=!1;const K=Z();if(!K.length)return;const te=E.scrollLeft+E.clientWidth/2,Se=R(K,te);let se=Se;Se===U&&Math.abs(B)>4&&(se=B>0?Math.min(U+1,K.length-1):Math.max(U-1,0));const he=E.scrollWidth-E.clientWidth,Te=Math.max(0,Math.min(K[se]-E.clientWidth/2,he));E.scrollTo({left:Te,behavior:"smooth"}),clearTimeout($),$=setTimeout(()=>{E.style.scrollSnapType=""},450)},V=K=>{if(Math.abs(K.deltaX)>Math.abs(K.deltaY))return;const te=E.scrollWidth-E.clientWidth;if(te<=1)return;const Se=E.scrollLeft<=1,se=E.scrollLeft>=te-1;K.deltaY<0&&Se||K.deltaY>0&&se||(K.preventDefault(),L||(L=!0,B=0,U=R(Z(),E.scrollLeft+E.clientWidth/2)),B+=K.deltaY,E.style.scrollSnapType="none",E.scrollLeft+=K.deltaY,clearTimeout(I),I=setTimeout(_,150))};return E.addEventListener("wheel",V,{passive:!1}),()=>{E.removeEventListener("wheel",V),clearTimeout(I),clearTimeout($)}},[p,n]),v.useEffect(()=>{const E=g.current,I=b.current,$=y.current;if(p==="grid"||!E||!I||!$)return;let L=0;const U=()=>{L=0;const se=E.scrollWidth-E.clientWidth;if(se<=1){I.style.opacity="0",I.style.pointerEvents="none";return}I.style.opacity="1",I.style.pointerEvents="auto";const he=I.clientWidth,Te=Math.max(32,E.clientWidth/E.scrollWidth*he);$.style.width=`${Te}px`,$.style.transform=`translateX(${(E.scrollLeft/se*(he-Te)).toFixed(1)}px)`},B=()=>{L||(L=requestAnimationFrame(U))};U(),E.addEventListener("scroll",B,{passive:!0});const Z=new ResizeObserver(B);Z.observe(E);let R=!1,_=0;const V=se=>{const he=I.getBoundingClientRect(),Te=$.clientWidth,ot=Math.min(Math.max(se-he.left-_,0),he.width-Te);E.scrollLeft=ot/(he.width-Te)*(E.scrollWidth-E.clientWidth)},K=se=>{R=!0,I.setPointerCapture(se.pointerId),E.style.scrollSnapType="none";const he=$.getBoundingClientRect();_=se.clientX>=he.left&&se.clientX<=he.right?se.clientX-he.left:$.clientWidth/2,se.clientX>=he.left&&se.clientX<=he.right||V(se.clientX)},te=se=>{R&&V(se.clientX)},Se=se=>{var he;R&&(R=!1,(he=I.hasPointerCapture)!=null&&he.call(I,se.pointerId)&&I.releasePointerCapture(se.pointerId),E.style.scrollSnapType="")};return I.addEventListener("pointerdown",K),I.addEventListener("pointermove",te),I.addEventListener("pointerup",Se),I.addEventListener("pointercancel",Se),()=>{E.removeEventListener("scroll",B),Z.disconnect(),cancelAnimationFrame(L),I.removeEventListener("pointerdown",K),I.removeEventListener("pointermove",te),I.removeEventListener("pointerup",Se),I.removeEventListener("pointercancel",Se)}},[p,n]),$t({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}`}),o.vehicles.enabled&&!o.bypass)return c.jsx(pl,{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:C,packages:j}=n,S=new Map([...j].sort((E,I)=>E.total_price-I.total_price).map((E,I)=>[E.id,I])),N=E=>{const I=j.length,$=S.get(E.id)??0,L=I<=1?0:$/(I-1),U=Math.round(L*(f.length-1));return{tier:f[U],tierT:L}},M=E=>[...E.products.map(I=>I.name_override||I.scraped_name||a("modelPage.productLoading")),...(E.description||"").split(` + `),()=>{var M;(M=a.current)==null||M.removeAttribute("data-motion-pop-id"),N.contains(S)&&N.removeChild(S)}},[e]),c.jsx(UL,{isPresent:e,childRef:a,sizeRef:l,pop:i,children:i===!1?t:v.cloneElement(t,{ref:h})})}const KL=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:a,anchorY:l,root:u})=>{const d=Gr(GL),h=v.useId(),f=v.useRef(n),p=v.useRef(r);ll(()=>{f.current=n,p.current=r});let m=!0,g=v.useMemo(()=>(m=!1,{id:h,initial:e,isPresent:n,custom:s,onExitComplete:b=>{d.set(b,!0);for(const y of d.values())if(!y)return;r&&r()},register:b=>(d.set(b,!1),()=>{var y;d.delete(b),!f.current&&!d.size&&((y=p.current)==null||y.call(p))})}),[n,d,r]);return i&&m&&(g={...g}),v.useMemo(()=>{d.forEach((b,y)=>d.set(y,!1))},[n]),v.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),t=c.jsx(WL,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:u,children:t}),c.jsx(Id.Provider,{value:g,children:t})};function GL(){return new Map}function rC(t=!0){const e=v.useContext(Id);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 Ul=t=>t.key||"";function Cb(t){const e=[];return v.Children.forEach(t,n=>{v.isValidElement(n)&&e.push(n)}),e}const qL=({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]=rC(o),f=v.useMemo(()=>Cb(t),[t]),p=o&&!d?[]:f.map(Ul),m=v.useRef(!0),g=v.useRef(f),b=Gr(()=>new Map),y=v.useRef(new Set),[x,k]=v.useState(f),[w,C]=v.useState(f);ll(()=>{m.current=!1,g.current=f;for(let N=0;N{const M=Ul(N),T=o&&!d?!1:f===w||p.includes(M),E=()=>{if(y.current.has(M))return;if(b.has(M))y.current.add(M),b.set(M,!0);else return;let I=!0;b.forEach($=>{$||(I=!1)}),I&&(S==null||S(),C(g.current),o&&(h==null||h()),r&&r())};return c.jsx(KL,{isPresent:T,initial:!m.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:u,onExitComplete:T?void 0:E,anchorX:a,anchorY:l,children:N},M)})})},sC=v.createContext({strict:!1}),jb={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 Eb=!1;function JL(){if(Eb)return;const t={};for(const e in jb)t[e]={isEnabled:n=>jb[e].some(r=>!!n[r])};RN(t),Eb=!0}function iC(){return JL(),D4()}function YL(t){const e=iC();for(const n in t)e[n]={...e[n],...t[n]};RN(e)}const XL=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 ku(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||XL.has(t)}let oC=t=>!ku(t);function ZL(t){typeof t=="function"&&(oC=e=>e.startsWith("on")?!ku(e):t(e))}try{ZL(require("@emotion/is-prop-valid").default)}catch{}function QL(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||Ue(t[s])||(oC(s)||n===!0&&ku(s)||!e&&!ku(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const Fd=v.createContext({});function eR(t,e){if(zd(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Ha(n)?n:void 0,animate:Ha(r)?r:void 0}}return t.inherit!==!1?e:{}}function tR(t){const{initial:e,animate:n}=eR(t,v.useContext(Fd));return v.useMemo(()=>({initial:e,animate:n}),[Tb(e),Tb(n)])}function Tb(t){return Array.isArray(t)?t.join(" "):t}const d0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function aC(t,e,n){for(const r in e)!Ue(e[r])&&!VN(r,n)&&(t[r]=e[r])}function nR({transformTemplate:t},e){return v.useMemo(()=>{const n=d0();return c0(n,e,t),Object.assign({},n.vars,n.style)},[e])}function rR(t,e){const n=t.style||{},r={};return aC(r,n,t),Object.assign(r,nR(t,e)),r}function sR(t,e){const n={},r=rR(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 lC=()=>({...d0(),attrs:{}});function iR(t,e,n,r){const s=v.useMemo(()=>{const i=lC();return $N(i,e,UN(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};aC(i,t.style,t),s.style={...i,...s.style}}return s}const oR=["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 h0(t){return typeof t!="string"||t.includes("-")?!1:!!(oR.indexOf(t)>-1||/[A-Z]/u.test(t))}function aR(t,e,n,{latestValues:r},s,i=!1,o){const l=(o??h0(t)?iR:sR)(e,r,s,t),u=QL(e,typeof t=="string",i),d=t!==v.Fragment?{...u,...l,ref:n}:{},{children:h}=e,f=v.useMemo(()=>Ue(h)?h.get():h,[h]);return v.createElement(t,{...d,children:f})}function lR({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:cR(n,r,s,t),renderState:e()}}function cR(t,e,n,r){const s={},i=r(t,{});for(const f in i)s[f]=Dc(i[f]);let{initial:o,animate:a}=t;const l=zd(t),u=DN(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"&&!Bd(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p(e,n)=>{const r=v.useContext(Fd),s=v.useContext(Id),i=()=>lR(t,e,r,s);return n?i():Gr(i)},uR=cC({scrapeMotionValuesFromProps:u0,createRenderState:d0}),dR=cC({scrapeMotionValuesFromProps:WN,createRenderState:lC}),hR=Symbol.for("motionComponentSymbol");function fR(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 uC=v.createContext({});function oi(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function pR(t,e,n,r,s,i){var k,w;const{visualElement:o}=v.useContext(Fd),a=v.useContext(sC),l=v.useContext(Id),u=v.useContext(hl),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(uC);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&mR(f.current,n,s,g);const b=v.useRef(!1);v.useInsertionEffect(()=>{m&&b.current&&m.update(n,l)});const y=n[yN],x=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 ll(()=>{p.current=!0,m&&(b.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),x.current&&m.animationState&&m.animationState.animateChanges())}),v.useEffect(()=>{m&&(!x.current&&m.animationState&&m.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var C;(C=window.MotionHandoffMarkAsComplete)==null||C.call(window,y)}),x.current=!1),m.enteringChildren=void 0)}),m}function mR(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:dC(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&oi(a),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:u,layoutAnchor:d})}function dC(t){if(t)return t.options.allowProjection!==!1?t.projection:dC(t.parent)}function qh(t,{forwardMotionProps:e=!1,type:n}={},r,s){r&&YL(r);const i=n?n==="svg":h0(t),o=i?dR:uR;function a(u,d){let h;const f={...v.useContext(hl),...u,layoutId:gR(u)},{isStatic:p}=f,m=tR(u),g=o(u,p);if(!p&&typeof window<"u"){xR();const b=yR(f);h=b.MeasureLayout,m.visualElement=pR(t,g,f,s,b.ProjectionNode,i)}return c.jsxs(Fd.Provider,{value:m,children:[h&&m.visualElement?c.jsx(h,{visualElement:m.visualElement,...f}):null,aR(t,u,fR(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[hR]=t,l}function gR({layoutId:t}){const e=v.useContext(Og).id;return e&&t!==void 0?e+"-"+t:t}function xR(t,e){v.useContext(sC).strict}function yR(t){const e=iC(),{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 bR(t,e){if(typeof Proxy>"u")return qh;const n=new Map,r=(i,o)=>qh(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,qh(o,void 0,t,e)),n.get(o))})}const vR=(t,e)=>e.isSVG??h0(t)?new J4(e):new H4(e,{allowProjection:t!==v.Fragment});class kR extends ts{constructor(e){super(e),e.animationState||(e.animationState=eL(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Bd(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 wR=0;class SR extends ts{constructor(){super(...arguments),this.id=wR++,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=As(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 NR={animation:{Feature:kR},exit:{Feature:SR}};function fl(t){return{point:{x:t.pageX,y:t.pageY}}}const CR=t=>e=>i0(e)&&t(e,fl(e));function ia(t,e,n,r){return Ua(t,e,CR(n),r)}const hC=({current:t})=>t?t.ownerDocument.defaultView:null,Mb=(t,e)=>Math.abs(t-e);function jR(t,e){const n=Mb(t.x,e.x),r=Mb(t.y,e.y);return Math.sqrt(n**2+r**2)}const Pb=new Set(["auto","scroll"]);class fC{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=Wl(this.lastRawMoveEventInfo,this.transformPagePoint));const m=Jh(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,b=jR(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!b)return;const{point:y}=m,{timestamp:x}=Ke;this.history.push({...y,timestamp:x});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=Wl(g,this.transformPagePoint),ae.update(this.updatePoint,!0)},this.handlePointerUp=(m,g)=>{this.end();const{onEnd:b,onSessionEnd:y,resumeAnimation:x}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Jh(m.type==="pointercancel"?this.lastMoveEventInfo:Wl(g,this.transformPagePoint),this.history);this.startEvent&&b&&b(m,k),y&&y(m,k)},!i0(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=fl(e),u=Wl(l,this.transformPagePoint),{point:d}=u,{timestamp:h}=Ke;this.history=[{...d,timestamp:h}];const{onSessionStart:f}=n;f&&f(e,Jh(u,this.history));const p={passive:!0,capture:!0};this.removeListeners=cl(ia(this.contextWindow,"pointermove",this.handlePointerMove,p),ia(this.contextWindow,"pointerup",this.handlePointerUp,p),ia(this.contextWindow,"pointercancel",this.handlePointerUp,p)),a&&this.startScrollTracking(a)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(Pb.has(r.overflowX)||Pb.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),ae.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),sn(this.updatePoint)}}function Wl(t,e){return e?{point:e(t.point)}:t}function Ab(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Jh({point:t},e){return{point:t,delta:Ab(t,pC(e)),offset:Ab(t,ER(e)),velocity:TR(e,.1)}}function ER(t){return t[0]}function pC(t){return t[t.length-1]}function TR(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=pC(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Ot(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&s.timestamp-r.timestamp>Ot(e)*2&&(r=t[1]);const i=Zt(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 MR(t,{min:e,max:n},r){return e!==void 0&&tn&&(t=r?pe(n,t,r.max):Math.min(t,n)),t}function Db(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 PR(t,{top:e,left:n,bottom:r,right:s}){return{x:Db(t.x,n,s),y:Db(t.y,e,r)}}function Lb(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.minr?n=Ui(e.min,e.max-r,t.min):r>s&&(n=Ui(t.min,t.max-s,e.min)),kn(0,1,n)}function LR(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 RR(t=sm){return t===!1?t=0:t===!0&&(t=sm),{x:Rb(t,"left","right"),y:Rb(t,"top","bottom")}}function Rb(t,e,n){return{min:_b(t,e),max:_b(t,n)}}function _b(t,e){return typeof t=="number"?t:t[e]||0}const _R=new WeakMap;class IR{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=Ve(),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(fl(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=o4(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),Cn(y=>{let x=this.getAxisMotionValue(y).get()||0;if(Ln.test(x)){const{projection:k}=this.visualElement;if(k&&k.layout){const w=k.layout.layoutBox[y];w&&(x=yt(w)*(parseFloat(x)/100))}}this.originPoint[y]=x}),g&&ae.update(()=>g(h,f),!1,!0),Gp(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:m,onDirectionLock:g,onDrag:b}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=f;if(m&&this.currentDirection===null){this.currentDirection=BR(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),b&&ae.update(()=>b(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 fC(e,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:hC(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&&ae.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||!Kl(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=MR(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&&oi(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=PR(r.layoutBox,e):this.constraints=!1,this.elastic=RR(n),s!==this.constraints&&!oi(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&Cn(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=LR(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!oi(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=O4(r,s.root,this.visualElement.getTransformPagePoint());let o=AR(s.layout.layoutBox,i);if(n){const a=n(R4(o));this.hasMutatedConstraints=!!a,a&&(o=IN(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Cn(d=>{if(!Kl(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 Gp(this.visualElement,e),r.start(t0(e,r,0,n,this.visualElement,!1))}stopAnimation(){Cn(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){Cn(n=>{const{drag:r}=this.getProps();if(!Kl(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]-pe(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!oi(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Cn(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=DR({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(),Cn(o=>{if(!Kl(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(pe(l,u,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;_R.set(this.visualElement,this);const e=this.visualElement.current,n=ia(e,"pointerdown",u=>{const{drag:d,dragListener:h=!0}=this.getProps(),f=u.target,p=f!==e&&h4(f);d&&h&&!p&&this.start(u)});let r;const s=()=>{const{dragConstraints:u}=this.getProps();oi(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=OR(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),ae.read(s);const a=Ua(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Cn(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 Ib(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function OR(t,e,n){const r=Zp(t,Ib(n)),s=Zp(e,Ib(n));return()=>{r(),s()}}function Kl(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function BR(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class zR extends ts{constructor(e){super(e),this.removeGroupControls=At,this.removeListeners=At,this.controls=new IR(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||At}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 Yh=t=>(e,n)=>{t&&ae.update(()=>t(e,n),!1,!0)};class FR extends ts{constructor(){super(...arguments),this.removePointerDownListener=At}onPointerDown(e){this.session=new fC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:hC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Yh(e),onStart:Yh(n),onMove:Yh(r),onEnd:(i,o)=>{delete this.session,s&&ae.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=ia(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 Xh=!1;class VR 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),Xh&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Lc.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}),Xh=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||ae.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(),Ki.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;Xh=!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 mC(t){const[e,n]=rC(),r=v.useContext(Og);return c.jsx(VR,{...t,layoutGroup:r,switchLayoutGroup:v.useContext(uC),isPresent:e,safeToRemove:n})}const $R={pan:{Feature:FR},drag:{Feature:zR,ProjectionNode:nC,MeasureLayout:mC}};function Ob(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&&ae.postRender(()=>i(e,fl(e)))}class HR extends ts{mount(){const{current:e}=this.node;e&&(this.unmount=l4(e,(n,r)=>(Ob(this.node,r,"Start"),s=>Ob(this.node,s,"End"))))}unmount(){}}class UR extends ts{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=cl(Ua(this.node.current,"focus",()=>this.onFocus()),Ua(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Bb(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&&ae.postRender(()=>i(e,fl(e)))}class WR extends ts{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=p4(e,(s,i)=>(Bb(this.node,i,"Start"),(o,{success:a})=>Bb(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const im=new WeakMap,Zh=new WeakMap,KR=t=>{const e=im.get(t.target);e&&e(t)},GR=t=>{t.forEach(KR)};function qR({root:t,...e}){const n=t||document;Zh.has(n)||Zh.set(n,{});const r=Zh.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(GR,{root:t,...e})),r[s]}function JR(t,e,n){const r=qR(e);return im.set(t,n),r.observe(t),()=>{im.delete(t),r.unobserve(t)}}const YR={some:0,all:1};class XR extends ts{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:YR[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=JR(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(ZR(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function ZR({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const QR={inView:{Feature:XR},tap:{Feature:WR},focus:{Feature:UR},hover:{Feature:HR}},e_={layout:{ProjectionNode:nC,MeasureLayout:mC}},t_={...NR,...QR,...$R,...e_},qn=bR(t_,vR);function wu(t){return typeof window>"u"?!1:t?aN():Qg()}const n_=50,zb=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),r_=()=>({time:0,x:zb(),y:zb()}),s_={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Fb(t,e,n,r){const s=n[e],{length:i,position:o}=s_[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=Ui(0,s.scrollLength,s.current);const u=r-l;s.velocity=u>n_?0:Vg(s.current-a,u)}function i_(t,e,n){Fb(t,"x",e,n),Fb(t,"y",e,n),e.time=n}function o_(t,e){const n={x:0,y:0};let r=t;for(;r&&r!==e;)if(ra(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 om={start:0,center:.5,end:1};function Vb(t,e,n=0){let r=0;if(t in om&&(t=om[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 a_=[0,0];function l_(t,e,n,r){let s=Array.isArray(t)?t:a_,i=0,o=0;return typeof t=="number"?s=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?s=t.split(" "):s=[t,om[t]?t:"0"]),i=Vb(s[0],n,r),o=Vb(s[1],e),i-o}const zo={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},c_={x:0,y:0};function u_(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function d_(t,e,n){const{offset:r=zo.All}=n,{target:s=t,axis:i="y"}=n,o=i==="y"?"height":"width",a=s!==t?o_(s,t):c_,l=s===t?{width:t.scrollWidth,height:t.scrollHeight}:u_(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_(t,r.target,n),i_(t,n,s),(r.offset||r.target)&&d_(t,n,r)},notify:()=>e(n)}}const ti=new WeakMap,$b=new WeakMap,Qh=new WeakMap,Hb=new WeakMap,Gl=new WeakMap,Ub=t=>t===document.scrollingElement?window:t;function gC(t,{container:e=document.scrollingElement,trackContentSize:n=!1,...r}={}){if(!e)return At;let s=Qh.get(e);s||(s=new Set,Qh.set(e,s));const i=r_(),o=f_(e,t,i,r);if(s.add(o),!ti.has(e)){const l=()=>{for(const f of s)f.measure(Ke.timestamp);ae.preUpdate(u)},u=()=>{for(const f of s)f.notify()},d=()=>ae.read(l);ti.set(e,d);const h=Ub(e);window.addEventListener("resize",d),e!==document.documentElement&&$b.set(e,Zp(e,d)),h.addEventListener("scroll",d),d()}if(n&&!Gl.has(e)){const l=ti.get(e),u={width:e.scrollWidth,height:e.scrollHeight};Hb.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=ae.read(d,!0);Gl.set(e,h)}const a=ti.get(e);return ae.read(a,!1,!0),()=>{var h;sn(a);const l=Qh.get(e);if(!l||(l.delete(o),l.size))return;const u=ti.get(e);ti.delete(e),u&&(Ub(e).removeEventListener("scroll",u),(h=$b.get(e))==null||h(),window.removeEventListener("resize",u));const d=Gl.get(e);d&&(sn(d),Gl.delete(e)),Hb.delete(e)}}const p_=[[zo.Enter,"entry"],[zo.Exit,"exit"],[zo.Any,"cover"],[zo.All,"contain"]],Wb={start:0,end:1};function m_(t){const e=t.trim().split(/\s+/);if(e.length!==2)return;const n=Wb[e[0]],r=Wb[e[1]];if(!(n===void 0||r===void 0))return[n,r]}function g_(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=m_(n);if(!r)return;e.push(r)}else return;return e}function x_(t,e){const n=g_(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 p_)if(x_(t,e))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const Kb=new Map;function Gb(t){const e={value:0},n=gC(r=>{e.value=r[t.axis].progress*100},t);return{currentTime:e,cancel:n}}function xC({source:t,container:e,...n}){const{axis:r}=n;t&&(e=t);let s=Kb.get(e);s||(s=new Map,Kb.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&&wu(n.target)?f0(n.offset)?o[a]=new ViewTimeline({subject:n.target,axis:r}):o[a]=Gb({container:e,...n}):wu()?o[a]=new ScrollTimeline({source:e,axis:r}):o[a]=Gb({container:e,...n})),o[a]}function y_(t,e){const n=xC(e),r=e.target?f0(e.offset):void 0,s=e.target?wu(e.target)&&!!r:wu();return t.attachTimeline({timeline:s?n:void 0,...r&&s&&{rangeStart:r.rangeStart,rangeEnd:r.rangeEnd},observe:i=>(i.pause(),AN(o=>{i.time=i.iterationDuration*o},n))})}function b_(t){return t&&(t.target||t.offset)}function v_(t){return t.length===2}function k_(t,e){return v_(t)||b_(e)?gC(n=>{t(n[e.axis].progress,n)},e):AN(t,xC(e))}function yC(t,{axis:e="y",container:n=document.scrollingElement,...r}={}){if(!n)return At;const s={axis:e,container:n,...r};return typeof t=="function"?k_(t,s):y_(t,s)}const w_=()=>({scrollX:pn(0),scrollY:pn(0),scrollXProgress:pn(0),scrollYProgress:pn(0)}),Ei=t=>t?!t.current:!1;function qb(t,e,n,r){return{factory:s=>{let i;const o=()=>{if(Ei(n)||Ei(r)){Ki.read(o);return}i=yC(s,{...e,axis:t,container:(n==null?void 0:n.current)||void 0,target:(r==null?void 0:r.current)||void 0})};return Ki.read(o),()=>{jN(o),i==null||i()}},times:[0,1],keyframes:[0,1],ease:s=>s,duration:1}}function S_(t,e){return typeof window>"u"?!1:t?aN()&&!!f0(e):Qg()}function bC({container:t,target:e,...n}={}){const r=Gr(w_);S_(e,n.offset)&&(r.scrollXProgress.accelerate=qb("x",n,t,e),r.scrollYProgress.accelerate=qb("y",n,t,e));const s=v.useRef(null),i=v.useRef(!1),o=v.useCallback(()=>(s.current=yC((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 ll(()=>{if(i.current=!1,Ei(t)||Ei(e)){i.current=!0;return}else return o()},[o]),v.useEffect(()=>{if(!i.current)return;let a;const l=()=>{const u=Ei(t),d=Ei(e);!u&&!d&&(a=o())};return Ki.read(l),()=>{jN(l),a==null||a()}},[o]),r}function vC(t){const e=Gr(()=>pn(t)),{isStatic:n}=v.useContext(hl);if(n){const[,r]=v.useState(t);v.useEffect(()=>e.on("change",r),[])}return e}function kC(t,e){const n=vC(e()),r=()=>n.set(e());return r(),ll(()=>{const s=()=>ae.preRender(r,!1,!0),i=t.map(o=>o.on("change",s));return()=>{i.forEach(o=>o()),sn(r)}}),n}function N_(t){na.current=[],t();const e=kC(na.current,t);return na.current=void 0,e}function mr(t,e,n,r){if(typeof t=="function")return N_(t);if(n!==void 0&&!Array.isArray(n)&&typeof e!="function")return C_(t,e,n,r);const o=typeof e=="function"?e:N4(e,n,r),a=Array.isArray(t)?Jb(t,o):Jb([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 Jb(t,e){const n=Gr(()=>[]);return kC(t,()=>{n.length=0;const r=t.length;for(let s=0;sObject.keys(n)),i=Gr(()=>({}));for(const o of s)i[o]=mr(t,e,n[o],r);return i}function j_(t,e={}){const{isStatic:n}=v.useContext(hl),r=()=>Ue(t)?t.get():t;if(n)return mr(r);const s=vC(r());return v.useInsertionEffect(()=>C4(s,t,e),[s,JSON.stringify(e)]),s}function E_(t,e={}){return j_(t,{type:"spring",...e})}function T_(){const{scrollYProgress:t}=bC(),e=E_(t,{stiffness:200,damping:30,restDelta:.001});return c.jsx(qn.div,{style:{scaleX:e},className:"fixed left-0 top-0 z-40 h-0.5 w-full origin-left bg-brand-500"})}const M_=()=>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 pl({message:t,fullScreen:e=!1}){const{t:n}=it(),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(M_,{})}),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.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white px-4 dark:bg-neutral-950",children:r}):c.jsx("div",{className:"mx-auto max-w-6xl px-4 py-20 sm:px-6",children:r})}const Yb=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 ml({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:Yb}):c.jsx("div",{className:"bg-amber-500 px-4 py-2 text-center text-xs font-semibold text-white",children:Yb})}function P_({onClose:t}){const{consent:e,saveCustom:n}=uo(),[r,s]=v.useState(e.external),[i,o]=v.useState(e.analytics),{t:a}=it();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(Q,{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 A_(){const{decided:t,settingsOpen:e,acceptAll:n,rejectNonEssential:r,openSettings:s,closeSettings:i}=uo(),{t:o}=it();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(Q,{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(P_,{onClose:i})]})}function D_(){const{consent:t}=uo(),{ga_measurement_id:e}=es(),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 wC=v.createContext({global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null},bypass:!1}),L_=wC.Provider;function Vd(){return v.useContext(wC)}const R_={global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null}},__={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}},I_={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:__,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},O_=["/impressum","/datenschutz","/agb"];function B_(){const[t,e]=v.useState(null),[n,r]=v.useState(I_),{loading:s,hasPermission:i}=wn(),o=on();if(v.useEffect(()=>{A.get("/maintenance").then(e).catch(()=>e(R_)),A.get("/site-settings").then(r).catch(()=>{})},[]),t===null||s)return c.jsx("div",{className:"min-h-screen bg-white dark:bg-neutral-950"});const a=i("maintenance.bypass"),l=O_.includes(o.pathname);return t.global.enabled&&!a&&!l?c.jsx(by,{children:c.jsx(pl,{message:t.global.message,fullScreen:!0})}):c.jsx(by,{children:c.jsx(L_,{value:{...t,bypass:a},children:c.jsx(WA,{value:n,children:c.jsxs("div",{className:"page-texture flex min-h-screen flex-col text-neutral-900 dark:text-neutral-100",children:[a&&t.global.enabled&&c.jsx(ml,{}),c.jsx(T_,{}),c.jsx(XA,{}),c.jsx("main",{className:"flex-1",children:c.jsx(_d,{})}),c.jsx(s3,{}),c.jsx(A_,{}),c.jsx(D_,{})]})})})})}const z_={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"},F_=({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 V_(){const{logout:t,user:e,hasPermission:n}=wn(),r=al(),[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"}]},{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(kS,{to:g.to,end:g.end,className:d,onClick:f,children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx(F_,{path:z_[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("span",{className:"rounded-lg px-2 py-1",children:[c.jsx("img",{src:Fa,alt:"HifiPlanet",className:"h-7 w-auto dark:hidden"}),c.jsx("img",{src:hu,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("span",{className:"rounded-lg px-1.5 py-0.5",children:[c.jsx("img",{src:Fa,alt:"HifiPlanet",className:"h-6 w-auto dark:hidden"}),c.jsx("img",{src:hu,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(CS,{}),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(_d,{})})]})]})}function $_(){const{user:t,loading:e}=wn();return e?c.jsx("div",{className:"flex min-h-screen items-center justify-center text-neutral-500",children:"Lädt…"}):t?c.jsx(_d,{}):c.jsx(za,{to:"/admin/login",replace:!0})}function ut({permission:t,children:e}){const{hasPermission:n}=wn();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 ef(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 H_(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 $t({title:t,description:e,path:n}){v.useEffect(()=>{t&&(document.title=`${t} | HifiPlanet`,ef("og:title",`${t} | HifiPlanet`,"property")),e&&(ef("description",e),ef("og:description",e,"property")),n&&H_(n)},[t,e,n])}const U_=[.16,1,.3,1],Xb={up:{y:40},left:{x:-56},right:{x:56}};function W_(t){return{hidden:{opacity:0,scale:.96,filter:"blur(8px)",...Xb[t]||Xb.up},visible:{opacity:1,scale:1,x:0,y:0,filter:"blur(0px)"}}}const K_={hidden:{x:"-130%"},visible:{x:"230%",transition:{duration:1.1,ease:"easeInOut",delay:.4}}};function Xe({children:t,direction:e="up",className:n="",index:r=0,shine:s=!1}){const i=Math.min(r*.09,.45);return c.jsxs(qn.div,{className:n,style:{position:"relative",overflow:"hidden"},initial:"hidden",whileInView:"visible",viewport:{once:!0,amount:.25,margin:"-100px"},variants:W_(e),transition:{duration:.75,ease:U_,delay:i},children:[t,s&&c.jsx(qn.div,{"aria-hidden":!0,variants:K_,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 G_({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(qn.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(qL,{initial:!1,children:i&&c.jsx(qn.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 SC({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 q_=70;function J_({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=x=>{if(r.half<=0)return x;for(;x>0;)x-=r.half;for(;x<=-r.half;)x+=r.half;return x},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=x=>{r.lastTime===null&&(r.lastTime=x);const k=(x-r.lastTime)/1e3;r.lastTime=x,!r.dragging&&!r.hovering&&!o&&(r.pos=l(r.pos+q_*k),a()),r.rafId=requestAnimationFrame(h)};r.rafId=requestAnimationFrame(h);const f=e.current,p=()=>{r.hovering=!0},m=()=>{r.hovering=!1},g=x=>{r.dragging=!0,r.dragStartX=x.clientX,r.dragStartPos=r.pos,f.setPointerCapture(x.pointerId),f.classList.add("cursor-grabbing"),f.classList.remove("cursor-grab")},b=x=>{r.dragging&&(r.pos=l(r.dragStartPos+(x.clientX-r.dragStartX)),a())},y=x=>{r.dragging&&(r.dragging=!1,f.hasPointerCapture(x.pointerId)&&f.releasePointerCapture(x.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",b),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",b),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(SC,{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 Gi(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 Y_="/assets/gallery-dash2-CEVCErVK.webp",NC="/assets/gallery-amp-purple-CESAKuOf.webp",X_="/assets/gallery-speaker-CUXQZ49Q.webp",CC="/assets/gallery-subs-COSd4seJ.webp",jC="/assets/gallery-dash-Cg-7v9qo.webp",Z_="/assets/hero-trunk-Dp4_JHDh.webp",Q_="/assets/gallery-rear-8cIXPC7T.webp",eI="/assets/hero-highlight-Co4f1Kj5.webp",tI="/assets/youtube-hintergrund-C0osNxn7.mp4",nI=["Ground Zero Audio","Audison","Hertz","Helix","Brax","Gladen","Alpine","Pioneer","Kenwood","JVC"],ql={left:"text-left",center:"text-center",right:"text-right"},rI={left:"",center:"mx-auto",right:"ml-auto"},sI={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:""};function Zb({label:t,url:e,className:n}){return!t||!e?null:e.startsWith("/")?c.jsx(Q,{to:e,className:n,children:t}):c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:n,children:t})}const iI=[{src:CC,width:900,height:600},{src:NC,width:900,height:600},{src:X_,width:900,height:1200},{src:jC,width:900,height:814},{src:Q_,width:900,height:1200},{src:Z_,width:1920,height:1280}];function oI(){const{hero_image_path:t}=es(),e=t||Y_,{t:n,language:r}=it(),s=n("home.stats"),i=n("home.galleryAlts"),o=iI.map((S,N)=>({...S,alt:i[N]})),[a,l]=v.useState([]),[u,d]=v.useState({}),h=S=>{const N=u[S]||sI;return{eyebrow:N[`eyebrow_${r}`]||"",title:N[`title_${r}`]||"",bodyHtml:N[`body_html_${r}`]||"",align:N.text_align||"center",alignX:N.text_align_x,alignY:N.text_align_y,buttonLabel:N[`button_label_${r}`]||"",buttonUrl:N.button_url||""}};v.useEffect(()=>{A.get("/home-sections").then(d).catch(()=>{})},[]);const[f,p]=v.useState(null),m=f?f.reviews.filter(S=>S.review_text).map(S=>({name:S.author_name,text:S.review_text,rating:S.rating,photo:S.profile_photo_url})):n("home.testimonials");v.useEffect(()=>{A.get("/faqs").then(S=>{l(S.map(N=>({question:r==="de"?N.question_de:N.question_en,answer:r==="de"?N.answer_de:N.answer_en})))}).catch(()=>{})},[r]),v.useEffect(()=>{A.get("/google-reviews").then(S=>{S.rating!=null&&S.reviews.some(N=>N.review_text)&&p(S)}).catch(()=>{})},[]),$t({title:n("home.metaTitle"),description:n("home.metaDescription"),path:"/"}),v.useEffect(()=>{if(a.length===0)return;const S=document.createElement("script");return S.type="application/ld+json",S.text=JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:a.map(N=>({"@type":"Question",name:N.question,acceptedAnswer:{"@type":"Answer",text:N.answer}}))}),document.head.appendChild(S),()=>document.head.removeChild(S)},[a]);const g=v.useRef(null),{scrollYProgress:b}=bC({target:g,offset:["start start","end start"]}),y=mr(b,[0,1],["-6%","6%"]),x=mr(b,[0,1],["0%","60%"]),k=mr(b,[0,.8],[1,0]),w=mr(b,[.5,1],[0,1]),C=mr(w,S=>S>.05?"auto":"none"),j=mr(b,[.5,1],[16,0]);return c.jsxs("div",{children:[c.jsx(qn.div,{style:{opacity:w,pointerEvents:C,y:j},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(Q,{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(Q,{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:g,className:"relative -mt-[89px] h-dvh min-h-[560px] overflow-hidden sm:-mt-[97px]",children:[c.jsx(qn.img,{style:{y,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(qn.div,{style:{y:x,opacity:k},className:"absolute inset-0",children:c.jsx("div",{className:"absolute w-full max-w-2xl px-4 text-center sm:px-6",style:Gi(h("hero").alignX,h("hero").alignY,{x:50,y:50}),children:c.jsxs(qn.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.7,ease:"easeOut"},children:[h("hero").eyebrow&&c.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-wide text-brand-400",children:h("hero").eyebrow}),c.jsx("h1",{className:"text-3xl font-extrabold tracking-tight text-white sm:text-5xl",children:h("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:h("hero").bodyHtml}}),c.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-3",children:[c.jsx(Q,{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(Q,{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((S,N)=>c.jsxs(Xe,{index:N,children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-400 sm:text-3xl",children:S.value}),c.jsx("p",{className:"text-sm text-neutral-400",children:S.label})]},S.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:nI.map((S,N)=>c.jsx(Xe,{index:N,className:"text-lg font-bold text-neutral-400 dark:text-neutral-600",children:S},S))})]})}),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:jC,className:"absolute inset-0 h-full w-full object-cover",children:c.jsx("source",{src:tI,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:Gi(h("youtube").alignX,h("youtube").alignY,{x:50,y:50}),children:c.jsxs(Xe,{children:[h("youtube").eyebrow&&c.jsx("p",{className:"mb-4 text-xs font-semibold uppercase tracking-[0.2em] text-neutral-200 sm:text-sm",children:h("youtube").eyebrow}),c.jsx("h2",{className:"text-3xl font-bold uppercase tracking-wide text-white sm:text-5xl",children:h("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:h("youtube").bodyHtml}}),c.jsx(Zb,{label:h("youtube").buttonLabel,url:h("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"})]})})]}),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(Xe,{direction:"left",shine:!0,className:"rounded-xl shadow-lg",children:c.jsx("img",{src:CC,alt:n("home.craftImageAlt"),width:900,height:600,className:"w-full rounded-xl object-cover",style:{maxHeight:380}})}),c.jsxs(Xe,{direction:"right",index:1,className:ql[h("craft").align],children:[h("craft").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("craft").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",children:h("craft").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:h("craft").bodyHtml}})]})]}),c.jsxs("div",{className:"grid items-center gap-8 md:grid-cols-2",children:[c.jsxs(Xe,{direction:"left",className:`order-2 md:order-1 ${ql[h("advice").align]}`,children:[h("advice").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("advice").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",children:h("advice").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:h("advice").bodyHtml}})]}),c.jsx(Xe,{direction:"right",index:1,shine:!0,className:"order-1 md:order-2 rounded-xl shadow-lg",children:c.jsx("img",{src:NC,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(Xe,{className:`mb-8 ${ql[h("insights").align]}`,children:[h("insights").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("insights").eyebrow}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:h("insights").title}),c.jsx("div",{className:"legal-content mt-2 text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:h("insights").bodyHtml}})]}),c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:o.map((S,N)=>c.jsx(Xe,{index:N%3,shine:!0,className:"aspect-square overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsx("img",{src:S.src,alt:S.alt,width:S.width,height:S.height,loading:"lazy",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})},S.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(Xe,{className:"mb-10 text-center",children:[c.jsx("div",{className:"mb-2 flex items-center justify-center gap-2",children:c.jsx(SC,{className:"h-6 w-6",count:f?Math.round(f.rating):5})}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:f?n("home.reviewsRatingDynamic")(f.rating,f.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(Xe,{children:c.jsx(J_,{testimonials:m})})]})}),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(Xe,{direction:"left",shine:!0,className:"overflow-hidden rounded-xl shadow-lg",children:c.jsx("img",{src:eI,alt:n("home.moreImageAlt"),width:1600,height:905,className:"h-full w-full object-cover",loading:"lazy"})}),c.jsxs(Xe,{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 ${ql[h("more").align]}`,children:[h("more").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",children:h("more").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",children:h("more").title}),c.jsx("div",{className:`legal-content mb-8 max-w-2xl text-neutral-600 dark:text-neutral-300 ${rI[h("more").align]}`,dangerouslySetInnerHTML:{__html:h("more").bodyHtml}}),c.jsx(Zb,{label:h("more").buttonLabel,url:h("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"})]})]})}),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(Xe,{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(Xe,{index:1,children:c.jsx(G_,{items:a})})]})})]})}function aI(){const[t,e]=v.useState([]),[n,r]=v.useState(""),s=Vd(),{t:i}=it();return $t({title:i("vehicleSelect.metaTitle"),description:i("vehicleSelect.metaDescription"),path:"/fahrzeuge"}),v.useEffect(()=>{s.vehicles.enabled&&!s.bypass||A.get("/brands").then(e).catch(o=>r(o.message))},[s.vehicles.enabled,s.bypass]),s.vehicles.enabled&&!s.bypass?c.jsx(pl,{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(ml,{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(o=>c.jsxs(Q,{to:`/fahrzeuge/${o.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:[o.image_path&&c.jsx("img",{src:o.image_path,alt:"",className:"h-16 w-full object-contain"}),o.name]},o.id))})]})}function lI(){const{brandSlug:t}=Js(),[e,n]=v.useState(null),[r,s]=v.useState(""),i=Vd(),{t:o}=it();return v.useEffect(()=>{i.vehicles.enabled&&!i.bypass||A.get(`/brands/${t}/models`).then(n).catch(a=>s(a.message))},[t,i.vehicles.enabled,i.bypass]),$t({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(pl,{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(ml,{inline:!0}),c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(Q,{to:"/fahrzeuge",className:"hover:text-brand-500",children:o("brandPage.breadcrumbVehicles")})," / ",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," – ",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(a=>c.jsxs(Q,{to:`/fahrzeuge/${t}/${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"}),a.name]},a.id))})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:o("brandPage.loading")})}const Qb="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==",cI="/assets/base-BKOm0Bib.webp",uI="/assets/clear-DZZMSrMX.webp",dI="/assets/drive-BE2W1yna.webp",hI="/assets/prime-BTVNe2Gb.webp",fI="/assets/elite_r-BRvz_pyr.webp",pI="/assets/apex-CFy2qup8.webp",mI="/assets/statement-pTO-wTPx.webp",gI="/assets/limitless-DDs0S_PU.webp",xI=(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)]},tf=(t,e,n)=>`rgb(${xI(t,e,n).join(", ")})`,ev=t=>t.map(([e,n,r,s,i,o])=>({bgTop:tf(e,n,r),border:tf(e,n,r+8),accent:tf(s,i,o),img:null})),tv={graphite:[{accent:"#b6b6b6",border:"#2a2a2a",bgTop:"#1c1c1c",img:cI},{accent:"#d3d3d3",border:"#2e2e2e",bgTop:"#212121",img:uI},{accent:"#8fb8bd",border:"#26383b",bgTop:"#16282b",img:dI},{accent:"#6fbf73",border:"#1f3a24",bgTop:"#122916",img:hI},{accent:"#63d34f",border:"#204a1c",bgTop:"#123312",img:fI},{accent:"#8bea3c",border:"#2b5518",bgTop:"#173a0f",img:pI},{accent:"#d9a83c",border:"#4a3a16",bgTop:"#33270d",img:mI},{accent:"#f2c14e",border:"#5a4718",bgTop:"#3d2f0c",img:gI}],"deep-blue":ev([[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":ev([[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]])},yI="#f2f2f2",bI="#8a8a8a",vI="#c4c4c4",nv=5;function kI({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-nv,h=l?s:s.slice(0,nv),f=e.img?null:{backgroundColor:e.accent,WebkitMaskImage:`url(${Qb})`,maskImage:`url(${Qb})`,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:{...f,opacity:.2+n*.45,filter:"blur(18px)"},"aria-hidden":"true"}),c.jsx("div",{className:"pointer-events-none absolute inset-0",style:{...f,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((p,m)=>c.jsxs("li",{className:"flex items-start gap-2",style:{fontSize:"13px",color:vI},children:[c.jsx(Et,{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:p})]},m))}),d>0&&c.jsxs("button",{type:"button",onClick:()=>u(p=>!p),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(Et,{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:bI},children:a("modelPage.totalPrice")}),c.jsx("div",{style:{marginTop:"4px",fontFamily:"'Barlow Condensed', sans-serif",fontSize:"30px",fontWeight:600,letterSpacing:"1px",color:yI},children:t.price_text||i(t.total_price)}),c.jsx(Q,{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 wI(){const{brandSlug:t,modelSlug:e}=Js(),[n,r]=v.useState(null),[s,i]=v.useState(""),o=Vd(),{t:a,language:l}=it(),{package_card_theme:u,package_card_layout:d,package_wheel_hint_interval:h}=es(),f=tv[u]||tv.graphite,p=["grid","strip","coverflow"].includes(d)?d:"strip",m=Math.max(2,Number(h)||8)*1e3,g=v.useRef(null),b=v.useRef(null),y=v.useRef(null),[x,k]=v.useState(!1),w=E=>new Intl.NumberFormat(l==="de"?"de-DE":"en-US",{style:"currency",currency:"EUR"}).format(E);if(v.useEffect(()=>{o.vehicles.enabled&&!o.bypass||A.get(`/models/${t}/${e}/packages`).then(r).catch(E=>i(E.message))},[t,e,o.vehicles.enabled,o.bypass]),v.useEffect(()=>{const E=g.current;if(p!=="coverflow"||!E)return;let I=0;const $=()=>{I=0;const B=E.scrollLeft+E.clientWidth/2;for(const Z of E.children){const R=Z.offsetLeft+Z.offsetWidth/2,_=Math.max(-1,Math.min(1,(R-B)/(Z.offsetWidth*1.4))),V=Math.abs(_);Z.style.transform=`rotateY(${(-_*35).toFixed(2)}deg) scale(${(1-V*.13).toFixed(3)}) translateZ(${(-V*60).toFixed(1)}px)`,Z.style.zIndex=String(100-Math.round(V*50))}},L=()=>{I||(I=requestAnimationFrame($))};$(),E.addEventListener("scroll",L,{passive:!0});const U=new ResizeObserver(L);return U.observe(E),()=>{E.removeEventListener("scroll",L),U.disconnect(),cancelAnimationFrame(I)}},[p,n]),v.useEffect(()=>{const E=g.current;if(p==="grid"||!E)return;const I=window.matchMedia("(pointer: coarse)").matches;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let L=[],U=0;const B=()=>{const R=Math.min(E.clientWidth*.4,160);L.push(setTimeout(()=>E.scrollTo({left:R,behavior:"smooth"}),500)),L.push(setTimeout(()=>E.scrollTo({left:0,behavior:"smooth"}),1250)),I||(L.push(setTimeout(()=>k(!0),450)),L.push(setTimeout(()=>k(!1),1700)))},Z=new IntersectionObserver(([R])=>{R.isIntersecting&&(Z.disconnect(),B(),U=setInterval(()=>{E.scrollLeft<=1&&B()},m))},{threshold:.35});return Z.observe(E),()=>{Z.disconnect(),clearInterval(U),L.forEach(clearTimeout)}},[p,n,m]),v.useEffect(()=>{const E=g.current;if(p==="grid"||!E)return;let I=0,$=0,L=!1,U=0,B=0;const Z=()=>[...E.children].map(K=>K.offsetLeft+K.offsetWidth/2),R=(K,te)=>{let Se=0,se=1/0;return K.forEach((he,Te)=>{const ot=Math.abs(he-te);ot{L=!1;const K=Z();if(!K.length)return;const te=E.scrollLeft+E.clientWidth/2,Se=R(K,te);let se=Se;Se===U&&Math.abs(B)>4&&(se=B>0?Math.min(U+1,K.length-1):Math.max(U-1,0));const he=E.scrollWidth-E.clientWidth,Te=Math.max(0,Math.min(K[se]-E.clientWidth/2,he));E.scrollTo({left:Te,behavior:"smooth"}),clearTimeout($),$=setTimeout(()=>{E.style.scrollSnapType=""},450)},V=K=>{if(Math.abs(K.deltaX)>Math.abs(K.deltaY))return;const te=E.scrollWidth-E.clientWidth;if(te<=1)return;const Se=E.scrollLeft<=1,se=E.scrollLeft>=te-1;K.deltaY<0&&Se||K.deltaY>0&&se||(K.preventDefault(),L||(L=!0,B=0,U=R(Z(),E.scrollLeft+E.clientWidth/2)),B+=K.deltaY,E.style.scrollSnapType="none",E.scrollLeft+=K.deltaY,clearTimeout(I),I=setTimeout(_,150))};return E.addEventListener("wheel",V,{passive:!1}),()=>{E.removeEventListener("wheel",V),clearTimeout(I),clearTimeout($)}},[p,n]),v.useEffect(()=>{const E=g.current,I=b.current,$=y.current;if(p==="grid"||!E||!I||!$)return;let L=0;const U=()=>{L=0;const se=E.scrollWidth-E.clientWidth;if(se<=1){I.style.opacity="0",I.style.pointerEvents="none";return}I.style.opacity="1",I.style.pointerEvents="auto";const he=I.clientWidth,Te=Math.max(32,E.clientWidth/E.scrollWidth*he);$.style.width=`${Te}px`,$.style.transform=`translateX(${(E.scrollLeft/se*(he-Te)).toFixed(1)}px)`},B=()=>{L||(L=requestAnimationFrame(U))};U(),E.addEventListener("scroll",B,{passive:!0});const Z=new ResizeObserver(B);Z.observe(E);let R=!1,_=0;const V=se=>{const he=I.getBoundingClientRect(),Te=$.clientWidth,ot=Math.min(Math.max(se-he.left-_,0),he.width-Te);E.scrollLeft=ot/(he.width-Te)*(E.scrollWidth-E.clientWidth)},K=se=>{R=!0,I.setPointerCapture(se.pointerId),E.style.scrollSnapType="none";const he=$.getBoundingClientRect();_=se.clientX>=he.left&&se.clientX<=he.right?se.clientX-he.left:$.clientWidth/2,se.clientX>=he.left&&se.clientX<=he.right||V(se.clientX)},te=se=>{R&&V(se.clientX)},Se=se=>{var he;R&&(R=!1,(he=I.hasPointerCapture)!=null&&he.call(I,se.pointerId)&&I.releasePointerCapture(se.pointerId),E.style.scrollSnapType="")};return I.addEventListener("pointerdown",K),I.addEventListener("pointermove",te),I.addEventListener("pointerup",Se),I.addEventListener("pointercancel",Se),()=>{E.removeEventListener("scroll",B),Z.disconnect(),cancelAnimationFrame(L),I.removeEventListener("pointerdown",K),I.removeEventListener("pointermove",te),I.removeEventListener("pointerup",Se),I.removeEventListener("pointercancel",Se)}},[p,n]),$t({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}`}),o.vehicles.enabled&&!o.bypass)return c.jsx(pl,{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:C,packages:j}=n,S=new Map([...j].sort((E,I)=>E.total_price-I.total_price).map((E,I)=>[E.id,I])),N=E=>{const I=j.length,$=S.get(E.id)??0,L=I<=1?0:$/(I-1),U=Math.round(L*(f.length-1));return{tier:f[U],tierT:L}},M=E=>[...E.products.map(I=>I.name_override||I.scraped_name||a("modelPage.productLoading")),...(E.description||"").split(` `).map(I=>I.trim()).filter(Boolean)],T=E=>`/kontakt?${new URLSearchParams({brand:C.brand_name,model:C.name,package:E.name,packageId:E.id,total:E.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(ml,{inline:!0}),c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(Q,{to:"/fahrzeuge",className:"hover:text-brand-500",children:a("modelPage.breadcrumbVehicles")})," /"," ",c.jsx(Q,{to:`/fahrzeuge/${t}`,className:"hover:text-brand-500",children:C.brand_name})," / ",C.name]}),c.jsxs("h1",{className:`text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl ${j.length?"mb-2":"mb-8"}`,children:[C.brand_name," ",C.name," – ",a("modelPage.titleSuffix")]}),j.length===0&&c.jsx("p",{className:"pb-12 text-neutral-500 dark:text-neutral-400",children:a("modelPage.empty")})]}),j.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:j.map(E=>{const{tier:I,tierT:$}=N(E);return c.jsx(kI,{pkg:E,tier:I,tierT:$,layout:p,bullets:M(E),formatPrice:w,contactUrl:T,t:a},E.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 ${x?"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(i2,{className:"h-3.5 w-3.5 text-brand-400"}),c.jsx(o2,{className:"h-4 w-4 text-brand-400"}),c.jsx(a2,{className:"h-3.5 w-3.5 text-brand-400"}),c.jsx("span",{children:a("modelPage.wheelHint")})]})}),p!=="grid"&&c.jsx("div",{ref:b,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 SI(){const[t,e]=v.useState(null),[n,r]=v.useState(""),{t:s}=it(),{gallery_card_text_x:i,gallery_card_text_y:o}=es();return $t({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(Q,{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:Gi(i,o,{x:0,y:100}),children:a.name})]},a.id))})]})}function NI(){const{brandSlug:t}=Js(),[e,n]=v.useState(null),[r,s]=v.useState(""),{t:i}=it(),{gallery_card_text_x:o,gallery_card_text_y:a}=es();return v.useEffect(()=>{A.get(`/gallery-brands/${t}/projects`).then(n).catch(l=>s(l.message))},[t]),$t({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(Q,{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(Q,{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:Gi(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 CI({photos:t,index:e,onClose:n,onNavigate:r}){const{t:s}=it();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 Ad.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 jI(){const{brandSlug:t,projectSlug:e}=Js(),[n,r]=v.useState(null),[s,i]=v.useState(""),[o,a]=v.useState(null),{t:l}=it();v.useEffect(()=>{A.get(`/gallery-brands/${t}/${e}/photos`).then(r).catch(d=>i(d.message))},[t,e]),$t({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(Q,{to:"/galerie",className:"hover:text-brand-500",children:l("galleryProjectPage.breadcrumbGallery")})," /"," ",c.jsx(Q,{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(Xe,{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(CI,{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 EI(){const[t,e]=v.useState([]),n=Vd(),{t:r}=it();return v.useEffect(()=>{A.get("/services").then(e).catch(()=>e([]))},[]),$t({title:r("leistungen.metaTitle"),description:r("leistungen.metaDescription"),path:"/leistungen"}),n.services.enabled&&!n.bypass?c.jsx(pl,{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(ml,{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(Xe,{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(Et,{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(Q,{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(Q,{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 TI({name:t,description:e,className:n="",children:r}){const{consent:s,acceptAll:i,openSettings:o}=uo();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 EC=t=>(t||"").replace(/[^\d+]/g,""),MI=t=>`https://wa.me/${EC(t).replace(/^0/,"49").replace("+","")}`,Rc={fontFamily:"'Michroma', sans-serif"};function PI({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 AI({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 DI={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 rv({formatted:t,color:e}){const[n,r]=t.split("€");return c.jsxs("span",{style:{...Rc,color:e},children:[n,c.jsx("span",{style:{fontFamily:"'Barlow', sans-serif"},children:"€"}),r]})}function Jl({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 LI(){const[t]=AA(),{phone:e,whatsapp:n,contact_email:r,address_street:s,address_zip:i,address_city:o,business_hours:a}=es(),{t:l,language:u}=it(),{consent:d}=uo(),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=PS(a,l("footer.closed")),g=_=>new Intl.NumberFormat(u==="de"?"de-DE":"en-US",{style:"currency",currency:"EUR"}).format(_),[b,y]=v.useState({name:"",email:"",phone:"",vin:"",message:""}),[x,k]=v.useState("idle"),[w,C]=v.useState(""),[j,S]=v.useState([]),[N,M]=v.useState([]),T=t.get("packageId"),E=t.get("total")?Number(t.get("total")):null;v.useEffect(()=>{if(!T){S([]);return}A.get(`/packages/${T}/upgrades`).then(S).catch(()=>S([]))},[T]);const I=_=>{M(V=>V.includes(_)?V.filter(K=>K!==_):[...V,_])},$=j.filter(_=>N.includes(_.id)).reduce((_,V)=>_+Number(V.price),0);$t({title:l("contactPage.metaTitle"),description:l("contactPage.metaDescription"),path:"/kontakt"});const L={brand:t.get("brand")||"",model:t.get("model")||"",package:t.get("package")||""},U=!!(L.brand&&L.model&&L.package),B=_=>y(V=>({...V,[_.target.name]:_.target.value})),Z=async _=>{_.preventDefault(),k("sending"),C("");try{await A.post("/contact",{...b,brand_name:L.brand||null,model_name:L.model||null,package_name:L.package||null,product_name:t.get("product")||null,package_id:T||null,package_product_id:t.get("productId")||null,upgrade_ids:N}),k("sent"),y({name:"",email:"",phone:"",vin:"",message:""})}catch(V){C(V.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:{...Rc,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:[U&&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(l2,{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:L.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:L.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:L.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:E!=null?c.jsx(rv,{formatted:g(E),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:()=>I(_.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&&E!=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(rv,{formatted:g(E+$),color:"var(--kf-text)"})]})]}),c.jsx("h2",{className:"mb-8 text-xl",style:{...Rc,color:"var(--kf-text)"},children:l("contactPage.formTitle")}),x==="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:Z,children:[c.jsxs("div",{className:"grid grid-cols-1 gap-6 min-[641px]:grid-cols-2",children:[c.jsx(Jl,{icon:c2,label:l("contactPage.nameLabel"),name:"name",required:!0,value:b.name,onChange:B,placeholder:l("contactPage.namePlaceholder")}),c.jsx(Jl,{icon:rx,label:l("contactPage.emailLabel"),name:"email",type:"email",required:!0,value:b.email,onChange:B,placeholder:l("contactPage.emailPlaceholder")}),c.jsx(Jl,{icon:sx,label:l("contactPage.phoneLabel"),name:"phone",value:b.phone,onChange:B,placeholder:l("contactPage.phonePlaceholder")}),c.jsx(Jl,{icon:u2,label:l("contactPage.vinLabel"),name:"vin",value:b.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:b.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:x==="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(d2,{className:"h-[18px] w-[18px]"}),l(x==="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:{...Rc,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(sx,{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:${EC(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(rx,{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(h2,{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(PI,{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:MI(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(f2,{className:"h-3.5 w-3.5",style:{color:"var(--kf-accent2)"}})]}),c.jsx(TI,{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(AI,{path:DI[_.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 RI(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/impressum").then(e).catch(()=>{})},[]),$t({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 _I(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/datenschutz").then(e).catch(()=>{})},[]),$t({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 II(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/agb").then(e).catch(()=>{})},[]),$t({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 OI={host:"",name:"",user:"",password:"",charset:"utf8mb4"},BI={username:"",password:"",password_confirmation:""};function zI(){$t({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(OI),[d,h]=v.useState(BI),[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)}},b=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)}},x=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:Fa,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(Q,{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 ${Na(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:b,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:x,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(Q,{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 FI(){const{user:t,login:e,verifyTwoFactor:n}=wn(),r=al(),[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(za,{to:"/admin",replace:!0});const b=async x=>{x.preventDefault(),g(!0),p("");try{(await e(o,l)).requires2fa?i("code"):r("/admin")}catch(k){p(k.message)}finally{g(!1)}},y=async x=>{x.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:Fa,alt:"HifiPlanet",className:"h-16 w-auto dark:hidden sm:h-20"}),c.jsx("img",{src:hu,alt:"HifiPlanet",className:"hidden h-16 w-auto dark:block sm:h-20"}),s==="credentials"?c.jsxs("form",{onSubmit:b,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:x=>a(x.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:x=>u(x.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:x=>h(x.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 VI={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"},$I=({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 HI(){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(Q,{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 UI(){const{user:t,hasPermission:e}=wn(),[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(Q,{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($I,{path:VI[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(HI,{})]})}function Br({value:t,onChange:e,label:n="Bild"}){const[r,s]=v.useState(!1),[i,o]=v.useState(""),a=async l=>{var d;const u=(d=l.target.files)==null?void 0:d[0];if(u){s(!0),o("");try{const h=new FormData;h.append("file",u);const f=await A.post("/uploads",h);e(f.path)}catch(h){o(h.message)}finally{s(!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:a,className:"text-sm"}),r&&c.jsx("span",{className:"text-sm text-neutral-500",children:"Lädt hoch…"})]}),i&&c.jsx("p",{className:"mt-1 text-sm text-red-600",children:i})]})}const sv={name:"",image_path:"",sort_order:0};function WI(){const[t,e]=v.useState([]),[n,r]=v.useState(sv),[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(sv)},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(Q,{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"})]}),c.jsx(Br,{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 iv={name:"",brand_id:"",image_path:"",sort_order:0};function KI(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(iv),[o,a]=v.useState(null),[l,u]=v.useState(""),[d,h]=v.useState("all"),f=v.useMemo(()=>d==="all"?t:t.filter(x=>String(x.brand_id)===d),[t,d]),p=()=>{A.get("/models").then(e),A.get("/brands").then(r)};v.useEffect(p,[]);const m=x=>{a(x.id),i({name:x.name,brand_id:x.brand_id,image_path:x.image_path||"",sort_order:x.sort_order})},g=()=>{a(null),i(iv)},b=async x=>{x.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 x=>{confirm("Modell inkl. aller Pakete/Produkte wirklich löschen?")&&(await A.delete(`/models/${x}`),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:x=>h(x.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(x=>c.jsx("option",{value:String(x.id),children:x.name},x.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(x=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:x.image_path?c.jsx("img",{src:x.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:x.brand_name}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:x.name}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>m(x),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>y(x.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},x.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:b,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:x=>i({...s,brand_id: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",children:[c.jsx("option",{value:"",children:"Bitte wählen…"}),n.map(x=>c.jsx("option",{value:x.id,children:x.name},x.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: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.jsx(Br,{value:s.image_path,onChange:x=>i({...s,image_path:x}),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:x=>i({...s,sort_order:Number(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"})]}),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 ov={name:"",cover_image_path:"",sort_order:0};function GI(){const[t,e]=v.useState([]),[n,r]=v.useState(ov),[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(ov)},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(Q,{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(Br,{value:n.cover_image_path,onChange:p=>r({...n,cover_image_path:p}),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 av={name:"",gallery_brand_id:"",cover_image_path:"",sort_order:0};function qI(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(av),[o,a]=v.useState(null),[l,u]=v.useState(""),[d,h]=v.useState("all"),f=v.useMemo(()=>d==="all"?t:t.filter(x=>String(x.gallery_brand_id)===d),[t,d]),p=()=>{A.get("/gallery-projects").then(e),A.get("/gallery-brands").then(r)};v.useEffect(p,[]);const m=x=>{a(x.id),i({name:x.name,gallery_brand_id:x.gallery_brand_id,cover_image_path:x.cover_image_path||"",sort_order:x.sort_order})},g=()=>{a(null),i(av)},b=async x=>{x.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 x=>{confirm("Projekt inkl. aller Fotos wirklich löschen?")&&(await A.delete(`/gallery-projects/${x}`),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:x=>h(x.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(x=>c.jsx("option",{value:String(x.id),children:x.name},x.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(x=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:x.brand_name}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:x.name}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx(Q,{to:`/admin/gallery-projects/${x.id}/photos`,className:"mr-3 text-brand-600 hover:underline",children:"Fotos"}),c.jsx("button",{onClick:()=>m(x),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>y(x.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},x.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:b,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:x=>i({...s,gallery_brand_id: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",children:[c.jsx("option",{value:"",children:"Bitte wählen…"}),n.map(x=>c.jsx("option",{value:x.id,children:x.name},x.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: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.jsx(Br,{value:s.cover_image_path,onChange:x=>i({...s,cover_image_path:x}),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:x=>i({...s,sort_order:Number(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"})]}),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 JI(){const{projectId:t}=Js(),[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 b=>{const y=Array.from(b.target.files||[]);if(y.length!==0){s(""),o(!0);try{for(let x=0;x{n(x=>x.map(k=>k.id===b.id?{...k,caption:y}:k))},p=(b,y)=>{n(x=>x.map(k=>k.id===b.id?{...k,sort_order:y}:k))},m=async b=>{await A.put(`/gallery-photos/${b.id}`,{caption:b.caption,sort_order:b.sort_order}),d()},g=async b=>{confirm("Foto wirklich entfernen?")&&(await A.delete(`/gallery-photos/${b}`),d())};return c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-sm",children:c.jsx(Q,{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(b=>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:b.image_path,alt:b.caption||"",className:"aspect-square w-full object-cover"}),c.jsxs("div",{className:"space-y-2 p-3",children:[c.jsx("input",{value:b.caption||"",onChange:y=>f(b,y.target.value),onBlur:()=>m(b),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:b.sort_order,onChange:y=>p(b,Number(y.target.value)),onBlur:()=>m(b),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(b.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]},b.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 YI=["Base","Clear","Drive","Prime","Elite","Apex","The Statement","Limitless"],XI=t=>(t+1)*10,Yl="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",am=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}),ZI=t=>({description:"",markup_type:"none",markup_value:0,icon_name:"",tagline:"",price_text:"",is_featured:!1,sort_order:XI(t)}),QI=["description","markup_type","markup_value","icon_name","tagline","price_text","is_featured","sort_order"],nf=t=>{if(!t.existing)return t.checked;const e=am(t.existing);return QI.some(n=>n==="is_featured"?!!e[n]!=!!t.form[n]:String(e[n])!==String(t.form[n]))},Eo=(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=YI.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?am(l):ZI(a)}}),i=n.filter(o=>!r.has(o.id)).map(o=>({key:`legacy-${o.id}`,tierName:null,existing:o,checked:!0,form:am(o)}));return[...s,...i]},eO=t=>{t.target.style.height="auto",t.target.style.height=`${t.target.scrollHeight}px`};function tO(){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),[b,y]=v.useState(""),[x,k]=v.useState(!1),[w,C]=v.useState(null),[j,S]=v.useState("all"),[N,M]=v.useState("all"),T=async()=>{const[P,X]=await Promise.all([A.get("/packages"),A.get("/models")]);return e(P),r(X),P};v.useEffect(()=>{T()},[]);const E=v.useMemo(()=>new Map(n.map(P=>[P.id,P])),[n]),I=v.useMemo(()=>{const P=new Map;return n.forEach(X=>{P.has(X.brand_id)||P.set(X.brand_id,X.brand_name)}),Array.from(P,([X,ie])=>({id:X,name:ie})).sort((X,ie)=>X.name.localeCompare(ie.name))},[n]),$=v.useMemo(()=>n.filter(P=>!s||String(P.brand_id)===s).sort((P,X)=>P.name.localeCompare(X.name)),[n,s]),L=o?E.get(Number(o)):null,U=v.useMemo(()=>l.some(nf),[l]),B=()=>!U||confirm("Ungespeicherte Änderungen verwerfen?"),Z=(P,X,ie=t)=>{i(String(P)),a(String(X)),u(Eo(Number(X),ie)),h({}),g(null),y(""),C(null)},R=P=>{B()&&(i(P),a(""),u([]),h({}),g(null),C(null))},_=P=>{if(!B())return;if(!P){a(""),u([]);return}const X=E.get(Number(P));Z(X?X.brand_id:s,P)},V=(P,X)=>u(ie=>ie.map(at=>at.key===P?{...at,checked:X}:at)),K=(P,X)=>u(ie=>ie.map(at=>at.key===P?{...at,form:{...at.form,...X}}:at)),te=P=>({name:P.tierName??P.existing.name,car_model_id:Number(o),...P.form,markup_value:Number(P.form.markup_value),sort_order:Number(P.form.sort_order)}),Se=async()=>{p(!0),g(null);const P={},X=l;let ie=0,at=0;for(const oe of l)try{oe.existing?nf(oe)&&(await A.put(`/packages/${oe.existing.id}`,te(oe)),at+=1):oe.checked&&(await A.post("/packages",te(oe)),ie+=1)}catch(Me){P[oe.key]=Me.message}const ke=await T(),ls=Eo(Number(o),ke).map(oe=>{if(!P[oe.key])return oe;const Me=X.find(us=>us.key===oe.key);return Me?{...oe,checked:Me.checked,form:Me.form}:oe});u(ls),h(P);const cs=Object.keys(P).length,D=[];ie&&D.push(`${ie} neu angelegt`),at&&D.push(`${at} aktualisiert`),!D.length&&!cs&&D.push("Keine Änderungen"),g(cs?{kind:"error",text:`${D.join(", ")||"Nichts gespeichert"} – ${cs} Paket(e) fehlgeschlagen (Details an der Zeile).`}:{kind:"ok",text:`${D.join(", ")}.`}),p(!1)},se=async P=>{if(!confirm(`Paket "${P.tierName??P.existing.name}" inkl. aller Produkte wirklich löschen?`))return;await A.delete(`/packages/${P.existing.id}`);const X=await T();u(Eo(Number(o),X)),g(null)},he=async P=>{if(!confirm("Paket inkl. aller Produkte wirklich löschen?"))return;await A.delete(`/packages/${P.id}`);const X=await T();o&&u(Eo(Number(o),X))},Te=async()=>{if(!b||!B())return;const P=E.get(Number(b)),X=E.get(Number(o));if(confirm(`Alle Pakete von "${P.brand_name} ${P.name}" inkl. verknüpfter Produkte nach "${X.brand_name} ${X.name}" kopieren? Bereits vorhandene Paketstufen werden übersprungen. Upgrades werden nicht mitkopiert.`)){k(!0),C(null);try{const ie=await A.post(`/models/${o}/copy-packages`,{source_model_id:Number(b)}),at=ie.copied.reduce((cs,D)=>cs+D.products,0),ke=[`${ie.copied.length} Paket(e) kopiert (${at} Produkte)`];ie.skipped.length&&ke.push(`übersprungen: ${ie.skipped.join(", ")}`),C({text:`${ke.join(" – ")}.`});const ls=await T();u(Eo(Number(o),ls)),h({})}catch(ie){C({error:ie.message})}k(!1)}},ot=l.filter(P=>!P.existing&&P.checked).length,ah=l.filter(P=>P.existing&&nf(P)).length,Zs=v.useMemo(()=>n.filter(P=>j==="all"||String(P.brand_id)===j).sort((P,X)=>P.name.localeCompare(X.name)),[n,j]),Qs=v.useMemo(()=>t.filter(P=>{const X=E.get(P.car_model_id);return!(j!=="all"&&String(X==null?void 0:X.brand_id)!==j||N!=="all"&&String(P.car_model_id)!==N)}),[t,E,j,N]),go=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:P=>{S(P.target.value),M("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(P=>c.jsx("option",{value:String(P.id),children:P.name},P.id))]}),c.jsxs("select",{value:N,onChange:P=>M(P.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"}),Zs.map(P=>c.jsxs("option",{value:String(P.id),children:[P.brand_name," ",P.name]},P.id))]}),(j!=="all"||N!=="all")&&c.jsx("button",{onClick:()=>{S("all"),M("all")},className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),c.jsxs("span",{className:"text-sm text-neutral-400",children:[Qs.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:[Qs.map(P=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsxs("td",{className:"px-4 py-2",children:[P.brand_name," ",P.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:[P.name,P.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:[P.markup_type==="fixed"&&`+${P.markup_value} €`,P.markup_type==="percent"&&`+${P.markup_value} %`,(!P.markup_type||P.markup_type==="none")&&"–"]}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx(Q,{to:`/admin/packages/${P.id}/products`,className:"mr-3 text-brand-600 hover:underline",children:"Produkte"}),c.jsx(Q,{to:`/admin/packages/${P.id}/upgrades`,className:"mr-3 text-brand-600 hover:underline",children:"Upgrades"}),c.jsx("button",{onClick:()=>{if(!B())return;const X=E.get(P.car_model_id);Z(X.brand_id,P.car_model_id),window.scrollTo({top:0,behavior:"smooth"})},className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>he(P),className:"text-red-600 hover:underline",children:"Löschen"})]})]},P.id)),Qs.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:P=>R(P.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(P=>c.jsx("option",{value:String(P.id),children:P.name},P.id))]}),c.jsxs("select",{value:o,onChange:P=>_(P.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…"}),$.map(P=>c.jsxs("option",{value:String(P.id),children:[P.brand_name," ",P.name]},P.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."})]}),L&&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 ",L.brand_name," ",L.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:b,onChange:P=>y(P.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(P=>String(P.id)!==o).sort((P,X)=>`${P.brand_name} ${P.name}`.localeCompare(`${X.brand_name} ${X.name}`)).map(P=>c.jsxs("option",{value:String(P.id),children:[P.brand_name," ",P.name]},P.id))]}),c.jsx("button",{type:"button",onClick:Te,disabled:!b||x,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:x?"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((P,X)=>c.jsxs("div",{children:[P.tierName===null&&X>0&&l[X-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 ${P.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:P.checked,disabled:!!P.existing||f,onChange:ie=>V(P.key,ie.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:P.tierName??P.existing.name})]}),P.tierName===null&&c.jsx("span",{className:"text-xs text-neutral-400",children:"(alter Name)"}),P.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"}):P.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"}),P.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"}),P.existing&&c.jsxs("span",{className:"ml-auto flex items-center gap-3 text-sm",children:[c.jsx(Q,{to:`/admin/packages/${P.existing.id}/products`,className:"text-brand-600 hover:underline",children:"Produkte"}),c.jsx(Q,{to:`/admin/packages/${P.existing.id}/upgrades`,className:"text-brand-600 hover:underline",children:"Upgrades"}),c.jsx("button",{type:"button",onClick:()=>se(P),className:"text-red-600 hover:underline",children:"Löschen"})]})]}),P.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."}),c.jsx("textarea",{rows:10,value:P.form.description,onChange:ie=>K(P.key,{description:ie.target.value}),onInput:eO,className:Yl})]}),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:P.form.markup_type,onChange:ie=>K(P.key,{markup_type:ie.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:P.form.markup_type==="none",value:P.form.markup_value,onChange:ie=>K(P.key,{markup_value:ie.target.value}),className:`${Yl} 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:P.form.price_text,onChange:ie=>K(P.key,{price_text:ie.target.value}),placeholder:'z. B. "Coming soon" oder "Preis auf Anfrage"',className:Yl}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"Ersetzt auf der Kachel den berechneten Preis, solange ausgefüllt."})]}),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:P.form.is_featured,onChange:ie=>K(P.key,{is_featured:ie.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:P.form.sort_order,onChange:ie=>K(P.key,{sort_order:ie.target.value}),className:`${Yl} max-w-[160px]`})]})]})]}),d[P.key]&&c.jsx("p",{className:"text-sm text-red-600",children:d[P.key]})]})]})]},P.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:Se,disabled:f||!U,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:[ot," neu, ",ah," 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})]})]}),L?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:go})]}):go]})}const Xl=[...p2].sort(),nO=120,rO=200;function sO({value:t,onChange:e}){const[n,r]=v.useState(""),s=v.useMemo(()=>{const i=n.trim().toLowerCase();return i?Xl.filter(o=>o.includes(i)).slice(0,rO):Xl.slice(0,nO)},[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(Et,{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:[Xl.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(Et,{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 ",Xl.length," Icons zu durchsuchen."]})]})}const lv={icon_name:"",title:"",description:"",image_path:"",cta_label:"",cta_url:"",sort_order:0};function iO(){const[t,e]=v.useState([]),[n,r]=v.useState(lv),[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(lv)},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(Et,{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(sO,{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(Br,{value:n.image_path,onChange:p=>r({...n,image_path:p}),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 cv={question_de:"",answer_de:"",question_en:"",answer_en:"",sort_order:0};function oO(){const[t,e]=v.useState([]),[n,r]=v.useState(cv),[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(cv)},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"})]})]})]})}var TC={exports:{}},MC={};/** diff --git a/hifi/index.html b/hifi/index.html index 4ff79a5..c75c6e1 100644 --- a/hifi/index.html +++ b/hifi/index.html @@ -43,7 +43,7 @@ "sameAs": ["https://www.youtube.com/@hifiplanet2812"] } - +