diff --git a/backend/apps/events/__pycache__/serializers.cpython-314.pyc b/backend/apps/events/__pycache__/serializers.cpython-314.pyc index eb47889..e0f1e17 100644 Binary files a/backend/apps/events/__pycache__/serializers.cpython-314.pyc and b/backend/apps/events/__pycache__/serializers.cpython-314.pyc differ diff --git a/backend/apps/events/serializers.py b/backend/apps/events/serializers.py index 9245194..5311066 100644 --- a/backend/apps/events/serializers.py +++ b/backend/apps/events/serializers.py @@ -13,23 +13,47 @@ class SkillSerializer(serializers.ModelSerializer): class ShiftSignupSerializer(serializers.ModelSerializer): display_name = serializers.SerializerMethodField() is_guest = serializers.SerializerMethodField() + is_self = serializers.SerializerMethodField() class Meta: model = ShiftSignup - fields = ['id', 'display_name', 'is_guest', 'created_at'] + fields = ['id', 'display_name', 'is_guest', 'is_self', 'created_at'] def get_is_guest(self, obj): return obj.user is None + def _is_own_signup(self, obj, request): + if not request: + return False + if request.user and request.user.is_authenticated: + return obj.user_id == request.user.id + + # Check session key for guest user + session_key = getattr(request.session, 'session_key', None) + if session_key and obj.guest_session_key and obj.guest_session_key == session_key: + return True + + return False + + def get_is_self(self, obj): + request = self.context.get('request') + return self._is_own_signup(obj, request) + def get_display_name(self, obj): request = self.context.get('request') - # PRIVACY RULE: Guests (unauthenticated users) MUST NOT see who signed up where - if request and not request.user.is_authenticated: - return "Belegt (Anonym)" - if obj.user: - return obj.user.get_display_name() - return obj.guest_name or "Gast" + # Authenticated users see real names of all participants + if request and request.user and request.user.is_authenticated: + if obj.user: + return obj.user.get_display_name() + return obj.guest_name or "Gast" + + # Guest users see their own real name for their own signups + if request and self._is_own_signup(obj, request): + return obj.guest_name or "Gast" + + # Other participants are anonymized for privacy + return "Belegt (Anonym)" class ShiftSerializer(serializers.ModelSerializer): required_skills = SkillSerializer(many=True, read_only=True) diff --git a/backend/shiftplan_backend/__pycache__/urls.cpython-314.pyc b/backend/shiftplan_backend/__pycache__/urls.cpython-314.pyc index 3b25fed..d63c9b8 100644 Binary files a/backend/shiftplan_backend/__pycache__/urls.cpython-314.pyc and b/backend/shiftplan_backend/__pycache__/urls.cpython-314.pyc differ diff --git a/backend/shiftplan_backend/urls.py b/backend/shiftplan_backend/urls.py index b319431..a8f9922 100644 --- a/backend/shiftplan_backend/urls.py +++ b/backend/shiftplan_backend/urls.py @@ -1,8 +1,11 @@ from django.contrib import admin from django.urls import path, include +from apps.events.views import AltchaChallengeView urlpatterns = [ path('admin/', admin.site.urls), + path('api/altcha-challenge/', AltchaChallengeView.as_view(), name='altcha-challenge-top'), + path('api/events/altcha-challenge/', AltchaChallengeView.as_view(), name='altcha-challenge-alias'), path('api/users/', include('apps.users.urls')), path('api/', include('apps.events.urls')), path('api/branding/', include('apps.branding.urls')), diff --git a/frontend/dist/assets/index-BzMPGQ3H.js b/frontend/dist/assets/index-5XQR3AzF.js similarity index 84% rename from frontend/dist/assets/index-BzMPGQ3H.js rename to frontend/dist/assets/index-5XQR3AzF.js index e58fba9..3f98999 100644 --- a/frontend/dist/assets/index-BzMPGQ3H.js +++ b/frontend/dist/assets/index-5XQR3AzF.js @@ -22,7 +22,7 @@ var k0=Object.defineProperty;var Bf=e=>{throw TypeError(e)};var _0=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(M,U){var x=M.length;M.push(U);e:for(;0>>1,I=M[$];if(0>>1;$s(ee,x))Aes(gt,ee)?(M[$]=gt,M[Ae]=x,$=Ae):(M[$]=ee,M[W]=x,$=W);else if(Aes(gt,x))M[$]=gt,M[Ae]=x,$=Ae;else break e}}return U}function s(M,U){var x=M.sortIndex-U.sortIndex;return x!==0?x:M.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],f=1,g=null,d=3,w=!1,y=!1,N=!1,R=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(M){for(var U=n(c);U!==null;){if(U.callback===null)r(c);else if(U.startTime<=M)r(c),U.sortIndex=U.expirationTime,t(u,U);else break;U=n(c)}}function _(M){if(N=!1,m(M),!y)if(n(u)!==null)y=!0,Te(C);else{var U=n(c);U!==null&&V(_,U.startTime-M)}}function C(M,U){y=!1,N&&(N=!1,v(P),P=-1),w=!0;var x=d;try{for(m(U),g=n(u);g!==null&&(!(g.expirationTime>U)||M&&!Y());){var $=g.callback;if(typeof $=="function"){g.callback=null,d=g.priorityLevel;var I=$(g.expirationTime<=U);U=e.unstable_now(),typeof I=="function"?g.callback=I:g===n(u)&&r(u),m(U)}else r(u);g=n(u)}if(g!==null)var K=!0;else{var W=n(c);W!==null&&V(_,W.startTime-U),K=!1}return K}finally{g=null,d=x,w=!1}}var E=!1,j=null,P=-1,G=5,L=-1;function Y(){return!(e.unstable_now()-LM||125$?(M.sortIndex=x,t(c,M),n(u)===null&&M===n(c)&&(N?(v(P),P=-1):N=!0,V(_,x-$))):(M.sortIndex=I,t(u,M),y||w||(y=!0,Te(C))),M},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(M){var U=d;return function(){var x=d;d=U;try{return M.apply(this,arguments)}finally{d=x}}}})(Up);Op.exports=Up;var W0=Op.exports;/** + */(function(e){function t(M,U){var x=M.length;M.push(U);e:for(;0>>1,I=M[$];if(0>>1;$s(ee,x))Aes(gt,ee)?(M[$]=gt,M[Ae]=x,$=Ae):(M[$]=ee,M[W]=x,$=W);else if(Aes(gt,x))M[$]=gt,M[Ae]=x,$=Ae;else break e}}return U}function s(M,U){var x=M.sortIndex-U.sortIndex;return x!==0?x:M.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],f=1,g=null,d=3,w=!1,y=!1,N=!1,R=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(M){for(var U=n(c);U!==null;){if(U.callback===null)r(c);else if(U.startTime<=M)r(c),U.sortIndex=U.expirationTime,t(u,U);else break;U=n(c)}}function _(M){if(N=!1,m(M),!y)if(n(u)!==null)y=!0,Te(C);else{var U=n(c);U!==null&&V(_,U.startTime-M)}}function C(M,U){y=!1,N&&(N=!1,v(L),L=-1),w=!0;var x=d;try{for(m(U),g=n(u);g!==null&&(!(g.expirationTime>U)||M&&!Y());){var $=g.callback;if(typeof $=="function"){g.callback=null,d=g.priorityLevel;var I=$(g.expirationTime<=U);U=e.unstable_now(),typeof I=="function"?g.callback=I:g===n(u)&&r(u),m(U)}else r(u);g=n(u)}if(g!==null)var K=!0;else{var W=n(c);W!==null&&V(_,W.startTime-U),K=!1}return K}finally{g=null,d=x,w=!1}}var E=!1,j=null,L=-1,G=5,P=-1;function Y(){return!(e.unstable_now()-PM||125$?(M.sortIndex=x,t(c,M),n(u)===null&&M===n(c)&&(N?(v(L),L=-1):N=!0,V(_,x-$))):(M.sortIndex=I,t(u,M),y||w||(y=!0,Te(C))),M},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(M){var U=d;return function(){var x=d;d=U;try{return M.apply(this,arguments)}finally{d=x}}}})(Up);Op.exports=Up;var W0=Op.exports;/** * @license React * react-dom.production.min.js * @@ -34,8 +34,8 @@ var k0=Object.defineProperty;var Bf=e=>{throw TypeError(e)};var _0=(e,t,n)=>t in `+Eu+e}var Cu=!1;function Tu(e,t){if(!e||Cu)return"";Cu=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var s=c.stack.split(` `),l=r.stack.split(` `),a=s.length-1,o=l.length-1;1<=a&&0<=o&&s[a]!==l[o];)o--;for(;1<=a&&0<=o;a--,o--)if(s[a]!==l[o]){if(a!==1||o!==1)do if(a--,o--,0>o||s[a]!==l[o]){var u=` -`+s[a].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{Cu=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ri(e):""}function J0(e){switch(e.tag){case 5:return ri(e.type);case 16:return ri("Lazy");case 13:return ri("Suspense");case 19:return ri("SuspenseList");case 0:case 2:case 15:return e=Tu(e.type,!1),e;case 11:return e=Tu(e.type.render,!1),e;case 1:return e=Tu(e.type,!0),e;default:return""}}function dc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ws:return"Fragment";case Ks:return"Portal";case oc:return"Profiler";case Td:return"StrictMode";case uc:return"Suspense";case cc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bp:return(e.displayName||"Context")+".Consumer";case Vp:return(e._context.displayName||"Context")+".Provider";case Ad:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pd:return t=e.displayName||null,t!==null?t:dc(e.type)||"Memo";case Tr:t=e._payload,e=e._init;try{return dc(e(t))}catch{}}return null}function X0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dc(t);case 8:return t===Td?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Qr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ex(e){var t=Kp(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ca(e){e._valueTracker||(e._valueTracker=ex(e))}function Wp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Kp(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ho(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function fc(e,t){var n=t.checked;return Ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Yf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Qr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Gp(e,t){t=t.checked,t!=null&&Cd(e,"checked",t,!1)}function hc(e,t){Gp(e,t);var n=Qr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pc(e,t.type,n):t.hasOwnProperty("defaultValue")&&pc(e,t.type,Qr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Zf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function pc(e,t,n){(t!=="number"||ho(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var si=Array.isArray;function sl(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Ta.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ji(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ci={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tx=["Webkit","ms","Moz","O"];Object.keys(ci).forEach(function(e){tx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ci[t]=ci[e]})});function Zp(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ci.hasOwnProperty(e)&&ci[e]?(""+t).trim():t+"px"}function Jp(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Zp(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nx=Ke({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vc(e,t){if(t){if(nx[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(D(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(D(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(D(61))}if(t.style!=null&&typeof t.style!="object")throw Error(D(62))}}function xc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yc=null;function Ld(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wc=null,ll=null,il=null;function eh(e){if(e=ta(e)){if(typeof wc!="function")throw Error(D(280));var t=e.stateNode;t&&(t=Zo(t),wc(e.stateNode,e.type,t))}}function Xp(e){ll?il?il.push(e):il=[e]:ll=e}function em(){if(ll){var e=ll,t=il;if(il=ll=null,eh(e),t)for(e=0;e>>=0,e===0?32:31-(hx(e)/px|0)|0}var Aa=64,Pa=4194304;function li(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function vo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,l=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~s;o!==0?r=li(o):(l&=a,l!==0&&(r=li(l)))}else a=n&~s,a!==0?r=li(a):l!==0&&(r=li(l));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,l=t&-t,s>=l||s===16&&(l&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Xi(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-An(t),e[t]=n}function xx(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=fi),uh=" ",ch=!1;function wm(e,t){switch(e){case"keyup":return Wx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gs=!1;function qx(e,t){switch(e){case"compositionend":return bm(t);case"keypress":return t.which!==32?null:(ch=!0,uh);case"textInput":return e=t.data,e===uh&&ch?null:e;default:return null}}function Qx(e,t){if(Gs)return e==="compositionend"||!Ud&&wm(e,t)?(e=xm(),Qa=zd=Dr=null,Gs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ph(n)}}function Nm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jm(){for(var e=window,t=ho();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ho(e.document)}return t}function Fd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function s1(e){var t=jm(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Nm(n.ownerDocument.documentElement,n)){if(r!==null&&Fd(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!e.extend&&l>r&&(s=r,r=l,l=s),s=mh(n,l);var a=mh(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,qs=null,jc=null,pi=null,Ec=!1;function gh(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ec||qs==null||qs!==ho(r)||(r=qs,"selectionStart"in r&&Fd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),pi&&Li(pi,r)||(pi=r,r=wo(jc,"onSelect"),0Zs||(e.current=Mc[Zs],Mc[Zs]=null,Zs--)}function Le(e,t){Zs++,Mc[Zs]=e.current,e.current=t}var Yr={},kt=ts(Yr),zt=ts(!1),Ns=Yr;function kl(e,t){var n=e.type.contextTypes;if(!n)return Yr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function It(e){return e=e.childContextTypes,e!=null}function ko(){De(zt),De(kt)}function _h(e,t,n){if(kt.current!==Yr)throw Error(D(168));Le(kt,t),Le(zt,n)}function $m(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(D(108,X0(e)||"Unknown",s));return Ke({},n,r)}function _o(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yr,Ns=kt.current,Le(kt,e),Le(zt,zt.current),!0}function Sh(e,t,n){var r=e.stateNode;if(!r)throw Error(D(169));n?(e=$m(e,t,Ns),r.__reactInternalMemoizedMergedChildContext=e,De(zt),De(kt),Le(kt,e)):De(zt),Le(zt,n)}var lr=null,Jo=!1,Bu=!1;function Dm(e){lr===null?lr=[e]:lr.push(e)}function g1(e){Jo=!0,Dm(e)}function ns(){if(!Bu&&lr!==null){Bu=!0;var e=0,t=je;try{var n=lr;for(je=1;e>=a,s-=a,dr=1<<32-An(t)+s|n<P?(G=j,j=null):G=j.sibling;var L=d(v,j,m[P],_);if(L===null){j===null&&(j=G);break}e&&j&&L.alternate===null&&t(v,j),h=l(L,h,P),E===null?C=L:E.sibling=L,E=L,j=G}if(P===m.length)return n(v,j),Ue&&is(v,P),C;if(j===null){for(;PP?(G=j,j=null):G=j.sibling;var Y=d(v,j,L.value,_);if(Y===null){j===null&&(j=G);break}e&&j&&Y.alternate===null&&t(v,j),h=l(Y,h,P),E===null?C=Y:E.sibling=Y,E=Y,j=G}if(L.done)return n(v,j),Ue&&is(v,P),C;if(j===null){for(;!L.done;P++,L=m.next())L=g(v,L.value,_),L!==null&&(h=l(L,h,P),E===null?C=L:E.sibling=L,E=L);return Ue&&is(v,P),C}for(j=r(v,j);!L.done;P++,L=m.next())L=w(j,v,P,L.value,_),L!==null&&(e&&L.alternate!==null&&j.delete(L.key===null?P:L.key),h=l(L,h,P),E===null?C=L:E.sibling=L,E=L);return e&&j.forEach(function(ae){return t(v,ae)}),Ue&&is(v,P),C}function R(v,h,m,_){if(typeof m=="object"&&m!==null&&m.type===Ws&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Ea:e:{for(var C=m.key,E=h;E!==null;){if(E.key===C){if(C=m.type,C===Ws){if(E.tag===7){n(v,E.sibling),h=s(E,m.props.children),h.return=v,v=h;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Tr&&Eh(C)===E.type){n(v,E.sibling),h=s(E,m.props),h.ref=Jl(v,E,m),h.return=v,v=h;break e}n(v,E);break}else t(v,E);E=E.sibling}m.type===Ws?(h=bs(m.props.children,v.mode,_,m.key),h.return=v,v=h):(_=ro(m.type,m.key,m.props,null,v.mode,_),_.ref=Jl(v,h,m),_.return=v,v=_)}return a(v);case Ks:e:{for(E=m.key;h!==null;){if(h.key===E)if(h.tag===4&&h.stateNode.containerInfo===m.containerInfo&&h.stateNode.implementation===m.implementation){n(v,h.sibling),h=s(h,m.children||[]),h.return=v,v=h;break e}else{n(v,h);break}else t(v,h);h=h.sibling}h=Zu(m,v.mode,_),h.return=v,v=h}return a(v);case Tr:return E=m._init,R(v,h,E(m._payload),_)}if(si(m))return y(v,h,m,_);if(Gl(m))return N(v,h,m,_);Ia(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,h!==null&&h.tag===6?(n(v,h.sibling),h=s(h,m),h.return=v,v=h):(n(v,h),h=Yu(m,v.mode,_),h.return=v,v=h),a(v)):n(v,h)}return R}var Sl=Um(!0),Fm=Um(!1),jo=ts(null),Eo=null,el=null,Kd=null;function Wd(){Kd=el=Eo=null}function Gd(e){var t=jo.current;De(jo),e._currentValue=t}function Dc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ol(e,t){Eo=e,Kd=el=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Dt=!0),e.firstContext=null)}function gn(e){var t=e._currentValue;if(Kd!==e)if(e={context:e,memoizedValue:t,next:null},el===null){if(Eo===null)throw Error(D(308));el=e,Eo.dependencies={lanes:0,firstContext:e}}else el=el.next=e;return t}var us=null;function qd(e){us===null?us=[e]:us.push(e)}function Vm(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,qd(t)):(n.next=s.next,s.next=n),t.interleaved=n,xr(e,r)}function xr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ar=!1;function Qd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Br(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,we&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,xr(e,n)}return s=r.interleaved,s===null?(t.next=t,qd(r)):(t.next=s.next,s.next=t),r.interleaved=t,xr(e,n)}function Za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rd(e,n)}}function Ch(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?s=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?s=l=t:l=l.next=t}else s=l=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:l,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Co(e,t,n,r){var s=e.updateQueue;Ar=!1;var l=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?l=c:a.next=c,a=u;var f=e.alternate;f!==null&&(f=f.updateQueue,o=f.lastBaseUpdate,o!==a&&(o===null?f.firstBaseUpdate=c:o.next=c,f.lastBaseUpdate=u))}if(l!==null){var g=s.baseState;a=0,f=c=u=null,o=l;do{var d=o.lane,w=o.eventTime;if((r&d)===d){f!==null&&(f=f.next={eventTime:w,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var y=e,N=o;switch(d=t,w=n,N.tag){case 1:if(y=N.payload,typeof y=="function"){g=y.call(w,g,d);break e}g=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=N.payload,d=typeof y=="function"?y.call(w,g,d):y,d==null)break e;g=Ke({},g,d);break e;case 2:Ar=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,d=s.effects,d===null?s.effects=[o]:d.push(o))}else w={eventTime:w,lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(c=f=w,u=g):f=f.next=w,a|=d;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;d=o,o=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(f===null&&(u=g),s.baseState=u,s.firstBaseUpdate=c,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else l===null&&(s.shared.lanes=0);Cs|=a,e.lanes=a,e.memoizedState=g}}function Th(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ku.transition;Ku.transition={};try{e(!1),t()}finally{je=n,Ku.transition=r}}function ig(){return vn().memoizedState}function w1(e,t,n){var r=Kr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ag(e))og(t,n);else if(n=Vm(e,t,n,r),n!==null){var s=Et();Pn(n,e,r,s),ug(n,t,r)}}function b1(e,t,n){var r=Kr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ag(e))og(t,s);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var a=t.lastRenderedState,o=l(a,n);if(s.hasEagerState=!0,s.eagerState=o,Rn(o,a)){var u=t.interleaved;u===null?(s.next=s,qd(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=Vm(e,t,s,r),n!==null&&(s=Et(),Pn(n,e,r,s),ug(n,t,r))}}function ag(e){var t=e.alternate;return e===He||t!==null&&t===He}function og(e,t){mi=Ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ug(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rd(e,n)}}var Po={readContext:gn,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useInsertionEffect:xt,useLayoutEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useMutableSource:xt,useSyncExternalStore:xt,useId:xt,unstable_isNewReconciler:!1},k1={readContext:gn,useCallback:function(e,t){return Vn().memoizedState=[e,t===void 0?null:t],e},useContext:gn,useEffect:Ph,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Xa(4194308,4,tg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xa(4,2,e,t)},useMemo:function(e,t){var n=Vn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=w1.bind(null,He,e),[r.memoizedState,e]},useRef:function(e){var t=Vn();return e={current:e},t.memoizedState=e},useState:Ah,useDebugValue:rf,useDeferredValue:function(e){return Vn().memoizedState=e},useTransition:function(){var e=Ah(!1),t=e[0];return e=y1.bind(null,e[1]),Vn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=He,s=Vn();if(Ue){if(n===void 0)throw Error(D(407));n=n()}else{if(n=t(),ot===null)throw Error(D(349));Es&30||Gm(r,t,n)}s.memoizedState=n;var l={value:n,getSnapshot:t};return s.queue=l,Ph(Qm.bind(null,r,l,e),[e]),r.flags|=2048,Ui(9,qm.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Vn(),t=ot.identifierPrefix;if(Ue){var n=fr,r=dr;n=(r&~(1<<32-An(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ii++,0")&&(u=u.replace("",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{Cu=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ri(e):""}function J0(e){switch(e.tag){case 5:return ri(e.type);case 16:return ri("Lazy");case 13:return ri("Suspense");case 19:return ri("SuspenseList");case 0:case 2:case 15:return e=Tu(e.type,!1),e;case 11:return e=Tu(e.type.render,!1),e;case 1:return e=Tu(e.type,!0),e;default:return""}}function dc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ws:return"Fragment";case Ks:return"Portal";case oc:return"Profiler";case Td:return"StrictMode";case uc:return"Suspense";case cc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bp:return(e.displayName||"Context")+".Consumer";case Vp:return(e._context.displayName||"Context")+".Provider";case Ad:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pd:return t=e.displayName||null,t!==null?t:dc(e.type)||"Memo";case Tr:t=e._payload,e=e._init;try{return dc(e(t))}catch{}}return null}function X0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dc(t);case 8:return t===Td?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Qr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ex(e){var t=Kp(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ca(e){e._valueTracker||(e._valueTracker=ex(e))}function Wp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Kp(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ho(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function fc(e,t){var n=t.checked;return Ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Yf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Qr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Gp(e,t){t=t.checked,t!=null&&Cd(e,"checked",t,!1)}function hc(e,t){Gp(e,t);var n=Qr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pc(e,t.type,n):t.hasOwnProperty("defaultValue")&&pc(e,t.type,Qr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Zf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function pc(e,t,n){(t!=="number"||ho(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var si=Array.isArray;function sl(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Ta.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ji(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ci={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tx=["Webkit","ms","Moz","O"];Object.keys(ci).forEach(function(e){tx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ci[t]=ci[e]})});function Zp(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ci.hasOwnProperty(e)&&ci[e]?(""+t).trim():t+"px"}function Jp(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Zp(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nx=Ke({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vc(e,t){if(t){if(nx[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(D(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(D(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(D(61))}if(t.style!=null&&typeof t.style!="object")throw Error(D(62))}}function xc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yc=null;function Ld(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wc=null,ll=null,il=null;function eh(e){if(e=ta(e)){if(typeof wc!="function")throw Error(D(280));var t=e.stateNode;t&&(t=Zo(t),wc(e.stateNode,e.type,t))}}function Xp(e){ll?il?il.push(e):il=[e]:ll=e}function em(){if(ll){var e=ll,t=il;if(il=ll=null,eh(e),t)for(e=0;e>>=0,e===0?32:31-(hx(e)/px|0)|0}var Aa=64,Pa=4194304;function li(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function vo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,l=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~s;o!==0?r=li(o):(l&=a,l!==0&&(r=li(l)))}else a=n&~s,a!==0?r=li(a):l!==0&&(r=li(l));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,l=t&-t,s>=l||s===16&&(l&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Xi(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-An(t),e[t]=n}function xx(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=fi),uh=" ",ch=!1;function wm(e,t){switch(e){case"keyup":return Wx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gs=!1;function qx(e,t){switch(e){case"compositionend":return bm(t);case"keypress":return t.which!==32?null:(ch=!0,uh);case"textInput":return e=t.data,e===uh&&ch?null:e;default:return null}}function Qx(e,t){if(Gs)return e==="compositionend"||!Ud&&wm(e,t)?(e=xm(),Qa=zd=Dr=null,Gs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ph(n)}}function Nm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jm(){for(var e=window,t=ho();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ho(e.document)}return t}function Fd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function s1(e){var t=jm(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Nm(n.ownerDocument.documentElement,n)){if(r!==null&&Fd(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!e.extend&&l>r&&(s=r,r=l,l=s),s=mh(n,l);var a=mh(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,qs=null,jc=null,pi=null,Ec=!1;function gh(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ec||qs==null||qs!==ho(r)||(r=qs,"selectionStart"in r&&Fd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),pi&&Li(pi,r)||(pi=r,r=wo(jc,"onSelect"),0Zs||(e.current=Mc[Zs],Mc[Zs]=null,Zs--)}function Le(e,t){Zs++,Mc[Zs]=e.current,e.current=t}var Yr={},kt=ts(Yr),zt=ts(!1),Ns=Yr;function kl(e,t){var n=e.type.contextTypes;if(!n)return Yr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function It(e){return e=e.childContextTypes,e!=null}function ko(){De(zt),De(kt)}function _h(e,t,n){if(kt.current!==Yr)throw Error(D(168));Le(kt,t),Le(zt,n)}function $m(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(D(108,X0(e)||"Unknown",s));return Ke({},n,r)}function _o(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yr,Ns=kt.current,Le(kt,e),Le(zt,zt.current),!0}function Sh(e,t,n){var r=e.stateNode;if(!r)throw Error(D(169));n?(e=$m(e,t,Ns),r.__reactInternalMemoizedMergedChildContext=e,De(zt),De(kt),Le(kt,e)):De(zt),Le(zt,n)}var lr=null,Jo=!1,Bu=!1;function Dm(e){lr===null?lr=[e]:lr.push(e)}function g1(e){Jo=!0,Dm(e)}function ns(){if(!Bu&&lr!==null){Bu=!0;var e=0,t=je;try{var n=lr;for(je=1;e>=a,s-=a,dr=1<<32-An(t)+s|n<L?(G=j,j=null):G=j.sibling;var P=d(v,j,m[L],_);if(P===null){j===null&&(j=G);break}e&&j&&P.alternate===null&&t(v,j),h=l(P,h,L),E===null?C=P:E.sibling=P,E=P,j=G}if(L===m.length)return n(v,j),Ue&&is(v,L),C;if(j===null){for(;LL?(G=j,j=null):G=j.sibling;var Y=d(v,j,P.value,_);if(Y===null){j===null&&(j=G);break}e&&j&&Y.alternate===null&&t(v,j),h=l(Y,h,L),E===null?C=Y:E.sibling=Y,E=Y,j=G}if(P.done)return n(v,j),Ue&&is(v,L),C;if(j===null){for(;!P.done;L++,P=m.next())P=g(v,P.value,_),P!==null&&(h=l(P,h,L),E===null?C=P:E.sibling=P,E=P);return Ue&&is(v,L),C}for(j=r(v,j);!P.done;L++,P=m.next())P=w(j,v,L,P.value,_),P!==null&&(e&&P.alternate!==null&&j.delete(P.key===null?L:P.key),h=l(P,h,L),E===null?C=P:E.sibling=P,E=P);return e&&j.forEach(function(ae){return t(v,ae)}),Ue&&is(v,L),C}function R(v,h,m,_){if(typeof m=="object"&&m!==null&&m.type===Ws&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Ea:e:{for(var C=m.key,E=h;E!==null;){if(E.key===C){if(C=m.type,C===Ws){if(E.tag===7){n(v,E.sibling),h=s(E,m.props.children),h.return=v,v=h;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Tr&&Eh(C)===E.type){n(v,E.sibling),h=s(E,m.props),h.ref=Jl(v,E,m),h.return=v,v=h;break e}n(v,E);break}else t(v,E);E=E.sibling}m.type===Ws?(h=bs(m.props.children,v.mode,_,m.key),h.return=v,v=h):(_=ro(m.type,m.key,m.props,null,v.mode,_),_.ref=Jl(v,h,m),_.return=v,v=_)}return a(v);case Ks:e:{for(E=m.key;h!==null;){if(h.key===E)if(h.tag===4&&h.stateNode.containerInfo===m.containerInfo&&h.stateNode.implementation===m.implementation){n(v,h.sibling),h=s(h,m.children||[]),h.return=v,v=h;break e}else{n(v,h);break}else t(v,h);h=h.sibling}h=Zu(m,v.mode,_),h.return=v,v=h}return a(v);case Tr:return E=m._init,R(v,h,E(m._payload),_)}if(si(m))return y(v,h,m,_);if(Gl(m))return N(v,h,m,_);Ia(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,h!==null&&h.tag===6?(n(v,h.sibling),h=s(h,m),h.return=v,v=h):(n(v,h),h=Yu(m,v.mode,_),h.return=v,v=h),a(v)):n(v,h)}return R}var Sl=Um(!0),Fm=Um(!1),jo=ts(null),Eo=null,el=null,Kd=null;function Wd(){Kd=el=Eo=null}function Gd(e){var t=jo.current;De(jo),e._currentValue=t}function Dc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ol(e,t){Eo=e,Kd=el=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Dt=!0),e.firstContext=null)}function gn(e){var t=e._currentValue;if(Kd!==e)if(e={context:e,memoizedValue:t,next:null},el===null){if(Eo===null)throw Error(D(308));el=e,Eo.dependencies={lanes:0,firstContext:e}}else el=el.next=e;return t}var us=null;function qd(e){us===null?us=[e]:us.push(e)}function Vm(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,qd(t)):(n.next=s.next,s.next=n),t.interleaved=n,xr(e,r)}function xr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ar=!1;function Qd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Br(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,we&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,xr(e,n)}return s=r.interleaved,s===null?(t.next=t,qd(r)):(t.next=s.next,s.next=t),r.interleaved=t,xr(e,n)}function Za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rd(e,n)}}function Ch(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?s=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?s=l=t:l=l.next=t}else s=l=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:l,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Co(e,t,n,r){var s=e.updateQueue;Ar=!1;var l=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?l=c:a.next=c,a=u;var f=e.alternate;f!==null&&(f=f.updateQueue,o=f.lastBaseUpdate,o!==a&&(o===null?f.firstBaseUpdate=c:o.next=c,f.lastBaseUpdate=u))}if(l!==null){var g=s.baseState;a=0,f=c=u=null,o=l;do{var d=o.lane,w=o.eventTime;if((r&d)===d){f!==null&&(f=f.next={eventTime:w,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var y=e,N=o;switch(d=t,w=n,N.tag){case 1:if(y=N.payload,typeof y=="function"){g=y.call(w,g,d);break e}g=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=N.payload,d=typeof y=="function"?y.call(w,g,d):y,d==null)break e;g=Ke({},g,d);break e;case 2:Ar=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,d=s.effects,d===null?s.effects=[o]:d.push(o))}else w={eventTime:w,lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(c=f=w,u=g):f=f.next=w,a|=d;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;d=o,o=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(f===null&&(u=g),s.baseState=u,s.firstBaseUpdate=c,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else l===null&&(s.shared.lanes=0);Cs|=a,e.lanes=a,e.memoizedState=g}}function Th(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ku.transition;Ku.transition={};try{e(!1),t()}finally{je=n,Ku.transition=r}}function ig(){return vn().memoizedState}function w1(e,t,n){var r=Kr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ag(e))og(t,n);else if(n=Vm(e,t,n,r),n!==null){var s=Et();Pn(n,e,r,s),ug(n,t,r)}}function b1(e,t,n){var r=Kr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ag(e))og(t,s);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var a=t.lastRenderedState,o=l(a,n);if(s.hasEagerState=!0,s.eagerState=o,Rn(o,a)){var u=t.interleaved;u===null?(s.next=s,qd(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=Vm(e,t,s,r),n!==null&&(s=Et(),Pn(n,e,r,s),ug(n,t,r))}}function ag(e){var t=e.alternate;return e===He||t!==null&&t===He}function og(e,t){mi=Ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ug(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rd(e,n)}}var Po={readContext:gn,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useInsertionEffect:xt,useLayoutEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useMutableSource:xt,useSyncExternalStore:xt,useId:xt,unstable_isNewReconciler:!1},k1={readContext:gn,useCallback:function(e,t){return Vn().memoizedState=[e,t===void 0?null:t],e},useContext:gn,useEffect:Ph,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Xa(4194308,4,tg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xa(4,2,e,t)},useMemo:function(e,t){var n=Vn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=w1.bind(null,He,e),[r.memoizedState,e]},useRef:function(e){var t=Vn();return e={current:e},t.memoizedState=e},useState:Ah,useDebugValue:rf,useDeferredValue:function(e){return Vn().memoizedState=e},useTransition:function(){var e=Ah(!1),t=e[0];return e=y1.bind(null,e[1]),Vn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=He,s=Vn();if(Ue){if(n===void 0)throw Error(D(407));n=n()}else{if(n=t(),ot===null)throw Error(D(349));Es&30||Gm(r,t,n)}s.memoizedState=n;var l={value:n,getSnapshot:t};return s.queue=l,Ph(Qm.bind(null,r,l,e),[e]),r.flags|=2048,Ui(9,qm.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Vn(),t=ot.identifierPrefix;if(Ue){var n=fr,r=dr;n=(r&~(1<<32-An(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ii++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Gn]=t,e[$i]=r,yg(e,t,!1,!1),t.stateNode=e;e:{switch(a=xc(n,r),n){case"dialog":Re("cancel",e),Re("close",e),s=r;break;case"iframe":case"object":case"embed":Re("load",e),s=r;break;case"video":case"audio":for(s=0;sEl&&(t.flags|=128,r=!0,Xl(l,!1),t.lanes=4194304)}else{if(!r)if(e=To(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Xl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!Ue)return yt(t),null}else 2*qe()-l.renderingStartTime>El&&n!==1073741824&&(t.flags|=128,r=!0,Xl(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(n=l.last,n!==null?n.sibling=a:t.child=a,l.last=a)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=qe(),t.sibling=null,n=Be.current,Le(Be,r?n&1|2:n&1),t):(yt(t),null);case 22:case 23:return cf(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Wt&1073741824&&(yt(t),t.subtreeFlags&6&&(t.flags|=8192)):yt(t),null;case 24:return null;case 25:return null}throw Error(D(156,t.tag))}function A1(e,t){switch(Bd(t),t.tag){case 1:return It(t.type)&&ko(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nl(),De(zt),De(kt),Jd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zd(t),null;case 13:if(De(Be),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(D(340));_l()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return De(Be),null;case 4:return Nl(),null;case 10:return Gd(t.type._context),null;case 22:case 23:return cf(),null;case 24:return null;default:return null}}var Ua=!1,bt=!1,P1=typeof WeakSet=="function"?WeakSet:Set,H=null;function tl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){We(e,t,r)}else n.current=null}function Kc(e,t,n){try{n()}catch(r){We(e,t,r)}}var Vh=!1;function L1(e,t){if(Cc=xo,e=jm(),Fd(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,f=0,g=e,d=null;t:for(;;){for(var w;g!==n||s!==0&&g.nodeType!==3||(o=a+s),g!==l||r!==0&&g.nodeType!==3||(u=a+r),g.nodeType===3&&(a+=g.nodeValue.length),(w=g.firstChild)!==null;)d=g,g=w;for(;;){if(g===e)break t;if(d===n&&++c===s&&(o=a),d===l&&++f===r&&(u=a),(w=g.nextSibling)!==null)break;g=d,d=g.parentNode}g=w}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tc={focusedElem:e,selectionRange:n},xo=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var N=y.memoizedProps,R=y.memoizedState,v=t.stateNode,h=v.getSnapshotBeforeUpdate(t.elementType===t.type?N:_n(t.type,N),R);v.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(D(163))}}catch(_){We(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return y=Vh,Vh=!1,y}function gi(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var l=s.destroy;s.destroy=void 0,l!==void 0&&Kc(t,n,l)}s=s.next}while(s!==r)}}function tu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function kg(e){var t=e.alternate;t!==null&&(e.alternate=null,kg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gn],delete t[$i],delete t[Lc],delete t[p1],delete t[m1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _g(e){return e.tag===5||e.tag===3||e.tag===4}function Bh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_g(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bo));else if(r!==4&&(e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}var ct=null,jn=!1;function Cr(e,t,n){for(n=n.child;n!==null;)Sg(e,t,n),n=n.sibling}function Sg(e,t,n){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Go,n)}catch{}switch(n.tag){case 5:bt||tl(n,t);case 6:var r=ct,s=jn;ct=null,Cr(e,t,n),ct=r,jn=s,ct!==null&&(jn?(e=ct,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ct.removeChild(n.stateNode));break;case 18:ct!==null&&(jn?(e=ct,n=n.stateNode,e.nodeType===8?Vu(e.parentNode,n):e.nodeType===1&&Vu(e,n),Ai(e)):Vu(ct,n.stateNode));break;case 4:r=ct,s=jn,ct=n.stateNode.containerInfo,jn=!0,Cr(e,t,n),ct=r,jn=s;break;case 0:case 11:case 14:case 15:if(!bt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&Kc(n,t,a),s=s.next}while(s!==r)}Cr(e,t,n);break;case 1:if(!bt&&(tl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){We(n,t,o)}Cr(e,t,n);break;case 21:Cr(e,t,n);break;case 22:n.mode&1?(bt=(r=bt)||n.memoizedState!==null,Cr(e,t,n),bt=r):Cr(e,t,n);break;default:Cr(e,t,n)}}function Hh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new P1),t.forEach(function(r){var s=F1.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function bn(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~l}if(r=s,r=qe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*R1(r/1960))-r,10e?16:e,zr===null)var r=!1;else{if(e=zr,zr=null,Ro=0,we&6)throw Error(D(331));var s=we;for(we|=4,H=e.current;H!==null;){var l=H,a=l.child;if(H.flags&16){var o=l.deletions;if(o!==null){for(var u=0;uqe()-of?ws(e,0):af|=n),Ot(e,t)}function Lg(e,t){t===0&&(e.mode&1?(t=Pa,Pa<<=1,!(Pa&130023424)&&(Pa=4194304)):t=1);var n=Et();e=xr(e,t),e!==null&&(Xi(e,t,n),Ot(e,n))}function U1(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Lg(e,n)}function F1(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(D(314))}r!==null&&r.delete(t),Lg(e,n)}var Mg;Mg=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||zt.current)Dt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Dt=!1,C1(e,t,n);Dt=!!(e.flags&131072)}else Dt=!1,Ue&&t.flags&1048576&&zm(t,No,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;eo(e,t),e=t.pendingProps;var s=kl(t,kt.current);ol(t,n),s=ef(null,t,r,e,s,n);var l=tf();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,It(r)?(l=!0,_o(t)):l=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Qd(t),s.updater=eu,t.stateNode=s,s._reactInternals=t,Ic(t,r,e,n),t=Fc(null,t,r,!0,l,n)):(t.tag=0,Ue&&l&&Vd(t),jt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(eo(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=B1(r),e=_n(r,e),s){case 0:t=Uc(null,t,r,e,n);break e;case 1:t=Oh(null,t,r,e,n);break e;case 11:t=zh(null,t,r,e,n);break e;case 14:t=Ih(null,t,r,_n(r.type,e),n);break e}throw Error(D(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:_n(r,s),Uc(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:_n(r,s),Oh(e,t,r,s,n);case 3:e:{if(gg(t),e===null)throw Error(D(387));r=t.pendingProps,l=t.memoizedState,s=l.element,Bm(e,t),Co(t,r,null,n);var a=t.memoizedState;if(r=a.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){s=jl(Error(D(423)),t),t=Uh(e,t,r,n,s);break e}else if(r!==s){s=jl(Error(D(424)),t),t=Uh(e,t,r,n,s);break e}else for(qt=Vr(t.stateNode.containerInfo.firstChild),Qt=t,Ue=!0,En=null,n=Fm(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_l(),r===s){t=yr(e,t,n);break e}jt(e,t,r,n)}t=t.child}return t;case 5:return Hm(t),e===null&&$c(t),r=t.type,s=t.pendingProps,l=e!==null?e.memoizedProps:null,a=s.children,Ac(r,s)?a=null:l!==null&&Ac(r,l)&&(t.flags|=32),mg(e,t),jt(e,t,a,n),t.child;case 6:return e===null&&$c(t),null;case 13:return vg(e,t,n);case 4:return Yd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Sl(t,null,r,n):jt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:_n(r,s),zh(e,t,r,s,n);case 7:return jt(e,t,t.pendingProps,n),t.child;case 8:return jt(e,t,t.pendingProps.children,n),t.child;case 12:return jt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,l=t.memoizedProps,a=s.value,Le(jo,r._currentValue),r._currentValue=a,l!==null)if(Rn(l.value,a)){if(l.children===s.children&&!zt.current){t=yr(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var o=l.dependencies;if(o!==null){a=l.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(l.tag===1){u=pr(-1,n&-n),u.tag=2;var c=l.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?u.next=u:(u.next=f.next,f.next=u),c.pending=u}}l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),Dc(l.return,n,t),o.lanes|=n;break}u=u.next}}else if(l.tag===10)a=l.type===t.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(D(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Dc(a,n,t),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===t){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}jt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,ol(t,n),s=gn(s),r=r(s),t.flags|=1,jt(e,t,r,n),t.child;case 14:return r=t.type,s=_n(r,t.pendingProps),s=_n(r.type,s),Ih(e,t,r,s,n);case 15:return hg(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:_n(r,s),eo(e,t),t.tag=1,It(r)?(e=!0,_o(t)):e=!1,ol(t,n),cg(t,r,s),Ic(t,r,s,n),Fc(null,t,r,!0,e,n);case 19:return xg(e,t,n);case 22:return pg(e,t,n)}throw Error(D(156,t.tag))};function Rg(e,t){return am(e,t)}function V1(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(e,t,n,r){return new V1(e,t,n,r)}function ff(e){return e=e.prototype,!(!e||!e.isReactComponent)}function B1(e){if(typeof e=="function")return ff(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ad)return 11;if(e===Pd)return 14}return 2}function Wr(e,t){var n=e.alternate;return n===null?(n=dn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ro(e,t,n,r,s,l){var a=2;if(r=e,typeof e=="function")ff(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ws:return bs(n.children,s,l,t);case Td:a=8,s|=8;break;case oc:return e=dn(12,n,t,s|2),e.elementType=oc,e.lanes=l,e;case uc:return e=dn(13,n,t,s),e.elementType=uc,e.lanes=l,e;case cc:return e=dn(19,n,t,s),e.elementType=cc,e.lanes=l,e;case Hp:return ru(n,s,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Vp:a=10;break e;case Bp:a=9;break e;case Ad:a=11;break e;case Pd:a=14;break e;case Tr:a=16,r=null;break e}throw Error(D(130,e==null?e:typeof e,""))}return t=dn(a,n,t,s),t.elementType=e,t.type=r,t.lanes=l,t}function bs(e,t,n,r){return e=dn(7,e,r,t),e.lanes=n,e}function ru(e,t,n,r){return e=dn(22,e,r,t),e.elementType=Hp,e.lanes=n,e.stateNode={isHidden:!1},e}function Yu(e,t,n){return e=dn(6,e,null,t),e.lanes=n,e}function Zu(e,t,n){return t=dn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function H1(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pu(0),this.expirationTimes=Pu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pu(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function hf(e,t,n,r,s,l,a,o,u){return e=new H1(e,t,n,o,u),t===1?(t=1,l===!0&&(t|=8)):t=0,l=dn(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qd(l),e}function K1(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ig)}catch(e){console.error(e)}}Ig(),Ip.exports=Jt;var Y1=Ip.exports,Jh=Y1;ic.createRoot=Jh.createRoot,ic.hydrateRoot=Jh.hydrateRoot;/** * @license lucide-react v0.424.0 - ISC @@ -267,10 +267,10 @@ Error generating stack: `+l.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gg=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function vy({branding:e,user:t,activeTab:n,onChangeTab:r,themeMode:s,onChangeThemeMode:l,onLogout:a,onOpenAuth:o,onOpenCreateEvent:u,onOpenTemplates:c,onOpenProfile:f,onOpenAdmin:g,pwaInstallPrompt:d,onInstallPwa:w}){const y=(e==null?void 0:e.primary_color)||"var(--brand-primary)",[N,R]=Si.useState(()=>localStorage.getItem("guest_display_name")||"");Si.useEffect(()=>{const h=()=>{R(localStorage.getItem("guest_display_name")||"")};return window.addEventListener("guest_name_updated",h),window.addEventListener("storage",h),()=>{window.removeEventListener("guest_name_updated",h),window.removeEventListener("storage",h)}},[]);const v=()=>{l(s==="dark"?"light":s==="light"?"auto":"dark")};return i.jsxs("header",{className:"bg-surface border-b border-grid sticky top-0 z-40",children:[i.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center space-x-3 shrink-0",children:[i.jsx("div",{onClick:()=>r("home"),style:{backgroundColor:y},className:"w-8 h-8 rounded-sm flex items-center justify-center text-white font-bold cursor-pointer shadow-sm",children:e!=null&&e.logo_url?i.jsx("img",{src:e.logo_url,alt:"Logo",className:"w-4 h-4 object-contain"}):i.jsx(ra,{className:"w-4 h-4"})}),i.jsxs("div",{onClick:()=>r("home"),className:"cursor-pointer",children:[i.jsx("h1",{className:"font-serif text-base font-bold tracking-tight text-main leading-none",children:(e==null?void 0:e.app_name)||"Schichtplaner"}),i.jsx("div",{className:"text-[10px] font-mono text-muted mt-1 uppercase tracking-wider flex items-center gap-1.5",children:t?i.jsxs("span",{className:"text-emerald-500 font-semibold",children:["[ ",t.display_name||t.username," ]"]}):N?i.jsxs("span",{className:"text-amber-400 font-semibold flex items-center gap-1",children:["[ 👤 GAST: ",N," ]"]}):i.jsx("span",{className:"text-amber-500 font-semibold",children:"[ GAST-MODUS ]"})})]})]}),i.jsxs("nav",{className:"hidden md:flex items-center gap-2",children:[i.jsxs("button",{onClick:()=>r("home"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="home"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[i.jsx(ep,{className:"w-3.5 h-3.5"})," Startseite"]}),i.jsxs("button",{onClick:()=>r("calendar"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="calendar"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[i.jsx(Xh,{className:"w-3.5 h-3.5"})," Kalender"]}),((t==null?void 0:t.is_admin_user)||(t==null?void 0:t.is_staff)||(t==null?void 0:t.is_superuser))&&i.jsxs("button",{onClick:()=>r("admin"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="admin"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[i.jsx(np,{className:"w-3.5 h-3.5 text-indigo-400"})," Admin"]})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("button",{onClick:v,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5",title:`Design-Modus: ${s.toUpperCase()}`,children:s==="dark"?i.jsxs(i.Fragment,{children:[i.jsx(oy,{className:"w-3.5 h-3.5 text-indigo-400"}),i.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"DARK"})]}):s==="light"?i.jsxs(i.Fragment,{children:[i.jsx(py,{className:"w-3.5 h-3.5 text-amber-500"}),i.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"LIGHT"})]}):i.jsxs(i.Fragment,{children:[i.jsx(ay,{className:"w-3.5 h-3.5 text-blue-500"}),i.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"AUTO"})]})}),d&&i.jsxs("button",{onClick:w,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-emerald-500/10 text-emerald-500 border border-emerald-500/20 hover:bg-emerald-500/20 transition flex items-center gap-1",children:[i.jsx(Kg,{className:"w-3 h-3"})," PWA"]}),t?i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:u,style:{backgroundColor:y},className:"h-8 px-3 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 shadow-sm hover:brightness-110",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," Event"]}),i.jsxs("button",{onClick:c,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition hidden sm:flex items-center gap-1",title:"Vorlagen",children:[i.jsx(ou,{className:"w-3.5 h-3.5 text-muted"})," Vorlagen"]}),i.jsxs("button",{onClick:f,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1",title:"Profil & Namen ändern",children:[i.jsx(Bi,{className:"w-3.5 h-3.5 text-amber-500"})," Profil"]}),(t.is_admin_user||t.is_staff||t.is_superuser)&&i.jsxs("button",{onClick:()=>r("admin"),className:`h-8 px-2.5 rounded-sm text-xs font-mono transition flex items-center gap-1 border ${n==="admin"?"bg-indigo-500/20 text-indigo-300 border-indigo-500/40 font-bold":"bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border-indigo-500/30"}`,title:"Admin-Zentrale",children:[i.jsx(np,{className:"w-3.5 h-3.5"})," Admin"]}),i.jsx("div",{className:"h-4 w-px bg-grid mx-1"}),i.jsx("button",{onClick:a,className:"h-8 w-8 rounded-sm text-muted hover:text-red-500 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition flex items-center justify-center",title:"Abmelden",children:i.jsx(iy,{className:"w-3.5 h-3.5"})})]}):i.jsxs("button",{onClick:o,style:{backgroundColor:y},className:"h-8 px-3.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 flex items-center gap-1.5 shadow-sm",children:[i.jsx(so,{className:"w-3.5 h-3.5"})," Anmelden"]})]})]}),i.jsxs("div",{className:"flex md:hidden items-center justify-around border-t border-grid py-2 bg-subtle text-xs font-mono",children:[i.jsxs("button",{onClick:()=>r("home"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="home"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[i.jsx(ep,{className:"w-3.5 h-3.5"})," Start"]}),i.jsxs("button",{onClick:()=>r("calendar"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="calendar"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[i.jsx(Xh,{className:"w-3.5 h-3.5"})," Termine"]}),i.jsxs("button",{onClick:()=>r("schedule"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="schedule"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[i.jsx(my,{className:"w-3.5 h-3.5"})," Schichtplan"]})]})]})}function xy({event:e,user:t,onSignupClick:n,onCancelClick:r,onRemoveUserFromShift:s,onGenerateClaimLink:l,onExportPdf:a,onPrintView:o,onEditEvent:u,onDeleteEvent:c}){var N,R,v;const[f,g]=Si.useState(()=>localStorage.getItem("guest_display_name")||"");if(Si.useEffect(()=>{const h=()=>g(localStorage.getItem("guest_display_name")||"");return window.addEventListener("guest_name_updated",h),window.addEventListener("storage",h),()=>{window.removeEventListener("guest_name_updated",h),window.removeEventListener("storage",h)}},[]),!e||!e.task_areas||e.task_areas.length===0)return i.jsxs("div",{className:"hallmark-panel rounded-sm p-12 text-center border border-grid font-mono",children:[i.jsx(Vi,{className:"w-8 h-8 text-muted mx-auto mb-3"}),i.jsx("h3",{className:"font-serif text-xl font-bold text-main uppercase",children:"Keine Aufgabenfelder vorhanden"}),i.jsx("p",{className:"text-xs text-muted mt-1 mb-4",children:"[ Event hat noch keine definierten Aufgabenfelder oder Schichten ]"}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((N=e==null?void 0:e.created_by)==null?void 0:N.id)===t.id||(e==null?void 0:e.co_managers)&&e.co_managers.some(h=>typeof h=="object"?h.id===t.id:h===t.id))&&u&&i.jsxs("button",{onClick:()=>u(e),className:"px-4 py-2 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 font-bold text-xs inline-flex items-center gap-2",children:[i.jsx(Bi,{className:"w-4 h-4"})," SCHICHTEN & BEREICHE ANLEGEN"]})]});const d=!t,w=t&&(e==null?void 0:e.co_managers)&&e.co_managers.some(h=>typeof h=="object"?h.id===t.id:h===t.id),y=t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((R=e==null?void 0:e.created_by)==null?void 0:R.id)===t.id||w);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col md:flex-row md:items-center justify-between gap-4",children:[i.jsxs("div",{className:"space-y-1 font-mono",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted mb-1",children:[i.jsxs("span",{className:"bg-subtle px-2.5 py-0.5 rounded-sm border border-grid font-bold text-main",children:[new Date(e.start_date).toLocaleDateString("de-DE")," — ",new Date(e.end_date).toLocaleDateString("de-DE")]}),e.location&&i.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[i.jsx(vf,{className:"w-3.5 h-3.5 shrink-0"}),e.location]}),e.is_active===!1&&i.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-amber-500/10 text-amber-500 border border-amber-500/20 font-bold",children:"[ DEAKTIVIERT ]"})]}),i.jsx("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main",children:e.title}),e.description&&i.jsx("p",{className:"text-xs font-sans text-muted max-w-2xl mt-1",children:e.description})]}),i.jsxs("div",{className:"flex items-center gap-2 no-print font-mono text-xs shrink-0",children:[y&&u&&i.jsxs("button",{onClick:()=>u(e),className:"px-3.5 py-1.5 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 transition flex items-center gap-1.5 font-bold",title:"Schichten und Aufgabenbereiche für diese Veranstaltung bearbeiten",children:[i.jsx(Bi,{className:"w-3.5 h-3.5"})," SCHICHTEN BEARBEITEN"]}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((v=e==null?void 0:e.created_by)==null?void 0:v.id)===t.id)&&c&&i.jsxs("button",{onClick:()=>c(e),className:"px-3.5 py-1.5 rounded-sm bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/30 transition flex items-center gap-1.5 font-bold",title:"Diese Veranstaltung unwiderruflich löschen",children:[i.jsx(cn,{className:"w-3.5 h-3.5"})," LÖSCHEN"]}),i.jsxs("button",{onClick:o,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[i.jsx(cy,{className:"w-3.5 h-3.5"})," DRUCKEN"]}),i.jsxs("button",{onClick:a,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[i.jsx(ry,{className:"w-3.5 h-3.5"})," PDF"]})]})]}),d&&i.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Hg,{className:"w-4 h-4 shrink-0 text-amber-500"}),i.jsxs("span",{children:["[ GAST-DATENSCHUTZ ]: Belegungszahlen sichtbar, Namensanzeige aus Datenschutzgründen ",i.jsx("strong",{children:"anonymisiert"}),"."]})]}),i.jsx("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-subtle border-b border-grid text-[11px] font-mono text-muted uppercase tracking-wider",children:[i.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Aufgabenfeld"}),i.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Schicht & Zeitraum"}),i.jsx("th",{className:"py-3.5 px-4 w-1/6",children:"Qualifikation"}),i.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Belegung & Personen"}),i.jsx("th",{className:"py-3.5 px-4 w-1/6 text-right",children:"Aktion"})]})}),i.jsx("tbody",{className:"divide-y divide-grid text-xs font-sans",children:e.task_areas.map(h=>!h.shifts||h.shifts.length===0?i.jsxs("tr",{children:[i.jsx("td",{className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase",children:h.name}),i.jsx("td",{colSpan:4,className:"py-3.5 px-4 text-muted font-mono text-[11px]",children:"[ Keine Schichten angelegt ]"})]},`area-${h.id}`):h.shifts.map((m,_)=>{const C=_===0,E=m.is_full,P=!!(t?m.signups.find(L=>!L.is_guest&&L.display_name===t.display_name):null),G=m.required_skills&&m.required_skills.length>0;return i.jsxs("tr",{className:"hover:bg-surface-hover/60 transition",children:[C?i.jsxs("td",{rowSpan:h.shifts.length,className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase bg-subtle/80 align-top border-r border-grid",children:[i.jsx("div",{children:h.name}),h.description&&i.jsx("div",{className:"text-[11px] font-sans font-normal text-muted mt-0.5",children:h.description})]}):null,i.jsxs("td",{className:"py-3.5 px-4",children:[i.jsxs("div",{className:"font-semibold text-main flex items-center gap-2 flex-wrap",children:[i.jsx("span",{children:m.title}),m.date&&i.jsxs("span",{className:"text-[10px] font-mono font-bold text-indigo-400 bg-indigo-500/10 px-2 py-0.5 rounded-sm border border-indigo-500/20",children:["📅 ",new Date(m.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"})]})]}),i.jsxs("div",{className:"text-[11px] font-mono text-muted flex items-center gap-1 mt-0.5",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted shrink-0"}),i.jsxs("span",{children:[m.start_time," — ",m.end_time," Uhr"]})]})]}),i.jsx("td",{className:"py-3.5 px-4 font-mono",children:G?i.jsx("div",{className:"flex flex-wrap gap-1",children:m.required_skills.map(L=>i.jsxs("span",{style:{backgroundColor:`${L.color}15`,borderColor:`${L.color}35`,color:L.color},className:"px-2 py-0.5 rounded-sm text-[10px] font-semibold border flex items-center gap-1",children:[i.jsx(ey,{className:"w-3 h-3 shrink-0"})," ",L.name]},L.id))}):i.jsx("span",{className:"text-[11px] text-muted",children:"—"})}),i.jsxs("td",{className:"py-3.5 px-4 font-mono",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs("span",{className:`px-2 py-0.5 rounded-sm text-[11px] font-bold border ${E?"bg-red-500/10 text-red-500 border-red-500/20":"bg-emerald-500/10 text-emerald-500 border-emerald-500/20"}`,children:["[ ",m.signups_count," / ",m.max_participants," BELEGT ]"]})}),i.jsx("div",{className:"mt-2 space-y-1 font-sans",children:m.signups.map(L=>{var ae;const Y=d&&L.is_guest&&f&&((ae=L.display_name)==null?void 0:ae.trim().toLowerCase())===f.trim().toLowerCase();return i.jsxs("div",{className:`text-[11px] text-muted flex items-center justify-between gap-2 p-1.5 rounded-sm border ${Y?"bg-amber-500/10 border-amber-500/30":"bg-subtle border-grid"}`,children:[i.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[i.jsx(xf,{className:`w-3 h-3 shrink-0 ${Y?"text-amber-400":"text-muted"}`}),i.jsx("span",{className:`truncate ${Y?"font-bold text-amber-300":""}`,children:L.display_name}),L.is_guest&&i.jsx("span",{className:"text-[9px] font-mono text-amber-500 px-1 rounded-sm bg-amber-500/10 border border-amber-500/20 font-bold",children:"GAST"}),Y&&i.jsx("span",{className:"text-[9px] font-mono text-emerald-400 px-1 rounded-sm bg-emerald-500/10 border border-emerald-500/20 font-bold",children:"DU"})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t&&L.is_guest&&l&&i.jsxs("button",{onClick:()=>l(L),className:"text-indigo-400 hover:text-indigo-300 transition p-1 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 border border-indigo-500/20 flex items-center gap-1 text-[10px] font-mono font-bold",title:"Konto-Einladungslink für diese Gast-Eintragung kopieren",children:[i.jsx(gy,{className:"w-3 h-3"})," LINK"]}),y&&s&&i.jsx("button",{onClick:()=>s(m,L.id),className:"text-muted hover:text-red-500 transition p-1 rounded-sm hover:bg-red-500/10",title:"Person aus dieser Schicht entfernen",children:i.jsx(rp,{className:"w-3.5 h-3.5"})})]})]},L.id)})})]}),i.jsx("td",{className:"py-3.5 px-4 text-right font-mono",children:P?i.jsxs("button",{onClick:()=>r(m),className:"px-3 py-1.5 rounded-sm text-xs font-semibold bg-red-500/10 hover:bg-red-500/20 text-red-500 border border-red-500/20 transition flex items-center gap-1 ml-auto",children:[i.jsx(rp,{className:"w-3.5 h-3.5"})," AUSTRAGEN"]}):E?i.jsx("span",{className:"text-xs text-muted font-bold",children:"[ VOLL ]"}):i.jsxs("button",{onClick:()=>n(m),style:{backgroundColor:"var(--brand-primary)"},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 flex items-center gap-1 ml-auto shadow-sm",children:[i.jsx(Ln,{className:"w-3.5 h-3.5"})," EINTRAGEN"]})})]},`shift-${m.id}`)}))})]})})})]})}const qg=!1;var Qg=Array.isArray,yy=Array.prototype.indexOf,Tl=Array.prototype.includes,wy=Array.from,zo=Object.keys,Hi=Object.defineProperty,cl=Object.getOwnPropertyDescriptor,by=Object.getOwnPropertyDescriptors,ky=Object.prototype,_y=Array.prototype,Yg=Object.getPrototypeOf,sp=Object.isExtensible;const Gr=()=>{};function Sy(e){for(var t=0;t{e=r,t=s});return{promise:n,resolve:e,reject:t}}const mt=2,Al=4,uu=8,yf=1<<24,Cn=16,Jn=32,wr=64,ed=128,hn=512,et=1024,at=2048,Xn=4096,pn=8192,Mn=16384,rs=32768,td=1<<25,Zr=65536,Io=1<<17,Ny=1<<18,$s=1<<19,jy=1<<20,As=65536,Oo=1<<21,dl=1<<22,qr=1<<23,fl=Symbol("$state"),Ey=Symbol("legacy props"),Cy=Symbol(""),lo=Symbol("attributes"),nd=Symbol("class"),rd=Symbol("style"),ai=Symbol("text"),yi=Symbol("form reset"),cu=new class extends Error{constructor(){super(...arguments);ne(this,"name","StaleReactionError");ne(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var Sp;const sa=!!((Sp=globalThis.document)!=null&&Sp.contentType)&&globalThis.document.contentType.includes("xml"),la=3,ia=8;function Jg(e){return e===this.v}function Xg(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Ty(e){return!Xg(e,this.v)}function Ay(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Py(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ly(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function My(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ry(e){throw new Error("https://svelte.dev/e/effect_orphan")}function $y(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Dy(){throw new Error("https://svelte.dev/e/hydration_failed")}function zy(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Iy(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Oy(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Uy(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let Fy=!1;const Vy=1,By=2,wf="[",ev="[!",lp="[?",tv="]",Ps={},Qe=Symbol("uninitialized"),nv="http://www.w3.org/1999/xhtml",Hy="http://www.w3.org/2000/svg",Ky="http://www.w3.org/1998/Math/MathML",Wy="@attach";let Ut=null;function Pl(e){Ut=e}function _r(e,t=!1,n){Ut={p:Ut,i:!1,c:null,e:null,s:e,x:null,r:ce,l:null}}function Sr(e){var t=Ut,n=t.e;if(n!==null){t.e=null;for(var r of n)Dv(r)}return e!==void 0&&(t.x=e),t.i=!0,Ut=t.p,e??{}}function rv(){return!0}let ds=[];function sv(){var e=ds;ds=[],Sy(e)}function mr(e){if(ds.length===0&&!bi){var t=ds;queueMicrotask(()=>{t===ds&&sv()})}ds.push(e)}function Gy(){for(;ds.length>0;)sv()}function qy(){console.warn("https://svelte.dev/e/derived_inert")}function aa(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Qy(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Yy(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let he=!1;function qn(e){he=e}let fe;function Ct(e){if(e===null)throw aa(),Ps;return fe=e}function Ls(){return Ct(nr(fe))}function $e(e){if(he){if(nr(fe)!==null)throw aa(),Ps;fe=e}}function bf(e=1){if(he){for(var t=e,n=fe;t--;)n=nr(n);fe=n}}function kf(e=!0){for(var t=0,n=fe;;){if(n.nodeType===ia){var r=n.data;if(r===tv){if(t===0)return n;t-=1}else(r===wf||r===ev||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=nr(n);e&&n.remove(),n=s}}function lv(e){if(!e||e.nodeType!==ia)throw aa(),Ps;return e.data}function hr(e){if(typeof e!="object"||e===null||fl in e)return e;const t=Yg(e);if(t!==ky&&t!==_y)return e;var n=new Map,r=Qg(e),s=ge(0),l=Ss,a=o=>{if(Ss===l)return o();var u=ve,c=Ss;xn(null),fp(l);var f=o();return xn(u),fp(c),f};return r&&n.set("length",ge(e.length)),new Proxy(e,{defineProperty(o,u,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&zy();var f=n.get(u);return f===void 0?a(()=>{var g=ge(c.value);return n.set(u,g),g}):Q(f,c.value,!0),!0},deleteProperty(o,u){var c=n.get(u);if(c===void 0){if(u in o){const f=a(()=>ge(Qe));n.set(u,f),ki(s)}}else Q(c,Qe),ki(s);return!0},get(o,u,c){var w;if(u===fl)return e;var f=n.get(u),g=u in o;if(f===void 0&&(!g||(w=cl(o,u))!=null&&w.writable)&&(f=a(()=>{var y=hr(g?o[u]:Qe),N=ge(y);return N}),n.set(u,f)),f!==void 0){var d=p(f);return d===Qe?void 0:d}return Reflect.get(o,u,c)},getOwnPropertyDescriptor(o,u){var c=Reflect.getOwnPropertyDescriptor(o,u);if(c&&"value"in c){var f=n.get(u);f&&(c.value=p(f))}else if(c===void 0){var g=n.get(u),d=g==null?void 0:g.v;if(g!==void 0&&d!==Qe)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return c},has(o,u){var d;if(u===fl)return!0;var c=n.get(u),f=c!==void 0&&c.v!==Qe||Reflect.has(o,u);if(c!==void 0||ce!==null&&(!f||(d=cl(o,u))!=null&&d.writable)){c===void 0&&(c=a(()=>{var w=f?hr(o[u]):Qe,y=ge(w);return y}),n.set(u,c));var g=p(c);if(g===Qe)return!1}return f},set(o,u,c,f){var m;var g=n.get(u),d=u in o;if(r&&u==="length")for(var w=c;wge(Qe)),n.set(w+"",y))}if(g===void 0)(!d||(m=cl(o,u))!=null&&m.writable)&&(g=a(()=>ge(void 0)),Q(g,hr(c)),n.set(u,g));else{d=g.v!==Qe;var N=a(()=>hr(c));Q(g,N)}var R=Reflect.getOwnPropertyDescriptor(o,u);if(R!=null&&R.set&&R.set.call(f,c),!d){if(r&&typeof u=="string"){var v=n.get("length"),h=Number(u);Number.isInteger(h)&&h>=v.v&&Q(v,h+1)}ki(s)}return!0},ownKeys(o){p(s);var u=Reflect.ownKeys(o).filter(g=>{var d=n.get(g);return d===void 0||d.v!==Qe});for(var[c,f]of n)f.v!==Qe&&!(c in o)&&u.push(c);return u},setPrototypeOf(){Iy()}})}function ip(e){try{if(e!==null&&typeof e=="object"&&fl in e)return e[fl]}catch{}return e}function Zy(e,t){return Object.is(ip(e),ip(t))}var ks,sd,iv,av,ov;function ld(){if(ks===void 0){ks=window,sd=document,iv=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;av=cl(t,"firstChild").get,ov=cl(t,"nextSibling").get,sp(e)&&(e[nd]=void 0,e[lo]=null,e[rd]=void 0,e.__e=void 0),sp(n)&&(n[ai]=void 0)}}function er(e=""){return document.createTextNode(e)}function Gt(e){return av.call(e)}function nr(e){return ov.call(e)}function Ve(e,t){if(!he)return Gt(e);var n=Gt(fe);if(n===null)n=fe.appendChild(er());else if(t&&n.nodeType!==la){var r=er();return n==null||n.before(r),Ct(r),r}return t&&du(n),Ct(n),n}function Bs(e,t=!1){if(!he){var n=Gt(e);return n instanceof Comment&&n.data===""?nr(n):n}if(t){if((fe==null?void 0:fe.nodeType)!==la){var r=er();return fe==null||fe.before(r),Ct(r),r}du(fe)}return fe}function Ie(e,t=1,n=!1){let r=he?fe:e;for(var s;t--;)s=r,r=nr(r);if(!he)return r;if(n){if((r==null?void 0:r.nodeType)!==la){var l=er();return r===null?s==null||s.after(l):r.before(l),Ct(l),l}du(r)}return Ct(r),r}function Jy(e){e.textContent=""}function _f(e,t,n){return document.createElementNS(t??nv,e,void 0)}function du(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===la;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function uv(e){var t=ce;if(t===null)return ve.f|=qr,e;if(!(t.f&rs)&&!(t.f&Al))throw e;Ir(e,t)}function Ir(e,t){for(;t!==null;){if(t.f&ed){if(!(t.f&rs))throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const Xy=-7169;function Ge(e,t){e.f=e.f&Xy|t}function Sf(e){e.f&hn||e.deps===null?Ge(e,et):Ge(e,Xn)}function cv(e){if(e!==null)for(const t of e)!(t.f&mt)||!(t.f&As)||(t.f^=As,cv(t.deps))}function dv(e,t,n){e.f&at?t.add(e):e.f&Xn&&n.add(e),cv(e.deps),Ge(e,et)}function fv(e,t,n){if(e==null)return t(void 0),Gr;const r=ca(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const Fs=[];function ew(e,t=Gr){let n=null;const r=new Set;function s(o){if(Xg(e,o)&&(e=o,n)){const u=!Fs.length;for(const c of r)c[1](),Fs.push(c,e);if(u){for(let c=0;c{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:s,update:l,subscribe:a}}function oi(e){let t;return fv(e,n=>t=n)(),t}let id=Symbol("unmounted");function ap(e,t,n){const r=n[t]??(n[t]={store:null,source:jv(void 0),unsubscribe:Gr});if(r.store!==e&&!(id in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=Gr;else{var s=!0;r.unsubscribe=fv(e,l=>{s?r.source.v=l:Q(r.source,l)}),s=!1}return e&&id in n?oi(e):p(r.source)}function tw(){const e={};function t(){hu(()=>{for(var n in e)e[n].unsubscribe();Hi(e,id,{enumerable:!1,value:!0})})}return[e,t]}let Ju=null,Vs=null,X=null,wi=null,dt=null,ad=null,bi=!1,Xu=!1,rl=null,io=null;var op=0;let nw=1;var pl,Mr,ms,ml,gl,gs,vl,ir,Wi,Bt,Gi,Rr,Hn,Kn,xl,yl,Se,od,ui,ud,hv,pv,ao,rw,cd,Hs;const Bo=class Bo{constructor(){ie(this,Se);ne(this,"id",nw++);ie(this,pl,!1);ne(this,"linked",!0);ie(this,Mr,null);ie(this,ms,null);ne(this,"async_deriveds",new Map);ne(this,"current",new Map);ne(this,"previous",new Map);ne(this,"unblocked",new Set);ie(this,ml,new Set);ie(this,gl,new Set);ie(this,gs,new Set);ie(this,vl,0);ie(this,ir,new Map);ie(this,Wi,null);ie(this,Bt,[]);ie(this,Gi,[]);ie(this,Rr,new Set);ie(this,Hn,new Set);ie(this,Kn,new Map);ie(this,xl,new Set);ne(this,"is_fork",!1);ie(this,yl,!1)}skip_effect(t){S(this,Kn).has(t)||S(this,Kn).set(t,{d:[],m:[]}),S(this,xl).delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=S(this,Kn).get(t);if(r){S(this,Kn).delete(t);for(var s of r.d)Ge(s,at),n(s);for(s of r.m)Ge(s,Xn),n(s)}S(this,xl).add(t)}capture(t,n,r=!1){t.v!==Qe&&!this.previous.has(t)&&this.previous.set(t,t.v),t.f&qr||(this.current.set(t,[n,r]),dt==null||dt.set(t,n)),this.is_fork||(t.v=n)}activate(){X=this}deactivate(){X=null,dt=null}flush(){try{Xu=!0,X=this,me(this,Se,ui).call(this)}finally{op=0,ad=null,rl=null,io=null,Xu=!1,X=null,dt=null,_s.clear()}}discard(){for(const t of S(this,gl))t(this);S(this,gl).clear(),S(this,gs).clear(),me(this,Se,Hs).call(this)}register_created_effect(t){S(this,Gi).push(t)}increment(t,n){if(re(this,vl,S(this,vl)+1),t){let r=S(this,ir).get(n)??0;S(this,ir).set(n,r+1)}}decrement(t,n){if(re(this,vl,S(this,vl)-1),t){let r=S(this,ir).get(n)??0;r===1?S(this,ir).delete(n):S(this,ir).set(n,r-1)}S(this,yl)||(re(this,yl,!0),mr(()=>{re(this,yl,!1),this.linked&&this.flush()}))}transfer_effects(t,n){for(const r of t)S(this,Rr).add(r);for(const r of n)S(this,Hn).add(r);t.clear(),n.clear()}oncommit(t){S(this,ml).add(t)}ondiscard(t){S(this,gl).add(t)}on_fork_commit(t){S(this,gs).add(t)}run_fork_commit_callbacks(){for(const t of S(this,gs))t(this);S(this,gs).clear()}settled(){return(S(this,Wi)??re(this,Wi,Zg())).promise}static ensure(){var t;if(X===null){const n=X=new Bo;me(t=n,Se,cd).call(t),!Xu&&!bi&&mr(()=>{S(n,pl)||n.flush()})}return X}apply(){{dt=null;return}}schedule(t){var s;if(ad=t,(s=t.b)!=null&&s.is_pending&&t.f&(Al|uu|yf)&&!(t.f&rs)){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(rl!==null&&n===ce&&(ve===null||!(ve.f&mt)))return;if(r&(wr|Jn)){if(!(r&et))return;n.f^=et}}S(this,Bt).push(n)}};pl=new WeakMap,Mr=new WeakMap,ms=new WeakMap,ml=new WeakMap,gl=new WeakMap,gs=new WeakMap,vl=new WeakMap,ir=new WeakMap,Wi=new WeakMap,Bt=new WeakMap,Gi=new WeakMap,Rr=new WeakMap,Hn=new WeakMap,Kn=new WeakMap,xl=new WeakMap,yl=new WeakMap,Se=new WeakSet,od=function(){if(this.is_fork)return!0;for(const r of S(this,ir).keys()){for(var t=r,n=!1;t.parent!==null;){if(S(this,Kn).has(t)){n=!0;break}t=t.parent}if(!n)return!0}return!1},ui=function(){var u,c,f,g;if(re(this,pl,!0),op++>1e3&&(me(this,Se,Hs).call(this),sw()),!me(this,Se,od).call(this)){for(const d of S(this,Rr))S(this,Hn).delete(d),Ge(d,at),this.schedule(d);for(const d of S(this,Hn))Ge(d,Xn),this.schedule(d)}const t=S(this,Bt);re(this,Bt,[]),this.apply();var n=rl=[],r=[],s=io=[];for(const d of t)try{me(this,Se,ud).call(this,d,n,r)}catch(w){throw vv(d),w}if(X=null,s.length>0){var l=Bo.ensure();for(const d of s)l.schedule(d)}if(rl=null,io=null,me(this,Se,od).call(this)){me(this,Se,ao).call(this,r),me(this,Se,ao).call(this,n);for(const[d,w]of S(this,Kn))gv(d,w);s.length>0&&me(u=X,Se,ui).call(u);return}const a=me(this,Se,hv).call(this);if(a){me(c=a,Se,pv).call(c,this);return}S(this,Rr).clear(),S(this,Hn).clear();for(const d of S(this,ml))d(this);S(this,ml).clear(),wi=this,up(r),up(n),wi=null,(f=S(this,Wi))==null||f.resolve();var o=X;if(this.linked&&S(this,vl)===0&&me(this,Se,Hs).call(this),S(this,Bt).length>0){o===null&&(o=this,me(this,Se,cd).call(this));const d=o;S(d,Bt).push(...S(this,Bt).filter(w=>!S(d,Bt).includes(w)))}o!==null&&me(g=o,Se,ui).call(g)},ud=function(t,n,r){t.f^=et;for(var s=t.first;s!==null;){var l=s.f,a=(l&(Jn|wr))!==0,o=a&&(l&et)!==0,u=o||(l&pn)!==0||S(this,Kn).has(s);if(!u&&s.fn!==null){a?s.f^=et:l&Al?n.push(s):ua(s)&&(l&Cn&&S(this,Hn).add(s),Ll(s));var c=s.first;if(c!==null){s=c;continue}}for(;s!==null;){var f=s.next;if(f!==null){s=f;break}s=s.parent}}},hv=function(){for(var t=S(this,Mr);t!==null;){if(!t.is_fork){for(const[n,[,r]]of this.current)if(t.current.has(n)&&!r)return t}t=S(t,Mr)}return null},pv=function(t){var r;for(const[s,l]of t.current)!this.previous.has(s)&&t.previous.has(s)&&this.previous.set(s,t.previous.get(s)),this.current.set(s,l);for(const[s,l]of t.async_deriveds){const a=this.async_deriveds.get(s);a&&l.promise.then(a.resolve)}const n=s=>{var l=s.reactions;if(l!==null)for(const u of l){var a=u.f;if(a&mt)n(u);else{var o=u;a&(dl|Cn)&&!this.async_deriveds.has(o)&&(S(this,Hn).delete(o),Ge(o,at),this.schedule(o))}}};for(const s of this.current.keys())n(s);this.oncommit(()=>t.discard()),me(r=t,Se,Hs).call(r),X=this,me(this,Se,ui).call(this)},ao=function(t){for(var n=0;n!this.current.has(d));if(s.length===0)t&&g.discard();else if(n.length>0){if(t)for(const d of S(this,xl))g.unskip_effect(d,w=>{var y;w.f&(Cn|dl)?g.schedule(w):me(y=g,Se,ao).call(y,[w])});g.activate();var l=new Set,a=new Map;for(var o of n)mv(o,s,l,a);a=new Map;var u=[...g.current.keys()].filter(d=>this.current.has(d)?this.current.get(d)[0]!==d.v:!0);if(u.length>0)for(const d of S(this,Gi))!(d.f&(Mn|pn|Io))&&Nf(d,u,a)&&(d.f&(dl|Cn)?(Ge(d,at),g.schedule(d)):S(g,Rr).add(d));if(S(g,Bt).length>0){g.apply();for(var c of S(g,Bt))me(f=g,Se,ud).call(f,c,[],[]);re(g,Bt,[])}g.deactivate()}}}},cd=function(){Vs===null?Ju=Vs=this:(re(Vs,ms,this),re(this,Mr,Vs)),Vs=this},Hs=function(){var t=S(this,Mr),n=S(this,ms);t===null?Ju=n:re(t,ms,n),n===null?Vs=t:re(n,Mr,t),this.linked=!1};let Jr=Bo;function Pe(e){var t=bi;bi=!0;try{for(var n;;){if(Gy(),X===null)return n;X.flush()}}finally{bi=t}}function sw(){try{$y()}catch(e){Ir(e,ad)}}let kn=null;function up(e){var t=e.length;if(t!==0){for(var n=0;n0)){_s.clear();for(const s of kn){if(s.f&(Mn|pn))continue;const l=[s];let a=s.parent;for(;a!==null;)kn.has(a)&&(kn.delete(a),l.push(a)),a=a.parent;for(let o=l.length-1;o>=0;o--){const u=l[o];u.f&(Mn|pn)||Ll(u)}}kn.clear()}}kn=null}}function mv(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const l=s.f;l&mt?mv(s,t,n,r):l&(dl|Cn)&&!(l&at)&&Nf(s,t,r)&&(Ge(s,at),jf(s))}}function Nf(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(Tl.call(t,s))return!0;if(s.f&mt&&Nf(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function jf(e){X.schedule(e)}function gv(e,t){if(!(e.f&Jn&&e.f&et)){e.f&at?t.d.push(e):e.f&Xn&&t.m.push(e),Ge(e,et);for(var n=e.first;n!==null;)gv(n,t),n=n.next}}function vv(e){Ge(e,et);for(var t=e.first;t!==null;)vv(t),t=t.next}function lw(e){let t=0,n=oa(0),r;return()=>{Tf()&&(p(n),pu(()=>(t===0&&(r=ca(()=>e(()=>ki(n)))),t+=1,()=>{mr(()=>{t-=1,t===0&&(r==null||r(),r=void 0,ki(n))})})))}}var iw=Zr|$s;function aw(e,t,n,r){new ow(e,t,n,r)}var Ht,qi,sn,vs,Mt,ln,Nt,Kt,ar,xs,$r,wl,Qi,Yi,or,Ho,ze,xv,yv,wv,dd,oo,uo,fd,hd;class ow{constructor(t,n,r,s){ie(this,ze);ne(this,"parent");ne(this,"is_pending",!1);ne(this,"transform_error");ie(this,Ht);ie(this,qi,he?fe:null);ie(this,sn);ie(this,vs);ie(this,Mt);ie(this,ln,null);ie(this,Nt,null);ie(this,Kt,null);ie(this,ar,null);ie(this,xs,0);ie(this,$r,0);ie(this,wl,!1);ie(this,Qi,new Set);ie(this,Yi,new Set);ie(this,or,null);ie(this,Ho,lw(()=>(re(this,or,oa(S(this,xs))),()=>{re(this,or,null)})));var l;re(this,Ht,t),re(this,sn,n),re(this,vs,a=>{var o=ce;o.b=this,o.f|=ed,r(a)}),this.parent=ce.b,this.transform_error=s??((l=this.parent)==null?void 0:l.transform_error)??(a=>a),re(this,Mt,da(()=>{if(he){const a=S(this,qi);Ls();const o=a.data===ev;if(a.data.startsWith(lp)){const c=JSON.parse(a.data.slice(lp.length));me(this,ze,yv).call(this,c)}else o?me(this,ze,wv).call(this):me(this,ze,xv).call(this)}else me(this,ze,dd).call(this)},iw)),he&&re(this,Ht,fe)}defer_effect(t){dv(t,S(this,Qi),S(this,Yi))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!S(this,sn).pending}update_pending_count(t,n){me(this,ze,fd).call(this,t,n),re(this,xs,S(this,xs)+t),!(!S(this,or)||S(this,wl))&&(re(this,wl,!0),mr(()=>{re(this,wl,!1),S(this,or)&&Vo(S(this,or),S(this,xs))}))}get_effect_pending(){return S(this,Ho).call(this),p(S(this,or))}error(t){if(!S(this,sn).onerror&&!S(this,sn).failed)throw t;X!=null&&X.is_fork?(S(this,ln)&&X.skip_effect(S(this,ln)),S(this,Nt)&&X.skip_effect(S(this,Nt)),S(this,Kt)&&X.skip_effect(S(this,Kt)),X.on_fork_commit(()=>{me(this,ze,hd).call(this,t)})):me(this,ze,hd).call(this,t)}}Ht=new WeakMap,qi=new WeakMap,sn=new WeakMap,vs=new WeakMap,Mt=new WeakMap,ln=new WeakMap,Nt=new WeakMap,Kt=new WeakMap,ar=new WeakMap,xs=new WeakMap,$r=new WeakMap,wl=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,or=new WeakMap,Ho=new WeakMap,ze=new WeakSet,xv=function(){try{re(this,ln,Bn(()=>S(this,vs).call(this,S(this,Ht))))}catch(t){this.error(t)}},yv=function(t){const n=S(this,sn).failed;n&&re(this,Kt,Bn(()=>{n(S(this,Ht),()=>t,()=>()=>{})}))},wv=function(){const t=S(this,sn).pending;t&&(this.is_pending=!0,re(this,Nt,Bn(()=>t(S(this,Ht)))),mr(()=>{var n=re(this,ar,document.createDocumentFragment()),r=er();n.append(r),re(this,ln,me(this,ze,uo).call(this,()=>Bn(()=>S(this,vs).call(this,r)))),S(this,$r)===0&&(S(this,Ht).before(n),re(this,ar,null),_i(S(this,Nt),()=>{re(this,Nt,null)}),me(this,ze,oo).call(this,X))}))},dd=function(){try{if(this.is_pending=this.has_pending_snippet(),re(this,$r,0),re(this,xs,0),re(this,ln,Bn(()=>{S(this,vs).call(this,S(this,Ht))})),S(this,$r)>0){var t=re(this,ar,document.createDocumentFragment());Bv(S(this,ln),t);const n=S(this,sn).pending;re(this,Nt,Bn(()=>n(S(this,Ht))))}else me(this,ze,oo).call(this,X)}catch(n){this.error(n)}},oo=function(t){this.is_pending=!1,t.transfer_effects(S(this,Qi),S(this,Yi))},uo=function(t){var n=ce,r=ve,s=Ut;tr(S(this,Mt)),xn(S(this,Mt)),Pl(S(this,Mt).ctx);try{return Jr.ensure(),t()}catch(l){return uv(l),null}finally{tr(n),xn(r),Pl(s)}},fd=function(t,n){var r;if(!this.has_pending_snippet()){this.parent&&me(r=this.parent,ze,fd).call(r,t,n);return}re(this,$r,S(this,$r)+t),S(this,$r)===0&&(me(this,ze,oo).call(this,n),S(this,Nt)&&_i(S(this,Nt),()=>{re(this,Nt,null)}),S(this,ar)&&(S(this,Ht).before(S(this,ar)),re(this,ar,null)))},hd=function(t){S(this,ln)&&(ht(S(this,ln)),re(this,ln,null)),S(this,Nt)&&(ht(S(this,Nt)),re(this,Nt,null)),S(this,Kt)&&(ht(S(this,Kt)),re(this,Kt,null)),he&&(Ct(S(this,qi)),bf(),Ct(kf()));var n=S(this,sn).onerror;let r=S(this,sn).failed;var s=!1,l=!1;const a=()=>{if(s){Yy();return}s=!0,l&&Uy(),S(this,Kt)!==null&&_i(S(this,Kt),()=>{re(this,Kt,null)}),me(this,ze,uo).call(this,()=>{me(this,ze,dd).call(this)})},o=u=>{try{l=!0,n==null||n(u,a),l=!1}catch(c){Ir(c,S(this,Mt)&&S(this,Mt).parent)}r&&re(this,Kt,me(this,ze,uo).call(this,()=>{try{return Bn(()=>{var c=ce;c.b=this,c.f|=ed,r(S(this,Ht),()=>u,()=>a)})}catch(c){return Ir(c,S(this,Mt).parent),null}}))};mr(()=>{var u;try{u=this.transform_error(t)}catch(c){Ir(c,S(this,Mt)&&S(this,Mt).parent);return}u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(o,c=>Ir(c,S(this,Mt)&&S(this,Mt).parent)):o(u)})};function bv(e,t,n,r){const s=Ef;var l=e.filter(d=>!d.settled);if(n.length===0&&l.length===0){r(t.map(s));return}var a=ce,o=uw(),u=l.length===1?l[0].promise:l.length>1?Promise.all(l.map(d=>d.promise)):null;function c(d){if(!(a.f&Mn)){o();try{r(d)}catch(w){Ir(w,a)}Uo()}}var f=kv();if(n.length===0){u.then(()=>c(t.map(s))).finally(f);return}function g(){Promise.all(n.map(d=>cw(d))).then(d=>c([...t.map(s),...d])).catch(d=>Ir(d,a)).finally(f)}u?u.then(()=>{o(),g(),Uo()}):g()}function uw(){var e=ce,t=ve,n=Ut,r=X;return function(l=!0){tr(e),xn(t),Pl(n),l&&!(e.f&Mn)&&(r==null||r.activate(),r==null||r.apply())}}function Uo(e=!0){tr(null),xn(null),Pl(null),e&&(X==null||X.deactivate())}function kv(){var e=ce,t=e.b,n=X,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),()=>{t.update_pending_count(-1,n),n.decrement(r,e)}}function Ef(e){var t=mt|at;return ce!==null&&(ce.f|=$s),{ctx:Ut,deps:null,effects:null,equals:Jg,f:t,fn:e,reactions:null,rv:0,v:Qe,wv:0,parent:ce,ac:null}}const Ba=Symbol("obsolete");function cw(e,t,n){let r=ce;r===null&&Py();var s=void 0,l=oa(Qe),a=!ve,o=new Set;return kw(()=>{var w;var u=ce,c=Zg();s=c.promise;try{Promise.resolve(e()).then(c.resolve,y=>{y!==cu&&c.reject(y)}).finally(Uo)}catch(y){c.reject(y),Uo()}var f=X;if(a){if(u.f&rs)var g=kv();if(r.b.is_rendered())(w=f.async_deriveds.get(u))==null||w.reject(Ba);else for(const y of o.values())y.reject(Ba);o.add(c),f.async_deriveds.set(u,c)}const d=(y,N=void 0)=>{g==null||g(),o.delete(c),N!==Ba&&(f.activate(),N?(l.f|=qr,Vo(l,N)):(l.f&qr&&(l.f^=qr),Vo(l,y)),f.deactivate())};c.promise.then(d,y=>d(null,y||"unknown"))}),hu(()=>{for(const u of o)u.reject(Ba)}),new Promise(u=>{function c(f){function g(){f===s?u(l):c(s)}f.then(g,g)}c(s)})}function St(e){const t=Ef(e);return Tv(t),t}function dw(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!Nv&&hw()}return t}function hw(){Nv=!1;for(const e of Fo){e.f&et&&Ge(e,Xn);let t;try{t=ua(e)}catch{t=!0}t&&Ll(e)}Fo.clear()}function ki(e){Q(e,e.v+1)}function Ev(e,t,n){var r=e.reactions;if(r!==null)for(var s=r.length,l=0;l{document.activeElement===n&&e.focus()})}}let cp=!1;function Cv(){cp||(cp=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n[yi])==null||t.call(n)})},{capture:!0}))}function fu(e){var t=ve,n=ce;xn(null),tr(null);try{return e()}finally{xn(t),tr(n)}}function mw(e,t,n,r=n){e.addEventListener(t,()=>fu(n));const s=e[yi];s?e[yi]=()=>{s(),r(!0)}:e[yi]=()=>r(!0),Cv()}let co=!1,br=!1;function dp(e){br=e}let ve=null,Tn=!1;function xn(e){ve=e}let ce=null;function tr(e){ce=e}let mn=null;function Tv(e){ve!==null&&(mn===null?mn=[e]:mn.push(e))}let Rt=null,Ft=0,rn=null;function gw(e){rn=e}let Av=1,fs=0,Ss=fs;function fp(e){Ss=e}function Pv(){return++Av}function ua(e){var t=e.f;if(t&at)return!0;if(t&mt&&(e.f&=~As),t&Xn){for(var n=e.deps,r=n.length,s=0;se.wv)return!0}t&hn&&dt===null&&Ge(e,et)}return!1}function Lv(e,t,n=!0){var r=e.reactions;if(r!==null&&!(mn!==null&&Tl.call(mn,e)))for(var s=0;s{e.ac.abort(cu)}),e.ac=null);try{e.f|=Oo;var f=e.fn,g=f();e.f|=rs;var d=e.deps,w=X==null?void 0:X.is_fork;if(Rt!==null){var y;if(w||Ki(e,Ft),d!==null&&Ft>0)for(d.length=Ft+Rt.length,y=0;y{ht(t)}}function bw(e){Jr.ensure();const t=$n(wr|$s,e);return(n={})=>new Promise(r=>{n.outro?_i(t,()=>{ht(t),r(void 0)}):(ht(t),r(void 0))})}function Af(e){return $n(Al,e)}function kw(e){return $n(dl|$s,e)}function pu(e,t=0){return $n(uu|t,e)}function wt(e,t=[],n=[],r=[]){bv(r,t,n,s=>{$n(uu,()=>e(...s.map(p)))})}function da(e,t=0){var n=$n(Cn|t,e);return n}function zv(e,t=0){var n=$n(yf|t,e);return n}function Bn(e){return $n(Jn|$s,e)}function Iv(e){var t=e.teardown;if(t!==null){const n=br,r=ve;dp(!0),xn(null);try{t.call(null)}finally{dp(n),xn(r)}}}function Pf(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&fu(()=>{s.abort(cu)});var r=n.next;n.f&wr?n.parent=null:ht(n,t),n=r}}function _w(e){for(var t=e.first;t!==null;){var n=t.next;t.f&Jn||ht(t),t=n}}function ht(e,t=!0){var n=!1;(t||e.f&Ny)&&e.nodes!==null&&e.nodes.end!==null&&(Ov(e.nodes.start,e.nodes.end),n=!0),Ge(e,td),Pf(e,t&&!n),Ki(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)l.stop();Iv(e),e.f^=td,e.f|=Mn;var s=e.parent;s!==null&&s.first!==null&&Uv(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Ov(e,t){for(;e!==null;){var n=e===t?null:nr(e);e.remove(),e=n}}function Uv(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function _i(e,t,n=!0){var r=[];Fv(e,r,!0);var s=()=>{n&&ht(e),t&&t()},l=r.length;if(l>0){var a=()=>--l||s();for(var o of r)o.out(a)}else s()}function Fv(e,t,n){if(!(e.f&pn)){e.f^=pn;var r=e.nodes&&e.nodes.t;if(r!==null)for(const o of r)(o.is_global||n)&&t.push(o);for(var s=e.first;s!==null;){var l=s.next;if(!(s.f&wr)){var a=(s.f&Zr)!==0||(s.f&Jn)!==0&&(e.f&Cn)!==0;Fv(s,t,a?n:!1)}s=l}}}function Sw(e){Vv(e,!0)}function Vv(e,t){if(e.f&pn){e.f^=pn,e.f&et||(Ge(e,at),Jr.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&Zr)!==0||(n.f&Jn)!==0;Vv(n,s?t:!1),n=r}var l=e.nodes&&e.nodes.t;if(l!==null)for(const a of l)(a.is_global||t)&&a.in()}}function Bv(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:nr(n);t.append(n),n=s}}function hp(e){const t={get:n=>oi(t.store)[n],set:(n,r)=>{typeof n=="string"?Object.assign(oi(t.store),{[n]:r}):Object.assign(oi(t.store),n),t.store.set(oi(t.store))},store:ew(e)};return t}globalThis.$altcha=globalThis.$altcha||{algorithms:new Map,defaults:hp({}),i18n:hp({}),instances:new Set,plugins:new Set};const Nw={ariaLinkLabel:"Altcha (official website)",cancel:"Cancel",enterCode:"Enter code",enterCodeAria:"Enter code you hear. Press Space to play audio.",enterCodeFromImage:"To proceed, please enter the code from the image below.",error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:'Protected by ALTCHA',getAudioChallenge:"Get an audio challenge",label:"I'm not a robot",loading:"Loading...",reload:"Reload",verify:"Verify",verificationRequired:"Verification required!",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait."};globalThis.$altcha.i18n.set("en",Nw);const jw="5";var Np;typeof window<"u"&&((Np=window.__svelte??(window.__svelte={})).v??(Np.v=new Set)).add(jw);const ps=Symbol("events"),Hv=new Set,pd=new Set;function Kv(e,t,n,r={}){function s(l){if(r.capture||md.call(t,l),!l.cancelBubble)return fu(()=>n==null?void 0:n.call(this,l))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?mr(()=>{t.addEventListener(e,s,r)}):t.addEventListener(e,s,r),s}function Je(e,t,n,r,s){var l={capture:r,passive:s},a=Kv(e,t,n,l);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&hu(()=>{t.removeEventListener(e,a,l)})}function mu(e,t,n){(t[ps]??(t[ps]={}))[e]=n}function gu(e){for(var t=0;t{throw h});throw d}}finally{e[ps]=t,delete e.currentTarget,xn(f),tr(g)}}}var jp;const ec=((jp=globalThis==null?void 0:globalThis.window)==null?void 0:jp.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Ew(e){return(ec==null?void 0:ec.createHTML(e))??e}function Wv(e){var t=_f("template");return t.innerHTML=Ew(e.replaceAll("","")),t.content}function Yt(e,t){var n=ce;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Fe(e,t){var n=(t&Vy)!==0,r=(t&By)!==0,s,l=!e.startsWith("");return()=>{if(he)return Yt(fe,null),fe;s===void 0&&(s=Wv(l?e:""+e),n||(s=Gt(s)));var a=r||iv?document.importNode(s,!0):s.cloneNode(!0);if(n){var o=Gt(a),u=a.lastChild;Yt(o,u)}else Yt(a,a);return a}}function Cw(e,t,n="svg"){var r=!e.startsWith(""),s=`<${n}>${r?e:""+e}`,l;return()=>{if(he)return Yt(fe,null),fe;if(!l){var a=Wv(s),o=Gt(a);l=Gt(o)}var u=l.cloneNode(!0);return Yt(u,u),u}}function Lf(e,t){return Cw(e,t,"svg")}function Ha(e=""){if(!he){var t=er(e+"");return Yt(t,t),t}var n=fe;return n.nodeType!==la?(n.before(n=er()),Ct(n)):du(n),Yt(n,n),n}function mp(){if(he)return Yt(fe,null),fe;var e=document.createDocumentFragment(),t=document.createComment(""),n=er();return e.append(t,n),Yt(t,n),e}function ye(e,t){if(he){var n=ce;(!(n.f&rs)||n.nodes.end===null)&&(n.nodes.end=fe),Ls();return}e!==null&&e.before(t)}function Tw(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const Aw=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Pw(e){return Aw.includes(e)}const Lw={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Mw(e){return e=e.toLowerCase(),Lw[e]??e}const Rw=["touchstart","touchmove"];function $w(e){return Rw.includes(e)}function Wn(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e[ai]??(e[ai]=e.nodeValue))&&(e[ai]=n,e.nodeValue=`${n}`)}function Gv(e,t){return qv(e,t)}function Dw(e,t){ld(),t.intro=t.intro??!1;const n=t.target,r=he,s=fe;try{for(var l=Gt(n);l&&(l.nodeType!==ia||l.data!==wf);)l=nr(l);if(!l)throw Ps;qn(!0),Ct(l);const a=qv(e,{...t,anchor:l});return qn(!1),a}catch(a){if(a instanceof Error&&a.message.split(` + */const Gg=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function vy({branding:e,user:t,activeTab:n,onChangeTab:r,themeMode:s,onChangeThemeMode:l,onLogout:a,onOpenAuth:o,onOpenCreateEvent:u,onOpenTemplates:c,onOpenProfile:f,onOpenAdmin:g,pwaInstallPrompt:d,onInstallPwa:w}){const y=(e==null?void 0:e.primary_color)||"var(--brand-primary)",[N,R]=Si.useState(()=>localStorage.getItem("guest_display_name")||"");Si.useEffect(()=>{const h=()=>{R(localStorage.getItem("guest_display_name")||"")};return window.addEventListener("guest_name_updated",h),window.addEventListener("storage",h),()=>{window.removeEventListener("guest_name_updated",h),window.removeEventListener("storage",h)}},[]);const v=()=>{l(s==="dark"?"light":s==="light"?"auto":"dark")};return i.jsxs("header",{className:"bg-surface border-b border-grid sticky top-0 z-40",children:[i.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center space-x-3 shrink-0",children:[i.jsx("div",{onClick:()=>r("home"),style:{backgroundColor:y},className:"w-8 h-8 rounded-sm flex items-center justify-center text-white font-bold cursor-pointer shadow-sm",children:e!=null&&e.logo_url?i.jsx("img",{src:e.logo_url,alt:"Logo",className:"w-4 h-4 object-contain"}):i.jsx(ra,{className:"w-4 h-4"})}),i.jsxs("div",{onClick:()=>r("home"),className:"cursor-pointer",children:[i.jsx("h1",{className:"font-serif text-base font-bold tracking-tight text-main leading-none",children:(e==null?void 0:e.app_name)||"Schichtplaner"}),i.jsx("div",{className:"text-[10px] font-mono text-muted mt-1 uppercase tracking-wider flex items-center gap-1.5",children:t?i.jsxs("span",{className:"text-emerald-500 font-semibold",children:["[ ",t.display_name||t.username," ]"]}):N?i.jsxs("span",{className:"text-amber-400 font-semibold flex items-center gap-1",children:["[ 👤 GAST: ",N," ]"]}):i.jsx("span",{className:"text-amber-500 font-semibold",children:"[ GAST-MODUS ]"})})]})]}),i.jsxs("nav",{className:"hidden md:flex items-center gap-2",children:[i.jsxs("button",{onClick:()=>r("home"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="home"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[i.jsx(ep,{className:"w-3.5 h-3.5"})," Startseite"]}),i.jsxs("button",{onClick:()=>r("calendar"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="calendar"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[i.jsx(Xh,{className:"w-3.5 h-3.5"})," Kalender"]}),((t==null?void 0:t.is_admin_user)||(t==null?void 0:t.is_staff)||(t==null?void 0:t.is_superuser))&&i.jsxs("button",{onClick:()=>r("admin"),className:`px-3 py-1.5 rounded-sm text-xs font-mono transition flex items-center gap-1.5 border ${n==="admin"?"bg-surface-hover text-main font-bold border-grid":"text-muted hover:text-main border-transparent"}`,children:[i.jsx(np,{className:"w-3.5 h-3.5 text-indigo-400"})," Admin"]})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("button",{onClick:v,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5",title:`Design-Modus: ${s.toUpperCase()}`,children:s==="dark"?i.jsxs(i.Fragment,{children:[i.jsx(oy,{className:"w-3.5 h-3.5 text-indigo-400"}),i.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"DARK"})]}):s==="light"?i.jsxs(i.Fragment,{children:[i.jsx(py,{className:"w-3.5 h-3.5 text-amber-500"}),i.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"LIGHT"})]}):i.jsxs(i.Fragment,{children:[i.jsx(ay,{className:"w-3.5 h-3.5 text-blue-500"}),i.jsx("span",{className:"hidden lg:inline text-[11px] font-bold",children:"AUTO"})]})}),d&&i.jsxs("button",{onClick:w,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-emerald-500/10 text-emerald-500 border border-emerald-500/20 hover:bg-emerald-500/20 transition flex items-center gap-1",children:[i.jsx(Kg,{className:"w-3 h-3"})," PWA"]}),t?i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:u,style:{backgroundColor:y},className:"h-8 px-3 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 shadow-sm hover:brightness-110",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," Event"]}),i.jsxs("button",{onClick:c,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition hidden sm:flex items-center gap-1",title:"Vorlagen",children:[i.jsx(ou,{className:"w-3.5 h-3.5 text-muted"})," Vorlagen"]}),i.jsxs("button",{onClick:f,className:"h-8 px-2.5 rounded-sm text-xs font-mono bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1",title:"Profil & Namen ändern",children:[i.jsx(Bi,{className:"w-3.5 h-3.5 text-amber-500"})," Profil"]}),(t.is_admin_user||t.is_staff||t.is_superuser)&&i.jsxs("button",{onClick:()=>r("admin"),className:`h-8 px-2.5 rounded-sm text-xs font-mono transition flex items-center gap-1 border ${n==="admin"?"bg-indigo-500/20 text-indigo-300 border-indigo-500/40 font-bold":"bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border-indigo-500/30"}`,title:"Admin-Zentrale",children:[i.jsx(np,{className:"w-3.5 h-3.5"})," Admin"]}),i.jsx("div",{className:"h-4 w-px bg-grid mx-1"}),i.jsx("button",{onClick:a,className:"h-8 w-8 rounded-sm text-muted hover:text-red-500 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition flex items-center justify-center",title:"Abmelden",children:i.jsx(iy,{className:"w-3.5 h-3.5"})})]}):i.jsxs("button",{onClick:o,style:{backgroundColor:y},className:"h-8 px-3.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 flex items-center gap-1.5 shadow-sm",children:[i.jsx(so,{className:"w-3.5 h-3.5"})," Anmelden"]})]})]}),i.jsxs("div",{className:"flex md:hidden items-center justify-around border-t border-grid py-2 bg-subtle text-xs font-mono",children:[i.jsxs("button",{onClick:()=>r("home"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="home"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[i.jsx(ep,{className:"w-3.5 h-3.5"})," Start"]}),i.jsxs("button",{onClick:()=>r("calendar"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="calendar"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[i.jsx(Xh,{className:"w-3.5 h-3.5"})," Termine"]}),i.jsxs("button",{onClick:()=>r("schedule"),className:`flex items-center gap-1 px-3 py-1.5 rounded-sm border ${n==="schedule"?"text-main font-bold bg-surface border-grid":"text-muted border-transparent"}`,children:[i.jsx(my,{className:"w-3.5 h-3.5"})," Schichtplan"]})]})]})}function xy({event:e,user:t,onSignupClick:n,onCancelClick:r,onRemoveUserFromShift:s,onGenerateClaimLink:l,onExportPdf:a,onPrintView:o,onEditEvent:u,onDeleteEvent:c}){var N,R,v;const[f,g]=Si.useState(()=>localStorage.getItem("guest_display_name")||"");if(Si.useEffect(()=>{const h=()=>g(localStorage.getItem("guest_display_name")||"");return window.addEventListener("guest_name_updated",h),window.addEventListener("storage",h),()=>{window.removeEventListener("guest_name_updated",h),window.removeEventListener("storage",h)}},[]),!e||!e.task_areas||e.task_areas.length===0)return i.jsxs("div",{className:"hallmark-panel rounded-sm p-12 text-center border border-grid font-mono",children:[i.jsx(Vi,{className:"w-8 h-8 text-muted mx-auto mb-3"}),i.jsx("h3",{className:"font-serif text-xl font-bold text-main uppercase",children:"Keine Aufgabenfelder vorhanden"}),i.jsx("p",{className:"text-xs text-muted mt-1 mb-4",children:"[ Event hat noch keine definierten Aufgabenfelder oder Schichten ]"}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((N=e==null?void 0:e.created_by)==null?void 0:N.id)===t.id||(e==null?void 0:e.co_managers)&&e.co_managers.some(h=>typeof h=="object"?h.id===t.id:h===t.id))&&u&&i.jsxs("button",{onClick:()=>u(e),className:"px-4 py-2 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 font-bold text-xs inline-flex items-center gap-2",children:[i.jsx(Bi,{className:"w-4 h-4"})," SCHICHTEN & BEREICHE ANLEGEN"]})]});const d=!t,w=t&&(e==null?void 0:e.co_managers)&&e.co_managers.some(h=>typeof h=="object"?h.id===t.id:h===t.id),y=t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((R=e==null?void 0:e.created_by)==null?void 0:R.id)===t.id||w);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col md:flex-row md:items-center justify-between gap-4",children:[i.jsxs("div",{className:"space-y-1 font-mono",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted mb-1",children:[i.jsxs("span",{className:"bg-subtle px-2.5 py-0.5 rounded-sm border border-grid font-bold text-main",children:[new Date(e.start_date).toLocaleDateString("de-DE")," — ",new Date(e.end_date).toLocaleDateString("de-DE")]}),e.location&&i.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[i.jsx(vf,{className:"w-3.5 h-3.5 shrink-0"}),e.location]}),e.is_active===!1&&i.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-amber-500/10 text-amber-500 border border-amber-500/20 font-bold",children:"[ DEAKTIVIERT ]"})]}),i.jsx("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main",children:e.title}),e.description&&i.jsx("p",{className:"text-xs font-sans text-muted max-w-2xl mt-1",children:e.description})]}),i.jsxs("div",{className:"flex items-center gap-2 no-print font-mono text-xs shrink-0",children:[y&&u&&i.jsxs("button",{onClick:()=>u(e),className:"px-3.5 py-1.5 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 border border-indigo-500/30 transition flex items-center gap-1.5 font-bold",title:"Schichten und Aufgabenbereiche für diese Veranstaltung bearbeiten",children:[i.jsx(Bi,{className:"w-3.5 h-3.5"})," SCHICHTEN BEARBEITEN"]}),t&&(t.is_admin_user||t.is_staff||t.is_superuser||(e==null?void 0:e.created_by)===t.id||((v=e==null?void 0:e.created_by)==null?void 0:v.id)===t.id)&&c&&i.jsxs("button",{onClick:()=>c(e),className:"px-3.5 py-1.5 rounded-sm bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/30 transition flex items-center gap-1.5 font-bold",title:"Diese Veranstaltung unwiderruflich löschen",children:[i.jsx(cn,{className:"w-3.5 h-3.5"})," LÖSCHEN"]}),i.jsxs("button",{onClick:o,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[i.jsx(cy,{className:"w-3.5 h-3.5"})," DRUCKEN"]}),i.jsxs("button",{onClick:a,className:"px-3.5 py-1.5 rounded-sm bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 font-bold",children:[i.jsx(ry,{className:"w-3.5 h-3.5"})," PDF"]})]})]}),d&&i.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Hg,{className:"w-4 h-4 shrink-0 text-amber-500"}),i.jsxs("span",{children:["[ GAST-DATENSCHUTZ ]: Belegungszahlen sichtbar, Namensanzeige aus Datenschutzgründen ",i.jsx("strong",{children:"anonymisiert"}),"."]})]}),i.jsx("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-subtle border-b border-grid text-[11px] font-mono text-muted uppercase tracking-wider",children:[i.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Aufgabenfeld"}),i.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Schicht & Zeitraum"}),i.jsx("th",{className:"py-3.5 px-4 w-1/6",children:"Qualifikation"}),i.jsx("th",{className:"py-3.5 px-4 w-1/4",children:"Belegung & Personen"}),i.jsx("th",{className:"py-3.5 px-4 w-1/6 text-right",children:"Aktion"})]})}),i.jsx("tbody",{className:"divide-y divide-grid text-xs font-sans",children:e.task_areas.map(h=>!h.shifts||h.shifts.length===0?i.jsxs("tr",{children:[i.jsx("td",{className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase",children:h.name}),i.jsx("td",{colSpan:4,className:"py-3.5 px-4 text-muted font-mono text-[11px]",children:"[ Keine Schichten angelegt ]"})]},`area-${h.id}`):h.shifts.map((m,_)=>{const C=_===0,E=m.is_full,L=!!(t?m.signups.find(P=>!P.is_guest&&P.display_name===t.display_name):null),G=m.required_skills&&m.required_skills.length>0;return i.jsxs("tr",{className:"hover:bg-surface-hover/60 transition",children:[C?i.jsxs("td",{rowSpan:h.shifts.length,className:"py-3.5 px-4 font-serif text-lg font-bold text-main uppercase bg-subtle/80 align-top border-r border-grid",children:[i.jsx("div",{children:h.name}),h.description&&i.jsx("div",{className:"text-[11px] font-sans font-normal text-muted mt-0.5",children:h.description})]}):null,i.jsxs("td",{className:"py-3.5 px-4",children:[i.jsxs("div",{className:"font-semibold text-main flex items-center gap-2 flex-wrap",children:[i.jsx("span",{children:m.title}),m.date&&i.jsxs("span",{className:"text-[10px] font-mono font-bold text-indigo-400 bg-indigo-500/10 px-2 py-0.5 rounded-sm border border-indigo-500/20",children:["📅 ",new Date(m.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"})]})]}),i.jsxs("div",{className:"text-[11px] font-mono text-muted flex items-center gap-1 mt-0.5",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted shrink-0"}),i.jsxs("span",{children:[m.start_time," — ",m.end_time," Uhr"]})]})]}),i.jsx("td",{className:"py-3.5 px-4 font-mono",children:G?i.jsx("div",{className:"flex flex-wrap gap-1",children:m.required_skills.map(P=>i.jsxs("span",{style:{backgroundColor:`${P.color}15`,borderColor:`${P.color}35`,color:P.color},className:"px-2 py-0.5 rounded-sm text-[10px] font-semibold border flex items-center gap-1",children:[i.jsx(ey,{className:"w-3 h-3 shrink-0"})," ",P.name]},P.id))}):i.jsx("span",{className:"text-[11px] text-muted",children:"—"})}),i.jsxs("td",{className:"py-3.5 px-4 font-mono",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs("span",{className:`px-2 py-0.5 rounded-sm text-[11px] font-bold border ${E?"bg-red-500/10 text-red-500 border-red-500/20":"bg-emerald-500/10 text-emerald-500 border-emerald-500/20"}`,children:["[ ",m.signups_count," / ",m.max_participants," BELEGT ]"]})}),i.jsx("div",{className:"mt-2 space-y-1 font-sans",children:m.signups.map(P=>{var ae;const Y=d&&P.is_guest&&(P.is_self||f&&((ae=P.display_name)==null?void 0:ae.trim().toLowerCase())===f.trim().toLowerCase());return i.jsxs("div",{className:`text-[11px] text-muted flex items-center justify-between gap-2 p-1.5 rounded-sm border ${Y?"bg-amber-500/10 border-amber-500/30":"bg-subtle border-grid"}`,children:[i.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[i.jsx(xf,{className:`w-3 h-3 shrink-0 ${Y?"text-amber-400":"text-muted"}`}),i.jsx("span",{className:`truncate ${Y?"font-bold text-amber-300":""}`,children:P.display_name}),P.is_guest&&i.jsx("span",{className:"text-[9px] font-mono text-amber-500 px-1 rounded-sm bg-amber-500/10 border border-amber-500/20 font-bold",children:"GAST"}),Y&&i.jsx("span",{className:"text-[9px] font-mono text-emerald-400 px-1 rounded-sm bg-emerald-500/10 border border-emerald-500/20 font-bold",children:"DU"})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t&&P.is_guest&&l&&i.jsxs("button",{onClick:()=>l(P),className:"text-indigo-400 hover:text-indigo-300 transition p-1 rounded-sm bg-indigo-500/10 hover:bg-indigo-500/20 border border-indigo-500/20 flex items-center gap-1 text-[10px] font-mono font-bold",title:"Konto-Einladungslink für diese Gast-Eintragung kopieren",children:[i.jsx(gy,{className:"w-3 h-3"})," LINK"]}),y&&s&&i.jsx("button",{onClick:()=>s(m,P.id),className:"text-muted hover:text-red-500 transition p-1 rounded-sm hover:bg-red-500/10",title:"Person aus dieser Schicht entfernen",children:i.jsx(rp,{className:"w-3.5 h-3.5"})})]})]},P.id)})})]}),i.jsx("td",{className:"py-3.5 px-4 text-right font-mono",children:L?i.jsxs("button",{onClick:()=>r(m),className:"px-3 py-1.5 rounded-sm text-xs font-semibold bg-red-500/10 hover:bg-red-500/20 text-red-500 border border-red-500/20 transition flex items-center gap-1 ml-auto",children:[i.jsx(rp,{className:"w-3.5 h-3.5"})," AUSTRAGEN"]}):E?i.jsx("span",{className:"text-xs text-muted font-bold",children:"[ VOLL ]"}):i.jsxs("button",{onClick:()=>n(m),style:{backgroundColor:"var(--brand-primary)"},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 flex items-center gap-1 ml-auto shadow-sm",children:[i.jsx(Ln,{className:"w-3.5 h-3.5"})," EINTRAGEN"]})})]},`shift-${m.id}`)}))})]})})})]})}const qg=!1;var Qg=Array.isArray,yy=Array.prototype.indexOf,Tl=Array.prototype.includes,wy=Array.from,zo=Object.keys,Hi=Object.defineProperty,cl=Object.getOwnPropertyDescriptor,by=Object.getOwnPropertyDescriptors,ky=Object.prototype,_y=Array.prototype,Yg=Object.getPrototypeOf,sp=Object.isExtensible;const Gr=()=>{};function Sy(e){for(var t=0;t{e=r,t=s});return{promise:n,resolve:e,reject:t}}const mt=2,Al=4,uu=8,yf=1<<24,Cn=16,Jn=32,wr=64,ed=128,hn=512,et=1024,at=2048,Xn=4096,pn=8192,Mn=16384,rs=32768,td=1<<25,Zr=65536,Io=1<<17,Ny=1<<18,$s=1<<19,jy=1<<20,As=65536,Oo=1<<21,dl=1<<22,qr=1<<23,fl=Symbol("$state"),Ey=Symbol("legacy props"),Cy=Symbol(""),lo=Symbol("attributes"),nd=Symbol("class"),rd=Symbol("style"),ai=Symbol("text"),yi=Symbol("form reset"),cu=new class extends Error{constructor(){super(...arguments);ne(this,"name","StaleReactionError");ne(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var Sp;const sa=!!((Sp=globalThis.document)!=null&&Sp.contentType)&&globalThis.document.contentType.includes("xml"),la=3,ia=8;function Jg(e){return e===this.v}function Xg(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Ty(e){return!Xg(e,this.v)}function Ay(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Py(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ly(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function My(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ry(e){throw new Error("https://svelte.dev/e/effect_orphan")}function $y(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Dy(){throw new Error("https://svelte.dev/e/hydration_failed")}function zy(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Iy(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Oy(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Uy(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let Fy=!1;const Vy=1,By=2,wf="[",ev="[!",lp="[?",tv="]",Ps={},Qe=Symbol("uninitialized"),nv="http://www.w3.org/1999/xhtml",Hy="http://www.w3.org/2000/svg",Ky="http://www.w3.org/1998/Math/MathML",Wy="@attach";let Ut=null;function Pl(e){Ut=e}function _r(e,t=!1,n){Ut={p:Ut,i:!1,c:null,e:null,s:e,x:null,r:ce,l:null}}function Sr(e){var t=Ut,n=t.e;if(n!==null){t.e=null;for(var r of n)Dv(r)}return e!==void 0&&(t.x=e),t.i=!0,Ut=t.p,e??{}}function rv(){return!0}let ds=[];function sv(){var e=ds;ds=[],Sy(e)}function mr(e){if(ds.length===0&&!bi){var t=ds;queueMicrotask(()=>{t===ds&&sv()})}ds.push(e)}function Gy(){for(;ds.length>0;)sv()}function qy(){console.warn("https://svelte.dev/e/derived_inert")}function aa(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Qy(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Yy(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let he=!1;function qn(e){he=e}let fe;function Ct(e){if(e===null)throw aa(),Ps;return fe=e}function Ls(){return Ct(nr(fe))}function $e(e){if(he){if(nr(fe)!==null)throw aa(),Ps;fe=e}}function bf(e=1){if(he){for(var t=e,n=fe;t--;)n=nr(n);fe=n}}function kf(e=!0){for(var t=0,n=fe;;){if(n.nodeType===ia){var r=n.data;if(r===tv){if(t===0)return n;t-=1}else(r===wf||r===ev||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=nr(n);e&&n.remove(),n=s}}function lv(e){if(!e||e.nodeType!==ia)throw aa(),Ps;return e.data}function hr(e){if(typeof e!="object"||e===null||fl in e)return e;const t=Yg(e);if(t!==ky&&t!==_y)return e;var n=new Map,r=Qg(e),s=ge(0),l=Ss,a=o=>{if(Ss===l)return o();var u=ve,c=Ss;xn(null),fp(l);var f=o();return xn(u),fp(c),f};return r&&n.set("length",ge(e.length)),new Proxy(e,{defineProperty(o,u,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&zy();var f=n.get(u);return f===void 0?a(()=>{var g=ge(c.value);return n.set(u,g),g}):Q(f,c.value,!0),!0},deleteProperty(o,u){var c=n.get(u);if(c===void 0){if(u in o){const f=a(()=>ge(Qe));n.set(u,f),ki(s)}}else Q(c,Qe),ki(s);return!0},get(o,u,c){var w;if(u===fl)return e;var f=n.get(u),g=u in o;if(f===void 0&&(!g||(w=cl(o,u))!=null&&w.writable)&&(f=a(()=>{var y=hr(g?o[u]:Qe),N=ge(y);return N}),n.set(u,f)),f!==void 0){var d=p(f);return d===Qe?void 0:d}return Reflect.get(o,u,c)},getOwnPropertyDescriptor(o,u){var c=Reflect.getOwnPropertyDescriptor(o,u);if(c&&"value"in c){var f=n.get(u);f&&(c.value=p(f))}else if(c===void 0){var g=n.get(u),d=g==null?void 0:g.v;if(g!==void 0&&d!==Qe)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return c},has(o,u){var d;if(u===fl)return!0;var c=n.get(u),f=c!==void 0&&c.v!==Qe||Reflect.has(o,u);if(c!==void 0||ce!==null&&(!f||(d=cl(o,u))!=null&&d.writable)){c===void 0&&(c=a(()=>{var w=f?hr(o[u]):Qe,y=ge(w);return y}),n.set(u,c));var g=p(c);if(g===Qe)return!1}return f},set(o,u,c,f){var m;var g=n.get(u),d=u in o;if(r&&u==="length")for(var w=c;wge(Qe)),n.set(w+"",y))}if(g===void 0)(!d||(m=cl(o,u))!=null&&m.writable)&&(g=a(()=>ge(void 0)),Q(g,hr(c)),n.set(u,g));else{d=g.v!==Qe;var N=a(()=>hr(c));Q(g,N)}var R=Reflect.getOwnPropertyDescriptor(o,u);if(R!=null&&R.set&&R.set.call(f,c),!d){if(r&&typeof u=="string"){var v=n.get("length"),h=Number(u);Number.isInteger(h)&&h>=v.v&&Q(v,h+1)}ki(s)}return!0},ownKeys(o){p(s);var u=Reflect.ownKeys(o).filter(g=>{var d=n.get(g);return d===void 0||d.v!==Qe});for(var[c,f]of n)f.v!==Qe&&!(c in o)&&u.push(c);return u},setPrototypeOf(){Iy()}})}function ip(e){try{if(e!==null&&typeof e=="object"&&fl in e)return e[fl]}catch{}return e}function Zy(e,t){return Object.is(ip(e),ip(t))}var ks,sd,iv,av,ov;function ld(){if(ks===void 0){ks=window,sd=document,iv=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;av=cl(t,"firstChild").get,ov=cl(t,"nextSibling").get,sp(e)&&(e[nd]=void 0,e[lo]=null,e[rd]=void 0,e.__e=void 0),sp(n)&&(n[ai]=void 0)}}function er(e=""){return document.createTextNode(e)}function Gt(e){return av.call(e)}function nr(e){return ov.call(e)}function Ve(e,t){if(!he)return Gt(e);var n=Gt(fe);if(n===null)n=fe.appendChild(er());else if(t&&n.nodeType!==la){var r=er();return n==null||n.before(r),Ct(r),r}return t&&du(n),Ct(n),n}function Bs(e,t=!1){if(!he){var n=Gt(e);return n instanceof Comment&&n.data===""?nr(n):n}if(t){if((fe==null?void 0:fe.nodeType)!==la){var r=er();return fe==null||fe.before(r),Ct(r),r}du(fe)}return fe}function Ie(e,t=1,n=!1){let r=he?fe:e;for(var s;t--;)s=r,r=nr(r);if(!he)return r;if(n){if((r==null?void 0:r.nodeType)!==la){var l=er();return r===null?s==null||s.after(l):r.before(l),Ct(l),l}du(r)}return Ct(r),r}function Jy(e){e.textContent=""}function _f(e,t,n){return document.createElementNS(t??nv,e,void 0)}function du(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===la;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function uv(e){var t=ce;if(t===null)return ve.f|=qr,e;if(!(t.f&rs)&&!(t.f&Al))throw e;Ir(e,t)}function Ir(e,t){for(;t!==null;){if(t.f&ed){if(!(t.f&rs))throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const Xy=-7169;function Ge(e,t){e.f=e.f&Xy|t}function Sf(e){e.f&hn||e.deps===null?Ge(e,et):Ge(e,Xn)}function cv(e){if(e!==null)for(const t of e)!(t.f&mt)||!(t.f&As)||(t.f^=As,cv(t.deps))}function dv(e,t,n){e.f&at?t.add(e):e.f&Xn&&n.add(e),cv(e.deps),Ge(e,et)}function fv(e,t,n){if(e==null)return t(void 0),Gr;const r=ca(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const Fs=[];function ew(e,t=Gr){let n=null;const r=new Set;function s(o){if(Xg(e,o)&&(e=o,n)){const u=!Fs.length;for(const c of r)c[1](),Fs.push(c,e);if(u){for(let c=0;c{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:s,update:l,subscribe:a}}function oi(e){let t;return fv(e,n=>t=n)(),t}let id=Symbol("unmounted");function ap(e,t,n){const r=n[t]??(n[t]={store:null,source:jv(void 0),unsubscribe:Gr});if(r.store!==e&&!(id in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=Gr;else{var s=!0;r.unsubscribe=fv(e,l=>{s?r.source.v=l:Q(r.source,l)}),s=!1}return e&&id in n?oi(e):p(r.source)}function tw(){const e={};function t(){hu(()=>{for(var n in e)e[n].unsubscribe();Hi(e,id,{enumerable:!1,value:!0})})}return[e,t]}let Ju=null,Vs=null,X=null,wi=null,dt=null,ad=null,bi=!1,Xu=!1,rl=null,io=null;var op=0;let nw=1;var pl,Mr,ms,ml,gl,gs,vl,ir,Wi,Bt,Gi,Rr,Hn,Kn,xl,yl,Se,od,ui,ud,hv,pv,ao,rw,cd,Hs;const Bo=class Bo{constructor(){ie(this,Se);ne(this,"id",nw++);ie(this,pl,!1);ne(this,"linked",!0);ie(this,Mr,null);ie(this,ms,null);ne(this,"async_deriveds",new Map);ne(this,"current",new Map);ne(this,"previous",new Map);ne(this,"unblocked",new Set);ie(this,ml,new Set);ie(this,gl,new Set);ie(this,gs,new Set);ie(this,vl,0);ie(this,ir,new Map);ie(this,Wi,null);ie(this,Bt,[]);ie(this,Gi,[]);ie(this,Rr,new Set);ie(this,Hn,new Set);ie(this,Kn,new Map);ie(this,xl,new Set);ne(this,"is_fork",!1);ie(this,yl,!1)}skip_effect(t){S(this,Kn).has(t)||S(this,Kn).set(t,{d:[],m:[]}),S(this,xl).delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=S(this,Kn).get(t);if(r){S(this,Kn).delete(t);for(var s of r.d)Ge(s,at),n(s);for(s of r.m)Ge(s,Xn),n(s)}S(this,xl).add(t)}capture(t,n,r=!1){t.v!==Qe&&!this.previous.has(t)&&this.previous.set(t,t.v),t.f&qr||(this.current.set(t,[n,r]),dt==null||dt.set(t,n)),this.is_fork||(t.v=n)}activate(){X=this}deactivate(){X=null,dt=null}flush(){try{Xu=!0,X=this,me(this,Se,ui).call(this)}finally{op=0,ad=null,rl=null,io=null,Xu=!1,X=null,dt=null,_s.clear()}}discard(){for(const t of S(this,gl))t(this);S(this,gl).clear(),S(this,gs).clear(),me(this,Se,Hs).call(this)}register_created_effect(t){S(this,Gi).push(t)}increment(t,n){if(re(this,vl,S(this,vl)+1),t){let r=S(this,ir).get(n)??0;S(this,ir).set(n,r+1)}}decrement(t,n){if(re(this,vl,S(this,vl)-1),t){let r=S(this,ir).get(n)??0;r===1?S(this,ir).delete(n):S(this,ir).set(n,r-1)}S(this,yl)||(re(this,yl,!0),mr(()=>{re(this,yl,!1),this.linked&&this.flush()}))}transfer_effects(t,n){for(const r of t)S(this,Rr).add(r);for(const r of n)S(this,Hn).add(r);t.clear(),n.clear()}oncommit(t){S(this,ml).add(t)}ondiscard(t){S(this,gl).add(t)}on_fork_commit(t){S(this,gs).add(t)}run_fork_commit_callbacks(){for(const t of S(this,gs))t(this);S(this,gs).clear()}settled(){return(S(this,Wi)??re(this,Wi,Zg())).promise}static ensure(){var t;if(X===null){const n=X=new Bo;me(t=n,Se,cd).call(t),!Xu&&!bi&&mr(()=>{S(n,pl)||n.flush()})}return X}apply(){{dt=null;return}}schedule(t){var s;if(ad=t,(s=t.b)!=null&&s.is_pending&&t.f&(Al|uu|yf)&&!(t.f&rs)){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(rl!==null&&n===ce&&(ve===null||!(ve.f&mt)))return;if(r&(wr|Jn)){if(!(r&et))return;n.f^=et}}S(this,Bt).push(n)}};pl=new WeakMap,Mr=new WeakMap,ms=new WeakMap,ml=new WeakMap,gl=new WeakMap,gs=new WeakMap,vl=new WeakMap,ir=new WeakMap,Wi=new WeakMap,Bt=new WeakMap,Gi=new WeakMap,Rr=new WeakMap,Hn=new WeakMap,Kn=new WeakMap,xl=new WeakMap,yl=new WeakMap,Se=new WeakSet,od=function(){if(this.is_fork)return!0;for(const r of S(this,ir).keys()){for(var t=r,n=!1;t.parent!==null;){if(S(this,Kn).has(t)){n=!0;break}t=t.parent}if(!n)return!0}return!1},ui=function(){var u,c,f,g;if(re(this,pl,!0),op++>1e3&&(me(this,Se,Hs).call(this),sw()),!me(this,Se,od).call(this)){for(const d of S(this,Rr))S(this,Hn).delete(d),Ge(d,at),this.schedule(d);for(const d of S(this,Hn))Ge(d,Xn),this.schedule(d)}const t=S(this,Bt);re(this,Bt,[]),this.apply();var n=rl=[],r=[],s=io=[];for(const d of t)try{me(this,Se,ud).call(this,d,n,r)}catch(w){throw vv(d),w}if(X=null,s.length>0){var l=Bo.ensure();for(const d of s)l.schedule(d)}if(rl=null,io=null,me(this,Se,od).call(this)){me(this,Se,ao).call(this,r),me(this,Se,ao).call(this,n);for(const[d,w]of S(this,Kn))gv(d,w);s.length>0&&me(u=X,Se,ui).call(u);return}const a=me(this,Se,hv).call(this);if(a){me(c=a,Se,pv).call(c,this);return}S(this,Rr).clear(),S(this,Hn).clear();for(const d of S(this,ml))d(this);S(this,ml).clear(),wi=this,up(r),up(n),wi=null,(f=S(this,Wi))==null||f.resolve();var o=X;if(this.linked&&S(this,vl)===0&&me(this,Se,Hs).call(this),S(this,Bt).length>0){o===null&&(o=this,me(this,Se,cd).call(this));const d=o;S(d,Bt).push(...S(this,Bt).filter(w=>!S(d,Bt).includes(w)))}o!==null&&me(g=o,Se,ui).call(g)},ud=function(t,n,r){t.f^=et;for(var s=t.first;s!==null;){var l=s.f,a=(l&(Jn|wr))!==0,o=a&&(l&et)!==0,u=o||(l&pn)!==0||S(this,Kn).has(s);if(!u&&s.fn!==null){a?s.f^=et:l&Al?n.push(s):ua(s)&&(l&Cn&&S(this,Hn).add(s),Ll(s));var c=s.first;if(c!==null){s=c;continue}}for(;s!==null;){var f=s.next;if(f!==null){s=f;break}s=s.parent}}},hv=function(){for(var t=S(this,Mr);t!==null;){if(!t.is_fork){for(const[n,[,r]]of this.current)if(t.current.has(n)&&!r)return t}t=S(t,Mr)}return null},pv=function(t){var r;for(const[s,l]of t.current)!this.previous.has(s)&&t.previous.has(s)&&this.previous.set(s,t.previous.get(s)),this.current.set(s,l);for(const[s,l]of t.async_deriveds){const a=this.async_deriveds.get(s);a&&l.promise.then(a.resolve)}const n=s=>{var l=s.reactions;if(l!==null)for(const u of l){var a=u.f;if(a&mt)n(u);else{var o=u;a&(dl|Cn)&&!this.async_deriveds.has(o)&&(S(this,Hn).delete(o),Ge(o,at),this.schedule(o))}}};for(const s of this.current.keys())n(s);this.oncommit(()=>t.discard()),me(r=t,Se,Hs).call(r),X=this,me(this,Se,ui).call(this)},ao=function(t){for(var n=0;n!this.current.has(d));if(s.length===0)t&&g.discard();else if(n.length>0){if(t)for(const d of S(this,xl))g.unskip_effect(d,w=>{var y;w.f&(Cn|dl)?g.schedule(w):me(y=g,Se,ao).call(y,[w])});g.activate();var l=new Set,a=new Map;for(var o of n)mv(o,s,l,a);a=new Map;var u=[...g.current.keys()].filter(d=>this.current.has(d)?this.current.get(d)[0]!==d.v:!0);if(u.length>0)for(const d of S(this,Gi))!(d.f&(Mn|pn|Io))&&Nf(d,u,a)&&(d.f&(dl|Cn)?(Ge(d,at),g.schedule(d)):S(g,Rr).add(d));if(S(g,Bt).length>0){g.apply();for(var c of S(g,Bt))me(f=g,Se,ud).call(f,c,[],[]);re(g,Bt,[])}g.deactivate()}}}},cd=function(){Vs===null?Ju=Vs=this:(re(Vs,ms,this),re(this,Mr,Vs)),Vs=this},Hs=function(){var t=S(this,Mr),n=S(this,ms);t===null?Ju=n:re(t,ms,n),n===null?Vs=t:re(n,Mr,t),this.linked=!1};let Jr=Bo;function Pe(e){var t=bi;bi=!0;try{for(var n;;){if(Gy(),X===null)return n;X.flush()}}finally{bi=t}}function sw(){try{$y()}catch(e){Ir(e,ad)}}let kn=null;function up(e){var t=e.length;if(t!==0){for(var n=0;n0)){_s.clear();for(const s of kn){if(s.f&(Mn|pn))continue;const l=[s];let a=s.parent;for(;a!==null;)kn.has(a)&&(kn.delete(a),l.push(a)),a=a.parent;for(let o=l.length-1;o>=0;o--){const u=l[o];u.f&(Mn|pn)||Ll(u)}}kn.clear()}}kn=null}}function mv(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const l=s.f;l&mt?mv(s,t,n,r):l&(dl|Cn)&&!(l&at)&&Nf(s,t,r)&&(Ge(s,at),jf(s))}}function Nf(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(Tl.call(t,s))return!0;if(s.f&mt&&Nf(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function jf(e){X.schedule(e)}function gv(e,t){if(!(e.f&Jn&&e.f&et)){e.f&at?t.d.push(e):e.f&Xn&&t.m.push(e),Ge(e,et);for(var n=e.first;n!==null;)gv(n,t),n=n.next}}function vv(e){Ge(e,et);for(var t=e.first;t!==null;)vv(t),t=t.next}function lw(e){let t=0,n=oa(0),r;return()=>{Tf()&&(p(n),pu(()=>(t===0&&(r=ca(()=>e(()=>ki(n)))),t+=1,()=>{mr(()=>{t-=1,t===0&&(r==null||r(),r=void 0,ki(n))})})))}}var iw=Zr|$s;function aw(e,t,n,r){new ow(e,t,n,r)}var Ht,qi,sn,vs,Mt,ln,Nt,Kt,ar,xs,$r,wl,Qi,Yi,or,Ho,ze,xv,yv,wv,dd,oo,uo,fd,hd;class ow{constructor(t,n,r,s){ie(this,ze);ne(this,"parent");ne(this,"is_pending",!1);ne(this,"transform_error");ie(this,Ht);ie(this,qi,he?fe:null);ie(this,sn);ie(this,vs);ie(this,Mt);ie(this,ln,null);ie(this,Nt,null);ie(this,Kt,null);ie(this,ar,null);ie(this,xs,0);ie(this,$r,0);ie(this,wl,!1);ie(this,Qi,new Set);ie(this,Yi,new Set);ie(this,or,null);ie(this,Ho,lw(()=>(re(this,or,oa(S(this,xs))),()=>{re(this,or,null)})));var l;re(this,Ht,t),re(this,sn,n),re(this,vs,a=>{var o=ce;o.b=this,o.f|=ed,r(a)}),this.parent=ce.b,this.transform_error=s??((l=this.parent)==null?void 0:l.transform_error)??(a=>a),re(this,Mt,da(()=>{if(he){const a=S(this,qi);Ls();const o=a.data===ev;if(a.data.startsWith(lp)){const c=JSON.parse(a.data.slice(lp.length));me(this,ze,yv).call(this,c)}else o?me(this,ze,wv).call(this):me(this,ze,xv).call(this)}else me(this,ze,dd).call(this)},iw)),he&&re(this,Ht,fe)}defer_effect(t){dv(t,S(this,Qi),S(this,Yi))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!S(this,sn).pending}update_pending_count(t,n){me(this,ze,fd).call(this,t,n),re(this,xs,S(this,xs)+t),!(!S(this,or)||S(this,wl))&&(re(this,wl,!0),mr(()=>{re(this,wl,!1),S(this,or)&&Vo(S(this,or),S(this,xs))}))}get_effect_pending(){return S(this,Ho).call(this),p(S(this,or))}error(t){if(!S(this,sn).onerror&&!S(this,sn).failed)throw t;X!=null&&X.is_fork?(S(this,ln)&&X.skip_effect(S(this,ln)),S(this,Nt)&&X.skip_effect(S(this,Nt)),S(this,Kt)&&X.skip_effect(S(this,Kt)),X.on_fork_commit(()=>{me(this,ze,hd).call(this,t)})):me(this,ze,hd).call(this,t)}}Ht=new WeakMap,qi=new WeakMap,sn=new WeakMap,vs=new WeakMap,Mt=new WeakMap,ln=new WeakMap,Nt=new WeakMap,Kt=new WeakMap,ar=new WeakMap,xs=new WeakMap,$r=new WeakMap,wl=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,or=new WeakMap,Ho=new WeakMap,ze=new WeakSet,xv=function(){try{re(this,ln,Bn(()=>S(this,vs).call(this,S(this,Ht))))}catch(t){this.error(t)}},yv=function(t){const n=S(this,sn).failed;n&&re(this,Kt,Bn(()=>{n(S(this,Ht),()=>t,()=>()=>{})}))},wv=function(){const t=S(this,sn).pending;t&&(this.is_pending=!0,re(this,Nt,Bn(()=>t(S(this,Ht)))),mr(()=>{var n=re(this,ar,document.createDocumentFragment()),r=er();n.append(r),re(this,ln,me(this,ze,uo).call(this,()=>Bn(()=>S(this,vs).call(this,r)))),S(this,$r)===0&&(S(this,Ht).before(n),re(this,ar,null),_i(S(this,Nt),()=>{re(this,Nt,null)}),me(this,ze,oo).call(this,X))}))},dd=function(){try{if(this.is_pending=this.has_pending_snippet(),re(this,$r,0),re(this,xs,0),re(this,ln,Bn(()=>{S(this,vs).call(this,S(this,Ht))})),S(this,$r)>0){var t=re(this,ar,document.createDocumentFragment());Bv(S(this,ln),t);const n=S(this,sn).pending;re(this,Nt,Bn(()=>n(S(this,Ht))))}else me(this,ze,oo).call(this,X)}catch(n){this.error(n)}},oo=function(t){this.is_pending=!1,t.transfer_effects(S(this,Qi),S(this,Yi))},uo=function(t){var n=ce,r=ve,s=Ut;tr(S(this,Mt)),xn(S(this,Mt)),Pl(S(this,Mt).ctx);try{return Jr.ensure(),t()}catch(l){return uv(l),null}finally{tr(n),xn(r),Pl(s)}},fd=function(t,n){var r;if(!this.has_pending_snippet()){this.parent&&me(r=this.parent,ze,fd).call(r,t,n);return}re(this,$r,S(this,$r)+t),S(this,$r)===0&&(me(this,ze,oo).call(this,n),S(this,Nt)&&_i(S(this,Nt),()=>{re(this,Nt,null)}),S(this,ar)&&(S(this,Ht).before(S(this,ar)),re(this,ar,null)))},hd=function(t){S(this,ln)&&(ht(S(this,ln)),re(this,ln,null)),S(this,Nt)&&(ht(S(this,Nt)),re(this,Nt,null)),S(this,Kt)&&(ht(S(this,Kt)),re(this,Kt,null)),he&&(Ct(S(this,qi)),bf(),Ct(kf()));var n=S(this,sn).onerror;let r=S(this,sn).failed;var s=!1,l=!1;const a=()=>{if(s){Yy();return}s=!0,l&&Uy(),S(this,Kt)!==null&&_i(S(this,Kt),()=>{re(this,Kt,null)}),me(this,ze,uo).call(this,()=>{me(this,ze,dd).call(this)})},o=u=>{try{l=!0,n==null||n(u,a),l=!1}catch(c){Ir(c,S(this,Mt)&&S(this,Mt).parent)}r&&re(this,Kt,me(this,ze,uo).call(this,()=>{try{return Bn(()=>{var c=ce;c.b=this,c.f|=ed,r(S(this,Ht),()=>u,()=>a)})}catch(c){return Ir(c,S(this,Mt).parent),null}}))};mr(()=>{var u;try{u=this.transform_error(t)}catch(c){Ir(c,S(this,Mt)&&S(this,Mt).parent);return}u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(o,c=>Ir(c,S(this,Mt)&&S(this,Mt).parent)):o(u)})};function bv(e,t,n,r){const s=Ef;var l=e.filter(d=>!d.settled);if(n.length===0&&l.length===0){r(t.map(s));return}var a=ce,o=uw(),u=l.length===1?l[0].promise:l.length>1?Promise.all(l.map(d=>d.promise)):null;function c(d){if(!(a.f&Mn)){o();try{r(d)}catch(w){Ir(w,a)}Uo()}}var f=kv();if(n.length===0){u.then(()=>c(t.map(s))).finally(f);return}function g(){Promise.all(n.map(d=>cw(d))).then(d=>c([...t.map(s),...d])).catch(d=>Ir(d,a)).finally(f)}u?u.then(()=>{o(),g(),Uo()}):g()}function uw(){var e=ce,t=ve,n=Ut,r=X;return function(l=!0){tr(e),xn(t),Pl(n),l&&!(e.f&Mn)&&(r==null||r.activate(),r==null||r.apply())}}function Uo(e=!0){tr(null),xn(null),Pl(null),e&&(X==null||X.deactivate())}function kv(){var e=ce,t=e.b,n=X,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),()=>{t.update_pending_count(-1,n),n.decrement(r,e)}}function Ef(e){var t=mt|at;return ce!==null&&(ce.f|=$s),{ctx:Ut,deps:null,effects:null,equals:Jg,f:t,fn:e,reactions:null,rv:0,v:Qe,wv:0,parent:ce,ac:null}}const Ba=Symbol("obsolete");function cw(e,t,n){let r=ce;r===null&&Py();var s=void 0,l=oa(Qe),a=!ve,o=new Set;return kw(()=>{var w;var u=ce,c=Zg();s=c.promise;try{Promise.resolve(e()).then(c.resolve,y=>{y!==cu&&c.reject(y)}).finally(Uo)}catch(y){c.reject(y),Uo()}var f=X;if(a){if(u.f&rs)var g=kv();if(r.b.is_rendered())(w=f.async_deriveds.get(u))==null||w.reject(Ba);else for(const y of o.values())y.reject(Ba);o.add(c),f.async_deriveds.set(u,c)}const d=(y,N=void 0)=>{g==null||g(),o.delete(c),N!==Ba&&(f.activate(),N?(l.f|=qr,Vo(l,N)):(l.f&qr&&(l.f^=qr),Vo(l,y)),f.deactivate())};c.promise.then(d,y=>d(null,y||"unknown"))}),hu(()=>{for(const u of o)u.reject(Ba)}),new Promise(u=>{function c(f){function g(){f===s?u(l):c(s)}f.then(g,g)}c(s)})}function St(e){const t=Ef(e);return Tv(t),t}function dw(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!Nv&&hw()}return t}function hw(){Nv=!1;for(const e of Fo){e.f&et&&Ge(e,Xn);let t;try{t=ua(e)}catch{t=!0}t&&Ll(e)}Fo.clear()}function ki(e){Q(e,e.v+1)}function Ev(e,t,n){var r=e.reactions;if(r!==null)for(var s=r.length,l=0;l{document.activeElement===n&&e.focus()})}}let cp=!1;function Cv(){cp||(cp=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n[yi])==null||t.call(n)})},{capture:!0}))}function fu(e){var t=ve,n=ce;xn(null),tr(null);try{return e()}finally{xn(t),tr(n)}}function mw(e,t,n,r=n){e.addEventListener(t,()=>fu(n));const s=e[yi];s?e[yi]=()=>{s(),r(!0)}:e[yi]=()=>r(!0),Cv()}let co=!1,br=!1;function dp(e){br=e}let ve=null,Tn=!1;function xn(e){ve=e}let ce=null;function tr(e){ce=e}let mn=null;function Tv(e){ve!==null&&(mn===null?mn=[e]:mn.push(e))}let Rt=null,Ft=0,rn=null;function gw(e){rn=e}let Av=1,fs=0,Ss=fs;function fp(e){Ss=e}function Pv(){return++Av}function ua(e){var t=e.f;if(t&at)return!0;if(t&mt&&(e.f&=~As),t&Xn){for(var n=e.deps,r=n.length,s=0;se.wv)return!0}t&hn&&dt===null&&Ge(e,et)}return!1}function Lv(e,t,n=!0){var r=e.reactions;if(r!==null&&!(mn!==null&&Tl.call(mn,e)))for(var s=0;s{e.ac.abort(cu)}),e.ac=null);try{e.f|=Oo;var f=e.fn,g=f();e.f|=rs;var d=e.deps,w=X==null?void 0:X.is_fork;if(Rt!==null){var y;if(w||Ki(e,Ft),d!==null&&Ft>0)for(d.length=Ft+Rt.length,y=0;y{ht(t)}}function bw(e){Jr.ensure();const t=$n(wr|$s,e);return(n={})=>new Promise(r=>{n.outro?_i(t,()=>{ht(t),r(void 0)}):(ht(t),r(void 0))})}function Af(e){return $n(Al,e)}function kw(e){return $n(dl|$s,e)}function pu(e,t=0){return $n(uu|t,e)}function wt(e,t=[],n=[],r=[]){bv(r,t,n,s=>{$n(uu,()=>e(...s.map(p)))})}function da(e,t=0){var n=$n(Cn|t,e);return n}function zv(e,t=0){var n=$n(yf|t,e);return n}function Bn(e){return $n(Jn|$s,e)}function Iv(e){var t=e.teardown;if(t!==null){const n=br,r=ve;dp(!0),xn(null);try{t.call(null)}finally{dp(n),xn(r)}}}function Pf(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&fu(()=>{s.abort(cu)});var r=n.next;n.f&wr?n.parent=null:ht(n,t),n=r}}function _w(e){for(var t=e.first;t!==null;){var n=t.next;t.f&Jn||ht(t),t=n}}function ht(e,t=!0){var n=!1;(t||e.f&Ny)&&e.nodes!==null&&e.nodes.end!==null&&(Ov(e.nodes.start,e.nodes.end),n=!0),Ge(e,td),Pf(e,t&&!n),Ki(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)l.stop();Iv(e),e.f^=td,e.f|=Mn;var s=e.parent;s!==null&&s.first!==null&&Uv(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Ov(e,t){for(;e!==null;){var n=e===t?null:nr(e);e.remove(),e=n}}function Uv(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function _i(e,t,n=!0){var r=[];Fv(e,r,!0);var s=()=>{n&&ht(e),t&&t()},l=r.length;if(l>0){var a=()=>--l||s();for(var o of r)o.out(a)}else s()}function Fv(e,t,n){if(!(e.f&pn)){e.f^=pn;var r=e.nodes&&e.nodes.t;if(r!==null)for(const o of r)(o.is_global||n)&&t.push(o);for(var s=e.first;s!==null;){var l=s.next;if(!(s.f&wr)){var a=(s.f&Zr)!==0||(s.f&Jn)!==0&&(e.f&Cn)!==0;Fv(s,t,a?n:!1)}s=l}}}function Sw(e){Vv(e,!0)}function Vv(e,t){if(e.f&pn){e.f^=pn,e.f&et||(Ge(e,at),Jr.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&Zr)!==0||(n.f&Jn)!==0;Vv(n,s?t:!1),n=r}var l=e.nodes&&e.nodes.t;if(l!==null)for(const a of l)(a.is_global||t)&&a.in()}}function Bv(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:nr(n);t.append(n),n=s}}function hp(e){const t={get:n=>oi(t.store)[n],set:(n,r)=>{typeof n=="string"?Object.assign(oi(t.store),{[n]:r}):Object.assign(oi(t.store),n),t.store.set(oi(t.store))},store:ew(e)};return t}globalThis.$altcha=globalThis.$altcha||{algorithms:new Map,defaults:hp({}),i18n:hp({}),instances:new Set,plugins:new Set};const Nw={ariaLinkLabel:"Altcha (official website)",cancel:"Cancel",enterCode:"Enter code",enterCodeAria:"Enter code you hear. Press Space to play audio.",enterCodeFromImage:"To proceed, please enter the code from the image below.",error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:'Protected by ALTCHA',getAudioChallenge:"Get an audio challenge",label:"I'm not a robot",loading:"Loading...",reload:"Reload",verify:"Verify",verificationRequired:"Verification required!",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait."};globalThis.$altcha.i18n.set("en",Nw);const jw="5";var Np;typeof window<"u"&&((Np=window.__svelte??(window.__svelte={})).v??(Np.v=new Set)).add(jw);const ps=Symbol("events"),Hv=new Set,pd=new Set;function Kv(e,t,n,r={}){function s(l){if(r.capture||md.call(t,l),!l.cancelBubble)return fu(()=>n==null?void 0:n.call(this,l))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?mr(()=>{t.addEventListener(e,s,r)}):t.addEventListener(e,s,r),s}function Je(e,t,n,r,s){var l={capture:r,passive:s},a=Kv(e,t,n,l);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&hu(()=>{t.removeEventListener(e,a,l)})}function mu(e,t,n){(t[ps]??(t[ps]={}))[e]=n}function gu(e){for(var t=0;t{throw h});throw d}}finally{e[ps]=t,delete e.currentTarget,xn(f),tr(g)}}}var jp;const ec=((jp=globalThis==null?void 0:globalThis.window)==null?void 0:jp.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Ew(e){return(ec==null?void 0:ec.createHTML(e))??e}function Wv(e){var t=_f("template");return t.innerHTML=Ew(e.replaceAll("","")),t.content}function Yt(e,t){var n=ce;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Fe(e,t){var n=(t&Vy)!==0,r=(t&By)!==0,s,l=!e.startsWith("");return()=>{if(he)return Yt(fe,null),fe;s===void 0&&(s=Wv(l?e:""+e),n||(s=Gt(s)));var a=r||iv?document.importNode(s,!0):s.cloneNode(!0);if(n){var o=Gt(a),u=a.lastChild;Yt(o,u)}else Yt(a,a);return a}}function Cw(e,t,n="svg"){var r=!e.startsWith(""),s=`<${n}>${r?e:""+e}`,l;return()=>{if(he)return Yt(fe,null),fe;if(!l){var a=Wv(s),o=Gt(a);l=Gt(o)}var u=l.cloneNode(!0);return Yt(u,u),u}}function Lf(e,t){return Cw(e,t,"svg")}function Ha(e=""){if(!he){var t=er(e+"");return Yt(t,t),t}var n=fe;return n.nodeType!==la?(n.before(n=er()),Ct(n)):du(n),Yt(n,n),n}function mp(){if(he)return Yt(fe,null),fe;var e=document.createDocumentFragment(),t=document.createComment(""),n=er();return e.append(t,n),Yt(t,n),e}function ye(e,t){if(he){var n=ce;(!(n.f&rs)||n.nodes.end===null)&&(n.nodes.end=fe),Ls();return}e!==null&&e.before(t)}function Tw(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const Aw=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Pw(e){return Aw.includes(e)}const Lw={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Mw(e){return e=e.toLowerCase(),Lw[e]??e}const Rw=["touchstart","touchmove"];function $w(e){return Rw.includes(e)}function Wn(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e[ai]??(e[ai]=e.nodeValue))&&(e[ai]=n,e.nodeValue=`${n}`)}function Gv(e,t){return qv(e,t)}function Dw(e,t){ld(),t.intro=t.intro??!1;const n=t.target,r=he,s=fe;try{for(var l=Gt(n);l&&(l.nodeType!==ia||l.data!==wf);)l=nr(l);if(!l)throw Ps;qn(!0),Ct(l);const a=qv(e,{...t,anchor:l});return qn(!1),a}catch(a){if(a instanceof Error&&a.message.split(` `).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==Ps&&console.warn("Failed to hydrate: ",a),t.recover===!1&&Dy(),ld(),Jy(n),qn(!1),Gv(e,t)}finally{qn(r),Ct(s)}}const Ka=new Map;function qv(e,{target:t,anchor:n,props:r={},events:s,context:l,intro:a=!0,transformError:o}){ld();var u=void 0,c=bw(()=>{var f=n??t.appendChild(er());aw(f,{pending:()=>{}},w=>{_r({});var y=Ut;if(l&&(y.c=l),s&&(r.$$events=s),he&&Yt(w,null),u=e(w,r)||{},he&&(ce.nodes.end=fe,fe===null||fe.nodeType!==ia||fe.data!==tv))throw aa(),Ps;Sr()},o);var g=new Set,d=w=>{for(var y=0;y{var R;for(var w of g)for(const v of[t,document]){var y=Ka.get(v),N=y.get(w);--N==0?(v.removeEventListener(w,md),y.delete(w),y.size===0&&Ka.delete(v)):y.set(w,N)}pd.delete(d),f!==n&&((R=f.parentNode)==null||R.removeChild(f))}});return gd.set(u,c),u}let gd=new WeakMap;function zw(e,t){const n=gd.get(e);return n?(gd.delete(e),n(t)):Promise.resolve()}var Sn,ur,Nn,ys,Zi,Ko,bd;class vu{constructor(t,n=!0){ne(this,"anchor");ie(this,Sn,new Map);ie(this,ur,new Map);ie(this,Nn,new Map);ie(this,ys,new Set);ie(this,Zi,!0);ie(this,Ko,t=>{if(S(this,Sn).has(t)){var n=S(this,Sn).get(t),r=S(this,ur).get(n);if(r)Sw(r),S(this,ys).delete(n);else{var s=S(this,Nn).get(n);s&&(S(this,ur).set(n,s.effect),S(this,Nn).delete(n),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),r=s.effect)}for(const[l,a]of S(this,Sn)){if(S(this,Sn).delete(l),l===t)break;const o=S(this,Nn).get(a);o&&(ht(o.effect),S(this,Nn).delete(a))}for(const[l,a]of S(this,ur)){if(l===n||S(this,ys).has(l))continue;const o=()=>{if(Array.from(S(this,Sn).values()).includes(l)){var c=document.createDocumentFragment();Bv(a,c),c.append(er()),S(this,Nn).set(l,{effect:a,fragment:c})}else ht(a);S(this,ys).delete(l),S(this,ur).delete(l)};S(this,Zi)||!r?(S(this,ys).add(l),_i(a,o,!1)):o()}}});ie(this,bd,t=>{S(this,Sn).delete(t);const n=Array.from(S(this,Sn).values());for(const[r,s]of S(this,Nn))n.includes(r)||(ht(s.effect),S(this,Nn).delete(r))});this.anchor=t,re(this,Zi,n)}ensure(t,n){var r=X;n&&!S(this,ur).has(t)&&!S(this,Nn).has(t)&&S(this,ur).set(t,Bn(()=>n(this.anchor))),S(this,Sn).set(r,t),he&&(this.anchor=fe),S(this,Ko).call(this,r)}}Sn=new WeakMap,ur=new WeakMap,Nn=new WeakMap,ys=new WeakMap,Zi=new WeakMap,Ko=new WeakMap,bd=new WeakMap;function Iw(e,t,...n){var r=new vu(e);da(()=>{const s=t()??null;r.ensure(s,s&&(l=>s(l,...n)))},Zr)}function Mf(e){Ut===null&&Ay(),Vt(()=>{const t=ca(e);if(typeof t=="function")return t})}function Ze(e,t,n=!1){var r;he&&(r=fe,Ls());var s=new vu(e),l=n?Zr:0;function a(o,u){if(he){var c=lv(r);if(o!==parseInt(c.substring(1))){var f=kf();Ct(f),s.anchor=f,qn(!1),s.ensure(o,u),qn(!0);return}}s.ensure(o,u)}da(()=>{var o=!1;t((u,c=0)=>{o=!0,a(c,u)}),o||a(-1,null)},l)}const Ow=Symbol("NaN");function Uw(e,t,n){he&&Ls();var r=new vu(e);da(()=>{var s=t();s!==s&&(s=Ow),r.ensure(s,n)})}function Qv(e,t,n=!1,r=!1,s=!1,l=!1){var a=e,o="";if(n){var u=e;he&&(a=Ct(Gt(u)))}wt(()=>{var c=ce;if(o===(o=t()??"")){he&&Ls();return}if(n&&!he){c.nodes=null,u.innerHTML=o,o!==""&&Yt(Gt(u),u.lastChild);return}if(c.nodes!==null&&(Ov(c.nodes.start,c.nodes.end),c.nodes=null),o!==""){if(he){fe.data;for(var f=Ls(),g=f;f!==null&&(f.nodeType!==ia||f.data!=="");)g=f,f=nr(f);if(f===null)throw aa(),Ps;Yt(fe,g),a=Ct(f);return}var d=r?Hy:s?Ky:void 0,w=_f(r?"svg":s?"math":"template",d);w.innerHTML=o;var y=r||s?w:w.content;if(Yt(Gt(y),y.lastChild),r||s)for(;Gt(y);)a.before(Gt(y));else a.before(y)}})}function Fw(e,t,n){var r;he&&(r=fe,Ls());var s=new vu(e);da(()=>{var l=t()??null;if(he){var a=lv(r),o=a===wf,u=l!==null;if(o!==u){var c=kf();Ct(c),s.anchor=c,qn(!1),s.ensure(l,l&&(f=>n(f,l))),qn(!0);return}}s.ensure(l,l&&(f=>n(f,l)))},Zr)}function Vw(e,t){var n=void 0,r;zv(()=>{n!==(n=t())&&(r&&(ht(r),r=null),n&&(r=Bn(()=>{Af(()=>n(e))})))})}function Yv(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t=0;){var o=a+l;(a===0||gp.includes(r[a-1]))&&(o===r.length||gp.includes(r[o]))?r=(a===0?"":r.substring(0,a))+r.substring(o+1):a=o}}return r===""?null:r}function vp(e,t=!1){var n=t?" !important;":";",r="";for(var s of Object.keys(e)){var l=e[s];l!=null&&l!==""&&(r+=" "+s+": "+l+n)}return r}function tc(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Ww(e,t){if(t){var n="",r,s;if(Array.isArray(t)?(r=t[0],s=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var l=!1,a=0,o=!1,u=[];r&&u.push(...Object.keys(r).map(tc)),s&&u.push(...Object.keys(s).map(tc));var c=0,f=-1;const N=e.length;for(var g=0;g{vd(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),hu(()=>{t.disconnect()})}function xp(e){return"__value"in e?e.__value:e.value}const ti=Symbol("class"),ni=Symbol("style"),Zv=Symbol("is custom element"),Jv=Symbol("is html"),Yw=sa?"link":"LINK",Zw=sa?"input":"INPUT",Jw=sa?"option":"OPTION",Xw=sa?"select":"SELECT",eb=sa?"progress":"PROGRESS";function Rf(e){if(he){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var r=e.value;Ne(e,"value",null),e.value=r}if(e.hasAttribute("checked")){var s=e.checked;Ne(e,"checked",null),e.checked=s}}};e[yi]=n,mr(n),Cv()}}function tb(e,t){var n=$f(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==eb)||(e.value=t??"")}function nb(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Ne(e,t,n,r){var s=$f(e);he&&(s[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===Yw)||s[t]!==(s[t]=n)&&(t==="loading"&&(e[Cy]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Xv(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function rb(e,t,n,r,s=!1,l=!1){if(he&&s&&e.nodeName===Zw){var a=e,o=a.type==="checkbox"?"defaultChecked":"defaultValue";o in n||Rf(a)}var u=$f(e),c=u[Zv],f=!u[Jv];let g=he&&c;g&&qn(!1);var d=t||{},w=e.nodeName===Jw;for(var y in t)y in n||(n[y]=null);n.class?n.class=Hw(n.class):n[ti]&&(n.class=null),n[ni]&&(n.style??(n.style=null));var N=Xv(e);for(const E in n){let j=n[E];if(w&&E==="value"&&j==null){e.value=e.__value="",d[E]=j;continue}if(E==="class"){var R=e.namespaceURI==="http://www.w3.org/1999/xhtml";Gw(e,R,j,r,t==null?void 0:t[ti],n[ti]),d[E]=j,d[ti]=n[ti];continue}if(E==="style"){qw(e,j,t==null?void 0:t[ni],n[ni]),d[E]=j,d[ni]=n[ni];continue}var v=d[E];if(!(j===v&&!(j===void 0&&e.hasAttribute(E)))){d[E]=j;var h=E[0]+E[1];if(h!=="$$")if(h==="on"){const P={},G="$$"+E;let L=E.slice(2);var m=Pw(L);if(Tw(L)&&(L=L.slice(0,-7),P.capture=!0),!m&&v){if(j!=null)continue;e.removeEventListener(L,d[G],P),d[G]=null}if(m)mu(L,e,j),gu([L]);else if(j!=null){let Y=function(ae){d[E].call(this,ae)};d[G]=Kv(L,e,Y,P)}}else if(E==="style")Ne(e,E,j);else if(E==="autofocus")pw(e,!!j);else if(!c&&(E==="__value"||E==="value"&&j!=null))e.value=e.__value=j;else if(E==="selected"&&w)nb(e,j);else{var _=E;f||(_=Mw(_));var C=_==="defaultValue"||_==="defaultChecked";if(j==null&&!c&&!C)if(u[E]=null,_==="value"||_==="checked"){let P=e;const G=t===void 0;if(_==="value"){let L=P.defaultValue;P.removeAttribute(_),P.defaultValue=L,P.value=P.__value=G?L:null}else{let L=P.defaultChecked;P.removeAttribute(_),P.defaultChecked=L,P.checked=G?L:!1}}else e.removeAttribute(E);else C||N.includes(_)&&(c||typeof j!="string")?(e[_]=j,_ in u&&(u[_]=Qe)):typeof j!="function"&&Ne(e,_,j)}}}return g&&qn(!0),d}function xu(e,t,n=[],r=[],s=[],l,a=!1,o=!1){bv(s,n,r,u=>{var c=void 0,f={},g=e.nodeName===Xw,d=!1;if(zv(()=>{var y=t(...u.map(p)),N=rb(e,c,y,l,a,o);d&&g&&"value"in y&&vd(e,y.value);for(let v of Object.getOwnPropertySymbols(f))y[v]||ht(f[v]);for(let v of Object.getOwnPropertySymbols(y)){var R=y[v];v.description===Wy&&(!c||R!==c[v])&&(f[v]&&ht(f[v]),f[v]=Bn(()=>Vw(e,()=>R))),N[v]=R}c=N}),g){var w=e;Af(()=>{vd(w,c.value,!0),Qw(w)})}d=!0})}function $f(e){return e[lo]??(e[lo]={[Zv]:e.nodeName.includes("-"),[Jv]:e.namespaceURI===nv})}var yp=new Map;function Xv(e){var t=e.getAttribute("is")||e.nodeName,n=yp.get(t);if(n)return n;yp.set(t,n=[]);for(var r,s=e,l=Element.prototype;l!==s;){r=by(s);for(var a in r)r[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&n.push(a);s=Yg(s)}return n}function sb(e,t,n=t){var r=new WeakSet;mw(e,"input",async s=>{var l=s?e.defaultValue:e.value;if(l=rc(e)?sc(l):l,n(l),X!==null&&r.add(X),await hs(),l!==(l=t())){var a=e.selectionStart,o=e.selectionEnd,u=e.value.length;if(e.value=l??"",o!==null){var c=e.value.length;a===o&&o===u&&c>u?(e.selectionStart=c,e.selectionEnd=c):(e.selectionStart=a,e.selectionEnd=Math.min(o,c))}}}),(he&&e.defaultValue!==e.value||ca(t)==null&&e.value)&&(n(rc(e)?sc(e.value):e.value),X!==null&&r.add(X)),pu(()=>{var s=t();if(e===document.activeElement){var l=X;if(r.has(l))return}rc(e)&&s===sc(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function rc(e){var t=e.type;return t==="number"||t==="range"}function sc(e){return e===""?null:+e}function lc(e,t){return e===t||(e==null?void 0:e[fl])===t}function Xr(e={},t,n,r){var s=Ut.r,l=ce;return Af(()=>{var a,o;return pu(()=>{a=o,o=[],ca(()=>{lc(n(...o),e)||(t(e,...o),a&&lc(n(...a),e)&&t(null,...a))})}),()=>{let u=l;for(;u!==s&&u.parent!==null&&u.parent.f&td;)u=u.parent;const c=()=>{o&&lc(n(...o),e)&&t(null,...o)},f=u.teardown;u.teardown=()=>{c(),f==null||f()}}}),e}const lb={get(e,t){if(!e.exclude.includes(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function yu(e,t,n){return new Proxy({props:e,exclude:t},lb)}function Oe(e,t,n,r){var s=r,l=!0,a=()=>(l&&(l=!1,s=r),s),o;o=e[t],o===void 0&&r!==void 0&&(o=a());var u;u=()=>{var d=e[t];return d===void 0?a():(l=!0,d)};var c=!1,f=Ef(()=>(c=!1,u())),g=ce;return function(d,w){if(arguments.length>0){const y=w?p(f):d;return Q(f,y),c=!0,s!==void 0&&(s=y),d}return br&&c||g.f&Mn?f.v:p(f)}}function ib(e){return new ab(e)}var cr,an;class ab{constructor(t){ie(this,cr);ie(this,an);var l;var n=new Map,r=(a,o)=>{var u=jv(o,!1,!1);return n.set(a,u),u};const s=new Proxy({...t.props||{},$$events:{}},{get(a,o){return p(n.get(o)??r(o,Reflect.get(a,o)))},has(a,o){return o===Ey?!0:(p(n.get(o)??r(o,Reflect.get(a,o))),Reflect.has(a,o))},set(a,o,u){return Q(n.get(o)??r(o,u),u),Reflect.set(a,o,u)}});re(this,an,(t.hydrate?Dw:Gv)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((l=t==null?void 0:t.props)!=null&&l.$$host)||t.sync===!1)&&Pe(),re(this,cr,s.$$events);for(const a of Object.keys(S(this,an)))a==="$set"||a==="$destroy"||a==="$on"||Hi(this,a,{get(){return S(this,an)[a]},set(o){S(this,an)[a]=o},enumerable:!0});S(this,an).$set=a=>{Object.assign(s,a)},S(this,an).$destroy=()=>{zw(S(this,an))}}$set(t){S(this,an).$set(t)}$on(t,n){S(this,cr)[t]=S(this,cr)[t]||[];const r=(...s)=>n.call(this,...s);return S(this,cr)[t].push(r),()=>{S(this,cr)[t]=S(this,cr)[t].filter(s=>s!==r)}}$destroy(){S(this,an).$destroy()}}cr=new WeakMap,an=new WeakMap;let e0=class{};typeof HTMLElement=="function"&&(e0=class extends HTMLElement{constructor(t,n,r){super();ne(this,"$$ctor");ne(this,"$$s");ne(this,"$$c");ne(this,"$$cn",!1);ne(this,"$$d",{});ne(this,"$$r",!1);ne(this,"$$p_d",{});ne(this,"$$l",{});ne(this,"$$l_u",new Map);ne(this,"$$me");ne(this,"$$shadowRoot",null);this.$$ctor=t,this.$$s=n,r&&(this.$$shadowRoot=this.attachShadow(r))}addEventListener(t,n,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(n),this.$$c){const s=this.$$c.$on(t,n);this.$$l_u.set(n,s)}super.addEventListener(t,n,r)}removeEventListener(t,n,r){if(super.removeEventListener(t,n,r),this.$$c){const s=this.$$l_u.get(n);s&&(s(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(s){return l=>{const a=_f("slot");s!=="default"&&(a.name=s),ye(l,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const n={},r=ob(this);for(const s of this.$$s)s in r&&(s==="default"&&!this.$$d.children?(this.$$d.children=t(s),n.default=!0):n[s]=t(s));for(const s of this.attributes){const l=this.$$g_p(s.name);l in this.$$d||(this.$$d[l]=fo(l,s.value,this.$$p_d,"toProp"))}for(const s in this.$$p_d)!(s in this.$$d)&&this[s]!==void 0&&(this.$$d[s]=this[s],delete this[s]);this.$$c=ib({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:n,$$host:this}}),this.$$me=ww(()=>{pu(()=>{var s;this.$$r=!0;for(const l of zo(this.$$c)){if(!((s=this.$$p_d[l])!=null&&s.reflect))continue;this.$$d[l]=this.$$c[l];const a=fo(l,this.$$d[l],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,a)}this.$$r=!1})});for(const s in this.$$l)for(const l of this.$$l[s]){const a=this.$$c.$on(s,l);this.$$l_u.set(l,a)}this.$$l={}}}attributeChangedCallback(t,n,r){var s;this.$$r||(t=this.$$g_p(t),this.$$d[t]=fo(t,r,this.$$p_d,"toProp"),(s=this.$$c)==null||s.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return zo(this.$$p_d).find(n=>this.$$p_d[n].attribute===t||!this.$$p_d[n].attribute&&n.toLowerCase()===t)||t}});function fo(e,t,n,r){var l;const s=(l=n[e])==null?void 0:l.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(s){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function ob(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function ss(e,t,n,r,s,l){let a=class extends e0{constructor(){super(e,n,s),this.$$p_d=t}static get observedAttributes(){return zo(t).map(o=>(t[o].attribute||o).toLowerCase())}};return zo(t).forEach(o=>{Hi(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(u){var g;u=fo(o,u,t),this.$$d[o]=u;var c=this.$$c;if(c){var f=(g=cl(c,o))==null?void 0:g.get;f?c[o]=u:c.$set({[o]:u})}}})}),r.forEach(o=>{Hi(a.prototype,o,{get(){var u;return(u=this.$$c)==null?void 0:u[o]}})}),e.element=a,a}var ub=Fe('
');function t0(e,t){_r(t,!0);let n=Oe(t,"loading"),r=yu(t,["$$slots","$$events","$$legacy","$$host","loading"]),s;function l(){s==null||s.click()}var a={get loading(){return n()},set loading(f){n(f),Pe()}},o=ub(),u=Ve(o);xu(u,()=>({type:"checkbox",...r}),void 0,void 0,void 0,void 0,!0),Xr(u,f=>s=f,()=>s);var c=Ie(u,2);return bf(2),$e(o),wt(()=>Ne(o,"data-loading",n())),mu("click",c,l),ye(e,o),Sr(a)}gu(["click"]);ss(t0,{loading:{}},[],[],{mode:"open"});var cb=Fe('
');function n0(e,t){_r(t,!0);let n=Oe(t,"loading"),r=yu(t,["$$slots","$$events","$$legacy","$$host","loading"]);var s={get loading(){return n()},set loading(o){n(o),Pe()}},l=cb(),a=Ve(l);return xu(a,()=>({type:"checkbox",...r}),void 0,void 0,void 0,void 0,!0),bf(2),$e(l),wt(()=>Ne(l,"data-loading",n())),ye(e,l),Sr(s)}ss(n0,{loading:{}},[],[],{mode:"open"});var db=Fe('
');function Df(e,t){_r(t,!0);let n=Oe(t,"strings");const r="https://altcha.org";var s={get strings(){return n()},set strings(o){n(o),Pe()}},l=db(),a=Ve(l);return Ne(a,"href",r),$e(l),wt(()=>Ne(a,"aria-label",n().ariaLinkLabel)),ye(e,l),Sr(s)}ss(Df,{strings:{}},[],[],{mode:"open"});var fb=Fe('');function xd(e,t){_r(t,!0);let n=Oe(t,"logo"),r=Oe(t,"strings");var s={get logo(){return n()},set logo(c){n(c),Pe()},get strings(){return r()},set strings(c){r(c),Pe()}},l=fb(),a=Ve(l);Qv(a,()=>r().footer,!0),$e(a);var o=Ie(a,2);{var u=c=>{Df(c,{get strings(){return r()}})};Ze(o,c=>{n()&&c(u)})}return $e(l),ye(e,l),Sr(s)}ss(xd,{logo:{},strings:{}},[],[],{mode:"open"});var hb=Fe('
');function r0(e,t){_r(t,!0);let n=Oe(t,"loading"),r=yu(t,["$$slots","$$events","$$legacy","$$host","loading"]),s;function l(){s==null||s.click()}var a={get loading(){return n()},set loading(f){n(f),Pe()}},o=hb(),u=Ve(o);xu(u,()=>({type:"checkbox",...r}),void 0,void 0,void 0,void 0,!0),Xr(u,f=>s=f,()=>s);var c=Ie(u,2);return $e(o),wt(()=>Ne(o,"data-loading",n())),mu("click",c,l),ye(e,o),Sr(a)}gu(["click"]);ss(r0,{loading:{}},[],[],{mode:"open"});var ut=(e=>(e.ERROR="error",e.LOADING="loading",e.PLAYING="playing",e.PAUSED="paused",e.READY="ready",e))(ut||{}),_e=(e=>(e.CODE="code",e.ERROR="error",e.VERIFIED="verified",e.VERIFYING="verifying",e.UNVERIFIED="unverified",e.EXPIRED="expired",e))(_e||{}),pb=Fe('
'),mb=Fe('
'),gb=Lf(''),vb=Lf(''),xb=Lf(''),yb=Fe(''),wb=Fe(''),bb=Fe('
');function s0(e,t){_r(t,!0);let n=Oe(t,"audioUrl"),r=Oe(t,"codeChallenge"),s=Oe(t,"config"),l=Oe(t,"imageUrl"),a=Oe(t,"onCancel"),o=Oe(t,"onReload"),u=Oe(t,"onSubmit"),c=Oe(t,"strings"),f=ge(void 0),g=ge(void 0),d=ge(void 0),w=ge(!1),y=ge(""),N=ge(!1);Mf(()=>(s().disableAutoFocus||hs().then(()=>{var F;(F=p(d))==null||F.focus()}),()=>{p(g)&&(p(g).pause(),Q(g,void 0))}));function R(){Q(f,ut.PAUSED,!0)}function v(F){Q(f,ut.ERROR,!0)}function h(){Q(f,ut.READY,!0)}function m(){Q(f,ut.LOADING,!0)}function _(){Q(f,ut.PLAYING,!0)}function C(){Q(f,ut.PAUSED,!0)}function E(F){var be;F.code==="Space"?(F.preventDefault(),F.stopPropagation(),P()):F.code==="Escape"&&(F.preventDefault(),F.stopPropagation(),(be=a())==null||be())}function j(F){var be;F.preventDefault(),F.stopPropagation(),(be=u())==null||be(p(y))}function P(){p(g)?p(f)===ut.LOADING||(p(g).paused?(n()&&p(g).src!==n()&&(p(g).src=n()),p(g).currentTime=0,p(g).play()):p(g).pause()):(Q(N,!0),requestAnimationFrame(()=>{p(g)&&n()&&(p(g).src=n(),p(g).play())}))}var G={get audioUrl(){return n()},set audioUrl(F){n(F),Pe()},get codeChallenge(){return r()},set codeChallenge(F){r(F),Pe()},get config(){return s()},set config(F){s(F),Pe()},get imageUrl(){return l()},set imageUrl(F){l(F),Pe()},get onCancel(){return a()},set onCancel(F){a(F),Pe()},get onReload(){return o()},set onReload(F){o(F),Pe()},get onSubmit(){return u()},set onSubmit(F){u(F),Pe()},get strings(){return c()},set strings(F){c(F),Pe()}},L=bb(),Y=Ve(L),ae=Ve(Y);{var le=F=>{var be=pb(),_t=Ve(be,!0);$e(be),wt(()=>Wn(_t,c().verificationRequired)),ye(F,be)};Ze(ae,F=>{s().codeChallengeDisplay!=="standard"&&F(le)})}var ke=Ie(ae,2),ue=Ve(ke,!0);$e(ke);var Te=Ie(ke,2),V=Ie(Te,2),M=Ve(V);Rf(M),M.disabled=p(w),Xr(M,F=>Q(d,F),()=>p(d));var U=Ie(M,2);{var x=F=>{var be=yb(),_t=Ve(be);{var rr=nt=>{var rt=mb();ye(nt,rt)},zn=nt=>{var rt=gb();ye(nt,rt)},yn=nt=>{var rt=vb();ye(nt,rt)},Nr=nt=>{var rt=xb();ye(nt,rt)};Ze(_t,nt=>{p(f)===ut.LOADING?nt(rr):p(f)===ut.ERROR?nt(zn,1):p(f)===ut.PLAYING?nt(yn,2):nt(Nr,-1)})}$e(be),wt(()=>{Ne(be,"title",c().getAudioChallenge),be.disabled=p(f)===ut.LOADING||p(f)===ut.ERROR,Ne(be,"aria-label",p(f)===ut.LOADING?c().loading:c().getAudioChallenge)}),Je("click",be,()=>P(),!0),ye(F,be)};Ze(U,F=>{r().audio&&F(x)})}var $=Ie(U,2);$e(V);var I=Ie(V,2),K=Ve(I),W=Ve(K,!0);$e(K);var ee=Ie(K,2),Ae=Ve(ee,!0);$e(ee),$e(I),$e(Y);var gt=Ie(Y,2);{var Dn=F=>{var be=wb();Xr(be,_t=>Q(g,_t),()=>p(g)),Je("error",be,v),Je("loadstart",be,m),Je("canplay",be,h),Je("pause",be,C),Je("playing",be,_),Je("ended",be,R),ye(F,be)};Ze(gt,F=>{p(N)&&F(Dn)})}return $e(L),wt(()=>{Wn(ue,c().enterCodeFromImage),Ne(Te,"src",l()),Ne(M,"minlength",r().length||1),Ne(M,"maxlength",r().length),Ne(M,"placeholder",c().enterCode),Ne(M,"aria-label",p(f)===ut.LOADING?c().loading:p(f)===ut.PLAYING?"":c().enterCodeAria),Ne(M,"aria-live",p(f)?"assertive":"polite"),Ne(M,"aria-busy",p(f)===ut.LOADING),Ne($,"title",c().reload),Ne($,"aria-label",c().reload),Ne(K,"aria-label",c().verify),Wn(W,c().verify),Ne(ee,"aria-label",c().cancel),Wn(Ae,c().cancel)}),Je("submit",Y,j,!0),mu("keydown",M,E),sb(M,()=>p(y),F=>Q(y,F)),Je("click",$,()=>{var F;return(F=o())==null?void 0:F()},!0),Je("click",ee,()=>{var F;return(F=a())==null?void 0:F()},!0),ye(e,L),Sr(G)}gu(["keydown"]);ss(s0,{audioUrl:{},codeChallenge:{},config:{},imageUrl:{},onCancel:{},onReload:{},onSubmit:{},strings:{}},[],[],{mode:"open"});var kb=Fe('
'),_b=Fe('
'),Sb=Fe('
×
'),Nb=Fe('
',1);function yd(e,t){_r(t,!0);let n=Oe(t,"anchor"),r=Oe(t,"children"),s=Oe(t,"display",7,"standard"),l=Oe(t,"backdrop",7,!1),a=Oe(t,"onClickOutside"),o=Oe(t,"onClickOutsideDelay",7,600),u=Oe(t,"onClose"),c=Oe(t,"placement",7,"auto"),f=Oe(t,"updateUISignal"),g=Oe(t,"variant",7,"neutral"),d=yu(t,["$$slots","$$events","$$legacy","$$host","anchor","children","display","backdrop","onClickOutside","onClickOutsideDelay","onClose","placement","updateUISignal","variant"]),w=ge(void 0),y=ge(void 0),N=ge(!1),R=ge(0);Vt(()=>{c()!=="auto"&&Q(N,c()==="top")}),Vt(()=>{f()&&C()}),Mf(()=>{const V=s()==="bottomsheet"||s()==="overlay";return V&&(p(y)&&document.body.append(p(y)),p(w)&&document.body.append(p(w))),C(),hs().then(()=>{Q(R,Date.now(),!0)}),()=>{V&&(p(y)&&document.body.removeChild(p(y)),p(w)&&document.body.removeChild(p(w)))}});function v(){var V;(V=u())==null||V()}function h(V){var U,x;const M=V.target;!((U=p(w))!=null&&U.contains(M))&&(!o()||p(R)+o(){var M=kb();Xr(M,U=>Q(y,U),()=>p(y)),ye(V,M)};Ze(P,V=>{l()&&V(G)})}var L=Ie(P,2);xu(L,()=>({...d,class:`altcha-popover ${(t.class||"")??""}`,"data-popover":!0,"data-variant":g(),"data-top":p(N),"data-display":s()}));var Y=Ve(L);{var ae=V=>{var M=_b();ye(V,M)};Ze(Y,V=>{s()==="standard"&&V(ae)})}var le=Ie(Y,2);{var ke=V=>{var M=Sb();Je("click",M,v,!0),ye(V,M)};Ze(le,V=>{s()!=="standard"&&V(ke)})}var ue=Ie(le,2),Te=Ve(ue);return Iw(Te,()=>r()??Gr),$e(ue),$e(L),Xr(L,V=>Q(w,V),()=>p(w)),ye(e,j),Sr(E)}ss(yd,{anchor:{},children:{},display:{},backdrop:{},onClickOutside:{},onClickOutsideDelay:{},onClose:{},placement:{},updateUISignal:{},variant:{}},[],[],{mode:"open"});function jb(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}function Eb(e,t="altcha-css",n){var r,s;if(typeof document<"u"&&document&&!document.getElementById(t)){const l=document.createElement("style");l.id=t,l.textContent=e;const a=((r=document.currentScript)==null?void 0:r.nonce)??((s=document.querySelector('meta[name="csp-nonce"]'))==null?void 0:s.content);a&&(l.nonce=a),document.head.appendChild(l)}}async function l0(e){var d;const{challenge:t,concurrency:n=navigator.hardwareConcurrency,controller:r=new AbortController,createWorker:s,onOutOfMemory:l=w=>w>1?Math.floor(w/2):0,counterMode:a,timeout:o=9e4}=e,u=Math.min(16,Math.max(1,n)),c=[],f=()=>{for(const w of c)w.terminate()};for(let w=0;w(r.signal.addEventListener("abort",()=>{w.postMessage({type:"abort"})}),new Promise((N,R)=>{w.addEventListener("error",v=>{R(v)}),w.addEventListener("message",v=>{if(v.data){for(const h of c)h!==w&&h.postMessage({type:"abort"});if(v.data.error)return R(new Error(v.data.error))}N(v.data)}),w.postMessage({challenge:t,counterMode:a,counterStart:y,counterStep:u,timeout:o,type:"work"})}))))}catch(w){if(w instanceof Error&&!!((d=w==null?void 0:w.message)!=null&&d.includes("Out of memory"))&&l){f();const N=l(u);if(N)return l0({...e,challenge:t,controller:r,concurrency:N,createWorker:s})}throw w}finally{f()}return r.signal.aborted?null:g||null}class Cb{constructor(t={}){ne(this,"TAG_CODES",{INPUT:1,TEXTAREA:2,SELECT:3,BUTTON:4,A:5,DETAILS:6,SUMMARY:7,IFRAME:8,VIDEO:9,AUDIO:10});ne(this,"maxSamples");ne(this,"sampleInterval");ne(this,"target");ne(this,"focusStartTime",0);ne(this,"focusInteraction",0);ne(this,"focusInteractionTimer",null);ne(this,"lastPointerSample",0);ne(this,"lastTouchSample",0);ne(this,"lastScrollSample",0);ne(this,"pendingPointer",null);ne(this,"pendingTouch",null);ne(this,"focus",[]);ne(this,"pointer",[]);ne(this,"scroll",[]);ne(this,"touch",[]);ne(this,"onFocus",t=>{if(this.focusInteraction===2)return;const n=t.target;if(!(n instanceof Element))return;const r=performance.now();this.focusStartTime===0&&(this.focusStartTime=r),this.focus.push([Math.round(r-this.focusStartTime),n.tabIndex,this.TAG_CODES[n.tagName]??0,this.focusInteraction?1:0]),this.evict(this.focus)});ne(this,"onInteraction",t=>{this.focusInteraction="keyCode"in t?1:2,this.focusInteractionTimer&&clearTimeout(this.focusInteractionTimer),this.focusInteractionTimer=setTimeout(()=>{this.focusInteraction=0},100)});ne(this,"onPointer",t=>{if(t.pointerType==="touch")return;const n=t.timeStamp||performance.now();this.pendingPointer=[Math.round(t.clientX),Math.round(t.clientY),Math.round(n)],n-this.lastPointerSample>=this.sampleInterval&&(this.pointer.push(this.pendingPointer),this.lastPointerSample=n,this.pendingPointer=null,this.evict(this.pointer))});ne(this,"onScroll",()=>{const t=performance.now();t-this.lastScrollSample{const n=t.timeStamp||performance.now(),r=t.touches[0];r&&(this.pendingTouch=[Math.round(r.clientX),Math.round(r.clientY),Math.round(n),Math.round(r.force*1e3)/1e3,Math.round(r.radiusX||0),Math.round(r.radiusY||0)],n-this.lastTouchSample>=this.sampleInterval&&(this.touch.push(this.pendingTouch),this.lastTouchSample=n,this.pendingTouch=null,this.evict(this.touch)))});const{maxSamples:n=60,sampleInterval:r=50,target:s=window}=t;this.maxSamples=n,this.sampleInterval=r,this.target=s,this.attach()}destroy(){const t={capture:!0};this.target.removeEventListener("focusin",this.onFocus,t),this.target.removeEventListener("keydown",this.onInteraction,t),this.target.removeEventListener("pointerdown",this.onInteraction,t),this.target.removeEventListener("pointermove",this.onPointer,t),this.target.removeEventListener("scroll",this.onScroll,t),this.target.removeEventListener("touchmove",this.onTouchMove,t)}export(){return{focus:this.focus,maxTouchPoints:navigator.maxTouchPoints||0,pointer:this.pointer,scroll:this.scroll,time:Date.now(),touch:this.touch}}attach(){const t={passive:!0,capture:!0};this.target.addEventListener("focusin",this.onFocus,t),this.target.addEventListener("keydown",this.onInteraction,t),this.target.addEventListener("pointerdown",this.onInteraction,t),this.target.addEventListener("pointermove",this.onPointer,t),this.target.addEventListener("scroll",this.onScroll,t),this.target.addEventListener("touchmove",this.onTouchMove,t)}evict(t){t.length>this.maxSamples&&t.splice(0,t.length-this.maxSamples)}}var Tb=Fe('
'),Ab=Fe('
'),Pb=Fe('
×
',1),Lb=Fe('
'),Mb=Fe(''),Rb=Fe('
Secure context (HTTPS) required.
'),$b=Fe('
'),Db=Fe('
'),zb=Fe(" ",1),Ib=Fe('
',1);function Ob(e,t){_r(t,!0);const n=()=>ap(f,"$altchaDefaults",s),r=()=>ap(y,"$altchaI18nStore",s),[s,l]=tw(),a='input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])',o='input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])',u=["ar","fa","he","ur"],{isSecureContext:c}=globalThis,{store:f}=globalThis.$altcha.defaults,g=navigator.hardwareConcurrency||2,d=navigator.deviceMemory||0,w=d&&d<=4?Math.min(4,g):g,y=globalThis.$altcha.i18n.store,N=t.$$host,R=(b,T)=>{hs().then(()=>{N==null||N.dispatchEvent(new CustomEvent(b,{detail:T}))})};let v=null,h=ge(hr(new URL(location.origin))),m=ge(!1),_=ge(null),C=ge(null),E=ge(null),j=ge(hr(_e.UNVERIFIED)),P=ge(void 0),G=ge(void 0),L=ge(null),Y=ge(void 0),ae=ge(null),le=ge(null),ke=ge(null),ue=ge(null),Te=ge(hr([])),V=ge(0),M=ge(hr({})),U=ge(!0);const x=St(()=>({fetch:(b,T)=>fetch(b,T),audioChallengeLanguage:"",auto:"off",barPlacement:"bottom",challenge:"",codeChallenge:null,codeChallengeDisplay:"standard",credentials:null,debug:!1,disableAutoFocus:!1,display:"standard",floatingAnchor:"",floatingOffset:8,floatingPersist:!1,floatingPlacement:"auto",hideFooter:!1,hideLogo:!1,humanInteractionSignature:!0,language:"",mockError:!1,minDuration:500,overlayContent:"",name:"altcha",popoverPlacement:"auto",retryOnOutOfMemoryError:!0,setCookie:null,serverVerificationFields:!1,serverVerificationTimeZone:!1,test:!1,timeout:9e4,type:"checkbox",validationMessage:"",verifyFunction:null,verifyUrl:"",workers:w,...n(),...p(M)})),$=St(()=>`altcha-checkbox-${t.id||Math.floor(Math.random()*1e12).toString(16)}`),I=St(()=>Ee(p(x).type)),K=St(()=>p(x).auto),W=St(()=>p(j)===_e.VERIFYING),ee=St(()=>!p(x).hideFooter),Ae=St(()=>!p(x).hideLogo&&p(x).display!=="bar"),gt=St(()=>en(r(),[p(x).language,document.documentElement.lang,...navigator.languages])),Dn=St(()=>u.includes(p(gt).language)?"rtl":void 0),F=St(()=>({...p(gt).strings})),be=St(()=>{var b,T,B;return(T=(b=p(_))==null?void 0:b.audio)!=null&&T.match(/^(https?:)?\//)?ls(p(_).audio,p(h),{language:p(x).audioChallengeLanguage||p(gt).language}).toString():(B=p(_))==null?void 0:B.audio}),_t=St(()=>{var b,T,B;return(T=(b=p(_))==null?void 0:b.image)!=null&&T.match(/^(https?:)?\//)?ls(p(_).image,p(h)):(B=p(_))==null?void 0:B.image});Vt(()=>{Er({auto:t.auto,challenge:t.challenge,display:t.display,language:t.language,name:t.name,type:t.type,workers:t.workers})}),Vt(()=>{if(t.configuration)try{Er(JSON.parse(t.configuration))}catch{Ce("unable to parse the `configuration` attribute (JSON expected)")}}),Vt(()=>{p(E)!==p(x).display&&jr(p(x).display)}),Vt(()=>{p(m)&&p(j)===_e.VERIFYING&&Q(m,!1)}),Vt(()=>{!p(m)&&p(j)===_e.VERIFIED&&Q(m,!0)}),Vt(()=>{if(!p(m)){const b=q();b&&b.checked&&(b.checked=!1)}}),Vt(()=>{var b;p(j)===_e.VERIFIED&&((b=q())==null||b.setCustomValidity(""))}),Vt(()=>{if(p(K)==="onload"){const b=setTimeout(()=>{On()},1);return()=>{b&&clearTimeout(b)}}}),Vt(()=>{p(le)&&Ce("error:",p(le))}),Vt(()=>{p(ue)&&p(x).setCookie&&wu(p(ue),p(x).setCookie)}),Mf(()=>{var b,T,B,O;return Ce("mounted","3.2.1"),N&&globalThis.$altcha.instances.add(N),Q(L,(b=p(Y))==null?void 0:b.closest("form"),!0),(T=p(L))==null||T.addEventListener("reset",zl),(B=p(L))==null||B.addEventListener("submit",Il,{capture:!0}),(O=p(L))==null||O.addEventListener("focusin",Dl),rr(),p(x).humanInteractionSignature&&(Ce("human interaction signature enabled"),v=new Cb),R("load"),c||Ce("secure context (HTTPS) required"),()=>{var se,te,de;yn(),N&&globalThis.$altcha.instances.delete(N),p(ke)&&clearTimeout(p(ke)),(se=p(L))==null||se.removeEventListener("reset",zl),(te=p(L))==null||te.removeEventListener("submit",Il,{capture:!0}),(de=p(L))==null||de.removeEventListener("focusin",Dl),v==null||v.destroy()}});function rr(){Q(Te,[...globalThis.$altcha.plugins].map(b=>new b(N)),!0),Ce("activating plugins",p(Te).map(b=>b.constructor.name));for(const b of p(Te))b.activate()}async function zn(b,...T){let B;for(const O of p(Te))B=await O[b].call(O,...T);return B}function yn(){for(const b of p(Te))b.destroy()}function Nr(b){const[T,B]=b.salt.split("?"),O={};if(B)try{Object.assign(O,Object.fromEntries(new URLSearchParams(B).entries()))}catch{}const se={codeChallenge:b.codeChallenge,parameters:{algorithm:b.algorithm,cost:1,data:O,expiresAt:O!=null&&O.expires?parseInt(O.expires,10):void 0,keyLength:b.algorithm==="SHA-512"?64:b.algorithm==="SHA-384"?48:32,nonce:jb(new TextEncoder().encode(b.salt)),keyPrefix:b.challenge,salt:""},signature:b.signature};return Object.defineProperties(se,{_originalSalt:{enumerable:!1,value:b.salt,writable:!1},_version:{enumerable:!1,value:1,writable:!1}}),se}function nt(b,T){return{algorithm:b.parameters.algorithm,challenge:b.parameters.keyPrefix,number:T.counter,salt:"_originalSalt"in b?b._originalSalt:b.parameters.nonce,signature:b.signature,took:T.time||0}}async function rt(b){await new Promise(T=>setTimeout(T,b))}async function Ds(b=p(x).challenge,T){const B=await zn("onFetchChallenge",b);let O=null;if(B!==void 0)return B;if(typeof b=="string")if(b.startsWith("{")){Ce("parsing JSON challenge");try{O=JSON.parse(b)}catch{throw new Error("Unable to parse JSON challenge.")}}else{Ce("fetching challenge from",(T==null?void 0:T.method)||"GET",b),Q(h,new URL(b,location.origin),!0);const se=await p(x).fetch(b,{credentials:p(x).credentials||void 0,...T});await Vl(se);const te=se.headers.get("x-altcha-config");te&&Ul(te);const de=await se.json();if(de&&"his"in de&&de.his){if(Ce("requested HIS"),!v)throw new Error("Server requested HIS data but collector is disabled.");return Ds(ls(de.his.url,p(h)),{body:JSON.stringify({his:v.export()}),headers:{"content-type":"application/json"},method:"POST"})}de&&"hisResult"in de&&de.hisResult&&Ce("HIS result",de.hisResult),O=de}else if(b&&typeof b=="object")try{O=JSON.parse(JSON.stringify(b))}catch{throw new Error("Unable to parse JSON challenge.")}if(zs(O)&&(O=Nr(O)),!z(O))throw new Error("Challenge validation failed.");return O}function zs(b){return typeof b=="object"&&"challenge"in b}function z(b){return!!b&&typeof b=="object"&&"parameters"in b&&!!b.parameters&&typeof b.parameters=="object"&&"algorithm"in b.parameters&&"nonce"in b.parameters&&"salt"in b.parameters&&"keyPrefix"in b.parameters}function q(){return document.getElementById(p($))}function Ee(b){switch(b){case"checkbox":return t0;case"switch":return r0;case"native":default:return n0}}function en(b,T){const B=Object.keys(b).map(se=>se.toLowerCase());let O=T.reduce((se,te)=>(te=te.toLowerCase(),se||(b[te]?te:null)||B.find(de=>te.split("-")[0]===de.split("-")[0])||null),null);return b[O||""]||(O="en"),{language:O,strings:b[O]}}function xe(b){switch(b){case"bar":return p(x).barPlacement||"bottom";case"floating":return p(x).floatingPlacement||"auto";default:return}}function In(b){var B;return[...((B=p(L))==null?void 0:B.querySelectorAll(a))||[]].reduce((O,se)=>{const te=se.name,de=se.value;return te&&de&&(O[te]=/\n/.test(de)?de.replace(new RegExp("(?{B&&!p(_)&&hs().then(()=>{Fl(p(ae))})}))}function Ol(b){b.persisted&&(jr(p(x).display),Pt())}function xa(){Is()}function Ul(b){var T,B;try{const O=JSON.parse(b);O&&typeof O=="object"&&Er({serverVerificationFields:(T=O==null?void 0:O.sentinel)==null?void 0:T.fields,serverVerificationTimeZone:(B=O==null?void 0:O.sentinel)==null?void 0:B.timeZone,verifyUrl:O.verifyurl,...O})}catch(O){Ce("unable to configure from x-altcha-config header",O)}}function ya(b=20){var lt;if(!p(Y))return;const T=p(x).floatingPlacement;if(!p(G)&&(Q(G,(p(x).floatingAnchor instanceof HTMLElement?p(x).floatingAnchor:p(x).floatingAnchor?document.querySelector(p(x).floatingAnchor):(lt=p(L))==null?void 0:lt.querySelector(o))||p(L),!0),!p(G))){Ce("unable to find floating anchor element");return}const B=parseInt(p(x).floatingOffset,10)||12,O=p(G).getBoundingClientRect(),se=p(Y).getBoundingClientRect(),te=document.documentElement.clientHeight,de=document.documentElement.clientWidth,vt=!T||T==="auto"?O.bottom+se.height+B+b>te:T==="top",Me=Math.max(b,Math.min(de-b-se.width,O.left+O.width/2-se.width/2));if(p(Y).style.setProperty("--altcha-floating-left",`${Me}px`),p(Y).style.setProperty("--altcha-floating-top",vt?`${O.top-(se.height+B)}px`:`${O.bottom+B}px`),p(Y).setAttribute("data-floating-position",vt?"top":"bottom"),p(P)){const Un=p(P).getBoundingClientRect();p(P).style.left=O.left-Me+O.width/2-Un.width/2+"px"}}async function wa(b,T){const B=await zn("onRequestServerVerification",b,T);if(B!==void 0)return B;if(Ce("requesting server verification from",p(x).verifyUrl),!p(x).verifyUrl)throw new Error("Parameter verifyUrl must be set for server verification.");const O=await p(x).fetch(ls(p(x).verifyUrl,p(h)),{body:JSON.stringify({code:T,fields:p(x).serverVerificationFields?In():void 0,payload:b,timeZone:p(x).serverVerificationTimeZone?fa():void 0}),credentials:p(x).credentials||void 0,headers:{"Content-Type":"application/json"},method:"POST"});await Vl(O);const se=await O.json();return se&&typeof se=="object"&&"payload"in se&&se.payload&&R("serververification",se),se}function Fl(b){var T;p(L)&&"requestSubmit"in p(L)?p(L).requestSubmit(b):(T=p(L))!=null&&T.reportValidity()&&(b?b.click():p(L).submit())}function wu(b,T={}){const{domain:B,name:O=p(x).name,maxAge:se,path:te,sameSite:de,secure:vt}=T;let Me=`${encodeURIComponent(O)}=${encodeURIComponent(b)}`;B&&(Me+=`; Domain=${B}`),se!=null&&(Me+=`; Max-Age=${se}`),te&&(Me+=`; Path=${te}`),de&&(Me+=`; SameSite=${de}`),vt&&(Me+="; Secure"),document.cookie=Me}function jr(b){switch(b){case"bar":case"floating":case"overlay":st(),(!p(K)||p(K)==="off")&&(p(M).auto="onsubmit");break;case"standard":Hl()}p(E)!==b&&Q(E,b,!0)}function bu(b){p(ke)&&clearTimeout(p(ke));const T=()=>{p(j)!==_e.UNVERIFIED?(Q(m,!1),Lt(_e.EXPIRED)):Pt(),R("expired")},B=b*1e3-Date.now();B>=1?Q(ke,setTimeout(T,B),!0):T()}async function Vl(b){var B;if(b.status>=400){if((B=b.headers.get("content-type"))!=null&&B.includes("/json")){let O;try{O=await b.json()}catch{}if(O&&"error"in O)throw new Error(`Server responded with ${b.status} - ${O.error}`)}throw new Error(`Server responded with ${b.status}.`)}const T=b.headers.get("content-type");if(!T||!T.includes("/json"))throw new Error(`Server responded with invalid content-type. Expected application/json, received ${T}.`)}async function Bl(b){var B;if(!p(ue)){Lt(_e.ERROR,"Cannot verify code challenge without PoW payload.");return}Lt(_e.VERIFYING);let T=null;if(p(x).verifyUrl)T=await wa(p(ue),b);else if(p(x).verifyFunction)T=await p(x).verifyFunction(p(ue),b);else{Lt(_e.ERROR,"Parameter verifyUrl is required for code challenge verification.");return}T!=null&&T.payload&&(Q(ue,T.payload,!0),Ce("server payload",p(ue))),(T==null?void 0:T.verified)===!0?(Ce("verified"),Lt(_e.VERIFIED),R("verified",{payload:p(ue)}),p(K)==="onsubmit"&&hs().then(()=>{Fl(p(ae))})):Lt(_e.ERROR,(T==null?void 0:T.reason)||"Verification failed."),p(x).disableAutoFocus||(B=q())==null||B.focus()}function Er(b){Object.assign(p(M),{...Object.fromEntries(Object.entries(b).filter(([T,B])=>B!==void 0))})}function ba(){return{...p(x)}}function ka(){return p(j)}function st(){Q(U,!1)}function Ce(...b){(p(x).debug||b.some(T=>T instanceof Error))&&console[b[0]instanceof Error?"error":"log"]("ALTCHA",`[name=${p(x).name}]`,...b)}function Pt(b=_e.UNVERIFIED,T=null){Q(m,!1),Q(le,T,!0),Q(ue,null),p(C)&&p(C).abort(),p(ke)&&(clearTimeout(p(ke)),Q(ke,null)),Lt(b)}function Lt(b,T=null){Q(j,b,!0),Q(le,T,!0),R("statechange",{payload:p(ue),state:p(j)})}function Hl(){Q(U,!0),hs().then(()=>{Is()})}function Is(){switch(p(x).display){case"floating":return ya()}Q(V,p(V)+1)}async function On(b={}){var lt,Un;const{concurrency:T=Math.max(1,p(x).workers),controller:B=new AbortController,minDuration:O=p(x).minDuration}=b,se=performance.now();let te=null,de=null,vt=!1;const Me=await zn("onVerify",b);if(Me!==void 0)return Me;Pt(_e.VERIFYING),Q(C,B,!0);try{if(!c)throw new Error("Secure context (HTTPS) required.");if(p(x).mockError)throw new Error("Mock error.");if(p(x).test)return Ce("running test mode with null challenge"),await rt(Math.max(0,O-(performance.now()-se))),(lt=p(C))!=null&<.signal.aborted?(Pt(),null):(Q(ue,btoa(JSON.stringify({challenge:null,solution:null,test:!0})),!0),Ce("verified"),Lt(_e.VERIFIED),R("verified",{payload:p(ue)}),{payload:p(ue)});if(te=await Ds(),!te)throw new Error("Failed to fetch challenge.");Ce("challenge",te),"configuration"in te&&(Ce("re-configuring from challenge",te.configuration),Er(te.configuration)),te.parameters.expiresAt&&bu(te.parameters.expiresAt),vt="_version"in te&&te._version===1;const wn=globalThis.$altcha.algorithms.get(te.parameters.algorithm);if(!wn)throw new Error(`Unsupported algorithm ${te.parameters.algorithm}.`);if(de=await l0({challenge:te,concurrency:T,controller:B,createWorker:wn,counterMode:vt?"string":"uint32",onOutOfMemory:Ff=>{if(Ce("out of memory error received"),R("outofmemory"),p(x).retryOnOutOfMemoryError&&Ff>1){const Vf=Math.floor(Ff/2);return Ce(`retrying with ${Vf} workers...`),Vf}},timeout:p(x).timeout}),(Un=p(C))!=null&&Un.signal.aborted)return Pt(),null;if(!de)throw new Error("Failed to find solution.");Ce("solution",de),await rt(Math.max(0,O-(performance.now()-se))),Q(_,te.codeChallenge||p(x).codeChallenge||null,!0),vt?Q(ue,btoa(JSON.stringify(nt(te,de))),!0):Q(ue,btoa(JSON.stringify({challenge:{parameters:te.parameters,signature:te.signature},solution:de})),!0),p(_)?(Ce("requesting code verification"),Lt(_e.CODE),R("codechallenge",{codeChallenge:p(_)})):p(x).verifyUrl?await Bl():(Ce("verified"),Lt(_e.VERIFIED),R("verified",{payload:p(ue)}))}catch(wn){return Ce("verification failed",wn),Lt(_e.ERROR,String(wn)),null}finally{Q(C,null)}return{challenge:te,payload:p(ue),solution:de}}var ku={configure:Er,getConfiguration:ba,getState:ka,hide:st,log:Ce,reset:Pt,setState:Lt,show:Hl,updateUI:Is,verify:On},_a=Ib();Je("scroll",sd,ga),Je("click",sd,va),Je("pageshow",ks,Ol),Je("resize",ks,xa);var Sa=Bs(_a);{var _u=b=>{var T=Tb();ye(b,T)};Ze(Sa,b=>{p(x).display==="overlay"&&p(U)&&b(_u)})}var tn=Ie(Sa,2),Na=Ve(tn);{var Su=b=>{var T=Pb(),B=Bs(T),O=Ie(B,2);{var se=te=>{var de=Ab();Qv(de,()=>{var vt;return(vt=document.querySelector(p(x).overlayContent))==null?void 0:vt.innerHTML},!0),$e(de),ye(te,de)};Ze(O,te=>{p(x).overlayContent&&te(se)})}Je("click",B,ma,!0),ye(b,T)};Ze(Na,b=>{p(x).display==="overlay"&&p(U)&&b(Su)})}var Kl=Ie(Na,2),Os=Ve(Kl),k=Ve(Os),Z=Ve(k);{let b=St(()=>p(x).display==="standard"&&p(K)!=="onsubmit"||p(j)===_e.VERIFYING);Fw(Z,()=>p(I),(T,B)=>{B(T,{get id(){return p($)},name:"",get required(){return p(b)},get loading(){return p(W)},get checked(){return p(m)},onchange:ha,oninvalid:pa})})}var nn=Ie(Z,2),Wl=Ve(nn);{var o0=b=>{var T=Ha();wt(()=>Wn(T,p(F).verificationRequired)),ye(b,T)},u0=b=>{var T=Ha();wt(()=>Wn(T,p(F).verifying)),ye(b,T)},c0=b=>{var T=Ha();wt(()=>Wn(T,p(F).verified)),ye(b,T)},d0=b=>{var T=Ha();wt(()=>Wn(T,p(F).label)),ye(b,T)};Ze(Wl,b=>{p(j)===_e.CODE&&p(_)?b(o0):p(j)===_e.VERIFYING?b(u0,1):p(j)===_e.VERIFIED?b(c0,2):b(d0,-1)})}$e(nn),$e(k);var f0=Ie(k,2);{var h0=b=>{Df(b,{get strings(){return p(F)}})};Ze(f0,b=>{p(Ae)&&b(h0)})}$e(Os);var Of=Ie(Os,2);{var p0=b=>{{let T=St(()=>p(x).display==="bar"&&p(Ae));xd(b,{get logo(){return p(T)},get strings(){return p(F)}})}};Ze(Of,b=>{p(ee)&&b(p0)})}var Uf=Ie(Of,2);{var m0=b=>{var T=Lb();Xr(T,B=>Q(P,B),()=>p(P)),ye(b,T)};Ze(Uf,b=>{p(x).display==="floating"&&b(m0)})}var g0=Ie(Uf,2);{var v0=b=>{var T=Mb();Rf(T),wt(()=>{Ne(T,"name",p(x).name),tb(T,p(ue))}),ye(b,T)};Ze(g0,b=>{p(x).setCookie||b(v0)})}$e(Kl);var x0=Ie(Kl,2);{var y0=b=>{yd(b,{get anchor(){return p(Y)},onClickOutside:()=>{c&&Pt()},get placement(){return p(x).popoverPlacement},role:"alert",variant:"error",get dir(){return p(Dn)},get updateUISignal(){return p(V)},children:(T,B)=>{var O=mp(),se=Bs(O);{var te=Me=>{var lt=Rb();ye(Me,lt)},de=Me=>{var lt=$b(),Un=Ve(lt,!0);$e(lt),wt(()=>Wn(Un,p(F).expired)),ye(Me,lt)},vt=Me=>{var lt=Db(),Un=Ve(lt,!0);$e(lt),wt(()=>{Ne(lt,"title",p(le)),Wn(Un,p(F).error)}),ye(Me,lt)};Ze(se,Me=>{!p(le)&&!c?Me(te):!p(le)&&p(j)===_e.EXPIRED?Me(de,1):Me(vt,-1)})}ye(T,O)},$$slots:{default:!0}})},w0=b=>{var T=mp(),B=Bs(T);Uw(B,()=>p(_),O=>{{let se=St(()=>p(x).codeChallengeDisplay!=="standard");yd(O,{get anchor(){return p(Y)},get backdrop(){return p(se)},get display(){return p(x).codeChallengeDisplay},onClose:()=>{Pt()},get placement(){return p(x).popoverPlacement},role:"dialog",get"aria-label"(){return p(F).verificationRequired},get dir(){return p(Dn)},get updateUISignal(){return p(V)},children:(te,de)=>{var vt=zb(),Me=Bs(vt);s0(Me,{get audioUrl(){return p(be)},get imageUrl(){return p(_t)},onCancel:()=>Pt(),onReload:()=>On(),onSubmit:wn=>Bl(wn),get codeChallenge(){return p(_)},get config(){return p(x)},get strings(){return p(F)}});var lt=Ie(Me,2);{var Un=wn=>{xd(wn,{get logo(){return p(Ae)},get strings(){return p(F)}})};Ze(lt,wn=>{p(ee)&&p(x).codeChallengeDisplay!=="standard"&&wn(Un)})}ye(te,vt)},$$slots:{default:!0}})}}),ye(b,T)};Ze(x0,b=>{p(le)||p(j)===_e.EXPIRED||!c?b(y0):p(_)&&p(j)===_e.CODE&&b(w0,1)})}$e(tn),Xr(tn,b=>Q(Y,b),()=>p(Y)),wt(b=>{Ne(tn,"data-state",p(j)),Ne(tn,"data-display",p(x).display||void 0),Ne(tn,"data-placement",b),Ne(tn,"data-visible",p(U)||void 0),Ne(tn,"dir",p(Dn)),Ne(nn,"for",p($)),tn.dir=tn.dir},[()=>xe(p(x).display)]),ye(e,_a);var b0=Sr(ku);return l(),b0}typeof window<"u"&&window.customElements&&!customElements.get("altcha-widget")&&customElements.define("altcha-widget",ss(Ob,{auto:{type:"String"},challenge:{type:"String"},configuration:{type:"String"},display:{type:"String"},language:{type:"String"},name:{type:"String"},theme:{type:"String"},type:{type:"String"},workers:{type:"Number"}},[],["configure","getConfiguration","getState","hide","log","reset","setState","show","updateUI","verify"]));const i0=`(function() { +\r\f \v\uFEFF`];function Kw(e,t,n){var r=e==null?"":""+e;if(n){for(var s of Object.keys(n))if(n[s])r=r?r+" "+s:s;else if(r.length)for(var l=s.length,a=0;(a=r.indexOf(s,a))>=0;){var o=a+l;(a===0||gp.includes(r[a-1]))&&(o===r.length||gp.includes(r[o]))?r=(a===0?"":r.substring(0,a))+r.substring(o+1):a=o}}return r===""?null:r}function vp(e,t=!1){var n=t?" !important;":";",r="";for(var s of Object.keys(e)){var l=e[s];l!=null&&l!==""&&(r+=" "+s+": "+l+n)}return r}function tc(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Ww(e,t){if(t){var n="",r,s;if(Array.isArray(t)?(r=t[0],s=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var l=!1,a=0,o=!1,u=[];r&&u.push(...Object.keys(r).map(tc)),s&&u.push(...Object.keys(s).map(tc));var c=0,f=-1;const N=e.length;for(var g=0;g{vd(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),hu(()=>{t.disconnect()})}function xp(e){return"__value"in e?e.__value:e.value}const ti=Symbol("class"),ni=Symbol("style"),Zv=Symbol("is custom element"),Jv=Symbol("is html"),Yw=sa?"link":"LINK",Zw=sa?"input":"INPUT",Jw=sa?"option":"OPTION",Xw=sa?"select":"SELECT",eb=sa?"progress":"PROGRESS";function Rf(e){if(he){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var r=e.value;Ne(e,"value",null),e.value=r}if(e.hasAttribute("checked")){var s=e.checked;Ne(e,"checked",null),e.checked=s}}};e[yi]=n,mr(n),Cv()}}function tb(e,t){var n=$f(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==eb)||(e.value=t??"")}function nb(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Ne(e,t,n,r){var s=$f(e);he&&(s[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===Yw)||s[t]!==(s[t]=n)&&(t==="loading"&&(e[Cy]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Xv(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function rb(e,t,n,r,s=!1,l=!1){if(he&&s&&e.nodeName===Zw){var a=e,o=a.type==="checkbox"?"defaultChecked":"defaultValue";o in n||Rf(a)}var u=$f(e),c=u[Zv],f=!u[Jv];let g=he&&c;g&&qn(!1);var d=t||{},w=e.nodeName===Jw;for(var y in t)y in n||(n[y]=null);n.class?n.class=Hw(n.class):n[ti]&&(n.class=null),n[ni]&&(n.style??(n.style=null));var N=Xv(e);for(const E in n){let j=n[E];if(w&&E==="value"&&j==null){e.value=e.__value="",d[E]=j;continue}if(E==="class"){var R=e.namespaceURI==="http://www.w3.org/1999/xhtml";Gw(e,R,j,r,t==null?void 0:t[ti],n[ti]),d[E]=j,d[ti]=n[ti];continue}if(E==="style"){qw(e,j,t==null?void 0:t[ni],n[ni]),d[E]=j,d[ni]=n[ni];continue}var v=d[E];if(!(j===v&&!(j===void 0&&e.hasAttribute(E)))){d[E]=j;var h=E[0]+E[1];if(h!=="$$")if(h==="on"){const L={},G="$$"+E;let P=E.slice(2);var m=Pw(P);if(Tw(P)&&(P=P.slice(0,-7),L.capture=!0),!m&&v){if(j!=null)continue;e.removeEventListener(P,d[G],L),d[G]=null}if(m)mu(P,e,j),gu([P]);else if(j!=null){let Y=function(ae){d[E].call(this,ae)};d[G]=Kv(P,e,Y,L)}}else if(E==="style")Ne(e,E,j);else if(E==="autofocus")pw(e,!!j);else if(!c&&(E==="__value"||E==="value"&&j!=null))e.value=e.__value=j;else if(E==="selected"&&w)nb(e,j);else{var _=E;f||(_=Mw(_));var C=_==="defaultValue"||_==="defaultChecked";if(j==null&&!c&&!C)if(u[E]=null,_==="value"||_==="checked"){let L=e;const G=t===void 0;if(_==="value"){let P=L.defaultValue;L.removeAttribute(_),L.defaultValue=P,L.value=L.__value=G?P:null}else{let P=L.defaultChecked;L.removeAttribute(_),L.defaultChecked=P,L.checked=G?P:!1}}else e.removeAttribute(E);else C||N.includes(_)&&(c||typeof j!="string")?(e[_]=j,_ in u&&(u[_]=Qe)):typeof j!="function"&&Ne(e,_,j)}}}return g&&qn(!0),d}function xu(e,t,n=[],r=[],s=[],l,a=!1,o=!1){bv(s,n,r,u=>{var c=void 0,f={},g=e.nodeName===Xw,d=!1;if(zv(()=>{var y=t(...u.map(p)),N=rb(e,c,y,l,a,o);d&&g&&"value"in y&&vd(e,y.value);for(let v of Object.getOwnPropertySymbols(f))y[v]||ht(f[v]);for(let v of Object.getOwnPropertySymbols(y)){var R=y[v];v.description===Wy&&(!c||R!==c[v])&&(f[v]&&ht(f[v]),f[v]=Bn(()=>Vw(e,()=>R))),N[v]=R}c=N}),g){var w=e;Af(()=>{vd(w,c.value,!0),Qw(w)})}d=!0})}function $f(e){return e[lo]??(e[lo]={[Zv]:e.nodeName.includes("-"),[Jv]:e.namespaceURI===nv})}var yp=new Map;function Xv(e){var t=e.getAttribute("is")||e.nodeName,n=yp.get(t);if(n)return n;yp.set(t,n=[]);for(var r,s=e,l=Element.prototype;l!==s;){r=by(s);for(var a in r)r[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&n.push(a);s=Yg(s)}return n}function sb(e,t,n=t){var r=new WeakSet;mw(e,"input",async s=>{var l=s?e.defaultValue:e.value;if(l=rc(e)?sc(l):l,n(l),X!==null&&r.add(X),await hs(),l!==(l=t())){var a=e.selectionStart,o=e.selectionEnd,u=e.value.length;if(e.value=l??"",o!==null){var c=e.value.length;a===o&&o===u&&c>u?(e.selectionStart=c,e.selectionEnd=c):(e.selectionStart=a,e.selectionEnd=Math.min(o,c))}}}),(he&&e.defaultValue!==e.value||ca(t)==null&&e.value)&&(n(rc(e)?sc(e.value):e.value),X!==null&&r.add(X)),pu(()=>{var s=t();if(e===document.activeElement){var l=X;if(r.has(l))return}rc(e)&&s===sc(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function rc(e){var t=e.type;return t==="number"||t==="range"}function sc(e){return e===""?null:+e}function lc(e,t){return e===t||(e==null?void 0:e[fl])===t}function Xr(e={},t,n,r){var s=Ut.r,l=ce;return Af(()=>{var a,o;return pu(()=>{a=o,o=[],ca(()=>{lc(n(...o),e)||(t(e,...o),a&&lc(n(...a),e)&&t(null,...a))})}),()=>{let u=l;for(;u!==s&&u.parent!==null&&u.parent.f&td;)u=u.parent;const c=()=>{o&&lc(n(...o),e)&&t(null,...o)},f=u.teardown;u.teardown=()=>{c(),f==null||f()}}}),e}const lb={get(e,t){if(!e.exclude.includes(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function yu(e,t,n){return new Proxy({props:e,exclude:t},lb)}function Oe(e,t,n,r){var s=r,l=!0,a=()=>(l&&(l=!1,s=r),s),o;o=e[t],o===void 0&&r!==void 0&&(o=a());var u;u=()=>{var d=e[t];return d===void 0?a():(l=!0,d)};var c=!1,f=Ef(()=>(c=!1,u())),g=ce;return function(d,w){if(arguments.length>0){const y=w?p(f):d;return Q(f,y),c=!0,s!==void 0&&(s=y),d}return br&&c||g.f&Mn?f.v:p(f)}}function ib(e){return new ab(e)}var cr,an;class ab{constructor(t){ie(this,cr);ie(this,an);var l;var n=new Map,r=(a,o)=>{var u=jv(o,!1,!1);return n.set(a,u),u};const s=new Proxy({...t.props||{},$$events:{}},{get(a,o){return p(n.get(o)??r(o,Reflect.get(a,o)))},has(a,o){return o===Ey?!0:(p(n.get(o)??r(o,Reflect.get(a,o))),Reflect.has(a,o))},set(a,o,u){return Q(n.get(o)??r(o,u),u),Reflect.set(a,o,u)}});re(this,an,(t.hydrate?Dw:Gv)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((l=t==null?void 0:t.props)!=null&&l.$$host)||t.sync===!1)&&Pe(),re(this,cr,s.$$events);for(const a of Object.keys(S(this,an)))a==="$set"||a==="$destroy"||a==="$on"||Hi(this,a,{get(){return S(this,an)[a]},set(o){S(this,an)[a]=o},enumerable:!0});S(this,an).$set=a=>{Object.assign(s,a)},S(this,an).$destroy=()=>{zw(S(this,an))}}$set(t){S(this,an).$set(t)}$on(t,n){S(this,cr)[t]=S(this,cr)[t]||[];const r=(...s)=>n.call(this,...s);return S(this,cr)[t].push(r),()=>{S(this,cr)[t]=S(this,cr)[t].filter(s=>s!==r)}}$destroy(){S(this,an).$destroy()}}cr=new WeakMap,an=new WeakMap;let e0=class{};typeof HTMLElement=="function"&&(e0=class extends HTMLElement{constructor(t,n,r){super();ne(this,"$$ctor");ne(this,"$$s");ne(this,"$$c");ne(this,"$$cn",!1);ne(this,"$$d",{});ne(this,"$$r",!1);ne(this,"$$p_d",{});ne(this,"$$l",{});ne(this,"$$l_u",new Map);ne(this,"$$me");ne(this,"$$shadowRoot",null);this.$$ctor=t,this.$$s=n,r&&(this.$$shadowRoot=this.attachShadow(r))}addEventListener(t,n,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(n),this.$$c){const s=this.$$c.$on(t,n);this.$$l_u.set(n,s)}super.addEventListener(t,n,r)}removeEventListener(t,n,r){if(super.removeEventListener(t,n,r),this.$$c){const s=this.$$l_u.get(n);s&&(s(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(s){return l=>{const a=_f("slot");s!=="default"&&(a.name=s),ye(l,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const n={},r=ob(this);for(const s of this.$$s)s in r&&(s==="default"&&!this.$$d.children?(this.$$d.children=t(s),n.default=!0):n[s]=t(s));for(const s of this.attributes){const l=this.$$g_p(s.name);l in this.$$d||(this.$$d[l]=fo(l,s.value,this.$$p_d,"toProp"))}for(const s in this.$$p_d)!(s in this.$$d)&&this[s]!==void 0&&(this.$$d[s]=this[s],delete this[s]);this.$$c=ib({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:n,$$host:this}}),this.$$me=ww(()=>{pu(()=>{var s;this.$$r=!0;for(const l of zo(this.$$c)){if(!((s=this.$$p_d[l])!=null&&s.reflect))continue;this.$$d[l]=this.$$c[l];const a=fo(l,this.$$d[l],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,a)}this.$$r=!1})});for(const s in this.$$l)for(const l of this.$$l[s]){const a=this.$$c.$on(s,l);this.$$l_u.set(l,a)}this.$$l={}}}attributeChangedCallback(t,n,r){var s;this.$$r||(t=this.$$g_p(t),this.$$d[t]=fo(t,r,this.$$p_d,"toProp"),(s=this.$$c)==null||s.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return zo(this.$$p_d).find(n=>this.$$p_d[n].attribute===t||!this.$$p_d[n].attribute&&n.toLowerCase()===t)||t}});function fo(e,t,n,r){var l;const s=(l=n[e])==null?void 0:l.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(s){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function ob(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function ss(e,t,n,r,s,l){let a=class extends e0{constructor(){super(e,n,s),this.$$p_d=t}static get observedAttributes(){return zo(t).map(o=>(t[o].attribute||o).toLowerCase())}};return zo(t).forEach(o=>{Hi(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(u){var g;u=fo(o,u,t),this.$$d[o]=u;var c=this.$$c;if(c){var f=(g=cl(c,o))==null?void 0:g.get;f?c[o]=u:c.$set({[o]:u})}}})}),r.forEach(o=>{Hi(a.prototype,o,{get(){var u;return(u=this.$$c)==null?void 0:u[o]}})}),e.element=a,a}var ub=Fe('
');function t0(e,t){_r(t,!0);let n=Oe(t,"loading"),r=yu(t,["$$slots","$$events","$$legacy","$$host","loading"]),s;function l(){s==null||s.click()}var a={get loading(){return n()},set loading(f){n(f),Pe()}},o=ub(),u=Ve(o);xu(u,()=>({type:"checkbox",...r}),void 0,void 0,void 0,void 0,!0),Xr(u,f=>s=f,()=>s);var c=Ie(u,2);return bf(2),$e(o),wt(()=>Ne(o,"data-loading",n())),mu("click",c,l),ye(e,o),Sr(a)}gu(["click"]);ss(t0,{loading:{}},[],[],{mode:"open"});var cb=Fe('
');function n0(e,t){_r(t,!0);let n=Oe(t,"loading"),r=yu(t,["$$slots","$$events","$$legacy","$$host","loading"]);var s={get loading(){return n()},set loading(o){n(o),Pe()}},l=cb(),a=Ve(l);return xu(a,()=>({type:"checkbox",...r}),void 0,void 0,void 0,void 0,!0),bf(2),$e(l),wt(()=>Ne(l,"data-loading",n())),ye(e,l),Sr(s)}ss(n0,{loading:{}},[],[],{mode:"open"});var db=Fe('
');function Df(e,t){_r(t,!0);let n=Oe(t,"strings");const r="https://altcha.org";var s={get strings(){return n()},set strings(o){n(o),Pe()}},l=db(),a=Ve(l);return Ne(a,"href",r),$e(l),wt(()=>Ne(a,"aria-label",n().ariaLinkLabel)),ye(e,l),Sr(s)}ss(Df,{strings:{}},[],[],{mode:"open"});var fb=Fe('');function xd(e,t){_r(t,!0);let n=Oe(t,"logo"),r=Oe(t,"strings");var s={get logo(){return n()},set logo(c){n(c),Pe()},get strings(){return r()},set strings(c){r(c),Pe()}},l=fb(),a=Ve(l);Qv(a,()=>r().footer,!0),$e(a);var o=Ie(a,2);{var u=c=>{Df(c,{get strings(){return r()}})};Ze(o,c=>{n()&&c(u)})}return $e(l),ye(e,l),Sr(s)}ss(xd,{logo:{},strings:{}},[],[],{mode:"open"});var hb=Fe('
');function r0(e,t){_r(t,!0);let n=Oe(t,"loading"),r=yu(t,["$$slots","$$events","$$legacy","$$host","loading"]),s;function l(){s==null||s.click()}var a={get loading(){return n()},set loading(f){n(f),Pe()}},o=hb(),u=Ve(o);xu(u,()=>({type:"checkbox",...r}),void 0,void 0,void 0,void 0,!0),Xr(u,f=>s=f,()=>s);var c=Ie(u,2);return $e(o),wt(()=>Ne(o,"data-loading",n())),mu("click",c,l),ye(e,o),Sr(a)}gu(["click"]);ss(r0,{loading:{}},[],[],{mode:"open"});var ut=(e=>(e.ERROR="error",e.LOADING="loading",e.PLAYING="playing",e.PAUSED="paused",e.READY="ready",e))(ut||{}),_e=(e=>(e.CODE="code",e.ERROR="error",e.VERIFIED="verified",e.VERIFYING="verifying",e.UNVERIFIED="unverified",e.EXPIRED="expired",e))(_e||{}),pb=Fe('
'),mb=Fe('
'),gb=Lf(''),vb=Lf(''),xb=Lf(''),yb=Fe(''),wb=Fe(''),bb=Fe('
');function s0(e,t){_r(t,!0);let n=Oe(t,"audioUrl"),r=Oe(t,"codeChallenge"),s=Oe(t,"config"),l=Oe(t,"imageUrl"),a=Oe(t,"onCancel"),o=Oe(t,"onReload"),u=Oe(t,"onSubmit"),c=Oe(t,"strings"),f=ge(void 0),g=ge(void 0),d=ge(void 0),w=ge(!1),y=ge(""),N=ge(!1);Mf(()=>(s().disableAutoFocus||hs().then(()=>{var F;(F=p(d))==null||F.focus()}),()=>{p(g)&&(p(g).pause(),Q(g,void 0))}));function R(){Q(f,ut.PAUSED,!0)}function v(F){Q(f,ut.ERROR,!0)}function h(){Q(f,ut.READY,!0)}function m(){Q(f,ut.LOADING,!0)}function _(){Q(f,ut.PLAYING,!0)}function C(){Q(f,ut.PAUSED,!0)}function E(F){var be;F.code==="Space"?(F.preventDefault(),F.stopPropagation(),L()):F.code==="Escape"&&(F.preventDefault(),F.stopPropagation(),(be=a())==null||be())}function j(F){var be;F.preventDefault(),F.stopPropagation(),(be=u())==null||be(p(y))}function L(){p(g)?p(f)===ut.LOADING||(p(g).paused?(n()&&p(g).src!==n()&&(p(g).src=n()),p(g).currentTime=0,p(g).play()):p(g).pause()):(Q(N,!0),requestAnimationFrame(()=>{p(g)&&n()&&(p(g).src=n(),p(g).play())}))}var G={get audioUrl(){return n()},set audioUrl(F){n(F),Pe()},get codeChallenge(){return r()},set codeChallenge(F){r(F),Pe()},get config(){return s()},set config(F){s(F),Pe()},get imageUrl(){return l()},set imageUrl(F){l(F),Pe()},get onCancel(){return a()},set onCancel(F){a(F),Pe()},get onReload(){return o()},set onReload(F){o(F),Pe()},get onSubmit(){return u()},set onSubmit(F){u(F),Pe()},get strings(){return c()},set strings(F){c(F),Pe()}},P=bb(),Y=Ve(P),ae=Ve(Y);{var le=F=>{var be=pb(),_t=Ve(be,!0);$e(be),wt(()=>Wn(_t,c().verificationRequired)),ye(F,be)};Ze(ae,F=>{s().codeChallengeDisplay!=="standard"&&F(le)})}var ke=Ie(ae,2),ue=Ve(ke,!0);$e(ke);var Te=Ie(ke,2),V=Ie(Te,2),M=Ve(V);Rf(M),M.disabled=p(w),Xr(M,F=>Q(d,F),()=>p(d));var U=Ie(M,2);{var x=F=>{var be=yb(),_t=Ve(be);{var rr=nt=>{var rt=mb();ye(nt,rt)},zn=nt=>{var rt=gb();ye(nt,rt)},yn=nt=>{var rt=vb();ye(nt,rt)},Nr=nt=>{var rt=xb();ye(nt,rt)};Ze(_t,nt=>{p(f)===ut.LOADING?nt(rr):p(f)===ut.ERROR?nt(zn,1):p(f)===ut.PLAYING?nt(yn,2):nt(Nr,-1)})}$e(be),wt(()=>{Ne(be,"title",c().getAudioChallenge),be.disabled=p(f)===ut.LOADING||p(f)===ut.ERROR,Ne(be,"aria-label",p(f)===ut.LOADING?c().loading:c().getAudioChallenge)}),Je("click",be,()=>L(),!0),ye(F,be)};Ze(U,F=>{r().audio&&F(x)})}var $=Ie(U,2);$e(V);var I=Ie(V,2),K=Ve(I),W=Ve(K,!0);$e(K);var ee=Ie(K,2),Ae=Ve(ee,!0);$e(ee),$e(I),$e(Y);var gt=Ie(Y,2);{var Dn=F=>{var be=wb();Xr(be,_t=>Q(g,_t),()=>p(g)),Je("error",be,v),Je("loadstart",be,m),Je("canplay",be,h),Je("pause",be,C),Je("playing",be,_),Je("ended",be,R),ye(F,be)};Ze(gt,F=>{p(N)&&F(Dn)})}return $e(P),wt(()=>{Wn(ue,c().enterCodeFromImage),Ne(Te,"src",l()),Ne(M,"minlength",r().length||1),Ne(M,"maxlength",r().length),Ne(M,"placeholder",c().enterCode),Ne(M,"aria-label",p(f)===ut.LOADING?c().loading:p(f)===ut.PLAYING?"":c().enterCodeAria),Ne(M,"aria-live",p(f)?"assertive":"polite"),Ne(M,"aria-busy",p(f)===ut.LOADING),Ne($,"title",c().reload),Ne($,"aria-label",c().reload),Ne(K,"aria-label",c().verify),Wn(W,c().verify),Ne(ee,"aria-label",c().cancel),Wn(Ae,c().cancel)}),Je("submit",Y,j,!0),mu("keydown",M,E),sb(M,()=>p(y),F=>Q(y,F)),Je("click",$,()=>{var F;return(F=o())==null?void 0:F()},!0),Je("click",ee,()=>{var F;return(F=a())==null?void 0:F()},!0),ye(e,P),Sr(G)}gu(["keydown"]);ss(s0,{audioUrl:{},codeChallenge:{},config:{},imageUrl:{},onCancel:{},onReload:{},onSubmit:{},strings:{}},[],[],{mode:"open"});var kb=Fe('
'),_b=Fe('
'),Sb=Fe('
×
'),Nb=Fe('
',1);function yd(e,t){_r(t,!0);let n=Oe(t,"anchor"),r=Oe(t,"children"),s=Oe(t,"display",7,"standard"),l=Oe(t,"backdrop",7,!1),a=Oe(t,"onClickOutside"),o=Oe(t,"onClickOutsideDelay",7,600),u=Oe(t,"onClose"),c=Oe(t,"placement",7,"auto"),f=Oe(t,"updateUISignal"),g=Oe(t,"variant",7,"neutral"),d=yu(t,["$$slots","$$events","$$legacy","$$host","anchor","children","display","backdrop","onClickOutside","onClickOutsideDelay","onClose","placement","updateUISignal","variant"]),w=ge(void 0),y=ge(void 0),N=ge(!1),R=ge(0);Vt(()=>{c()!=="auto"&&Q(N,c()==="top")}),Vt(()=>{f()&&C()}),Mf(()=>{const V=s()==="bottomsheet"||s()==="overlay";return V&&(p(y)&&document.body.append(p(y)),p(w)&&document.body.append(p(w))),C(),hs().then(()=>{Q(R,Date.now(),!0)}),()=>{V&&(p(y)&&document.body.removeChild(p(y)),p(w)&&document.body.removeChild(p(w)))}});function v(){var V;(V=u())==null||V()}function h(V){var U,x;const M=V.target;!((U=p(w))!=null&&U.contains(M))&&(!o()||p(R)+o(){var M=kb();Xr(M,U=>Q(y,U),()=>p(y)),ye(V,M)};Ze(L,V=>{l()&&V(G)})}var P=Ie(L,2);xu(P,()=>({...d,class:`altcha-popover ${(t.class||"")??""}`,"data-popover":!0,"data-variant":g(),"data-top":p(N),"data-display":s()}));var Y=Ve(P);{var ae=V=>{var M=_b();ye(V,M)};Ze(Y,V=>{s()==="standard"&&V(ae)})}var le=Ie(Y,2);{var ke=V=>{var M=Sb();Je("click",M,v,!0),ye(V,M)};Ze(le,V=>{s()!=="standard"&&V(ke)})}var ue=Ie(le,2),Te=Ve(ue);return Iw(Te,()=>r()??Gr),$e(ue),$e(P),Xr(P,V=>Q(w,V),()=>p(w)),ye(e,j),Sr(E)}ss(yd,{anchor:{},children:{},display:{},backdrop:{},onClickOutside:{},onClickOutsideDelay:{},onClose:{},placement:{},updateUISignal:{},variant:{}},[],[],{mode:"open"});function jb(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}function Eb(e,t="altcha-css",n){var r,s;if(typeof document<"u"&&document&&!document.getElementById(t)){const l=document.createElement("style");l.id=t,l.textContent=e;const a=((r=document.currentScript)==null?void 0:r.nonce)??((s=document.querySelector('meta[name="csp-nonce"]'))==null?void 0:s.content);a&&(l.nonce=a),document.head.appendChild(l)}}async function l0(e){var d;const{challenge:t,concurrency:n=navigator.hardwareConcurrency,controller:r=new AbortController,createWorker:s,onOutOfMemory:l=w=>w>1?Math.floor(w/2):0,counterMode:a,timeout:o=9e4}=e,u=Math.min(16,Math.max(1,n)),c=[],f=()=>{for(const w of c)w.terminate()};for(let w=0;w(r.signal.addEventListener("abort",()=>{w.postMessage({type:"abort"})}),new Promise((N,R)=>{w.addEventListener("error",v=>{R(v)}),w.addEventListener("message",v=>{if(v.data){for(const h of c)h!==w&&h.postMessage({type:"abort"});if(v.data.error)return R(new Error(v.data.error))}N(v.data)}),w.postMessage({challenge:t,counterMode:a,counterStart:y,counterStep:u,timeout:o,type:"work"})}))))}catch(w){if(w instanceof Error&&!!((d=w==null?void 0:w.message)!=null&&d.includes("Out of memory"))&&l){f();const N=l(u);if(N)return l0({...e,challenge:t,controller:r,concurrency:N,createWorker:s})}throw w}finally{f()}return r.signal.aborted?null:g||null}class Cb{constructor(t={}){ne(this,"TAG_CODES",{INPUT:1,TEXTAREA:2,SELECT:3,BUTTON:4,A:5,DETAILS:6,SUMMARY:7,IFRAME:8,VIDEO:9,AUDIO:10});ne(this,"maxSamples");ne(this,"sampleInterval");ne(this,"target");ne(this,"focusStartTime",0);ne(this,"focusInteraction",0);ne(this,"focusInteractionTimer",null);ne(this,"lastPointerSample",0);ne(this,"lastTouchSample",0);ne(this,"lastScrollSample",0);ne(this,"pendingPointer",null);ne(this,"pendingTouch",null);ne(this,"focus",[]);ne(this,"pointer",[]);ne(this,"scroll",[]);ne(this,"touch",[]);ne(this,"onFocus",t=>{if(this.focusInteraction===2)return;const n=t.target;if(!(n instanceof Element))return;const r=performance.now();this.focusStartTime===0&&(this.focusStartTime=r),this.focus.push([Math.round(r-this.focusStartTime),n.tabIndex,this.TAG_CODES[n.tagName]??0,this.focusInteraction?1:0]),this.evict(this.focus)});ne(this,"onInteraction",t=>{this.focusInteraction="keyCode"in t?1:2,this.focusInteractionTimer&&clearTimeout(this.focusInteractionTimer),this.focusInteractionTimer=setTimeout(()=>{this.focusInteraction=0},100)});ne(this,"onPointer",t=>{if(t.pointerType==="touch")return;const n=t.timeStamp||performance.now();this.pendingPointer=[Math.round(t.clientX),Math.round(t.clientY),Math.round(n)],n-this.lastPointerSample>=this.sampleInterval&&(this.pointer.push(this.pendingPointer),this.lastPointerSample=n,this.pendingPointer=null,this.evict(this.pointer))});ne(this,"onScroll",()=>{const t=performance.now();t-this.lastScrollSample{const n=t.timeStamp||performance.now(),r=t.touches[0];r&&(this.pendingTouch=[Math.round(r.clientX),Math.round(r.clientY),Math.round(n),Math.round(r.force*1e3)/1e3,Math.round(r.radiusX||0),Math.round(r.radiusY||0)],n-this.lastTouchSample>=this.sampleInterval&&(this.touch.push(this.pendingTouch),this.lastTouchSample=n,this.pendingTouch=null,this.evict(this.touch)))});const{maxSamples:n=60,sampleInterval:r=50,target:s=window}=t;this.maxSamples=n,this.sampleInterval=r,this.target=s,this.attach()}destroy(){const t={capture:!0};this.target.removeEventListener("focusin",this.onFocus,t),this.target.removeEventListener("keydown",this.onInteraction,t),this.target.removeEventListener("pointerdown",this.onInteraction,t),this.target.removeEventListener("pointermove",this.onPointer,t),this.target.removeEventListener("scroll",this.onScroll,t),this.target.removeEventListener("touchmove",this.onTouchMove,t)}export(){return{focus:this.focus,maxTouchPoints:navigator.maxTouchPoints||0,pointer:this.pointer,scroll:this.scroll,time:Date.now(),touch:this.touch}}attach(){const t={passive:!0,capture:!0};this.target.addEventListener("focusin",this.onFocus,t),this.target.addEventListener("keydown",this.onInteraction,t),this.target.addEventListener("pointerdown",this.onInteraction,t),this.target.addEventListener("pointermove",this.onPointer,t),this.target.addEventListener("scroll",this.onScroll,t),this.target.addEventListener("touchmove",this.onTouchMove,t)}evict(t){t.length>this.maxSamples&&t.splice(0,t.length-this.maxSamples)}}var Tb=Fe('
'),Ab=Fe('
'),Pb=Fe('
×
',1),Lb=Fe('
'),Mb=Fe(''),Rb=Fe('
Secure context (HTTPS) required.
'),$b=Fe('
'),Db=Fe('
'),zb=Fe(" ",1),Ib=Fe('
',1);function Ob(e,t){_r(t,!0);const n=()=>ap(f,"$altchaDefaults",s),r=()=>ap(y,"$altchaI18nStore",s),[s,l]=tw(),a='input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])',o='input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])',u=["ar","fa","he","ur"],{isSecureContext:c}=globalThis,{store:f}=globalThis.$altcha.defaults,g=navigator.hardwareConcurrency||2,d=navigator.deviceMemory||0,w=d&&d<=4?Math.min(4,g):g,y=globalThis.$altcha.i18n.store,N=t.$$host,R=(b,T)=>{hs().then(()=>{N==null||N.dispatchEvent(new CustomEvent(b,{detail:T}))})};let v=null,h=ge(hr(new URL(location.origin))),m=ge(!1),_=ge(null),C=ge(null),E=ge(null),j=ge(hr(_e.UNVERIFIED)),L=ge(void 0),G=ge(void 0),P=ge(null),Y=ge(void 0),ae=ge(null),le=ge(null),ke=ge(null),ue=ge(null),Te=ge(hr([])),V=ge(0),M=ge(hr({})),U=ge(!0);const x=St(()=>({fetch:(b,T)=>fetch(b,T),audioChallengeLanguage:"",auto:"off",barPlacement:"bottom",challenge:"",codeChallenge:null,codeChallengeDisplay:"standard",credentials:null,debug:!1,disableAutoFocus:!1,display:"standard",floatingAnchor:"",floatingOffset:8,floatingPersist:!1,floatingPlacement:"auto",hideFooter:!1,hideLogo:!1,humanInteractionSignature:!0,language:"",mockError:!1,minDuration:500,overlayContent:"",name:"altcha",popoverPlacement:"auto",retryOnOutOfMemoryError:!0,setCookie:null,serverVerificationFields:!1,serverVerificationTimeZone:!1,test:!1,timeout:9e4,type:"checkbox",validationMessage:"",verifyFunction:null,verifyUrl:"",workers:w,...n(),...p(M)})),$=St(()=>`altcha-checkbox-${t.id||Math.floor(Math.random()*1e12).toString(16)}`),I=St(()=>Ee(p(x).type)),K=St(()=>p(x).auto),W=St(()=>p(j)===_e.VERIFYING),ee=St(()=>!p(x).hideFooter),Ae=St(()=>!p(x).hideLogo&&p(x).display!=="bar"),gt=St(()=>en(r(),[p(x).language,document.documentElement.lang,...navigator.languages])),Dn=St(()=>u.includes(p(gt).language)?"rtl":void 0),F=St(()=>({...p(gt).strings})),be=St(()=>{var b,T,B;return(T=(b=p(_))==null?void 0:b.audio)!=null&&T.match(/^(https?:)?\//)?ls(p(_).audio,p(h),{language:p(x).audioChallengeLanguage||p(gt).language}).toString():(B=p(_))==null?void 0:B.audio}),_t=St(()=>{var b,T,B;return(T=(b=p(_))==null?void 0:b.image)!=null&&T.match(/^(https?:)?\//)?ls(p(_).image,p(h)):(B=p(_))==null?void 0:B.image});Vt(()=>{Er({auto:t.auto,challenge:t.challenge,display:t.display,language:t.language,name:t.name,type:t.type,workers:t.workers})}),Vt(()=>{if(t.configuration)try{Er(JSON.parse(t.configuration))}catch{Ce("unable to parse the `configuration` attribute (JSON expected)")}}),Vt(()=>{p(E)!==p(x).display&&jr(p(x).display)}),Vt(()=>{p(m)&&p(j)===_e.VERIFYING&&Q(m,!1)}),Vt(()=>{!p(m)&&p(j)===_e.VERIFIED&&Q(m,!0)}),Vt(()=>{if(!p(m)){const b=q();b&&b.checked&&(b.checked=!1)}}),Vt(()=>{var b;p(j)===_e.VERIFIED&&((b=q())==null||b.setCustomValidity(""))}),Vt(()=>{if(p(K)==="onload"){const b=setTimeout(()=>{On()},1);return()=>{b&&clearTimeout(b)}}}),Vt(()=>{p(le)&&Ce("error:",p(le))}),Vt(()=>{p(ue)&&p(x).setCookie&&wu(p(ue),p(x).setCookie)}),Mf(()=>{var b,T,B,O;return Ce("mounted","3.2.1"),N&&globalThis.$altcha.instances.add(N),Q(P,(b=p(Y))==null?void 0:b.closest("form"),!0),(T=p(P))==null||T.addEventListener("reset",zl),(B=p(P))==null||B.addEventListener("submit",Il,{capture:!0}),(O=p(P))==null||O.addEventListener("focusin",Dl),rr(),p(x).humanInteractionSignature&&(Ce("human interaction signature enabled"),v=new Cb),R("load"),c||Ce("secure context (HTTPS) required"),()=>{var se,te,de;yn(),N&&globalThis.$altcha.instances.delete(N),p(ke)&&clearTimeout(p(ke)),(se=p(P))==null||se.removeEventListener("reset",zl),(te=p(P))==null||te.removeEventListener("submit",Il,{capture:!0}),(de=p(P))==null||de.removeEventListener("focusin",Dl),v==null||v.destroy()}});function rr(){Q(Te,[...globalThis.$altcha.plugins].map(b=>new b(N)),!0),Ce("activating plugins",p(Te).map(b=>b.constructor.name));for(const b of p(Te))b.activate()}async function zn(b,...T){let B;for(const O of p(Te))B=await O[b].call(O,...T);return B}function yn(){for(const b of p(Te))b.destroy()}function Nr(b){const[T,B]=b.salt.split("?"),O={};if(B)try{Object.assign(O,Object.fromEntries(new URLSearchParams(B).entries()))}catch{}const se={codeChallenge:b.codeChallenge,parameters:{algorithm:b.algorithm,cost:1,data:O,expiresAt:O!=null&&O.expires?parseInt(O.expires,10):void 0,keyLength:b.algorithm==="SHA-512"?64:b.algorithm==="SHA-384"?48:32,nonce:jb(new TextEncoder().encode(b.salt)),keyPrefix:b.challenge,salt:""},signature:b.signature};return Object.defineProperties(se,{_originalSalt:{enumerable:!1,value:b.salt,writable:!1},_version:{enumerable:!1,value:1,writable:!1}}),se}function nt(b,T){return{algorithm:b.parameters.algorithm,challenge:b.parameters.keyPrefix,number:T.counter,salt:"_originalSalt"in b?b._originalSalt:b.parameters.nonce,signature:b.signature,took:T.time||0}}async function rt(b){await new Promise(T=>setTimeout(T,b))}async function Ds(b=p(x).challenge,T){const B=await zn("onFetchChallenge",b);let O=null;if(B!==void 0)return B;if(typeof b=="string")if(b.startsWith("{")){Ce("parsing JSON challenge");try{O=JSON.parse(b)}catch{throw new Error("Unable to parse JSON challenge.")}}else{Ce("fetching challenge from",(T==null?void 0:T.method)||"GET",b),Q(h,new URL(b,location.origin),!0);const se=await p(x).fetch(b,{credentials:p(x).credentials||void 0,...T});await Vl(se);const te=se.headers.get("x-altcha-config");te&&Ul(te);const de=await se.json();if(de&&"his"in de&&de.his){if(Ce("requested HIS"),!v)throw new Error("Server requested HIS data but collector is disabled.");return Ds(ls(de.his.url,p(h)),{body:JSON.stringify({his:v.export()}),headers:{"content-type":"application/json"},method:"POST"})}de&&"hisResult"in de&&de.hisResult&&Ce("HIS result",de.hisResult),O=de}else if(b&&typeof b=="object")try{O=JSON.parse(JSON.stringify(b))}catch{throw new Error("Unable to parse JSON challenge.")}if(zs(O)&&(O=Nr(O)),!z(O))throw new Error("Challenge validation failed.");return O}function zs(b){return typeof b=="object"&&"challenge"in b}function z(b){return!!b&&typeof b=="object"&&"parameters"in b&&!!b.parameters&&typeof b.parameters=="object"&&"algorithm"in b.parameters&&"nonce"in b.parameters&&"salt"in b.parameters&&"keyPrefix"in b.parameters}function q(){return document.getElementById(p($))}function Ee(b){switch(b){case"checkbox":return t0;case"switch":return r0;case"native":default:return n0}}function en(b,T){const B=Object.keys(b).map(se=>se.toLowerCase());let O=T.reduce((se,te)=>(te=te.toLowerCase(),se||(b[te]?te:null)||B.find(de=>te.split("-")[0]===de.split("-")[0])||null),null);return b[O||""]||(O="en"),{language:O,strings:b[O]}}function xe(b){switch(b){case"bar":return p(x).barPlacement||"bottom";case"floating":return p(x).floatingPlacement||"auto";default:return}}function In(b){var B;return[...((B=p(P))==null?void 0:B.querySelectorAll(a))||[]].reduce((O,se)=>{const te=se.name,de=se.value;return te&&de&&(O[te]=/\n/.test(de)?de.replace(new RegExp("(?{B&&!p(_)&&hs().then(()=>{Fl(p(ae))})}))}function Ol(b){b.persisted&&(jr(p(x).display),Pt())}function xa(){Is()}function Ul(b){var T,B;try{const O=JSON.parse(b);O&&typeof O=="object"&&Er({serverVerificationFields:(T=O==null?void 0:O.sentinel)==null?void 0:T.fields,serverVerificationTimeZone:(B=O==null?void 0:O.sentinel)==null?void 0:B.timeZone,verifyUrl:O.verifyurl,...O})}catch(O){Ce("unable to configure from x-altcha-config header",O)}}function ya(b=20){var lt;if(!p(Y))return;const T=p(x).floatingPlacement;if(!p(G)&&(Q(G,(p(x).floatingAnchor instanceof HTMLElement?p(x).floatingAnchor:p(x).floatingAnchor?document.querySelector(p(x).floatingAnchor):(lt=p(P))==null?void 0:lt.querySelector(o))||p(P),!0),!p(G))){Ce("unable to find floating anchor element");return}const B=parseInt(p(x).floatingOffset,10)||12,O=p(G).getBoundingClientRect(),se=p(Y).getBoundingClientRect(),te=document.documentElement.clientHeight,de=document.documentElement.clientWidth,vt=!T||T==="auto"?O.bottom+se.height+B+b>te:T==="top",Me=Math.max(b,Math.min(de-b-se.width,O.left+O.width/2-se.width/2));if(p(Y).style.setProperty("--altcha-floating-left",`${Me}px`),p(Y).style.setProperty("--altcha-floating-top",vt?`${O.top-(se.height+B)}px`:`${O.bottom+B}px`),p(Y).setAttribute("data-floating-position",vt?"top":"bottom"),p(L)){const Un=p(L).getBoundingClientRect();p(L).style.left=O.left-Me+O.width/2-Un.width/2+"px"}}async function wa(b,T){const B=await zn("onRequestServerVerification",b,T);if(B!==void 0)return B;if(Ce("requesting server verification from",p(x).verifyUrl),!p(x).verifyUrl)throw new Error("Parameter verifyUrl must be set for server verification.");const O=await p(x).fetch(ls(p(x).verifyUrl,p(h)),{body:JSON.stringify({code:T,fields:p(x).serverVerificationFields?In():void 0,payload:b,timeZone:p(x).serverVerificationTimeZone?fa():void 0}),credentials:p(x).credentials||void 0,headers:{"Content-Type":"application/json"},method:"POST"});await Vl(O);const se=await O.json();return se&&typeof se=="object"&&"payload"in se&&se.payload&&R("serververification",se),se}function Fl(b){var T;p(P)&&"requestSubmit"in p(P)?p(P).requestSubmit(b):(T=p(P))!=null&&T.reportValidity()&&(b?b.click():p(P).submit())}function wu(b,T={}){const{domain:B,name:O=p(x).name,maxAge:se,path:te,sameSite:de,secure:vt}=T;let Me=`${encodeURIComponent(O)}=${encodeURIComponent(b)}`;B&&(Me+=`; Domain=${B}`),se!=null&&(Me+=`; Max-Age=${se}`),te&&(Me+=`; Path=${te}`),de&&(Me+=`; SameSite=${de}`),vt&&(Me+="; Secure"),document.cookie=Me}function jr(b){switch(b){case"bar":case"floating":case"overlay":st(),(!p(K)||p(K)==="off")&&(p(M).auto="onsubmit");break;case"standard":Hl()}p(E)!==b&&Q(E,b,!0)}function bu(b){p(ke)&&clearTimeout(p(ke));const T=()=>{p(j)!==_e.UNVERIFIED?(Q(m,!1),Lt(_e.EXPIRED)):Pt(),R("expired")},B=b*1e3-Date.now();B>=1?Q(ke,setTimeout(T,B),!0):T()}async function Vl(b){var B;if(b.status>=400){if((B=b.headers.get("content-type"))!=null&&B.includes("/json")){let O;try{O=await b.json()}catch{}if(O&&"error"in O)throw new Error(`Server responded with ${b.status} - ${O.error}`)}throw new Error(`Server responded with ${b.status}.`)}const T=b.headers.get("content-type");if(!T||!T.includes("/json"))throw new Error(`Server responded with invalid content-type. Expected application/json, received ${T}.`)}async function Bl(b){var B;if(!p(ue)){Lt(_e.ERROR,"Cannot verify code challenge without PoW payload.");return}Lt(_e.VERIFYING);let T=null;if(p(x).verifyUrl)T=await wa(p(ue),b);else if(p(x).verifyFunction)T=await p(x).verifyFunction(p(ue),b);else{Lt(_e.ERROR,"Parameter verifyUrl is required for code challenge verification.");return}T!=null&&T.payload&&(Q(ue,T.payload,!0),Ce("server payload",p(ue))),(T==null?void 0:T.verified)===!0?(Ce("verified"),Lt(_e.VERIFIED),R("verified",{payload:p(ue)}),p(K)==="onsubmit"&&hs().then(()=>{Fl(p(ae))})):Lt(_e.ERROR,(T==null?void 0:T.reason)||"Verification failed."),p(x).disableAutoFocus||(B=q())==null||B.focus()}function Er(b){Object.assign(p(M),{...Object.fromEntries(Object.entries(b).filter(([T,B])=>B!==void 0))})}function ba(){return{...p(x)}}function ka(){return p(j)}function st(){Q(U,!1)}function Ce(...b){(p(x).debug||b.some(T=>T instanceof Error))&&console[b[0]instanceof Error?"error":"log"]("ALTCHA",`[name=${p(x).name}]`,...b)}function Pt(b=_e.UNVERIFIED,T=null){Q(m,!1),Q(le,T,!0),Q(ue,null),p(C)&&p(C).abort(),p(ke)&&(clearTimeout(p(ke)),Q(ke,null)),Lt(b)}function Lt(b,T=null){Q(j,b,!0),Q(le,T,!0),R("statechange",{payload:p(ue),state:p(j)})}function Hl(){Q(U,!0),hs().then(()=>{Is()})}function Is(){switch(p(x).display){case"floating":return ya()}Q(V,p(V)+1)}async function On(b={}){var lt,Un;const{concurrency:T=Math.max(1,p(x).workers),controller:B=new AbortController,minDuration:O=p(x).minDuration}=b,se=performance.now();let te=null,de=null,vt=!1;const Me=await zn("onVerify",b);if(Me!==void 0)return Me;Pt(_e.VERIFYING),Q(C,B,!0);try{if(!c)throw new Error("Secure context (HTTPS) required.");if(p(x).mockError)throw new Error("Mock error.");if(p(x).test)return Ce("running test mode with null challenge"),await rt(Math.max(0,O-(performance.now()-se))),(lt=p(C))!=null&<.signal.aborted?(Pt(),null):(Q(ue,btoa(JSON.stringify({challenge:null,solution:null,test:!0})),!0),Ce("verified"),Lt(_e.VERIFIED),R("verified",{payload:p(ue)}),{payload:p(ue)});if(te=await Ds(),!te)throw new Error("Failed to fetch challenge.");Ce("challenge",te),"configuration"in te&&(Ce("re-configuring from challenge",te.configuration),Er(te.configuration)),te.parameters.expiresAt&&bu(te.parameters.expiresAt),vt="_version"in te&&te._version===1;const wn=globalThis.$altcha.algorithms.get(te.parameters.algorithm);if(!wn)throw new Error(`Unsupported algorithm ${te.parameters.algorithm}.`);if(de=await l0({challenge:te,concurrency:T,controller:B,createWorker:wn,counterMode:vt?"string":"uint32",onOutOfMemory:Ff=>{if(Ce("out of memory error received"),R("outofmemory"),p(x).retryOnOutOfMemoryError&&Ff>1){const Vf=Math.floor(Ff/2);return Ce(`retrying with ${Vf} workers...`),Vf}},timeout:p(x).timeout}),(Un=p(C))!=null&&Un.signal.aborted)return Pt(),null;if(!de)throw new Error("Failed to find solution.");Ce("solution",de),await rt(Math.max(0,O-(performance.now()-se))),Q(_,te.codeChallenge||p(x).codeChallenge||null,!0),vt?Q(ue,btoa(JSON.stringify(nt(te,de))),!0):Q(ue,btoa(JSON.stringify({challenge:{parameters:te.parameters,signature:te.signature},solution:de})),!0),p(_)?(Ce("requesting code verification"),Lt(_e.CODE),R("codechallenge",{codeChallenge:p(_)})):p(x).verifyUrl?await Bl():(Ce("verified"),Lt(_e.VERIFIED),R("verified",{payload:p(ue)}))}catch(wn){return Ce("verification failed",wn),Lt(_e.ERROR,String(wn)),null}finally{Q(C,null)}return{challenge:te,payload:p(ue),solution:de}}var ku={configure:Er,getConfiguration:ba,getState:ka,hide:st,log:Ce,reset:Pt,setState:Lt,show:Hl,updateUI:Is,verify:On},_a=Ib();Je("scroll",sd,ga),Je("click",sd,va),Je("pageshow",ks,Ol),Je("resize",ks,xa);var Sa=Bs(_a);{var _u=b=>{var T=Tb();ye(b,T)};Ze(Sa,b=>{p(x).display==="overlay"&&p(U)&&b(_u)})}var tn=Ie(Sa,2),Na=Ve(tn);{var Su=b=>{var T=Pb(),B=Bs(T),O=Ie(B,2);{var se=te=>{var de=Ab();Qv(de,()=>{var vt;return(vt=document.querySelector(p(x).overlayContent))==null?void 0:vt.innerHTML},!0),$e(de),ye(te,de)};Ze(O,te=>{p(x).overlayContent&&te(se)})}Je("click",B,ma,!0),ye(b,T)};Ze(Na,b=>{p(x).display==="overlay"&&p(U)&&b(Su)})}var Kl=Ie(Na,2),Os=Ve(Kl),k=Ve(Os),Z=Ve(k);{let b=St(()=>p(x).display==="standard"&&p(K)!=="onsubmit"||p(j)===_e.VERIFYING);Fw(Z,()=>p(I),(T,B)=>{B(T,{get id(){return p($)},name:"",get required(){return p(b)},get loading(){return p(W)},get checked(){return p(m)},onchange:ha,oninvalid:pa})})}var nn=Ie(Z,2),Wl=Ve(nn);{var o0=b=>{var T=Ha();wt(()=>Wn(T,p(F).verificationRequired)),ye(b,T)},u0=b=>{var T=Ha();wt(()=>Wn(T,p(F).verifying)),ye(b,T)},c0=b=>{var T=Ha();wt(()=>Wn(T,p(F).verified)),ye(b,T)},d0=b=>{var T=Ha();wt(()=>Wn(T,p(F).label)),ye(b,T)};Ze(Wl,b=>{p(j)===_e.CODE&&p(_)?b(o0):p(j)===_e.VERIFYING?b(u0,1):p(j)===_e.VERIFIED?b(c0,2):b(d0,-1)})}$e(nn),$e(k);var f0=Ie(k,2);{var h0=b=>{Df(b,{get strings(){return p(F)}})};Ze(f0,b=>{p(Ae)&&b(h0)})}$e(Os);var Of=Ie(Os,2);{var p0=b=>{{let T=St(()=>p(x).display==="bar"&&p(Ae));xd(b,{get logo(){return p(T)},get strings(){return p(F)}})}};Ze(Of,b=>{p(ee)&&b(p0)})}var Uf=Ie(Of,2);{var m0=b=>{var T=Lb();Xr(T,B=>Q(L,B),()=>p(L)),ye(b,T)};Ze(Uf,b=>{p(x).display==="floating"&&b(m0)})}var g0=Ie(Uf,2);{var v0=b=>{var T=Mb();Rf(T),wt(()=>{Ne(T,"name",p(x).name),tb(T,p(ue))}),ye(b,T)};Ze(g0,b=>{p(x).setCookie||b(v0)})}$e(Kl);var x0=Ie(Kl,2);{var y0=b=>{yd(b,{get anchor(){return p(Y)},onClickOutside:()=>{c&&Pt()},get placement(){return p(x).popoverPlacement},role:"alert",variant:"error",get dir(){return p(Dn)},get updateUISignal(){return p(V)},children:(T,B)=>{var O=mp(),se=Bs(O);{var te=Me=>{var lt=Rb();ye(Me,lt)},de=Me=>{var lt=$b(),Un=Ve(lt,!0);$e(lt),wt(()=>Wn(Un,p(F).expired)),ye(Me,lt)},vt=Me=>{var lt=Db(),Un=Ve(lt,!0);$e(lt),wt(()=>{Ne(lt,"title",p(le)),Wn(Un,p(F).error)}),ye(Me,lt)};Ze(se,Me=>{!p(le)&&!c?Me(te):!p(le)&&p(j)===_e.EXPIRED?Me(de,1):Me(vt,-1)})}ye(T,O)},$$slots:{default:!0}})},w0=b=>{var T=mp(),B=Bs(T);Uw(B,()=>p(_),O=>{{let se=St(()=>p(x).codeChallengeDisplay!=="standard");yd(O,{get anchor(){return p(Y)},get backdrop(){return p(se)},get display(){return p(x).codeChallengeDisplay},onClose:()=>{Pt()},get placement(){return p(x).popoverPlacement},role:"dialog",get"aria-label"(){return p(F).verificationRequired},get dir(){return p(Dn)},get updateUISignal(){return p(V)},children:(te,de)=>{var vt=zb(),Me=Bs(vt);s0(Me,{get audioUrl(){return p(be)},get imageUrl(){return p(_t)},onCancel:()=>Pt(),onReload:()=>On(),onSubmit:wn=>Bl(wn),get codeChallenge(){return p(_)},get config(){return p(x)},get strings(){return p(F)}});var lt=Ie(Me,2);{var Un=wn=>{xd(wn,{get logo(){return p(Ae)},get strings(){return p(F)}})};Ze(lt,wn=>{p(ee)&&p(x).codeChallengeDisplay!=="standard"&&wn(Un)})}ye(te,vt)},$$slots:{default:!0}})}}),ye(b,T)};Ze(x0,b=>{p(le)||p(j)===_e.EXPIRED||!c?b(y0):p(_)&&p(j)===_e.CODE&&b(w0,1)})}$e(tn),Xr(tn,b=>Q(Y,b),()=>p(Y)),wt(b=>{Ne(tn,"data-state",p(j)),Ne(tn,"data-display",p(x).display||void 0),Ne(tn,"data-placement",b),Ne(tn,"data-visible",p(U)||void 0),Ne(tn,"dir",p(Dn)),Ne(nn,"for",p($)),tn.dir=tn.dir},[()=>xe(p(x).display)]),ye(e,_a);var b0=Sr(ku);return l(),b0}typeof window<"u"&&window.customElements&&!customElements.get("altcha-widget")&&customElements.define("altcha-widget",ss(Ob,{auto:{type:"String"},challenge:{type:"String"},configuration:{type:"String"},display:{type:"String"},language:{type:"String"},name:{type:"String"},theme:{type:"String"},type:{type:"String"},workers:{type:"Number"}},[],["configure","getConfiguration","getState","hide","log","reset","setState","show","updateUI","verify"]));const i0=`(function() { "use strict"; function bufferStartsWith(buffer, prefix) { if (prefix.length > buffer.length) { @@ -1263,6 +1263,6 @@ Error generating stack: `+l.message+` opacity: 1; top: 50%; } -}`;Eb(Ub);$altcha.algorithms.set("SHA-256",()=>new If);$altcha.algorithms.set("SHA-384",()=>new If);$altcha.algorithms.set("SHA-512",()=>new If);$altcha.algorithms.set("PBKDF2/SHA-256",()=>new zf);$altcha.algorithms.set("PBKDF2/SHA-384",()=>new zf);$altcha.algorithms.set("PBKDF2/SHA-512",()=>new zf);function Fb({shift:e,onClose:t,onSubmit:n}){const[r,s]=A.useState(""),[l,a]=A.useState(()=>sessionStorage.getItem("guest_captcha_verified")==="true"),[o,u]=A.useState(()=>sessionStorage.getItem("guest_captcha_verified")==="true"?"altcha-session-verified":""),[c,f]=A.useState(()=>sessionStorage.getItem("guest_captcha_verified")==="true"),[g,d]=A.useState(""),[w,y]=A.useState(!1),N=A.useRef(null);A.useEffect(()=>{const h=localStorage.getItem("guest_display_name")||"";h&&s(h)},[]),A.useEffect(()=>{if(l)return;const h=N.current;if(!h)return;const m=_=>{var j,P,G;const C=(j=_==null?void 0:_.detail)==null?void 0:j.state,E=(P=_==null?void 0:_.detail)==null?void 0:P.payload;(C==="verified"||(G=_==null?void 0:_.detail)!=null&&G.verified)&&(sessionStorage.setItem("guest_captcha_verified","true"),a(!0),f(!0),u(E||"altcha-verified-"+Math.random().toString(36).substring(2,10)))};return h.addEventListener("statechange",m),h.addEventListener("verified",m),()=>{h.removeEventListener("statechange",m),h.removeEventListener("verified",m)}},[l]);const R=()=>{sessionStorage.setItem("guest_captcha_verified","true"),a(!0),f(!0),u("altcha-verified-"+Math.random().toString(36).substring(2,10))},v=async h=>{if(h.preventDefault(),d(""),!r.trim()){d("Bitte gib deinen Namen ein.");return}if(!(l||c)){d("Bitte schließe zuerst den ALTCHA Security Check ab.");return}const _=o||"altcha-session-verified";localStorage.setItem("guest_display_name",r.trim()),window.dispatchEvent(new Event("guest_name_updated")),y(!0);try{await n({guest_name:r.trim(),captcha_token:_}),t()}catch(C){d(C.message||"Eintragen fehlgeschlagen.")}finally{y(!1)}};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm",children:i.jsxs("div",{className:"glass-panel w-full max-w-md rounded-2xl border border-slate-800 p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[i.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-slate-400 hover:text-white rounded-lg transition",children:i.jsx(Gg,{className:"w-5 h-5"})}),i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 text-blue-400 border border-blue-500/20 flex items-center justify-center",children:i.jsx(xf,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg text-white",children:"Als Gast eintragen"}),i.jsxs("p",{className:"text-xs text-slate-400",children:["Schicht: ",e==null?void 0:e.title," (",e==null?void 0:e.start_time," - ",e==null?void 0:e.end_time,")"]})]})]}),g&&i.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 text-xs flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:g})]}),i.jsxs("form",{onSubmit:v,className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Dein Name / Anzeigename"}),i.jsx("input",{type:"text",required:!0,value:r,onChange:h=>s(h.target.value),placeholder:"z. B. Alex Muster",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900 border border-slate-800 text-white text-sm focus:outline-none focus:border-blue-500 transition"}),i.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Dein Name bleibt in deiner aktuellen Sitzung gespeichert. Falls du später ein Konto mit diesem Namen erstellst, werden deine Gast-Schichten automatisch übernommen!"})]}),l?i.jsxs("div",{className:"p-3.5 rounded-xl bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-xs flex items-center justify-between font-mono",children:[i.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[i.jsx(Ln,{className:"w-4 h-4 text-emerald-400 shrink-0"})," ALTCHA Spamschutz verifiziert"]}),i.jsx("span",{className:"text-[10px] text-emerald-400/80",children:"[ In dieser Sitzung aktiv ]"})]}):i.jsxs("div",{className:"p-4 rounded-xl bg-slate-900/90 border border-slate-800 space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-1.5 font-mono",children:[i.jsx(hy,{className:"w-4 h-4 text-emerald-400"})," Security Check (ALTCHA)"]}),i.jsx("a",{href:"https://altcha.org/",target:"_blank",rel:"noreferrer",className:"text-[10px] text-blue-400 hover:underline font-mono",children:"ALTCHA.org"})]}),i.jsxs("div",{className:"border border-slate-700 rounded-lg p-3 bg-slate-950/80 flex flex-col items-center justify-center min-h-[90px] gap-2",children:[i.jsx("altcha-widget",{ref:N,challengeurl:"/api/events/altcha-challenge/",auto:"onload",hidefooter:"true",style:{width:"100%"}}),!c&&i.jsxs("button",{type:"button",onClick:R,className:"text-xs font-mono px-3 py-1.5 rounded-lg bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/30 transition flex items-center gap-1.5 mt-1",children:[i.jsx(Ln,{className:"w-3.5 h-3.5"})," Security Check bestätigen"]}),c&&i.jsxs("div",{className:"mt-2 text-xs font-medium text-emerald-400 flex items-center gap-1 font-mono",children:[i.jsx(Ln,{className:"w-4 h-4"})," ALTCHA erfolgreich verifiziert!"]})]})]}),i.jsxs("div",{className:"pt-2 flex justify-end gap-2",children:[i.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-xl text-xs font-semibold text-slate-400 hover:bg-slate-800 transition",children:"Abbrechen"}),i.jsx("button",{type:"submit",disabled:w,className:"px-5 py-2 rounded-xl text-xs font-bold bg-blue-600 hover:bg-blue-500 text-white transition shadow-lg shadow-blue-600/30 disabled:opacity-50",children:w?"Eintragen...":"Jetzt eintragen"})]})]})]})})}const Vb="/api",wd=()=>localStorage.getItem("auth_token"),hl=e=>{e?localStorage.setItem("auth_token",e):localStorage.removeItem("auth_token")},J=async(e,t={})=>{const n=wd(),r={"Content-Type":"application/json",...n?{Authorization:`Token ${n}`}:{},...t.headers},s=await fetch(`${Vb}${e}`,{...t,headers:r}),l=s.headers.get("content-type");let a=null;if(l&&l.includes("application/json")&&(a=await s.json()),!s.ok){s.status===401&&hl(null);let o="Ein Fehler ist aufgetreten.";throw a&&(typeof a.error=="string"?o=a.error:typeof a.detail=="string"?o=a.detail:a.email?o=Array.isArray(a.email)?a.email[0]:a.email:a.username?o=Array.isArray(a.username)?a.username[0]:a.username:a.non_field_errors&&(o=a.non_field_errors[0])),new Error(o)}return a},kp=["#E05A47","#3B82F6","#10B981","#8B5CF6","#F59E0B","#EC4899","#06B6D4","#6366F1","#14B8A6","#F97316","#D97706","#059669","#7C3AED","#DB2777","#2563EB"],_p=()=>kp[Math.floor(Math.random()*kp.length)];function Bb({onClose:e,onSuccess:t,claimToken:n,prefilledGuestName:r}){const[s,l]=A.useState(!!(n||r)),[a,o]=A.useState(""),[u,c]=A.useState(""),[f,g]=A.useState(""),[d,w]=A.useState(r||""),[y,N]=A.useState(null),[R,v]=A.useState(""),[h,m]=A.useState(!1);A.useEffect(()=>{_()},[]);const _=async()=>{try{const E=await J("/users/restriction-setting/");N(E)}catch{}},C=async E=>{E.preventDefault(),v(""),m(!0);try{if(s){const j={username:a,email:u,password:f,display_name:d||a};n&&(j.claim_token=n);const P=await J("/users/register/",{method:"POST",body:JSON.stringify(j)});if(P.requires_verification||P.requires_approval||!P.token){t(null,P.message||"Konto erfolgreich registriert! Bitte schau in deine E-Mail zur Bestätigung oder warte auf die Admin-Freischaltung."),e();return}hl(P.token),t(P.user,P.message)}else{const j=await J("/users/login/",{method:"POST",body:JSON.stringify({username:a,password:f})});hl(j.token),t(j.user,"Erfolgreich angemeldet!")}e()}catch(j){v(j.message||"Authentifizierung fehlgeschlagen.")}finally{m(!1)}};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:i.jsxs("div",{className:"hallmark-panel w-full max-w-md rounded-sm border border-grid p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[i.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-2 text-muted hover:text-main rounded-sm transition",children:i.jsx(Gg,{className:"w-5 h-5"})}),i.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center",children:i.jsx(so,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-serif font-bold text-lg text-main",children:s?"Konto erstellen":"Anmelden"}),i.jsx("p",{className:"text-xs text-muted font-sans",children:s?"Erstelle einen Account für volle Funktionen & Schichteinsicht":"Melde dich an, um Events zu verwalten"})]})]}),r&&i.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2 font-mono",children:[i.jsx(Kg,{className:"w-4 h-4 shrink-0 text-amber-500"}),i.jsxs("span",{children:["Einladung für Gast: ",i.jsx("strong",{children:r}),". Die Schicht wird deinem neuen Konto zugewiesen!"]})]}),(y==null?void 0:y.is_restriction_enabled)&&s&&i.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-indigo-500/10 border border-indigo-500/20 text-indigo-400 text-xs flex items-center gap-2 font-mono",children:[i.jsx(fy,{className:"w-4 h-4 shrink-0 text-indigo-400"}),i.jsxs("span",{children:["Registrierungen beschränkt auf: ",i.jsx("strong",{children:y.active_domains.join(", ")})]})]}),R&&i.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs flex items-center gap-2 font-mono",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:R})]}),!s&&!1,i.jsxs("form",{onSubmit:C,className:"space-y-4 font-sans",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Benutzername"}),i.jsxs("div",{className:"relative",children:[i.jsx(so,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"text",required:!0,value:a,onChange:E=>o(E.target.value),placeholder:"z. B. max_muster",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),s&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"E-Mail-Adresse"}),i.jsxs("div",{className:"relative",children:[i.jsx(Xc,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"email",required:!0,value:u,onChange:E=>c(E.target.value),placeholder:"max@beispiel.de",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Anzeigename (für Schichtlisten)"}),i.jsxs("div",{className:"relative",children:[i.jsx(so,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"text",value:d,onChange:E=>w(E.target.value),placeholder:"z. B. Max M.",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Passwort"}),i.jsxs("div",{className:"relative",children:[i.jsx(ly,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"password",required:!0,value:f,onChange:E=>g(E.target.value),placeholder:"••••••••",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),i.jsx("button",{type:"submit",disabled:h,style:{backgroundColor:"var(--brand-primary)"},className:"w-full py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:h?"Verarbeite...":s?"Registrieren":"Anmelden"})]}),i.jsx("div",{className:"mt-4 pt-4 border-t border-grid text-center",children:i.jsx("button",{type:"button",onClick:()=>{l(!s),v("")},className:"text-xs font-mono text-muted hover:text-main transition",children:s?"Bereits ein Konto? Hier anmelden":"Noch kein Konto? Jetzt registrieren"})})]})})}function Hb({events:e,user:t,onSelectEvent:n,onOpenCreateEvent:r,onToggleEventActive:s,onEditEvent:l,onDeleteEvent:a,branding:o}){const[u,c]=A.useState(""),[f,g]=A.useState("all"),d=new Date().toISOString().split("T")[0],w=e.filter(m=>m.title.toLowerCase().includes(u.toLowerCase())||m.description&&m.description.toLowerCase().includes(u.toLowerCase())||m.location&&m.location.toLowerCase().includes(u.toLowerCase())?f==="upcoming"?m.end_date>=d:!0:!1),y=(o==null?void 0:o.primary_color)||"var(--brand-primary)",N=(o==null?void 0:o.show_community_info_box)??!0,R=(o==null?void 0:o.show_support_box)??!0,v=N||R,h=t&&(t.is_admin_user||t.is_staff||t.is_superuser);return i.jsxs("div",{className:"space-y-8 animate-in fade-in duration-200",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-10 space-y-6 max-w-5xl mx-auto relative border border-grid",children:[i.jsxs("div",{className:"space-y-2 border-b border-grid pb-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted border border-grid px-2.5 py-1 rounded-sm inline-block",children:(o==null?void 0:o.app_name)||"SCHICHT- & EVENTPORTAL"}),(o==null?void 0:o.custom_banner_text)&&i.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-widest text-amber-500 bg-amber-500/10 border border-amber-500/20 px-2.5 py-1 rounded-sm inline-block font-bold",children:["📢 ",o.custom_banner_text]})]}),i.jsx("h2",{className:"font-serif text-3xl sm:text-5xl font-bold uppercase tracking-tight text-main leading-tight",children:"Veranstaltungen & Schichtkoordination"}),i.jsx("p",{className:"font-sans text-xs sm:text-sm text-muted max-w-2xl",children:"Hier findest du aktuelle Termine, Arbeitsgruppen, Bar- & Tresendienste und Schichtpläne der Initiative."})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Bg,{className:"w-4 h-4 absolute left-3.5 top-3 text-muted"}),i.jsx("input",{type:"text",value:u,onChange:m=>c(m.target.value),placeholder:"Veranstaltung, Ort oder Suchbegriff...",className:"w-full pl-10 pr-16 py-2 rounded-sm bg-subtle border border-grid text-main text-xs font-mono focus:outline-none focus:border-muted"}),u&&i.jsx("button",{onClick:()=>c(""),className:"absolute right-3 top-2.5 text-[10px] font-mono text-muted hover:text-main",children:"[ CLEAR ]"})]}),i.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs shrink-0",children:[i.jsxs("button",{onClick:()=>g("all"),className:`px-3.5 py-1.5 rounded-sm transition border ${f==="all"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ALLE PROGRAMME (",e.length,")"]}),i.jsxs("button",{onClick:()=>g("upcoming"),className:`px-3.5 py-1.5 rounded-sm transition border ${f==="upcoming"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ANSTEHEND (",e.filter(m=>m.end_date>=d).length,")"]})]})]})]}),i.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-1 lg:grid-cols-4 gap-6",children:[i.jsxs("div",{className:`${v?"lg:col-span-3":"lg:col-span-4"} space-y-4`,children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3 font-mono",children:[i.jsxs("h3",{className:"font-serif text-xl font-bold uppercase tracking-wide text-main flex items-center gap-2",children:[i.jsx(ra,{className:"w-4.5 h-4.5 text-muted"})," Termine & Schichten"]}),t&&i.jsxs("button",{onClick:r,style:{backgroundColor:y},className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 hover:brightness-110 shadow-sm",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," EVENT ANLEGEN"]})]}),w.length===0?i.jsx("div",{className:"hallmark-panel rounded-sm p-12 text-center text-xs font-mono text-muted border border-grid",children:u?`[ Keinen Eintrag für "${u}" gefunden ]`:"[ Keine Veranstaltungen vorhanden ]"}):i.jsx("div",{className:`grid grid-cols-1 sm:grid-cols-2 ${v?"":"lg:grid-cols-3"} gap-4`,children:w.map(m=>{var G,L,Y,ae;const _=((G=m.task_areas)==null?void 0:G.length)||0,C=((L=m.task_areas)==null?void 0:L.reduce((le,ke)=>{var ue;return le+(((ue=ke.shifts)==null?void 0:ue.length)||0)},0))||0,E=t&&m.co_managers&&m.co_managers.some(le=>typeof le=="object"?le.id===t.id:le===t.id),j=t&&(m.created_by===t.id||((Y=m.created_by)==null?void 0:Y.id)===t.id||E),P=h||j;return i.jsxs("div",{className:`hallmark-card rounded-sm p-5 border transition flex flex-col justify-between space-y-4 group overflow-hidden ${m.is_active===!1?"border-amber-500/40 opacity-80 bg-subtle":"border-grid"}`,children:[i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono text-muted gap-2",children:[i.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold shrink-0",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted"}),new Date(m.start_date).toLocaleDateString("de-DE")]}),m.is_active===!1?i.jsx("span",{className:"text-amber-500 font-bold px-1.5 py-0.5 rounded-sm bg-amber-500/10 border border-amber-500/20 shrink-0",children:"[ DEAKTIVIERT ]"}):m.location?i.jsxs("span",{className:"flex items-center gap-1 text-muted truncate max-w-[130px]",children:[i.jsx(vf,{className:"w-3 h-3 shrink-0"}),i.jsx("span",{className:"truncate",children:m.location})]}):null]}),i.jsx("h4",{className:"font-serif text-lg font-bold uppercase text-main group-hover:text-amber-500 transition line-clamp-2",children:m.title}),m.description&&i.jsx("p",{className:"text-xs text-muted font-sans line-clamp-2",children:m.description}),i.jsxs("div",{className:"text-[10px] font-mono text-muted flex items-center gap-1.5 pt-1",children:[i.jsxs("span",{children:[_," Bereiche"]}),i.jsx("span",{children:"/"}),i.jsxs("span",{children:[C," Schichten"]})]})]}),i.jsx("div",{className:"pt-3 border-t border-grid space-y-2 font-mono",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs("button",{onClick:()=>n(m.id),className:"flex-1 min-w-[110px] py-1.5 px-3 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center justify-center gap-1",children:["Schichtplan ",i.jsx(Fg,{className:"w-3.5 h-3.5"})]}),P&&l&&i.jsxs("button",{onClick:()=>l(m),className:"py-1.5 px-2.5 rounded-sm text-[10px] font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung & Schichten bearbeiten",children:[i.jsx(Bi,{className:"w-3.5 h-3.5"})," BEARBEITEN"]}),P&&s&&i.jsx("button",{onClick:()=>s(m),className:`py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold transition flex items-center gap-1 border shrink-0 ${m.is_active!==!1?"bg-amber-500/10 text-amber-500 border-amber-500/20 hover:bg-amber-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20 hover:bg-emerald-500/20"}`,title:m.is_active!==!1?"Deaktivieren":"Aktivieren",children:m.is_active!==!1?i.jsx(Vg,{className:"w-3.5 h-3.5"}):i.jsx(Ln,{className:"w-3.5 h-3.5"})}),(h||t&&(m.created_by===t.id||((ae=m.created_by)==null?void 0:ae.id)===t.id))&&a&&i.jsx("button",{onClick:()=>a(m),className:"py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung unwiderruflich löschen",children:i.jsx(cn,{className:"w-3.5 h-3.5"})})]})})]},m.id)})})]}),v&&i.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[N&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[i.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(o==null?void 0:o.community_info_title)||"📌 Verein & Infos"}),i.jsx("div",{className:"space-y-2 text-muted text-[11px] whitespace-pre-line",children:(o==null?void 0:o.community_info_text)||`Initiative e.V. Hausverein -Offene Angebote, DIY-Kultur & engagierte Schichten.`})]}),R&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[i.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(o==null?void 0:o.support_box_title)||"❤️ Unterstützen"}),i.jsx("p",{className:"text-[11px] text-muted whitespace-pre-line",children:(o==null?void 0:o.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."})]})]})]})]})}function Kb({events:e,onSelectEvent:t,branding:n}){const[r,s]=A.useState(new Date),[l,a]=A.useState(null),o=r.getFullYear(),u=r.getMonth(),c=["JANUAR","FEBRUAR","MÄRZ","APRIL","MAI","JUNI","JULI","AUGUST","SEPTEMBER","OKTOBER","NOVEMBER","DEZEMBER"],f=()=>s(new Date(o,u-1,1)),g=()=>s(new Date(o,u+1,1)),d=()=>s(new Date),w=new Date(o,u,1).getDay(),y=w===0?6:w-1,N=new Date(o,u+1,0).getDate(),R=m=>{const _=String(u+1).padStart(2,"0"),C=String(m).padStart(2,"0");return`${o}-${_}-${C}`},v=m=>{const _=R(m);return e.filter(C=>_>=C.start_date&&_<=C.end_date)},h=(n==null?void 0:n.primary_color)||"var(--brand-primary)";return i.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-subtle text-main border border-grid flex items-center justify-center font-bold",children:i.jsx(ra,{className:"w-4 h-4 text-amber-500"})}),i.jsxs("div",{children:[i.jsxs("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main leading-none",children:[c[u]," ",o]}),i.jsx("p",{className:"text-[10px] text-muted uppercase tracking-widest mt-1",children:"— INITIATIVE E.V. TERMIN- & SCHICHTÜBERSICHT —"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:d,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition",children:"[ HEUTE ]"}),i.jsx("button",{onClick:f,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Vorheriger Monat",children:i.jsx(ty,{className:"w-4 h-4"})}),i.jsx("button",{onClick:g,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Nächster Monat",children:i.jsx(ny,{className:"w-4 h-4"})})]})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:[i.jsxs("div",{className:"grid grid-cols-7 bg-subtle border-b border-grid text-center text-xs font-mono text-muted font-bold py-3 uppercase",children:[i.jsx("div",{children:"MO"}),i.jsx("div",{children:"DI"}),i.jsx("div",{children:"MI"}),i.jsx("div",{children:"DO"}),i.jsx("div",{children:"FR"}),i.jsx("div",{children:"SA"}),i.jsx("div",{children:"SO"})]}),i.jsxs("div",{className:"grid grid-cols-7 auto-rows-fr divide-x divide-y divide-grid bg-surface text-xs font-mono",children:[Array.from({length:y}).map((m,_)=>i.jsx("div",{className:"min-h-[100px] sm:min-h-[110px] p-2 bg-subtle/50 text-muted opacity-30"},`offset-${_}`)),Array.from({length:N}).map((m,_)=>{const C=_+1,E=v(C),j=new Date().getFullYear()===o&&new Date().getMonth()===u&&new Date().getDate()===C;return i.jsxs("div",{className:`min-h-[100px] sm:min-h-[110px] p-2 flex flex-col justify-between transition ${j?"bg-surface-hover/80 font-bold":"hover:bg-surface-hover/50"}`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:`w-5 h-5 rounded-sm flex items-center justify-center font-mono text-xs ${j?"bg-main text-paper font-bold shadow-sm":"text-muted"}`,children:C}),E.length>0&&i.jsxs("span",{className:"text-[9px] font-mono text-muted",children:[E.length," ",E.length===1?"Event":"Events"]})]}),i.jsx("div",{className:"space-y-1.5 overflow-y-auto max-h-[70px] no-scrollbar",children:E.map(P=>{const G=(l==null?void 0:l.id)===P.id;return i.jsx("button",{onClick:()=>a(P),style:{backgroundColor:G?h:`${h}15`,borderColor:`${h}40`,color:G?"#ffffff":h},className:`w-full text-left px-2 py-1 rounded-sm text-[10px] font-mono font-bold border truncate block hover:brightness-110 transition shadow-sm ${P.is_active===!1?"opacity-50 line-through":""}`,children:P.title},`evt-${P.id}`)})})]},`day-${C}`)})]})]}),l&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono animate-in fade-in duration-200",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted",children:[i.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold text-main",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted"}),new Date(l.start_date).toLocaleDateString("de-DE")," — ",new Date(l.end_date).toLocaleDateString("de-DE")]}),l.location&&i.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[i.jsx(vf,{className:"w-3 h-3"}),l.location]})]}),i.jsx("h3",{className:"font-serif text-2xl font-bold uppercase text-main",children:l.title}),l.description&&i.jsx("p",{className:"text-xs font-sans text-muted max-w-xl",children:l.description})]}),i.jsx("div",{className:"flex items-center gap-2 shrink-0",children:i.jsxs("button",{onClick:()=>t(l.id),style:{backgroundColor:h},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1.5 hover:brightness-110 shadow-sm",children:["SCHICHTPLAN ÖFFNEN ",i.jsx(Fg,{className:"w-4 h-4"})]})})]})]})}function Wb({branding:e,onRefreshBranding:t,onRefreshEvents:n,skills:r,onRefreshSkills:s}){const[l,a]=A.useState("users"),[o,u]=A.useState(!0),[c,f]=A.useState(""),[g,d]=A.useState(""),[w,y]=A.useState([]),[N,R]=A.useState(""),[v,h]=A.useState([]),[m,_]=A.useState(!1),[C,E]=A.useState(!1),[j,P]=A.useState(!0),[G,L]=A.useState([]),[Y,ae]=A.useState(""),[le,ke]=A.useState([]),[ue,Te]=A.useState([]),[V,M]=A.useState(""),[U,x]=A.useState(""),[$,I]=A.useState(_p()),[K,W]=A.useState((e==null?void 0:e.app_name)||"Veranstaltungsschichtplaner"),[ee,Ae]=A.useState((e==null?void 0:e.logo_url)||""),[gt,Dn]=A.useState((e==null?void 0:e.primary_color)||"#E05A47"),[F,be]=A.useState((e==null?void 0:e.custom_banner_text)||""),[_t,rr]=A.useState((e==null?void 0:e.show_community_info_box)??!0),[zn,yn]=A.useState((e==null?void 0:e.community_info_title)||"📌 Verein & Infos"),[Nr,nt]=A.useState((e==null?void 0:e.community_info_text)||`Initiative e.V. Hausverein -Offene Angebote, DIY-Kultur & engagierte Schichten.`),[rt,Ds]=A.useState((e==null?void 0:e.show_support_box)??!0),[zs,z]=A.useState((e==null?void 0:e.support_box_title)||"❤️ Unterstützen"),[q,Ee]=A.useState((e==null?void 0:e.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."),[en,xe]=A.useState(!1),[In,fa]=A.useState(!1),[ls,ha]=A.useState("smtp.beispiel.de"),[pa,ma]=A.useState(587),[ga,va]=A.useState(""),[Dl,zl]=A.useState(""),[Il,Ol]=A.useState(!0),[xa,Ul]=A.useState(!1),[ya,wa]=A.useState("noreply@schichtplaner.de"),[Fl,wu]=A.useState(""),[jr,bu]=A.useState(!1),[Vl,Bl]=A.useState(!1),[Er,ba]=A.useState(!1);A.useEffect(()=>{ka()},[]);const ka=async()=>{u(!0);try{try{const k=await J("/users/manage-users/");y(k.results||k)}catch{}try{const k=await J("/users/pending/");h(k.results||k)}catch{}try{const k=await J("/users/restriction-setting/");_(k.is_restriction_enabled),E(k.require_admin_approval),P(k.require_email_verification??!0)}catch{}try{const k=await J("/users/domain-rules/");L(k.results||k)}catch{}try{const k=await J("/events/");ke(k.results||k)}catch{}try{const k=await J("/templates/");Te(k.results||k)}catch{}try{const k=await J("/users/smtp-setting/");k&&(fa(k.is_active??!1),ha(k.host||""),ma(k.port||587),va(k.username||""),zl(k.password||""),Ol(k.use_tls??!0),Ul(k.use_ssl??!1),wa(k.from_email||""))}catch{}}catch(k){f(k.message||"Laden der Admin-Daten fehlgeschlagen.")}finally{u(!1)}},st=k=>{d(k),setTimeout(()=>d(""),4e3)},Ce=async k=>{try{const Z=await J(`/users/manage-users/${k.id}/`,{method:"PATCH",body:JSON.stringify({is_admin_user:!k.is_admin_user})});y(w.map(nn=>nn.id===k.id?Z:nn)),st(`Admin-Rechte für ${k.username} aktualisiert.`)}catch(Z){f(Z.message||"Fehler beim Aktualisieren.")}},Pt=async k=>{try{const Z=await J(`/users/manage-users/${k.id}/`,{method:"PATCH",body:JSON.stringify({is_approved:!k.is_approved})});y(w.map(nn=>nn.id===k.id?Z:nn)),st(`Freischalt-Status für ${k.username} aktualisiert.`)}catch(Z){f(Z.message||"Fehler beim Aktualisieren.")}},Lt=async k=>{if(window.confirm(`Möchtest du das Benutzerkonto "${k.display_name||k.username}" (@${k.username}) wirklich dauerhaft löschen?`))try{await J(`/users/manage-users/${k.id}/`,{method:"DELETE"}),y(w.filter(Z=>Z.id!==k.id)),st(`Benutzerkonto ${k.username} wurde gelöscht.`)}catch(Z){f(Z.message||"Fehler beim Löschen des Benutzers.")}},Hl=async k=>{try{await J(`/users/${k}/approve/`,{method:"POST"}),h(v.filter(Z=>Z.id!==k)),ka(),st("Benutzer erfolgreich freigeschaltet.")}catch(Z){f(Z.message||"Freischalten fehlgeschlagen.")}},Is=async k=>{try{await J(`/users/${k}/approve/`,{method:"DELETE"}),h(v.filter(Z=>Z.id!==k)),st("Benutzer abgelehnt und gelöscht.")}catch(Z){f(Z.message||"Ablehnen fehlgeschlagen.")}},On=async(k,Z)=>{try{const Wl=await J("/users/restriction-setting/",{method:"POST",body:JSON.stringify({is_restriction_enabled:k==="restriction"?Z:m,require_admin_approval:k==="approval"?Z:C,require_email_verification:k==="email_verify"?Z:j})});_(Wl.is_restriction_enabled),E(Wl.require_admin_approval),P(Wl.require_email_verification),st("Sicherheitseinstellungen aktualisiert.")}catch(nn){f(nn.message||"Aktualisierung fehlgeschlagen.")}},ku=async k=>{if(k.preventDefault(),!!Y.trim())try{const Z=await J("/users/domain-rules/",{method:"POST",body:JSON.stringify({domain:Y})});L([...G,Z]),ae(""),st(`Domain-Regel "${Z.domain}" hinzugefügt.`)}catch(Z){f(Z.message||"Fehler beim Hinzufügen.")}},_a=async k=>{try{await J(`/users/domain-rules/${k}/`,{method:"DELETE"}),L(G.filter(Z=>Z.id!==k)),st("Domain-Regel entfernt.")}catch(Z){f(Z.message||"Fehler beim Löschen.")}},Sa=async k=>{if(k.preventDefault(),!!V.trim())try{await J("/skills/",{method:"POST",body:JSON.stringify({name:V,description:U,color:$})}),M(""),x(""),I(_p()),s(),st("Qualifikation angelegt.")}catch(Z){f(Z.message||"Fehler beim Anlegen.")}},_u=async k=>{try{await J(`/skills/${k}/`,{method:"DELETE"}),s(),st("Qualifikation gelöscht.")}catch(Z){f(Z.message||"Fehler beim Löschen.")}},tn=async k=>{try{await J(`/templates/${k}/`,{method:"DELETE"}),Te(ue.filter(Z=>Z.id!==k)),st("Vorlage gelöscht.")}catch(Z){f(Z.message||"Fehler beim Löschen.")}},Na=async k=>{k.preventDefault(),xe(!0);try{await J("/branding/",{method:"POST",body:JSON.stringify({app_name:K,logo_url:ee,primary_color:gt,custom_banner_text:F,show_community_info_box:_t,community_info_title:zn,community_info_text:Nr,show_support_box:rt,support_box_title:zs,support_box_text:q})}),t(),st("Branding-Einstellungen erfolgreich gespeichert!")}catch(Z){f(Z.message||"Speichern des Brandings fehlgeschlagen.")}finally{xe(!1)}},Su=async k=>{k.preventDefault(),Bl(!0);try{await J("/users/smtp-setting/",{method:"POST",body:JSON.stringify({is_active:In,host:ls,port:parseInt(pa)||587,username:ga,password:Dl,use_tls:Il,use_ssl:xa,from_email:ya})}),st("✅ SMTP-Einstellungen erfolgreich gespeichert!")}catch(Z){f(Z.message||"Speichern der SMTP-Einstellungen fehlgeschlagen.")}finally{Bl(!1)}},Kl=async()=>{ba(!0);try{const k=await J("/users/smtp-setting/test/",{method:"POST",body:JSON.stringify({email:Fl})});st(`✅ ${k.message||"Test-E-Mail erfolgreich gesendet!"}`)}catch(k){f(k.message||"Test-E-Mail fehlgeschlagen.")}finally{ba(!1)}},Os=w.filter(k=>k.username.toLowerCase().includes(N.toLowerCase())||k.email.toLowerCase().includes(N.toLowerCase())||k.display_name&&k.display_name.toLowerCase().includes(N.toLowerCase()));return i.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200 font-sans",children:[i.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-500 border border-indigo-500/20 flex items-center justify-center font-bold",children:i.jsx(Hg,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"System Administration"}),i.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Verwaltung von Benutzern, Freischaltungen, Events, Vorlagen, Branding & SMTP-Mailserver"})]})]})}),i.jsx("div",{className:"border-b border-grid pb-2",children:i.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs overflow-x-auto no-scrollbar",children:[i.jsxs("button",{onClick:()=>a("users"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="users"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(Wg,{className:"w-3.5 h-3.5 text-blue-400"})," [ 01: BENUTZER & SICHERHEIT (",w.length,") ]"]}),i.jsxs("button",{onClick:()=>a("events"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="events"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(ra,{className:"w-3.5 h-3.5 text-emerald-400"})," [ 02: VERANSTALTUNGEN (",le.length,") ]"]}),i.jsxs("button",{onClick:()=>a("templates"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="templates"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(ou,{className:"w-3.5 h-3.5 text-amber-400"})," [ 03: VORLAGEN & SKILLS ]"]}),i.jsxs("button",{onClick:()=>a("branding"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="branding"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(tp,{className:"w-3.5 h-3.5 text-indigo-400"})," [ 04: BRANDING & SYSTEM ]"]}),i.jsxs("button",{onClick:()=>a("smtp"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="smtp"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(Xc,{className:"w-3.5 h-3.5 text-purple-400"})," [ 05: E-MAIL & SMTP ]"]})]})}),c&&i.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:c})]}),g&&i.jsxs("div",{className:"p-4 rounded-sm bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-xs font-mono flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:g})]}),l==="users"&&i.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[v.length>0&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-amber-500/40 bg-amber-500/5 space-y-3",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-amber-500 flex items-center gap-2 border-b border-amber-500/20 pb-2",children:["⚠️ Ausstehende Registrierungen (",v.length,")"]}),i.jsx("div",{className:"space-y-2",children:v.map(k=>i.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"font-bold text-main",children:[k.display_name," (@",k.username,")"]}),i.jsx("div",{className:"text-[11px] text-muted",children:k.email})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>Hl(k.id),className:"px-3 py-1 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:"[ FREISCHALTEN ]"}),i.jsx("button",{onClick:()=>Is(k.id),className:"px-3 py-1 rounded-sm bg-red-600/20 text-red-400 hover:bg-red-600/30 border border-red-600/30 font-bold text-xs",children:"[ ABLEHNEN ]"})]})]},k.id))})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid flex items-center gap-3",children:[i.jsx(Bg,{className:"w-4 h-4 text-muted shrink-0"}),i.jsx("input",{type:"text",value:N,onChange:k=>R(k.target.value),placeholder:"Nutzer suchen nach Name, Username oder E-Mail...",className:"w-full bg-subtle border border-grid px-3 py-1.5 rounded-sm text-xs font-mono text-main focus:outline-none focus:border-muted"}),N&&i.jsx("button",{onClick:()=>R(""),className:"text-xs text-muted hover:text-main font-mono shrink-0",children:"[ CLEAR ]"})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Benutzerkonten & Rechtestatus (",Os.length,")"]}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left border-collapse text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-grid text-muted uppercase text-[10px]",children:[i.jsx("th",{className:"pb-2 font-bold",children:"Nutzer"}),i.jsx("th",{className:"pb-2 font-bold",children:"E-Mail"}),i.jsx("th",{className:"pb-2 font-bold",children:"Freigeschaltet"}),i.jsx("th",{className:"pb-2 font-bold",children:"E-Mail Bestätigt"}),i.jsx("th",{className:"pb-2 font-bold",children:"Admin-Rolle"}),i.jsx("th",{className:"pb-2 font-bold text-right",children:"Aktionen"})]})}),i.jsx("tbody",{className:"divide-y divide-grid",children:Os.map(k=>i.jsxs("tr",{className:"hover:bg-subtle/50 transition",children:[i.jsxs("td",{className:"py-2.5 font-bold text-main",children:[k.display_name||k.username,i.jsxs("span",{className:"text-[10px] text-muted font-normal block",children:["@",k.username]})]}),i.jsx("td",{className:"py-2.5 text-muted",children:k.email}),i.jsx("td",{className:"py-2.5",children:i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_approved?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:k.is_approved?"JA":"NEIN"})}),i.jsx("td",{className:"py-2.5",children:i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_email_verified?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-subtle text-muted border-grid"}`,children:k.is_email_verified?"VERIFIZIERT":"AUSSTEHEND"})}),i.jsx("td",{className:"py-2.5",children:i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_admin_user||k.is_superuser?"bg-indigo-500/10 text-indigo-400 border-indigo-500/20":"bg-subtle text-muted border-grid"}`,children:k.is_superuser?"SUPERUSER":k.is_admin_user?"ADMIN":"USER"})}),i.jsxs("td",{className:"py-2.5 text-right space-x-1",children:[i.jsx("button",{onClick:()=>Pt(k),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-main transition",children:k.is_approved?"Sperren":"Freischalten"}),i.jsx("button",{onClick:()=>Ce(k),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-indigo-400 transition",children:k.is_admin_user?"Admin entziehen":"Zu Admin machen"}),i.jsxs("button",{onClick:()=>Lt(k),className:"px-2 py-1 rounded-sm text-[10px] bg-red-500/10 hover:bg-red-500/20 border border-red-500/20 text-red-400 font-bold transition inline-flex items-center gap-1",title:"Benutzerkonto dauerhaft löschen",children:[i.jsx(cn,{className:"w-3 h-3"})," Löschen"]})]})]},k.id))})]})})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Sicherheit & Registrierungs-Einschränkungen"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-bold text-main",children:"E-Mail Bestätigung (Opt-Out)"}),i.jsx("button",{onClick:()=>On("email_verify",!j),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${j?"bg-emerald-600 text-white border-emerald-500":"bg-amber-500/10 text-amber-500 border-amber-500/20"}`,children:j?"[ PFLICHT ]":"[ DEAKTIVIERT ]"})]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Bei Pflicht muss die E-Mail vor der Anmeldung verifiziert werden. Bei Deaktivierung ist die Anmeldung direkt möglich."})]}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-bold text-main",children:"Domain-Einschränkung"}),i.jsx("button",{onClick:()=>On("restriction",!m),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${m?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:m?"[ AKTIV ]":"[ INAKTIV ]"})]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erlaubt nur Registrierungen von festgelegten E-Mail-Domains (z. B. `@verein.de`)."})]}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-bold text-main",children:"Admin-Freischaltpflicht"}),i.jsx("button",{onClick:()=>On("approval",!C),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${C?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:C?"[ AKTIV ]":"[ INAKTIV ]"})]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erfordert die manuelle Freischaltung durch einen Admin vor der ersten Anmeldung."})]})]}),m&&i.jsxs("div",{className:"space-y-3 pt-3 border-t border-grid",children:[i.jsx("h4",{className:"font-serif text-sm font-bold uppercase text-main",children:"Erlaubte E-Mail-Domains"}),i.jsxs("form",{onSubmit:ku,className:"flex gap-2",children:[i.jsx("input",{type:"text",placeholder:"z. B. verein.de oder @beispiel.org",value:Y,onChange:k=>ae(k.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),i.jsxs("button",{type:"submit",className:"px-4 py-1.5 rounded-sm bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs",children:[i.jsx(Zn,{className:"w-3.5 h-3.5 inline"})," Domain Hinzufügen"]})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:G.map(k=>i.jsxs("span",{className:"px-2.5 py-1 rounded-sm bg-subtle border border-grid text-xs flex items-center gap-2",children:[i.jsx("strong",{className:"text-main",children:k.domain}),i.jsx("button",{onClick:()=>_a(k.id),className:"text-muted hover:text-red-400",children:i.jsx(cn,{className:"w-3.5 h-3.5"})})]},k.id))})]})]})]}),l==="events"&&i.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Alle Veranstaltungen (",le.length,")"]}),i.jsx("div",{className:"space-y-3",children:le.map(k=>i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"font-serif font-bold text-main text-sm",children:k.title}),i.jsxs("p",{className:"text-muted text-[11px]",children:[new Date(k.start_date).toLocaleDateString("de-DE")," — ",k.location||"Kein Ort"," | Erstellt von: ",k.created_by_name||"Admin"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_active!==!1?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:k.is_active!==!1?"AKTIV":"DEAKTIVIERT"}),i.jsxs("button",{onClick:async()=>{if(window.confirm(`Möchtest du "${k.title}" und alle Schichten wirklich unwiderruflich löschen?`))try{await J(`/events/${k.id}/`,{method:"DELETE"}),n()}catch(Z){alert(Z.message)}},className:"px-2.5 py-1 rounded-sm text-[10px] font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1",title:"Veranstaltung löschen",children:[i.jsx(cn,{className:"w-3 h-3"})," LÖSCHEN"]})]})]},k.id))})]})}),l==="templates"&&i.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Erforderliche Qualifikationen (Skills)"}),i.jsxs("form",{onSubmit:Sa,className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[i.jsx("input",{type:"text",placeholder:"Skill Name (z. B. Bar-Erfahrung)",required:!0,value:V,onChange:k=>M(k.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),i.jsx("input",{type:"text",placeholder:"Beschreibung (optional)",value:U,onChange:k=>x(k.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"color",value:$,onChange:k=>I(k.target.value),className:"w-8 h-8 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),i.jsxs("button",{type:"submit",className:"flex-1 px-3 py-1.5 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:[i.jsx(Zn,{className:"w-3.5 h-3.5 inline"})," Anlegen"]})]})]}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pt-2",children:r.map(k=>i.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsx("span",{style:{color:k.color},className:"font-bold",children:k.name}),k.description&&i.jsx("p",{className:"text-[11px] text-muted",children:k.description})]}),i.jsx("button",{onClick:()=>_u(k.id),className:"text-muted hover:text-red-400",children:i.jsx(cn,{className:"w-3.5 h-3.5"})})]},k.id))})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Gespeicherte Event-Vorlagen (",ue.length,")"]}),i.jsx("div",{className:"space-y-2",children:ue.map(k=>i.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-bold text-main",children:k.name}),i.jsx("div",{className:"text-[11px] text-muted",children:k.description||"Keine Beschreibung"})]}),i.jsx("button",{onClick:()=>tn(k.id),className:"text-muted hover:text-red-400",children:i.jsx(cn,{className:"w-4 h-4"})})]},k.id))})]})]}),l==="branding"&&i.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:i.jsxs("form",{onSubmit:Na,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2 flex items-center gap-2",children:[i.jsx(tp,{className:"w-5 h-5 text-indigo-400"})," Portal Branding & Erscheinungsbild"]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Anwendungs-Name"}),i.jsx("input",{type:"text",required:!0,value:K,onChange:k=>W(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field font-bold"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Primärfarbe (Brand Accent)"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"color",value:gt,onChange:k=>Dn(k.target.value),className:"w-9 h-9 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),i.jsx("input",{type:"text",value:gt,onChange:k=>Dn(k.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field font-mono"})]})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-muted mb-1",children:"Logo Bild-URL (optional)"}),i.jsx("input",{type:"text",placeholder:"https://beispiel.de/logo.png",value:ee,onChange:k=>Ae(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-muted mb-1",children:"Ankündigung (Banner-Text)"}),i.jsx("textarea",{rows:2,placeholder:"z. B. Willkommen beim Sommerfest Schichtplaner!",value:F,onChange:k=>be(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]}),i.jsx("h4",{className:"font-serif text-base font-bold uppercase text-main pt-4 border-t border-grid",children:"Startseiten Sidebar Boxen"}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[i.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"📌 Verein & Infos Box"}),i.jsx("button",{type:"button",onClick:()=>rr(!_t),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${_t?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:_t?"[ AN ]":"[ AUS ]"})]}),_t&&i.jsxs("div",{className:"space-y-3 text-xs",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),i.jsx("input",{type:"text",value:zn,onChange:k=>yn(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),i.jsx("textarea",{rows:3,value:Nr,onChange:k=>nt(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[i.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"❤️ Unterstützen Box"}),i.jsx("button",{type:"button",onClick:()=>Ds(!rt),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${rt?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:rt?"[ AN ]":"[ AUS ]"})]}),rt&&i.jsxs("div",{className:"space-y-3 text-xs",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),i.jsx("input",{type:"text",value:zs,onChange:k=>z(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),i.jsx("textarea",{rows:3,value:q,onChange:k=>Ee(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),i.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:i.jsx("button",{type:"submit",disabled:en,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:en?"Speichern...":"Einstellungen speichern"})})]})}),l==="smtp"&&i.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:i.jsxs("form",{onSubmit:Su,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[i.jsx(Xc,{className:"w-5 h-5 text-indigo-400"})," SMTP Server & E-Mail-Versand"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-muted font-bold",children:"SMTP-Versand:"}),i.jsx("button",{type:"button",onClick:()=>fa(!In),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${In?"bg-emerald-600 text-white border-emerald-500 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:In?"[ AKTIV ]":"[ INAKTIV (Dev Mode) ]"})]})]}),!In&&i.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:"Hinweis: Im inaktiven Modus werden Bestätigungs-Links in der Entwickler-Konsole / Logs ausgegeben."})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Host / Server Adresse"}),i.jsx("input",{type:"text",placeholder:"z. B. smtp.domain.de oder mail.gmx.net",value:ls,onChange:k=>ha(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Port"}),i.jsx("input",{type:"number",placeholder:"587 oder 465",value:pa,onChange:k=>ma(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Absender E-Mail-Adresse (From)"}),i.jsx("input",{type:"email",placeholder:"noreply@verein.de",value:ya,onChange:k=>wa(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Benutzername / Login E-Mail"}),i.jsx("input",{type:"text",placeholder:"z. B. noreply@verein.de",value:ga,onChange:k=>va(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Passwort"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:jr?"text":"password",placeholder:"••••••••",value:Dl,onChange:k=>zl(k.target.value),className:"w-full pl-3.5 pr-10 py-2 rounded-sm input-field font-mono"}),i.jsx("button",{type:"button",onClick:()=>bu(!jr),className:"absolute right-3 top-2.5 text-muted hover:text-main",children:jr?i.jsx(Vg,{className:"w-4 h-4"}):i.jsx(sy,{className:"w-4 h-4"})})]})]}),i.jsxs("div",{className:"sm:col-span-2 flex items-center gap-6 pt-2",children:[i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[i.jsx("input",{type:"checkbox",checked:Il,onChange:k=>{Ol(k.target.checked),k.target.checked&&Ul(!1)},className:"rounded-sm"}),i.jsx("span",{children:"STARTTLS verwenden (Empfohlen für Port 587)"})]}),i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[i.jsx("input",{type:"checkbox",checked:xa,onChange:k=>{Ul(k.target.checked),k.target.checked&&Ol(!1)},className:"rounded-sm"}),i.jsx("span",{children:"SSL/TLS verwenden (Empfohlen für Port 465)"})]})]})]}),i.jsxs("div",{className:"pt-4 border-t border-grid flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-[260px]",children:[i.jsx("input",{type:"email",placeholder:"Empfänger für Test-E-Mail...",value:Fl,onChange:k=>wu(k.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs flex-1 font-mono"}),i.jsxs("button",{type:"button",disabled:Er,onClick:Kl,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[i.jsx(dy,{className:"w-3.5 h-3.5"}),Er?"Sende...":"Test-Mail Senden"]})]}),i.jsxs("button",{type:"submit",disabled:Vl,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4"}),Vl?"Speichern...":"SMTP-Einstellungen Speichern"]})]})]})})]})}function Gb({eventToEdit:e,skills:t,user:n,onBack:r,onSubmit:s,onDeleteEvent:l}){var U;const[a,o]=A.useState((e==null?void 0:e.title)||""),[u,c]=A.useState((e==null?void 0:e.description)||""),[f,g]=A.useState((e==null?void 0:e.location)||""),[d,w]=A.useState((e==null?void 0:e.start_date)||new Date().toISOString().split("T")[0]),[y,N]=A.useState((e==null?void 0:e.end_date)||new Date().toISOString().split("T")[0]),[R,v]=A.useState(e!=null&&e.co_managers?e.co_managers.map(x=>x.id):[]),[h,m]=A.useState([]),[_,C]=A.useState([]),[E,j]=A.useState(!1),[P,G]=A.useState("");A.useEffect(()=>{if(L(),e&&e.task_areas&&e.task_areas.length>0){const x=e.task_areas.map($=>({id:$.id,name:$.name,description:$.description||"",shifts:($.shifts||[]).map(I=>({id:I.id,title:I.title,date:I.date||(e?e.start_date:new Date().toISOString().split("T")[0]),start_time:I.start_time,end_time:I.end_time,max_participants:I.max_participants||1,required_skill_ids:I.required_skills?I.required_skills.map(K=>K.id):[]}))}));C(x)}else e||C([{name:"Tresendienst",description:"Getränke- und Barverkauf",shifts:[{title:"Schicht 1",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}]},{name:"Essen kochen",description:"Zubereitung von Speisen",shifts:[{title:"Frühschicht",start_time:"15:00",end_time:"19:00",max_participants:3,required_skill_ids:[]}]},{name:"Aufbau & Aufräumen",description:"Tische, Stühle & Technik",shifts:[{title:"Aufbau",start_time:"12:00",end_time:"15:00",max_participants:4,required_skill_ids:[]}]}])},[e]);const L=async()=>{try{const x=await J("/users/all/");m(x.results||x)}catch{}},Y=()=>{C([..._,{name:"",description:"",shifts:[{title:"Schicht 1",start_time:"10:00",end_time:"14:00",max_participants:1,required_skill_ids:[]}]}])},ae=x=>{C(_.filter(($,I)=>I!==x))},le=(x,$,I)=>{const K=[..._];K[x][$]=I,C(K)},ke=x=>{const $=[..._];$[x].shifts.push({title:`Schicht ${$[x].shifts.length+1}`,date:d,start_time:"14:00",end_time:"18:00",max_participants:1,required_skill_ids:[]}),C($)},ue=(x,$)=>{const I=[..._];I[x].shifts=I[x].shifts.filter((K,W)=>W!==$),C(I)},Te=(x,$,I,K)=>{const W=[..._];W[x].shifts[$][I]=K,C(W)},V=(x,$,I)=>{const K=[..._],W=K[x].shifts[$].required_skill_ids||[];W.includes(I)?K[x].shifts[$].required_skill_ids=W.filter(ee=>ee!==I):K[x].shifts[$].required_skill_ids=[...W,I],C(K)},M=async x=>{if(x.preventDefault(),G(""),!a.trim()){G("Bitte gib einen Veranstaltungstitel an.");return}j(!0);try{await s({id:e==null?void 0:e.id,title:a,description:u,location:f,start_date:d,end_date:y,co_manager_ids:R,task_areas:_})}catch($){G($.message||"Speichern der Veranstaltung fehlgeschlagen.")}finally{j(!1)}};return i.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[i.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[i.jsxs("button",{onClick:r,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[i.jsx(Ug,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),i.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm",children:["MODE: ",e?"EVENT EDIT":"NEW EVENT"]})]}),i.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center font-bold",children:e?i.jsx(Bi,{className:"w-5 h-5"}):i.jsx(ra,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:e?"Veranstaltung & Schichten Bearbeiten":"Neue Veranstaltung Erstellen"}),i.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Konfiguriere Stammdaten, Co-Verwalter, Aufgabenfelder, Schichtzeiten & Qualifikationen"})]})]})}),P&&i.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:P})]}),i.jsxs("form",{onSubmit:M,className:"space-y-6",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"1. Stammdaten & Verwalter der Veranstaltung"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),i.jsx("input",{type:"text",required:!0,value:a,onChange:x=>o(x.target.value),placeholder:"z. B. Sommerfest 2026",className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),i.jsx("input",{type:"date",required:!0,value:d,onChange:x=>w(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),i.jsx("input",{type:"date",required:!0,value:y,onChange:x=>N(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),i.jsx("input",{type:"text",value:f,onChange:x=>g(x.target.value),placeholder:"z. B. Vereinsheim, Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),i.jsx("textarea",{rows:2,value:u,onChange:x=>c(x.target.value),placeholder:"Details zur Veranstaltung...",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs font-sans"})]}),h.length>0&&i.jsxs("div",{className:"sm:col-span-2 pt-3 border-t border-grid space-y-2",children:[i.jsxs("label",{className:"block text-main font-bold flex items-center gap-1.5",children:[i.jsx(Wg,{className:"w-4 h-4 text-indigo-400"})," Co-Verwalter / Mit-Organisatoren (optional)"]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Wähle registrierte Benutzer aus, die dieses Event ebenfalls verwalten, bearbeiten und Gäste eintragen dürfen:"}),i.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:h.map(x=>{const $=R.includes(x.id);return i.jsxs("button",{type:"button",onClick:()=>{v($?R.filter(I=>I!==x.id):[...R,x.id])},className:`px-3 py-1.5 rounded-sm text-xs font-mono font-bold transition flex items-center gap-1.5 border ${$?"bg-indigo-500/20 text-indigo-300 border-indigo-500/50 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:[i.jsx(xf,{className:`w-3.5 h-3.5 ${$?"text-indigo-400":"opacity-40"}`}),i.jsx("span",{children:x.display_name||x.username})]},x.id)})})]})]})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[i.jsx(ou,{className:"w-4 h-4 text-blue-500"})," 2. Aufgabenfelder & Schichten"]}),i.jsxs("button",{type:"button",onClick:Y,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-blue-500/10 text-blue-500 border border-blue-500/20 hover:bg-blue-500/20 transition flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," BEREICH HINZUFÜGEN"]})]}),_.map((x,$)=>i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("input",{type:"text",required:!0,placeholder:"Name des Aufgabenfeldes (z. B. Tresendienst)",value:x.name,onChange:I=>le($,"name",I.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-bold"}),i.jsx("button",{type:"button",onClick:()=>ae($),className:"p-1.5 text-muted hover:text-red-400 transition",title:"Bereich entfernen",children:i.jsx(cn,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs text-muted font-bold",children:[i.jsx("span",{children:"Schichten & Zeitfenster"}),i.jsxs("button",{type:"button",onClick:()=>ke($),className:"text-blue-500 hover:underline flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),x.shifts.map((I,K)=>i.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid space-y-2",children:[i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[i.jsx("input",{type:"text",placeholder:"Titel",value:I.title,onChange:W=>Te($,K,"title",W.target.value),className:"sm:col-span-3 px-2.5 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"date",title:"Schichtdatum",min:d,max:y,value:I.date||d,onChange:W=>Te($,K,"date",W.target.value),className:"sm:col-span-3 px-2 py-1 rounded-sm input-field text-xs font-mono text-indigo-400 font-bold"}),i.jsx("input",{type:"text",placeholder:"Start (14:00)",value:I.start_time,onChange:W=>Te($,K,"start_time",W.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"text",placeholder:"Ende (18:00)",value:I.end_time,onChange:W=>Te($,K,"end_time",W.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),i.jsx("div",{className:"sm:col-span-1 flex items-center gap-1",children:i.jsx("input",{type:"number",min:"1",title:"Max. Plätze",value:I.max_participants,onChange:W=>Te($,K,"max_participants",parseInt(W.target.value)||1),className:"w-full px-1.5 py-1 rounded-sm input-field text-xs font-bold text-center"})}),i.jsx("button",{type:"button",onClick:()=>ue($,K),className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",title:"Schicht löschen",children:i.jsx(cn,{className:"w-3.5 h-3.5 mx-auto"})})]}),t&&t.length>0&&i.jsxs("div",{className:"pt-2 border-t border-grid flex flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:"text-[10px] text-muted font-bold mr-1",children:"Erforderlich:"}),t.map(W=>{const ee=(I.required_skill_ids||[]).includes(W.id);return i.jsxs("button",{type:"button",onClick:()=>V($,K,W.id),style:{backgroundColor:ee?`${W.color}25`:"transparent",borderColor:ee?W.color:"var(--color-border-grid)",color:ee?W.color:"var(--color-text-muted)"},className:"px-2 py-0.5 rounded-sm text-[10px] border font-bold transition flex items-center gap-1",children:[i.jsx("span",{children:W.name}),ee&&i.jsx(Ln,{className:"w-3 h-3"})]},W.id)})]})]},K))]})]},$))]}),i.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2 font-mono",children:[e&&l&&n&&(n.is_admin_user||n.is_staff||n.is_superuser||e.created_by===n.id||((U=e.created_by)==null?void 0:U.id)===n.id)?i.jsxs("button",{type:"button",onClick:()=>l(e),className:"px-4 py-2.5 rounded-sm text-xs font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1.5",children:[i.jsx(cn,{className:"w-4 h-4"})," VERANSTALTUNG LÖSCHEN"]}):i.jsx("div",{}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:r,className:"px-5 py-2.5 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),i.jsxs("button",{type:"submit",disabled:E,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4"}),E?"Speichern...":"Veranstaltung Speichern"]})]})]})]})]})}function qb({onBack:e,onInstantiateTemplate:t,user:n,skills:r}){const[s,l]=A.useState([]),[a,o]=A.useState(!0),[u,c]=A.useState(""),[f,g]=A.useState(null),[d,w]=A.useState(""),[y,N]=A.useState(new Date().toISOString().split("T")[0]),[R,v]=A.useState(new Date().toISOString().split("T")[0]),[h,m]=A.useState(""),[_,C]=A.useState(!1),[E,j]=A.useState(!1),[P,G]=A.useState(""),[L,Y]=A.useState(""),[ae,le]=A.useState([{name:"Tresendienst",description:"Getränkeausschank und Bar",shifts:[{title:"Frühschicht",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]},{title:"Spätschicht",start_time:"22:00",end_time:"02:00",max_participants:3,required_skill_ids:[]}]}]);A.useEffect(()=>{ke()},[]);const ke=async()=>{o(!0);try{const x=await J("/templates/");l(x.results||x)}catch(x){c(x.message||"Laden der Vorlagen fehlgeschlagen.")}finally{o(!1)}},ue=x=>{g(x),w(x.name)},Te=async x=>{if(x.preventDefault(),!!f){C(!0);try{await t(f.id,{title:d,start_date:y,end_date:R,location:h})}catch($){c($.message||"Erstellen der Veranstaltung aus Vorlage fehlgeschlagen.")}finally{C(!1)}}},V=async x=>{if(x.preventDefault(),!P.trim()){c("Bitte gib einen Vorlagen-Namen an.");return}C(!0);try{const $={name:P,description:L,template_data:{task_areas:ae.map(I=>({name:I.name,description:I.description,shifts:(I.shifts||[]).map(K=>({title:K.title,start_time:K.start_time,end_time:K.end_time,max_participants:K.max_participants,required_skill_ids:K.required_skill_ids}))}))}};await J("/templates/",{method:"POST",body:JSON.stringify($)}),j(!1),G(""),Y(""),ke()}catch($){c($.message||"Erstellen der Vorlage fehlgeschlagen.")}finally{C(!1)}},M=()=>{le([...ae,{name:"Neuer Bereich",description:"",shifts:[{title:"Schicht 1",start_time:"14:00",end_time:"18:00",max_participants:2,required_skill_ids:[]}]}])},U=x=>{const $=[...ae];$[x].shifts.push({title:`Schicht ${$[x].shifts.length+1}`,start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}),le($)};return i.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[i.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[i.jsxs("button",{onClick:e,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[i.jsx(Ug,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),i.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm uppercase",children:["SYSTEM VORLAGEN (",s.length,")"]})]}),i.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-4",children:i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 flex items-center justify-center font-bold",children:i.jsx(ou,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"Veranstaltungs-Vorlagen Zentrale"}),i.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Erstelle neue Veranstaltungen mit voreingestellten Schichten und Aufgabenbereichen"})]})]}),n&&i.jsxs("button",{onClick:()=>j(!E),className:"px-3.5 py-2 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[i.jsx(Zn,{className:"w-4 h-4"}),E?"Schließen":"Neue Vorlage Erstellen"]})]})}),u&&i.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:u})]}),E&&i.jsxs("form",{onSubmit:V,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2 flex items-center justify-between",children:[i.jsx("span",{children:"Neue Vorlage mit voreingestellten Schichten anlegen"}),i.jsxs("button",{type:"button",onClick:M,className:"text-xs font-mono font-bold bg-indigo-500/20 text-indigo-300 px-3 py-1 rounded-sm border border-indigo-500/30 flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," Bereich Hinzufügen"]})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Vorlagen Name"}),i.jsx("input",{type:"text",required:!0,placeholder:"z. B. Standard Kneipenabend / Bar-Event",value:P,onChange:x=>G(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),i.jsx("input",{type:"text",placeholder:"z. B. Inklusive 2 Barschichten und Aufbau",value:L,onChange:x=>Y(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),i.jsx("div",{className:"space-y-4 pt-2",children:ae.map((x,$)=>i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("input",{type:"text",required:!0,placeholder:"Bereichs-Name (z. B. Bar)",value:x.name,onChange:I=>{const K=[...ae];K[$].name=I.target.value,le(K)},className:"flex-1 px-3 py-1 rounded-sm input-field text-xs font-bold"}),i.jsx("button",{type:"button",onClick:()=>{le(ae.filter((I,K)=>K!==$))},className:"text-muted hover:text-red-400 p-1",children:i.jsx(cn,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-muted text-[11px] font-bold",children:[i.jsx("span",{children:"Voreingestellte Schichten"}),i.jsxs("button",{type:"button",onClick:()=>U($),className:"text-indigo-400 hover:underline flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),x.shifts.map((I,K)=>i.jsxs("div",{className:"p-2.5 rounded-sm bg-surface border border-grid grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[i.jsx("input",{type:"text",placeholder:"Schichtname",value:I.title,onChange:W=>{const ee=[...ae];ee[$].shifts[K].title=W.target.value,le(ee)},className:"sm:col-span-4 px-2 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"text",placeholder:"Start (18:00)",value:I.start_time,onChange:W=>{const ee=[...ae];ee[$].shifts[K].start_time=W.target.value,le(ee)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"text",placeholder:"Ende (22:00)",value:I.end_time,onChange:W=>{const ee=[...ae];ee[$].shifts[K].end_time=W.target.value,le(ee)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),i.jsxs("div",{className:"sm:col-span-3 flex items-center gap-1",children:[i.jsx("span",{className:"text-[10px] text-muted",children:"Plätze:"}),i.jsx("input",{type:"number",min:"1",value:I.max_participants,onChange:W=>{const ee=[...ae];ee[$].shifts[K].max_participants=parseInt(W.target.value)||1,le(ee)},className:"w-full px-2 py-1 rounded-sm input-field text-xs font-bold"})]}),i.jsx("button",{type:"button",onClick:()=>{const W=[...ae];W[$].shifts=W[$].shifts.filter((ee,Ae)=>Ae!==K),le(W)},className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",children:i.jsx(cn,{className:"w-3.5 h-3.5 mx-auto"})})]},K))]})]},$))}),i.jsxs("div",{className:"pt-3 flex justify-end gap-2 border-t border-grid",children:[i.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),i.jsxs("button",{type:"submit",disabled:_,style:{backgroundColor:"var(--brand-primary)"},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-1.5",children:[i.jsx(Ln,{className:"w-4 h-4"})," Vorlage Speichern"]})]})]}),i.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main",children:"Verfügbare Vorlagen"}),a?i.jsx("div",{className:"hallmark-panel p-8 text-center text-muted",children:"Lade Vorlagen..."}):s.length===0?i.jsx("div",{className:"hallmark-panel p-8 text-center text-muted italic",children:'[ Noch keine Vorlagen gespeichert. Klicke oben auf "Neue Vorlage Erstellen" um Vorlagen mit voreingestellten Schichten anzulegen. ]'}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map(x=>{var $;return i.jsxs("div",{onClick:()=>ue(x),className:`hallmark-panel p-5 rounded-sm border cursor-pointer transition space-y-3 ${(f==null?void 0:f.id)===x.id?"bg-indigo-500/10 border-indigo-500 shadow-md":"bg-surface border-grid hover:border-muted"}`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"font-serif text-base font-bold text-main uppercase",children:x.name}),(f==null?void 0:f.id)===x.id&&i.jsx("span",{className:"text-[10px] font-mono text-indigo-400 bg-indigo-500/20 px-2 py-0.5 rounded-sm border border-indigo-500/30 font-bold",children:"[ AUSGEWÄHLT ]"})]}),x.description&&i.jsx("p",{className:"text-xs font-sans text-muted",children:x.description}),(($=x.template_data)==null?void 0:$.task_areas)&&x.template_data.task_areas.length>0&&i.jsxs("div",{className:"space-y-2 pt-2 border-t border-grid text-[11px]",children:[i.jsx("div",{className:"font-bold text-muted uppercase text-[10px]",children:"📌 Voreingestellte Schichten:"}),x.template_data.task_areas.map((I,K)=>{var W;return i.jsxs("div",{className:"bg-subtle p-2 rounded-sm border border-grid space-y-1",children:[i.jsxs("div",{className:"font-bold text-main flex items-center justify-between",children:[i.jsx("span",{children:I.name}),i.jsxs("span",{className:"text-[10px] text-muted font-normal",children:[((W=I.shifts)==null?void 0:W.length)||0," Schichten"]})]}),i.jsx("div",{className:"flex flex-wrap gap-1",children:(I.shifts||[]).map((ee,Ae)=>i.jsxs("span",{className:"px-2 py-0.5 rounded-sm bg-surface border border-grid text-[10px] flex items-center gap-1 font-mono",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted shrink-0"}),i.jsx("strong",{className:"text-main",children:ee.title}),i.jsxs("span",{className:"text-muted",children:["(",ee.start_time,"-",ee.end_time,", ",ee.max_participants," Plätze)"]})]},Ae))})]},K)})]}),i.jsxs("div",{className:"text-[10px] text-muted pt-2 border-t border-grid flex items-center justify-between",children:[i.jsxs("span",{children:["Erstellt von: ",i.jsx("strong",{children:x.created_by_name||"Admin"})]}),i.jsx("span",{className:"text-indigo-400 font-bold",children:"Klick zum Auswählen"})]})]},x.id)})})]}),f&&i.jsxs("form",{onSubmit:Te,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2",children:['Neue Veranstaltung aus Vorlage "',f.name,'" Erstellen']}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),i.jsx("input",{type:"text",required:!0,value:d,onChange:x=>w(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),i.jsx("input",{type:"date",required:!0,value:y,onChange:x=>N(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),i.jsx("input",{type:"date",required:!0,value:R,onChange:x=>v(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),i.jsx("input",{type:"text",value:h,onChange:x=>m(x.target.value),placeholder:"z. B. Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),i.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:i.jsxs("button",{type:"submit",disabled:_,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[i.jsx(uy,{className:"w-4 h-4 fill-white"}),_?"Erstellen...":"Veranstaltung Jetzt Aus Vorlage Erstellen"]})})]})]})}function Qb(){const[e,t]=A.useState(null),[n,r]=A.useState(null),[s,l]=A.useState([]),[a,o]=A.useState([]),[u,c]=A.useState(null),[f,g]=A.useState(null),[d,w]=A.useState(!0),[y,N]=A.useState("home"),[R,v]=A.useState(!1),[h,m]=A.useState(!1),[_,C]=A.useState(null),[E,j]=A.useState(!1),[P,G]=A.useState(!1),[L,Y]=A.useState(localStorage.getItem("theme_mode")||"auto"),[ae,le]=A.useState(null),[ke,ue]=A.useState(null);A.useEffect(()=>{window.addEventListener("beforeinstallprompt",z=>{z.preventDefault(),ue(z)}),$()},[]),A.useEffect(()=>{localStorage.setItem("theme_mode",L);const z=()=>{let q=L;L==="auto"&&(q=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),document.documentElement.setAttribute("data-theme",q)};if(z(),L==="auto"){const q=window.matchMedia("(prefers-color-scheme: dark)"),Ee=()=>z();return q.addEventListener("change",Ee),()=>q.removeEventListener("change",Ee)}},[L]),A.useEffect(()=>{n!=null&&n.primary_color&&(document.documentElement.style.setProperty("--brand-primary",n.primary_color),document.documentElement.style.setProperty("--brand-secondary",n.secondary_color||n.primary_color))},[n]);const[Te,V]=A.useState(null),[M,U]=A.useState(null),x=z=>{le(z),setTimeout(()=>le(null),5e3)},$=async()=>{w(!0);try{try{const xe=await J("/branding/");r(xe)}catch{}if(wd())try{const xe=await J("/users/me/");t(xe),!xe.is_admin_user&&!xe.is_staff&&!xe.is_superuser&&y==="admin"&&N("home")}catch{hl(null),t(null),N("home")}const z=new URLSearchParams(window.location.search),q=z.get("verify_email");if(q)try{const xe=await J("/users/verify-email/",{method:"POST",body:JSON.stringify({token:q})});hl(xe.token),t(xe.user),x(xe.message||"✅ E-Mail-Adresse erfolgreich bestätigt!"),window.history.replaceState({},document.title,window.location.pathname)}catch(xe){x(`⚠️ E-Mail Bestätigung: ${xe.message}`)}const Ee=z.get("claim_token"),en=z.get("guest_name");Ee&&en&&(V(Ee),U(en),wd()||v(!0)),await K(),await W()}catch(z){console.error(z)}finally{w(!1)}},I=async z=>{try{const q=await J(`/users/signups/${z.id}/generate-claim-link/`,{method:"POST"}),Ee=`${window.location.origin}/?claim_token=${q.token}&guest_name=${encodeURIComponent(q.guest_name)}`;navigator.clipboard?(await navigator.clipboard.writeText(Ee),x(`✅ Einladungs-Link für ${q.guest_name} in Zwischenablage kopiert!`)):prompt(`Einladungs-Link für ${q.guest_name} kopieren:`,Ee)}catch(q){alert(q.message||"Fehler beim Erstellen des Links.")}},K=async()=>{try{const z=await J("/skills/");l(z.results||z)}catch{}},W=async()=>{try{const z=await J("/events/"),q=z.results||z;o(q),q.length>0&&!u?(c(q[0].id),ee(q[0].id)):u&&ee(u)}catch{}},ee=async z=>{try{const q=await J(`/events/${z}/matrix/`);g(q)}catch{}},Ae=z=>{c(z),ee(z),N("schedule")},gt=()=>{hl(null),t(null),N("home"),x("Erfolgreich abgemeldet."),u&&ee(u)},Dn=(z,q)=>{t(z),z&&!z.is_admin_user&&!z.is_staff&&!z.is_superuser&&y==="admin"&&N("home"),x(q||"Erfolgreich angemeldet!"),u&&ee(u)},F=async z=>{if(!e)C(z),m(!0);else try{const q=await J(`/shifts/${z.id}/signup/`,{method:"POST"});x(q.message||"Erfolgreich für Schicht eingetragen!"),u&&ee(u)}catch(q){x(`Fehler: ${q.message}`)}},be=async z=>{if(!_)return;const q=await J(`/shifts/${_.id}/signup/`,{method:"POST",body:JSON.stringify(z)});x(q.message||"Als Gast eingetragen!"),u&&ee(u)},_t=async z=>{try{const q=await J(`/shifts/${z.id}/signup/`,{method:"DELETE"});x(q.message||"Eintragung storniert."),u&&ee(u)}catch(q){x(`Fehler: ${q.message}`)}},rr=async z=>{if(!(!z||!z.id)&&window.confirm(`Möchtest du die Veranstaltung "${z.title}" und alle zugehörigen Schichten wirklich unwiderruflich löschen?`))try{await J(`/events/${z.id}/`,{method:"DELETE"}),x(`Veranstaltung "${z.title}" wurde erfolgreich gelöscht.`),u===z.id&&c(null),y==="event-editor"&&N("home"),W()}catch(q){x(`Fehler beim Löschen: ${q.message}`)}},[zn,yn]=A.useState(null),Nr=async z=>{let q=z.id;q?await J(`/events/${q}/`,{method:"PATCH",body:JSON.stringify({title:z.title,description:z.description,location:z.location,start_date:z.start_date,end_date:z.end_date,co_manager_ids:z.co_manager_ids||[]})}):q=(await J("/events/",{method:"POST",body:JSON.stringify({title:z.title,description:z.description,location:z.location,start_date:z.start_date,end_date:z.end_date,co_manager_ids:z.co_manager_ids||[]})})).id;for(let Ee of z.task_areas){if(!Ee.name)continue;let en=Ee.id;en?await J(`/task-areas/${en}/`,{method:"PATCH",body:JSON.stringify({name:Ee.name,description:Ee.description||""})}):en=(await J("/task-areas/",{method:"POST",body:JSON.stringify({event:q,name:Ee.name,description:Ee.description||""})})).id;for(let xe of Ee.shifts){const In=xe.date||z.start_date;xe.id?await J(`/shifts/${xe.id}/`,{method:"PATCH",body:JSON.stringify({title:xe.title,date:In,start_time:xe.start_time,end_time:xe.end_time,max_participants:xe.max_participants,required_skill_ids:xe.required_skill_ids||[]})}):await J("/shifts/",{method:"POST",body:JSON.stringify({task_area:en,title:xe.title,date:In,start_time:xe.start_time,end_time:xe.end_time,max_participants:xe.max_participants,required_skill_ids:xe.required_skill_ids||[]})})}}x(z.id?"Veranstaltung & Schichten aktualisiert!":"Veranstaltung erfolgreich erstellt!"),await W(),Ae(q)},nt=async(z,q)=>{const Ee=await J(`/templates/${z}/instantiate/`,{method:"POST",body:JSON.stringify(q)});x("Veranstaltung aus Vorlage erstellt!"),await W(),Ee.id&&Ae(Ee.id)},rt=()=>{u&&window.open(`/api/events/${u}/export_pdf/`,"_blank")},Ds=()=>{window.print()},zs=()=>{ke&&(ke.prompt(),ke.userChoice.then(z=>{z.outcome==="accepted"&&x("PWA Installation gestartet!"),ue(null)}))};return i.jsxs("div",{className:"min-h-screen bg-canvas text-main flex flex-col font-sans selection:bg-surface-hover transition-colors duration-200",children:[ae&&i.jsxs("div",{className:"fixed bottom-6 right-6 z-50 bg-emerald-600 text-white px-4 py-2.5 rounded-sm shadow-2xl font-mono text-xs flex items-center gap-2 border border-emerald-400 animate-in fade-in slide-in-from-bottom-3 duration-200",children:[i.jsx(Ln,{className:"w-4 h-4"}),i.jsx("span",{children:ae})]}),i.jsx(vy,{branding:n,user:e,activeTab:y,onChangeTab:N,themeMode:L,onChangeThemeMode:Y,onLogout:gt,onOpenAuth:()=>v(!0),onOpenCreateEvent:()=>{yn(null),N("event-editor")},onOpenTemplates:()=>N("templates"),onOpenProfile:()=>G(!0),onOpenAdmin:()=>N("admin"),pwaInstallPrompt:!!ke,onInstallPwa:zs}),i.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-6",children:d?i.jsx("div",{className:"hallmark-panel p-16 text-center text-xs text-muted font-mono border border-grid",children:"Lade Daten..."}):y==="home"?i.jsx(Hb,{events:a,user:e,onSelectEvent:Ae,onOpenCreateEvent:()=>{yn(null),N("event-editor")},onToggleEventActive:async z=>{try{await J(`/events/${z.id}/`,{method:"PATCH",body:JSON.stringify({is_active:z.is_active===!1})}),W()}catch(q){alert(q.message||"Aktion fehlgeschlagen.")}},onEditEvent:z=>{yn(z),N("event-editor")},onDeleteEvent:rr,branding:n}):y==="calendar"?i.jsx(Kb,{events:a,onSelectEvent:Ae,branding:n}):y==="admin"&&e&&(e.is_admin_user||e.is_staff||e.is_superuser)?i.jsx(Wb,{branding:n,onRefreshBranding:async()=>{const z=await J("/branding/");r(z)},onRefreshEvents:W,skills:s,onRefreshSkills:K}):y==="event-editor"?i.jsx(Gb,{eventToEdit:zn,skills:s,user:e,onBack:()=>N("schedule"),onSubmit:Nr,onDeleteEvent:rr}):y==="templates"?i.jsx(qb,{onBack:()=>N("schedule"),onInstantiateTemplate:nt,user:e,skills:s}):i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between gap-4 overflow-x-auto pb-2 no-scrollbar font-mono",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs font-bold text-muted uppercase tracking-wider whitespace-nowrap",children:"Ausgewähltes Event:"}),a.map(z=>{const q=u===z.id;return i.jsx("button",{onClick:()=>Ae(z.id),style:{backgroundColor:q?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0,borderColor:q?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0},className:`px-3.5 py-1.5 rounded-sm text-xs font-bold transition whitespace-nowrap border ${q?"text-white shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:z.title},z.id)})]}),e&&i.jsxs("button",{onClick:()=>{yn(null),N("event-editor")},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 shrink-0",children:[i.jsx(Zn,{className:"w-4 h-4"})," Neues Event"]})]}),i.jsx(xy,{event:f,user:e,onSignupClick:F,onCancelClick:_t,onEditEvent:z=>{yn(z),N("event-editor")},onDeleteEvent:rr,onRemoveUserFromShift:async(z,q)=>{try{const Ee=await J(`/shifts/${z.id}/signup/${q}/`,{method:"DELETE"});x(Ee.message||"Eintragung entfernt."),W(),u&&Ae(u)}catch(Ee){alert(Ee.message||"Entfernen der Person fehlgeschlagen.")}},onGenerateClaimLink:I,onExportPdf:rt,onPrintView:Ds})]})}),i.jsx("footer",{className:"border-t border-grid py-6 text-center text-xs text-muted font-mono no-print",children:i.jsxs("p",{children:[(n==null?void 0:n.app_name)||"Veranstaltungsschichtplaner"," • PWA Enabled • PostgreSQL & Docker Ready"]})}),R&&i.jsx(Bb,{onClose:()=>{v(!1),V(null),U(null)},onSuccess:Dn,claimToken:Te,prefilledGuestName:M}),h&&i.jsx(Fb,{shift:_,onClose:()=>m(!1),onSubmit:be})]})}ic.createRoot(document.getElementById("root")).render(i.jsx(Si.StrictMode,{children:i.jsx(Qb,{})})); +}`;Eb(Ub);$altcha.algorithms.set("SHA-256",()=>new If);$altcha.algorithms.set("SHA-384",()=>new If);$altcha.algorithms.set("SHA-512",()=>new If);$altcha.algorithms.set("PBKDF2/SHA-256",()=>new zf);$altcha.algorithms.set("PBKDF2/SHA-384",()=>new zf);$altcha.algorithms.set("PBKDF2/SHA-512",()=>new zf);function Fb({shift:e,onClose:t,onSubmit:n}){const[r,s]=A.useState(""),[l,a]=A.useState(()=>sessionStorage.getItem("guest_captcha_verified")==="true"),[o,u]=A.useState(()=>sessionStorage.getItem("guest_captcha_verified")==="true"?"altcha-session-verified":""),[c,f]=A.useState(()=>sessionStorage.getItem("guest_captcha_verified")==="true"),[g,d]=A.useState(""),[w,y]=A.useState(!1),N=A.useRef(null);A.useEffect(()=>{const h=localStorage.getItem("guest_display_name")||"";h&&s(h)},[]),A.useEffect(()=>{if(l)return;const h=N.current;if(!h)return;const m=_=>{var j,L,G;const C=(j=_==null?void 0:_.detail)==null?void 0:j.state,E=(L=_==null?void 0:_.detail)==null?void 0:L.payload;(C==="verified"||(G=_==null?void 0:_.detail)!=null&&G.verified)&&(sessionStorage.setItem("guest_captcha_verified","true"),a(!0),f(!0),u(E||"altcha-verified-"+Math.random().toString(36).substring(2,10)))};return h.addEventListener("statechange",m),h.addEventListener("verified",m),()=>{h.removeEventListener("statechange",m),h.removeEventListener("verified",m)}},[l]);const R=()=>{sessionStorage.setItem("guest_captcha_verified","true"),a(!0),f(!0),u("altcha-verified-"+Math.random().toString(36).substring(2,10))},v=async h=>{if(h.preventDefault(),d(""),!r.trim()){d("Bitte gib deinen Namen ein.");return}if(!(l||c)){d("Bitte schließe zuerst den ALTCHA Security Check ab.");return}const _=o||"altcha-session-verified";localStorage.setItem("guest_display_name",r.trim()),window.dispatchEvent(new Event("guest_name_updated")),y(!0);try{await n({guest_name:r.trim(),captcha_token:_}),t()}catch(C){d(C.message||"Eintragen fehlgeschlagen.")}finally{y(!1)}};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm",children:i.jsxs("div",{className:"glass-panel w-full max-w-md rounded-2xl border border-slate-800 p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[i.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-slate-400 hover:text-white rounded-lg transition",children:i.jsx(Gg,{className:"w-5 h-5"})}),i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 text-blue-400 border border-blue-500/20 flex items-center justify-center",children:i.jsx(xf,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg text-white",children:"Als Gast eintragen"}),i.jsxs("p",{className:"text-xs text-slate-400",children:["Schicht: ",e==null?void 0:e.title," (",e==null?void 0:e.start_time," - ",e==null?void 0:e.end_time,")"]})]})]}),g&&i.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 text-xs flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:g})]}),i.jsxs("form",{onSubmit:v,className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Dein Name / Anzeigename"}),i.jsx("input",{type:"text",required:!0,value:r,onChange:h=>s(h.target.value),placeholder:"z. B. Alex Muster",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900 border border-slate-800 text-white text-sm focus:outline-none focus:border-blue-500 transition"}),i.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Dein Name bleibt in deiner aktuellen Sitzung gespeichert. Falls du später ein Konto mit diesem Namen erstellst, werden deine Gast-Schichten automatisch übernommen!"})]}),l?i.jsxs("div",{className:"p-3.5 rounded-xl bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-xs flex items-center justify-between font-mono",children:[i.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[i.jsx(Ln,{className:"w-4 h-4 text-emerald-400 shrink-0"})," ALTCHA Spamschutz verifiziert"]}),i.jsx("span",{className:"text-[10px] text-emerald-400/80",children:"[ In dieser Sitzung aktiv ]"})]}):i.jsxs("div",{className:"p-4 rounded-xl bg-slate-900/90 border border-slate-800 space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-1.5 font-mono",children:[i.jsx(hy,{className:"w-4 h-4 text-emerald-400"})," Security Check (ALTCHA)"]}),i.jsx("a",{href:"https://altcha.org/",target:"_blank",rel:"noreferrer",className:"text-[10px] text-blue-400 hover:underline font-mono",children:"ALTCHA.org"})]}),i.jsxs("div",{className:"border border-slate-700 rounded-lg p-3 bg-slate-950/80 flex flex-col items-center justify-center min-h-[90px] gap-2",children:[i.jsx("altcha-widget",{ref:N,challengeurl:"/api/altcha-challenge/",auto:"onload",hidefooter:"true",style:{width:"100%"}}),!c&&i.jsxs("button",{type:"button",onClick:R,className:"text-xs font-mono px-3 py-1.5 rounded-lg bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/30 transition flex items-center gap-1.5 mt-1",children:[i.jsx(Ln,{className:"w-3.5 h-3.5"})," Security Check bestätigen"]}),c&&i.jsxs("div",{className:"mt-2 text-xs font-medium text-emerald-400 flex items-center gap-1 font-mono",children:[i.jsx(Ln,{className:"w-4 h-4"})," ALTCHA erfolgreich verifiziert!"]})]})]}),i.jsxs("div",{className:"pt-2 flex justify-end gap-2",children:[i.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-xl text-xs font-semibold text-slate-400 hover:bg-slate-800 transition",children:"Abbrechen"}),i.jsx("button",{type:"submit",disabled:w,className:"px-5 py-2 rounded-xl text-xs font-bold bg-blue-600 hover:bg-blue-500 text-white transition shadow-lg shadow-blue-600/30 disabled:opacity-50",children:w?"Eintragen...":"Jetzt eintragen"})]})]})]})})}const Vb="/api",wd=()=>localStorage.getItem("auth_token"),hl=e=>{e?localStorage.setItem("auth_token",e):localStorage.removeItem("auth_token")},J=async(e,t={})=>{const n=wd(),r={"Content-Type":"application/json",...n?{Authorization:`Token ${n}`}:{},...t.headers},s=await fetch(`${Vb}${e}`,{...t,headers:r}),l=s.headers.get("content-type");let a=null;if(l&&l.includes("application/json")&&(a=await s.json()),!s.ok){s.status===401&&hl(null);let o="Ein Fehler ist aufgetreten.";throw a&&(typeof a.error=="string"?o=a.error:typeof a.detail=="string"?o=a.detail:a.email?o=Array.isArray(a.email)?a.email[0]:a.email:a.username?o=Array.isArray(a.username)?a.username[0]:a.username:a.non_field_errors&&(o=a.non_field_errors[0])),new Error(o)}return a},kp=["#E05A47","#3B82F6","#10B981","#8B5CF6","#F59E0B","#EC4899","#06B6D4","#6366F1","#14B8A6","#F97316","#D97706","#059669","#7C3AED","#DB2777","#2563EB"],_p=()=>kp[Math.floor(Math.random()*kp.length)];function Bb({onClose:e,onSuccess:t,claimToken:n,prefilledGuestName:r}){const[s,l]=A.useState(!!(n||r)),[a,o]=A.useState(""),[u,c]=A.useState(""),[f,g]=A.useState(""),[d,w]=A.useState(r||""),[y,N]=A.useState(null),[R,v]=A.useState(""),[h,m]=A.useState(!1);A.useEffect(()=>{_()},[]);const _=async()=>{try{const E=await J("/users/restriction-setting/");N(E)}catch{}},C=async E=>{E.preventDefault(),v(""),m(!0);try{if(s){const j={username:a,email:u,password:f,display_name:d||a};n&&(j.claim_token=n);const L=await J("/users/register/",{method:"POST",body:JSON.stringify(j)});if(L.requires_verification||L.requires_approval||!L.token){t(null,L.message||"Konto erfolgreich registriert! Bitte schau in deine E-Mail zur Bestätigung oder warte auf die Admin-Freischaltung."),e();return}hl(L.token),t(L.user,L.message)}else{const j=await J("/users/login/",{method:"POST",body:JSON.stringify({username:a,password:f})});hl(j.token),t(j.user,"Erfolgreich angemeldet!")}e()}catch(j){v(j.message||"Authentifizierung fehlgeschlagen.")}finally{m(!1)}};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:i.jsxs("div",{className:"hallmark-panel w-full max-w-md rounded-sm border border-grid p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200",children:[i.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-2 text-muted hover:text-main rounded-sm transition",children:i.jsx(Gg,{className:"w-5 h-5"})}),i.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center",children:i.jsx(so,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-serif font-bold text-lg text-main",children:s?"Konto erstellen":"Anmelden"}),i.jsx("p",{className:"text-xs text-muted font-sans",children:s?"Erstelle einen Account für volle Funktionen & Schichteinsicht":"Melde dich an, um Events zu verwalten"})]})]}),r&&i.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2 font-mono",children:[i.jsx(Kg,{className:"w-4 h-4 shrink-0 text-amber-500"}),i.jsxs("span",{children:["Einladung für Gast: ",i.jsx("strong",{children:r}),". Die Schicht wird deinem neuen Konto zugewiesen!"]})]}),(y==null?void 0:y.is_restriction_enabled)&&s&&i.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-indigo-500/10 border border-indigo-500/20 text-indigo-400 text-xs flex items-center gap-2 font-mono",children:[i.jsx(fy,{className:"w-4 h-4 shrink-0 text-indigo-400"}),i.jsxs("span",{children:["Registrierungen beschränkt auf: ",i.jsx("strong",{children:y.active_domains.join(", ")})]})]}),R&&i.jsxs("div",{className:"mb-4 p-3 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs flex items-center gap-2 font-mono",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:R})]}),!s&&!1,i.jsxs("form",{onSubmit:C,className:"space-y-4 font-sans",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Benutzername"}),i.jsxs("div",{className:"relative",children:[i.jsx(so,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"text",required:!0,value:a,onChange:E=>o(E.target.value),placeholder:"z. B. max_muster",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),s&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"E-Mail-Adresse"}),i.jsxs("div",{className:"relative",children:[i.jsx(Xc,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"email",required:!0,value:u,onChange:E=>c(E.target.value),placeholder:"max@beispiel.de",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Anzeigename (für Schichtlisten)"}),i.jsxs("div",{className:"relative",children:[i.jsx(so,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"text",value:d,onChange:E=>w(E.target.value),placeholder:"z. B. Max M.",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-main mb-1 font-mono",children:"Passwort"}),i.jsxs("div",{className:"relative",children:[i.jsx(ly,{className:"w-4 h-4 absolute left-3 top-3 text-muted"}),i.jsx("input",{type:"password",required:!0,value:f,onChange:E=>g(E.target.value),placeholder:"••••••••",className:"w-full pl-9 pr-3.5 py-2 rounded-sm input-field text-sm font-mono"})]})]}),i.jsx("button",{type:"submit",disabled:h,style:{backgroundColor:"var(--brand-primary)"},className:"w-full py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:h?"Verarbeite...":s?"Registrieren":"Anmelden"})]}),i.jsx("div",{className:"mt-4 pt-4 border-t border-grid text-center",children:i.jsx("button",{type:"button",onClick:()=>{l(!s),v("")},className:"text-xs font-mono text-muted hover:text-main transition",children:s?"Bereits ein Konto? Hier anmelden":"Noch kein Konto? Jetzt registrieren"})})]})})}function Hb({events:e,user:t,onSelectEvent:n,onOpenCreateEvent:r,onToggleEventActive:s,onEditEvent:l,onDeleteEvent:a,branding:o}){const[u,c]=A.useState(""),[f,g]=A.useState("all"),d=new Date().toISOString().split("T")[0],w=e.filter(m=>m.title.toLowerCase().includes(u.toLowerCase())||m.description&&m.description.toLowerCase().includes(u.toLowerCase())||m.location&&m.location.toLowerCase().includes(u.toLowerCase())?f==="upcoming"?m.end_date>=d:!0:!1),y=(o==null?void 0:o.primary_color)||"var(--brand-primary)",N=(o==null?void 0:o.show_community_info_box)??!0,R=(o==null?void 0:o.show_support_box)??!0,v=N||R,h=t&&(t.is_admin_user||t.is_staff||t.is_superuser);return i.jsxs("div",{className:"space-y-8 animate-in fade-in duration-200",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-10 space-y-6 max-w-5xl mx-auto relative border border-grid",children:[i.jsxs("div",{className:"space-y-2 border-b border-grid pb-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted border border-grid px-2.5 py-1 rounded-sm inline-block",children:(o==null?void 0:o.app_name)||"SCHICHT- & EVENTPORTAL"}),(o==null?void 0:o.custom_banner_text)&&i.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-widest text-amber-500 bg-amber-500/10 border border-amber-500/20 px-2.5 py-1 rounded-sm inline-block font-bold",children:["📢 ",o.custom_banner_text]})]}),i.jsx("h2",{className:"font-serif text-3xl sm:text-5xl font-bold uppercase tracking-tight text-main leading-tight",children:"Veranstaltungen & Schichtkoordination"}),i.jsx("p",{className:"font-sans text-xs sm:text-sm text-muted max-w-2xl",children:"Hier findest du aktuelle Termine, Arbeitsgruppen, Bar- & Tresendienste und Schichtpläne der Initiative."})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Bg,{className:"w-4 h-4 absolute left-3.5 top-3 text-muted"}),i.jsx("input",{type:"text",value:u,onChange:m=>c(m.target.value),placeholder:"Veranstaltung, Ort oder Suchbegriff...",className:"w-full pl-10 pr-16 py-2 rounded-sm bg-subtle border border-grid text-main text-xs font-mono focus:outline-none focus:border-muted"}),u&&i.jsx("button",{onClick:()=>c(""),className:"absolute right-3 top-2.5 text-[10px] font-mono text-muted hover:text-main",children:"[ CLEAR ]"})]}),i.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs shrink-0",children:[i.jsxs("button",{onClick:()=>g("all"),className:`px-3.5 py-1.5 rounded-sm transition border ${f==="all"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ALLE PROGRAMME (",e.length,")"]}),i.jsxs("button",{onClick:()=>g("upcoming"),className:`px-3.5 py-1.5 rounded-sm transition border ${f==="upcoming"?"bg-surface-hover text-main border-grid font-bold shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:["ANSTEHEND (",e.filter(m=>m.end_date>=d).length,")"]})]})]})]}),i.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-1 lg:grid-cols-4 gap-6",children:[i.jsxs("div",{className:`${v?"lg:col-span-3":"lg:col-span-4"} space-y-4`,children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3 font-mono",children:[i.jsxs("h3",{className:"font-serif text-xl font-bold uppercase tracking-wide text-main flex items-center gap-2",children:[i.jsx(ra,{className:"w-4.5 h-4.5 text-muted"})," Termine & Schichten"]}),t&&i.jsxs("button",{onClick:r,style:{backgroundColor:y},className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1 hover:brightness-110 shadow-sm",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," EVENT ANLEGEN"]})]}),w.length===0?i.jsx("div",{className:"hallmark-panel rounded-sm p-12 text-center text-xs font-mono text-muted border border-grid",children:u?`[ Keinen Eintrag für "${u}" gefunden ]`:"[ Keine Veranstaltungen vorhanden ]"}):i.jsx("div",{className:`grid grid-cols-1 sm:grid-cols-2 ${v?"":"lg:grid-cols-3"} gap-4`,children:w.map(m=>{var G,P,Y,ae;const _=((G=m.task_areas)==null?void 0:G.length)||0,C=((P=m.task_areas)==null?void 0:P.reduce((le,ke)=>{var ue;return le+(((ue=ke.shifts)==null?void 0:ue.length)||0)},0))||0,E=t&&m.co_managers&&m.co_managers.some(le=>typeof le=="object"?le.id===t.id:le===t.id),j=t&&(m.created_by===t.id||((Y=m.created_by)==null?void 0:Y.id)===t.id||E),L=h||j;return i.jsxs("div",{className:`hallmark-card rounded-sm p-5 border transition flex flex-col justify-between space-y-4 group overflow-hidden ${m.is_active===!1?"border-amber-500/40 opacity-80 bg-subtle":"border-grid"}`,children:[i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono text-muted gap-2",children:[i.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold shrink-0",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted"}),new Date(m.start_date).toLocaleDateString("de-DE")]}),m.is_active===!1?i.jsx("span",{className:"text-amber-500 font-bold px-1.5 py-0.5 rounded-sm bg-amber-500/10 border border-amber-500/20 shrink-0",children:"[ DEAKTIVIERT ]"}):m.location?i.jsxs("span",{className:"flex items-center gap-1 text-muted truncate max-w-[130px]",children:[i.jsx(vf,{className:"w-3 h-3 shrink-0"}),i.jsx("span",{className:"truncate",children:m.location})]}):null]}),i.jsx("h4",{className:"font-serif text-lg font-bold uppercase text-main group-hover:text-amber-500 transition line-clamp-2",children:m.title}),m.description&&i.jsx("p",{className:"text-xs text-muted font-sans line-clamp-2",children:m.description}),i.jsxs("div",{className:"text-[10px] font-mono text-muted flex items-center gap-1.5 pt-1",children:[i.jsxs("span",{children:[_," Bereiche"]}),i.jsx("span",{children:"/"}),i.jsxs("span",{children:[C," Schichten"]})]})]}),i.jsx("div",{className:"pt-3 border-t border-grid space-y-2 font-mono",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs("button",{onClick:()=>n(m.id),className:"flex-1 min-w-[110px] py-1.5 px-3 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition flex items-center justify-center gap-1",children:["Schichtplan ",i.jsx(Fg,{className:"w-3.5 h-3.5"})]}),L&&l&&i.jsxs("button",{onClick:()=>l(m),className:"py-1.5 px-2.5 rounded-sm text-[10px] font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung & Schichten bearbeiten",children:[i.jsx(Bi,{className:"w-3.5 h-3.5"})," BEARBEITEN"]}),L&&s&&i.jsx("button",{onClick:()=>s(m),className:`py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold transition flex items-center gap-1 border shrink-0 ${m.is_active!==!1?"bg-amber-500/10 text-amber-500 border-amber-500/20 hover:bg-amber-500/20":"bg-emerald-500/10 text-emerald-400 border-emerald-500/20 hover:bg-emerald-500/20"}`,title:m.is_active!==!1?"Deaktivieren":"Aktivieren",children:m.is_active!==!1?i.jsx(Vg,{className:"w-3.5 h-3.5"}):i.jsx(Ln,{className:"w-3.5 h-3.5"})}),(h||t&&(m.created_by===t.id||((ae=m.created_by)==null?void 0:ae.id)===t.id))&&a&&i.jsx("button",{onClick:()=>a(m),className:"py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 transition flex items-center gap-1 shrink-0",title:"Veranstaltung unwiderruflich löschen",children:i.jsx(cn,{className:"w-3.5 h-3.5"})})]})})]},m.id)})})]}),v&&i.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[N&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[i.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(o==null?void 0:o.community_info_title)||"📌 Verein & Infos"}),i.jsx("div",{className:"space-y-2 text-muted text-[11px] whitespace-pre-line",children:(o==null?void 0:o.community_info_text)||`Initiative e.V. Hausverein +Offene Angebote, DIY-Kultur & engagierte Schichten.`})]}),R&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid space-y-3",children:[i.jsx("h4",{className:"font-serif text-sm font-bold uppercase tracking-wide text-main border-b border-grid pb-2",children:(o==null?void 0:o.support_box_title)||"❤️ Unterstützen"}),i.jsx("p",{className:"text-[11px] text-muted whitespace-pre-line",children:(o==null?void 0:o.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."})]})]})]})]})}function Kb({events:e,onSelectEvent:t,branding:n}){const[r,s]=A.useState(new Date),[l,a]=A.useState(null),o=r.getFullYear(),u=r.getMonth(),c=["JANUAR","FEBRUAR","MÄRZ","APRIL","MAI","JUNI","JULI","AUGUST","SEPTEMBER","OKTOBER","NOVEMBER","DEZEMBER"],f=()=>s(new Date(o,u-1,1)),g=()=>s(new Date(o,u+1,1)),d=()=>s(new Date),w=new Date(o,u,1).getDay(),y=w===0?6:w-1,N=new Date(o,u+1,0).getDate(),R=m=>{const _=String(u+1).padStart(2,"0"),C=String(m).padStart(2,"0");return`${o}-${_}-${C}`},v=m=>{const _=R(m);return e.filter(C=>_>=C.start_date&&_<=C.end_date)},h=(n==null?void 0:n.primary_color)||"var(--brand-primary)";return i.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-subtle text-main border border-grid flex items-center justify-center font-bold",children:i.jsx(ra,{className:"w-4 h-4 text-amber-500"})}),i.jsxs("div",{children:[i.jsxs("h2",{className:"font-serif text-3xl sm:text-4xl font-bold uppercase tracking-tight text-main leading-none",children:[c[u]," ",o]}),i.jsx("p",{className:"text-[10px] text-muted uppercase tracking-widest mt-1",children:"— INITIATIVE E.V. TERMIN- & SCHICHTÜBERSICHT —"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:d,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-surface hover:bg-surface-hover text-main border border-grid transition",children:"[ HEUTE ]"}),i.jsx("button",{onClick:f,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Vorheriger Monat",children:i.jsx(ty,{className:"w-4 h-4"})}),i.jsx("button",{onClick:g,className:"p-1.5 rounded-sm text-muted hover:text-main bg-surface border border-grid transition",title:"Nächster Monat",children:i.jsx(ny,{className:"w-4 h-4"})})]})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm border border-grid overflow-hidden",children:[i.jsxs("div",{className:"grid grid-cols-7 bg-subtle border-b border-grid text-center text-xs font-mono text-muted font-bold py-3 uppercase",children:[i.jsx("div",{children:"MO"}),i.jsx("div",{children:"DI"}),i.jsx("div",{children:"MI"}),i.jsx("div",{children:"DO"}),i.jsx("div",{children:"FR"}),i.jsx("div",{children:"SA"}),i.jsx("div",{children:"SO"})]}),i.jsxs("div",{className:"grid grid-cols-7 auto-rows-fr divide-x divide-y divide-grid bg-surface text-xs font-mono",children:[Array.from({length:y}).map((m,_)=>i.jsx("div",{className:"min-h-[100px] sm:min-h-[110px] p-2 bg-subtle/50 text-muted opacity-30"},`offset-${_}`)),Array.from({length:N}).map((m,_)=>{const C=_+1,E=v(C),j=new Date().getFullYear()===o&&new Date().getMonth()===u&&new Date().getDate()===C;return i.jsxs("div",{className:`min-h-[100px] sm:min-h-[110px] p-2 flex flex-col justify-between transition ${j?"bg-surface-hover/80 font-bold":"hover:bg-surface-hover/50"}`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:`w-5 h-5 rounded-sm flex items-center justify-center font-mono text-xs ${j?"bg-main text-paper font-bold shadow-sm":"text-muted"}`,children:C}),E.length>0&&i.jsxs("span",{className:"text-[9px] font-mono text-muted",children:[E.length," ",E.length===1?"Event":"Events"]})]}),i.jsx("div",{className:"space-y-1.5 overflow-y-auto max-h-[70px] no-scrollbar",children:E.map(L=>{const G=(l==null?void 0:l.id)===L.id;return i.jsx("button",{onClick:()=>a(L),style:{backgroundColor:G?h:`${h}15`,borderColor:`${h}40`,color:G?"#ffffff":h},className:`w-full text-left px-2 py-1 rounded-sm text-[10px] font-mono font-bold border truncate block hover:brightness-110 transition shadow-sm ${L.is_active===!1?"opacity-50 line-through":""}`,children:L.title},`evt-${L.id}`)})})]},`day-${C}`)})]})]}),l&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid flex flex-col sm:flex-row sm:items-center justify-between gap-4 font-mono animate-in fade-in duration-200",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted",children:[i.jsxs("span",{className:"flex items-center gap-1 bg-subtle px-2 py-0.5 rounded-sm border border-grid font-bold text-main",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted"}),new Date(l.start_date).toLocaleDateString("de-DE")," — ",new Date(l.end_date).toLocaleDateString("de-DE")]}),l.location&&i.jsxs("span",{className:"flex items-center gap-1 text-muted",children:[i.jsx(vf,{className:"w-3 h-3"}),l.location]})]}),i.jsx("h3",{className:"font-serif text-2xl font-bold uppercase text-main",children:l.title}),l.description&&i.jsx("p",{className:"text-xs font-sans text-muted max-w-xl",children:l.description})]}),i.jsx("div",{className:"flex items-center gap-2 shrink-0",children:i.jsxs("button",{onClick:()=>t(l.id),style:{backgroundColor:h},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition flex items-center gap-1.5 hover:brightness-110 shadow-sm",children:["SCHICHTPLAN ÖFFNEN ",i.jsx(Fg,{className:"w-4 h-4"})]})})]})]})}function Wb({branding:e,onRefreshBranding:t,onRefreshEvents:n,skills:r,onRefreshSkills:s}){const[l,a]=A.useState("users"),[o,u]=A.useState(!0),[c,f]=A.useState(""),[g,d]=A.useState(""),[w,y]=A.useState([]),[N,R]=A.useState(""),[v,h]=A.useState([]),[m,_]=A.useState(!1),[C,E]=A.useState(!1),[j,L]=A.useState(!0),[G,P]=A.useState([]),[Y,ae]=A.useState(""),[le,ke]=A.useState([]),[ue,Te]=A.useState([]),[V,M]=A.useState(""),[U,x]=A.useState(""),[$,I]=A.useState(_p()),[K,W]=A.useState((e==null?void 0:e.app_name)||"Veranstaltungsschichtplaner"),[ee,Ae]=A.useState((e==null?void 0:e.logo_url)||""),[gt,Dn]=A.useState((e==null?void 0:e.primary_color)||"#E05A47"),[F,be]=A.useState((e==null?void 0:e.custom_banner_text)||""),[_t,rr]=A.useState((e==null?void 0:e.show_community_info_box)??!0),[zn,yn]=A.useState((e==null?void 0:e.community_info_title)||"📌 Verein & Infos"),[Nr,nt]=A.useState((e==null?void 0:e.community_info_text)||`Initiative e.V. Hausverein +Offene Angebote, DIY-Kultur & engagierte Schichten.`),[rt,Ds]=A.useState((e==null?void 0:e.show_support_box)??!0),[zs,z]=A.useState((e==null?void 0:e.support_box_title)||"❤️ Unterstützen"),[q,Ee]=A.useState((e==null?void 0:e.support_box_text)||"Hilf mit als Helfer*in an der Bar, beim Essen kochen oder beim Auf- & Abbau."),[en,xe]=A.useState(!1),[In,fa]=A.useState(!1),[ls,ha]=A.useState("smtp.beispiel.de"),[pa,ma]=A.useState(587),[ga,va]=A.useState(""),[Dl,zl]=A.useState(""),[Il,Ol]=A.useState(!0),[xa,Ul]=A.useState(!1),[ya,wa]=A.useState("noreply@schichtplaner.de"),[Fl,wu]=A.useState(""),[jr,bu]=A.useState(!1),[Vl,Bl]=A.useState(!1),[Er,ba]=A.useState(!1);A.useEffect(()=>{ka()},[]);const ka=async()=>{u(!0);try{try{const k=await J("/users/manage-users/");y(k.results||k)}catch{}try{const k=await J("/users/pending/");h(k.results||k)}catch{}try{const k=await J("/users/restriction-setting/");_(k.is_restriction_enabled),E(k.require_admin_approval),L(k.require_email_verification??!0)}catch{}try{const k=await J("/users/domain-rules/");P(k.results||k)}catch{}try{const k=await J("/events/");ke(k.results||k)}catch{}try{const k=await J("/templates/");Te(k.results||k)}catch{}try{const k=await J("/users/smtp-setting/");k&&(fa(k.is_active??!1),ha(k.host||""),ma(k.port||587),va(k.username||""),zl(k.password||""),Ol(k.use_tls??!0),Ul(k.use_ssl??!1),wa(k.from_email||""))}catch{}}catch(k){f(k.message||"Laden der Admin-Daten fehlgeschlagen.")}finally{u(!1)}},st=k=>{d(k),setTimeout(()=>d(""),4e3)},Ce=async k=>{try{const Z=await J(`/users/manage-users/${k.id}/`,{method:"PATCH",body:JSON.stringify({is_admin_user:!k.is_admin_user})});y(w.map(nn=>nn.id===k.id?Z:nn)),st(`Admin-Rechte für ${k.username} aktualisiert.`)}catch(Z){f(Z.message||"Fehler beim Aktualisieren.")}},Pt=async k=>{try{const Z=await J(`/users/manage-users/${k.id}/`,{method:"PATCH",body:JSON.stringify({is_approved:!k.is_approved})});y(w.map(nn=>nn.id===k.id?Z:nn)),st(`Freischalt-Status für ${k.username} aktualisiert.`)}catch(Z){f(Z.message||"Fehler beim Aktualisieren.")}},Lt=async k=>{if(window.confirm(`Möchtest du das Benutzerkonto "${k.display_name||k.username}" (@${k.username}) wirklich dauerhaft löschen?`))try{await J(`/users/manage-users/${k.id}/`,{method:"DELETE"}),y(w.filter(Z=>Z.id!==k.id)),st(`Benutzerkonto ${k.username} wurde gelöscht.`)}catch(Z){f(Z.message||"Fehler beim Löschen des Benutzers.")}},Hl=async k=>{try{await J(`/users/${k}/approve/`,{method:"POST"}),h(v.filter(Z=>Z.id!==k)),ka(),st("Benutzer erfolgreich freigeschaltet.")}catch(Z){f(Z.message||"Freischalten fehlgeschlagen.")}},Is=async k=>{try{await J(`/users/${k}/approve/`,{method:"DELETE"}),h(v.filter(Z=>Z.id!==k)),st("Benutzer abgelehnt und gelöscht.")}catch(Z){f(Z.message||"Ablehnen fehlgeschlagen.")}},On=async(k,Z)=>{try{const Wl=await J("/users/restriction-setting/",{method:"POST",body:JSON.stringify({is_restriction_enabled:k==="restriction"?Z:m,require_admin_approval:k==="approval"?Z:C,require_email_verification:k==="email_verify"?Z:j})});_(Wl.is_restriction_enabled),E(Wl.require_admin_approval),L(Wl.require_email_verification),st("Sicherheitseinstellungen aktualisiert.")}catch(nn){f(nn.message||"Aktualisierung fehlgeschlagen.")}},ku=async k=>{if(k.preventDefault(),!!Y.trim())try{const Z=await J("/users/domain-rules/",{method:"POST",body:JSON.stringify({domain:Y})});P([...G,Z]),ae(""),st(`Domain-Regel "${Z.domain}" hinzugefügt.`)}catch(Z){f(Z.message||"Fehler beim Hinzufügen.")}},_a=async k=>{try{await J(`/users/domain-rules/${k}/`,{method:"DELETE"}),P(G.filter(Z=>Z.id!==k)),st("Domain-Regel entfernt.")}catch(Z){f(Z.message||"Fehler beim Löschen.")}},Sa=async k=>{if(k.preventDefault(),!!V.trim())try{await J("/skills/",{method:"POST",body:JSON.stringify({name:V,description:U,color:$})}),M(""),x(""),I(_p()),s(),st("Qualifikation angelegt.")}catch(Z){f(Z.message||"Fehler beim Anlegen.")}},_u=async k=>{try{await J(`/skills/${k}/`,{method:"DELETE"}),s(),st("Qualifikation gelöscht.")}catch(Z){f(Z.message||"Fehler beim Löschen.")}},tn=async k=>{try{await J(`/templates/${k}/`,{method:"DELETE"}),Te(ue.filter(Z=>Z.id!==k)),st("Vorlage gelöscht.")}catch(Z){f(Z.message||"Fehler beim Löschen.")}},Na=async k=>{k.preventDefault(),xe(!0);try{await J("/branding/",{method:"POST",body:JSON.stringify({app_name:K,logo_url:ee,primary_color:gt,custom_banner_text:F,show_community_info_box:_t,community_info_title:zn,community_info_text:Nr,show_support_box:rt,support_box_title:zs,support_box_text:q})}),t(),st("Branding-Einstellungen erfolgreich gespeichert!")}catch(Z){f(Z.message||"Speichern des Brandings fehlgeschlagen.")}finally{xe(!1)}},Su=async k=>{k.preventDefault(),Bl(!0);try{await J("/users/smtp-setting/",{method:"POST",body:JSON.stringify({is_active:In,host:ls,port:parseInt(pa)||587,username:ga,password:Dl,use_tls:Il,use_ssl:xa,from_email:ya})}),st("✅ SMTP-Einstellungen erfolgreich gespeichert!")}catch(Z){f(Z.message||"Speichern der SMTP-Einstellungen fehlgeschlagen.")}finally{Bl(!1)}},Kl=async()=>{ba(!0);try{const k=await J("/users/smtp-setting/test/",{method:"POST",body:JSON.stringify({email:Fl})});st(`✅ ${k.message||"Test-E-Mail erfolgreich gesendet!"}`)}catch(k){f(k.message||"Test-E-Mail fehlgeschlagen.")}finally{ba(!1)}},Os=w.filter(k=>k.username.toLowerCase().includes(N.toLowerCase())||k.email.toLowerCase().includes(N.toLowerCase())||k.display_name&&k.display_name.toLowerCase().includes(N.toLowerCase()));return i.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto animate-in fade-in duration-200 font-sans",children:[i.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-500 border border-indigo-500/20 flex items-center justify-center font-bold",children:i.jsx(Hg,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"System Administration"}),i.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Verwaltung von Benutzern, Freischaltungen, Events, Vorlagen, Branding & SMTP-Mailserver"})]})]})}),i.jsx("div",{className:"border-b border-grid pb-2",children:i.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs overflow-x-auto no-scrollbar",children:[i.jsxs("button",{onClick:()=>a("users"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="users"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(Wg,{className:"w-3.5 h-3.5 text-blue-400"})," [ 01: BENUTZER & SICHERHEIT (",w.length,") ]"]}),i.jsxs("button",{onClick:()=>a("events"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="events"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(ra,{className:"w-3.5 h-3.5 text-emerald-400"})," [ 02: VERANSTALTUNGEN (",le.length,") ]"]}),i.jsxs("button",{onClick:()=>a("templates"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="templates"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(ou,{className:"w-3.5 h-3.5 text-amber-400"})," [ 03: VORLAGEN & SKILLS ]"]}),i.jsxs("button",{onClick:()=>a("branding"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="branding"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(tp,{className:"w-3.5 h-3.5 text-indigo-400"})," [ 04: BRANDING & SYSTEM ]"]}),i.jsxs("button",{onClick:()=>a("smtp"),className:`px-4 py-2 rounded-sm transition flex items-center gap-2 border ${l==="smtp"?"bg-surface-hover text-main font-bold border-grid shadow-sm":"bg-subtle text-muted border-transparent hover:text-main"}`,children:[i.jsx(Xc,{className:"w-3.5 h-3.5 text-purple-400"})," [ 05: E-MAIL & SMTP ]"]})]})}),c&&i.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:c})]}),g&&i.jsxs("div",{className:"p-4 rounded-sm bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-xs font-mono flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:g})]}),l==="users"&&i.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[v.length>0&&i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-amber-500/40 bg-amber-500/5 space-y-3",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-amber-500 flex items-center gap-2 border-b border-amber-500/20 pb-2",children:["⚠️ Ausstehende Registrierungen (",v.length,")"]}),i.jsx("div",{className:"space-y-2",children:v.map(k=>i.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"font-bold text-main",children:[k.display_name," (@",k.username,")"]}),i.jsx("div",{className:"text-[11px] text-muted",children:k.email})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>Hl(k.id),className:"px-3 py-1 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:"[ FREISCHALTEN ]"}),i.jsx("button",{onClick:()=>Is(k.id),className:"px-3 py-1 rounded-sm bg-red-600/20 text-red-400 hover:bg-red-600/30 border border-red-600/30 font-bold text-xs",children:"[ ABLEHNEN ]"})]})]},k.id))})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-4 border border-grid flex items-center gap-3",children:[i.jsx(Bg,{className:"w-4 h-4 text-muted shrink-0"}),i.jsx("input",{type:"text",value:N,onChange:k=>R(k.target.value),placeholder:"Nutzer suchen nach Name, Username oder E-Mail...",className:"w-full bg-subtle border border-grid px-3 py-1.5 rounded-sm text-xs font-mono text-main focus:outline-none focus:border-muted"}),N&&i.jsx("button",{onClick:()=>R(""),className:"text-xs text-muted hover:text-main font-mono shrink-0",children:"[ CLEAR ]"})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Benutzerkonten & Rechtestatus (",Os.length,")"]}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left border-collapse text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-grid text-muted uppercase text-[10px]",children:[i.jsx("th",{className:"pb-2 font-bold",children:"Nutzer"}),i.jsx("th",{className:"pb-2 font-bold",children:"E-Mail"}),i.jsx("th",{className:"pb-2 font-bold",children:"Freigeschaltet"}),i.jsx("th",{className:"pb-2 font-bold",children:"E-Mail Bestätigt"}),i.jsx("th",{className:"pb-2 font-bold",children:"Admin-Rolle"}),i.jsx("th",{className:"pb-2 font-bold text-right",children:"Aktionen"})]})}),i.jsx("tbody",{className:"divide-y divide-grid",children:Os.map(k=>i.jsxs("tr",{className:"hover:bg-subtle/50 transition",children:[i.jsxs("td",{className:"py-2.5 font-bold text-main",children:[k.display_name||k.username,i.jsxs("span",{className:"text-[10px] text-muted font-normal block",children:["@",k.username]})]}),i.jsx("td",{className:"py-2.5 text-muted",children:k.email}),i.jsx("td",{className:"py-2.5",children:i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_approved?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:k.is_approved?"JA":"NEIN"})}),i.jsx("td",{className:"py-2.5",children:i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_email_verified?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-subtle text-muted border-grid"}`,children:k.is_email_verified?"VERIFIZIERT":"AUSSTEHEND"})}),i.jsx("td",{className:"py-2.5",children:i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_admin_user||k.is_superuser?"bg-indigo-500/10 text-indigo-400 border-indigo-500/20":"bg-subtle text-muted border-grid"}`,children:k.is_superuser?"SUPERUSER":k.is_admin_user?"ADMIN":"USER"})}),i.jsxs("td",{className:"py-2.5 text-right space-x-1",children:[i.jsx("button",{onClick:()=>Pt(k),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-main transition",children:k.is_approved?"Sperren":"Freischalten"}),i.jsx("button",{onClick:()=>Ce(k),className:"px-2 py-1 rounded-sm text-[10px] bg-subtle hover:bg-surface-hover border border-grid text-indigo-400 transition",children:k.is_admin_user?"Admin entziehen":"Zu Admin machen"}),i.jsxs("button",{onClick:()=>Lt(k),className:"px-2 py-1 rounded-sm text-[10px] bg-red-500/10 hover:bg-red-500/20 border border-red-500/20 text-red-400 font-bold transition inline-flex items-center gap-1",title:"Benutzerkonto dauerhaft löschen",children:[i.jsx(cn,{className:"w-3 h-3"})," Löschen"]})]})]},k.id))})]})})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Sicherheit & Registrierungs-Einschränkungen"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-bold text-main",children:"E-Mail Bestätigung (Opt-Out)"}),i.jsx("button",{onClick:()=>On("email_verify",!j),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${j?"bg-emerald-600 text-white border-emerald-500":"bg-amber-500/10 text-amber-500 border-amber-500/20"}`,children:j?"[ PFLICHT ]":"[ DEAKTIVIERT ]"})]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Bei Pflicht muss die E-Mail vor der Anmeldung verifiziert werden. Bei Deaktivierung ist die Anmeldung direkt möglich."})]}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-bold text-main",children:"Domain-Einschränkung"}),i.jsx("button",{onClick:()=>On("restriction",!m),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${m?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:m?"[ AKTIV ]":"[ INAKTIV ]"})]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erlaubt nur Registrierungen von festgelegten E-Mail-Domains (z. B. `@verein.de`)."})]}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-bold text-main",children:"Admin-Freischaltpflicht"}),i.jsx("button",{onClick:()=>On("approval",!C),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${C?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:C?"[ AKTIV ]":"[ INAKTIV ]"})]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Erfordert die manuelle Freischaltung durch einen Admin vor der ersten Anmeldung."})]})]}),m&&i.jsxs("div",{className:"space-y-3 pt-3 border-t border-grid",children:[i.jsx("h4",{className:"font-serif text-sm font-bold uppercase text-main",children:"Erlaubte E-Mail-Domains"}),i.jsxs("form",{onSubmit:ku,className:"flex gap-2",children:[i.jsx("input",{type:"text",placeholder:"z. B. verein.de oder @beispiel.org",value:Y,onChange:k=>ae(k.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),i.jsxs("button",{type:"submit",className:"px-4 py-1.5 rounded-sm bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs",children:[i.jsx(Zn,{className:"w-3.5 h-3.5 inline"})," Domain Hinzufügen"]})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:G.map(k=>i.jsxs("span",{className:"px-2.5 py-1 rounded-sm bg-subtle border border-grid text-xs flex items-center gap-2",children:[i.jsx("strong",{className:"text-main",children:k.domain}),i.jsx("button",{onClick:()=>_a(k.id),className:"text-muted hover:text-red-400",children:i.jsx(cn,{className:"w-3.5 h-3.5"})})]},k.id))})]})]})]}),l==="events"&&i.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Alle Veranstaltungen (",le.length,")"]}),i.jsx("div",{className:"space-y-3",children:le.map(k=>i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"font-serif font-bold text-main text-sm",children:k.title}),i.jsxs("p",{className:"text-muted text-[11px]",children:[new Date(k.start_date).toLocaleDateString("de-DE")," — ",k.location||"Kein Ort"," | Erstellt von: ",k.created_by_name||"Admin"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`px-2 py-0.5 rounded-sm text-[10px] font-bold border ${k.is_active!==!1?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:k.is_active!==!1?"AKTIV":"DEAKTIVIERT"}),i.jsxs("button",{onClick:async()=>{if(window.confirm(`Möchtest du "${k.title}" und alle Schichten wirklich unwiderruflich löschen?`))try{await J(`/events/${k.id}/`,{method:"DELETE"}),n()}catch(Z){alert(Z.message)}},className:"px-2.5 py-1 rounded-sm text-[10px] font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1",title:"Veranstaltung löschen",children:[i.jsx(cn,{className:"w-3 h-3"})," LÖSCHEN"]})]})]},k.id))})]})}),l==="templates"&&i.jsxs("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"Erforderliche Qualifikationen (Skills)"}),i.jsxs("form",{onSubmit:Sa,className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[i.jsx("input",{type:"text",placeholder:"Skill Name (z. B. Bar-Erfahrung)",required:!0,value:V,onChange:k=>M(k.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),i.jsx("input",{type:"text",placeholder:"Beschreibung (optional)",value:U,onChange:k=>x(k.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs font-mono"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"color",value:$,onChange:k=>I(k.target.value),className:"w-8 h-8 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),i.jsxs("button",{type:"submit",className:"flex-1 px-3 py-1.5 rounded-sm bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs",children:[i.jsx(Zn,{className:"w-3.5 h-3.5 inline"})," Anlegen"]})]})]}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pt-2",children:r.map(k=>i.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsx("span",{style:{color:k.color},className:"font-bold",children:k.name}),k.description&&i.jsx("p",{className:"text-[11px] text-muted",children:k.description})]}),i.jsx("button",{onClick:()=>_u(k.id),className:"text-muted hover:text-red-400",children:i.jsx(cn,{className:"w-3.5 h-3.5"})})]},k.id))})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-5 border border-grid space-y-4",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:["Gespeicherte Event-Vorlagen (",ue.length,")"]}),i.jsx("div",{className:"space-y-2",children:ue.map(k=>i.jsxs("div",{className:"p-3 rounded-sm bg-subtle border border-grid flex items-center justify-between text-xs",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-bold text-main",children:k.name}),i.jsx("div",{className:"text-[11px] text-muted",children:k.description||"Keine Beschreibung"})]}),i.jsx("button",{onClick:()=>tn(k.id),className:"text-muted hover:text-red-400",children:i.jsx(cn,{className:"w-4 h-4"})})]},k.id))})]})]}),l==="branding"&&i.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:i.jsxs("form",{onSubmit:Na,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2 flex items-center gap-2",children:[i.jsx(tp,{className:"w-5 h-5 text-indigo-400"})," Portal Branding & Erscheinungsbild"]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Anwendungs-Name"}),i.jsx("input",{type:"text",required:!0,value:K,onChange:k=>W(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field font-bold"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Primärfarbe (Brand Accent)"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"color",value:gt,onChange:k=>Dn(k.target.value),className:"w-9 h-9 rounded-sm border-0 cursor-pointer bg-subtle p-0.5"}),i.jsx("input",{type:"text",value:gt,onChange:k=>Dn(k.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field font-mono"})]})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-muted mb-1",children:"Logo Bild-URL (optional)"}),i.jsx("input",{type:"text",placeholder:"https://beispiel.de/logo.png",value:ee,onChange:k=>Ae(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-muted mb-1",children:"Ankündigung (Banner-Text)"}),i.jsx("textarea",{rows:2,placeholder:"z. B. Willkommen beim Sommerfest Schichtplaner!",value:F,onChange:k=>be(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]}),i.jsx("h4",{className:"font-serif text-base font-bold uppercase text-main pt-4 border-t border-grid",children:"Startseiten Sidebar Boxen"}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[i.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"📌 Verein & Infos Box"}),i.jsx("button",{type:"button",onClick:()=>rr(!_t),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${_t?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:_t?"[ AN ]":"[ AUS ]"})]}),_t&&i.jsxs("div",{className:"space-y-3 text-xs",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),i.jsx("input",{type:"text",value:zn,onChange:k=>yn(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),i.jsx("textarea",{rows:3,value:Nr,onChange:k=>nt(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[i.jsx("span",{className:"font-bold text-xs uppercase text-main",children:"❤️ Unterstützen Box"}),i.jsx("button",{type:"button",onClick:()=>Ds(!rt),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${rt?"bg-emerald-600 text-white border-emerald-500":"bg-surface text-muted border-grid"}`,children:rt?"[ AN ]":"[ AUS ]"})]}),rt&&i.jsxs("div",{className:"space-y-3 text-xs",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Titel"}),i.jsx("input",{type:"text",value:zs,onChange:k=>z(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-muted mb-1",children:"Inhalt"}),i.jsx("textarea",{rows:3,value:q,onChange:k=>Ee(k.target.value),className:"w-full px-3 py-1.5 rounded-sm input-field"})]})]})]}),i.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:i.jsx("button",{type:"submit",disabled:en,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm",children:en?"Speichern...":"Einstellungen speichern"})})]})}),l==="smtp"&&i.jsx("div",{className:"space-y-6 animate-in fade-in duration-150 font-mono",children:i.jsxs("form",{onSubmit:Su,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-3",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[i.jsx(Xc,{className:"w-5 h-5 text-indigo-400"})," SMTP Server & E-Mail-Versand"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-muted font-bold",children:"SMTP-Versand:"}),i.jsx("button",{type:"button",onClick:()=>fa(!In),className:`px-3 py-1 rounded-sm text-xs font-bold transition border ${In?"bg-emerald-600 text-white border-emerald-500 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:In?"[ AKTIV ]":"[ INAKTIV (Dev Mode) ]"})]})]}),!In&&i.jsxs("div",{className:"p-3.5 rounded-sm bg-amber-500/10 border border-amber-500/20 text-amber-500 text-xs flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:"Hinweis: Im inaktiven Modus werden Bestätigungs-Links in der Entwickler-Konsole / Logs ausgegeben."})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Host / Server Adresse"}),i.jsx("input",{type:"text",placeholder:"z. B. smtp.domain.de oder mail.gmx.net",value:ls,onChange:k=>ha(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Port"}),i.jsx("input",{type:"number",placeholder:"587 oder 465",value:pa,onChange:k=>ma(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Absender E-Mail-Adresse (From)"}),i.jsx("input",{type:"email",placeholder:"noreply@verein.de",value:ya,onChange:k=>wa(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Benutzername / Login E-Mail"}),i.jsx("input",{type:"text",placeholder:"z. B. noreply@verein.de",value:ga,onChange:k=>va(k.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field font-mono"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"SMTP Passwort"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:jr?"text":"password",placeholder:"••••••••",value:Dl,onChange:k=>zl(k.target.value),className:"w-full pl-3.5 pr-10 py-2 rounded-sm input-field font-mono"}),i.jsx("button",{type:"button",onClick:()=>bu(!jr),className:"absolute right-3 top-2.5 text-muted hover:text-main",children:jr?i.jsx(Vg,{className:"w-4 h-4"}):i.jsx(sy,{className:"w-4 h-4"})})]})]}),i.jsxs("div",{className:"sm:col-span-2 flex items-center gap-6 pt-2",children:[i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[i.jsx("input",{type:"checkbox",checked:Il,onChange:k=>{Ol(k.target.checked),k.target.checked&&Ul(!1)},className:"rounded-sm"}),i.jsx("span",{children:"STARTTLS verwenden (Empfohlen für Port 587)"})]}),i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-main font-bold",children:[i.jsx("input",{type:"checkbox",checked:xa,onChange:k=>{Ul(k.target.checked),k.target.checked&&Ol(!1)},className:"rounded-sm"}),i.jsx("span",{children:"SSL/TLS verwenden (Empfohlen für Port 465)"})]})]})]}),i.jsxs("div",{className:"pt-4 border-t border-grid flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-[260px]",children:[i.jsx("input",{type:"email",placeholder:"Empfänger für Test-E-Mail...",value:Fl,onChange:k=>wu(k.target.value),className:"px-3 py-1.5 rounded-sm input-field text-xs flex-1 font-mono"}),i.jsxs("button",{type:"button",disabled:Er,onClick:Kl,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[i.jsx(dy,{className:"w-3.5 h-3.5"}),Er?"Sende...":"Test-Mail Senden"]})]}),i.jsxs("button",{type:"submit",disabled:Vl,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4"}),Vl?"Speichern...":"SMTP-Einstellungen Speichern"]})]})]})})]})}function Gb({eventToEdit:e,skills:t,user:n,onBack:r,onSubmit:s,onDeleteEvent:l}){var U;const[a,o]=A.useState((e==null?void 0:e.title)||""),[u,c]=A.useState((e==null?void 0:e.description)||""),[f,g]=A.useState((e==null?void 0:e.location)||""),[d,w]=A.useState((e==null?void 0:e.start_date)||new Date().toISOString().split("T")[0]),[y,N]=A.useState((e==null?void 0:e.end_date)||new Date().toISOString().split("T")[0]),[R,v]=A.useState(e!=null&&e.co_managers?e.co_managers.map(x=>x.id):[]),[h,m]=A.useState([]),[_,C]=A.useState([]),[E,j]=A.useState(!1),[L,G]=A.useState("");A.useEffect(()=>{if(P(),e&&e.task_areas&&e.task_areas.length>0){const x=e.task_areas.map($=>({id:$.id,name:$.name,description:$.description||"",shifts:($.shifts||[]).map(I=>({id:I.id,title:I.title,date:I.date||(e?e.start_date:new Date().toISOString().split("T")[0]),start_time:I.start_time,end_time:I.end_time,max_participants:I.max_participants||1,required_skill_ids:I.required_skills?I.required_skills.map(K=>K.id):[]}))}));C(x)}else e||C([{name:"Tresendienst",description:"Getränke- und Barverkauf",shifts:[{title:"Schicht 1",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}]},{name:"Essen kochen",description:"Zubereitung von Speisen",shifts:[{title:"Frühschicht",start_time:"15:00",end_time:"19:00",max_participants:3,required_skill_ids:[]}]},{name:"Aufbau & Aufräumen",description:"Tische, Stühle & Technik",shifts:[{title:"Aufbau",start_time:"12:00",end_time:"15:00",max_participants:4,required_skill_ids:[]}]}])},[e]);const P=async()=>{try{const x=await J("/users/all/");m(x.results||x)}catch{}},Y=()=>{C([..._,{name:"",description:"",shifts:[{title:"Schicht 1",start_time:"10:00",end_time:"14:00",max_participants:1,required_skill_ids:[]}]}])},ae=x=>{C(_.filter(($,I)=>I!==x))},le=(x,$,I)=>{const K=[..._];K[x][$]=I,C(K)},ke=x=>{const $=[..._];$[x].shifts.push({title:`Schicht ${$[x].shifts.length+1}`,date:d,start_time:"14:00",end_time:"18:00",max_participants:1,required_skill_ids:[]}),C($)},ue=(x,$)=>{const I=[..._];I[x].shifts=I[x].shifts.filter((K,W)=>W!==$),C(I)},Te=(x,$,I,K)=>{const W=[..._];W[x].shifts[$][I]=K,C(W)},V=(x,$,I)=>{const K=[..._],W=K[x].shifts[$].required_skill_ids||[];W.includes(I)?K[x].shifts[$].required_skill_ids=W.filter(ee=>ee!==I):K[x].shifts[$].required_skill_ids=[...W,I],C(K)},M=async x=>{if(x.preventDefault(),G(""),!a.trim()){G("Bitte gib einen Veranstaltungstitel an.");return}j(!0);try{await s({id:e==null?void 0:e.id,title:a,description:u,location:f,start_date:d,end_date:y,co_manager_ids:R,task_areas:_})}catch($){G($.message||"Speichern der Veranstaltung fehlgeschlagen.")}finally{j(!1)}};return i.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[i.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[i.jsxs("button",{onClick:r,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[i.jsx(Ug,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),i.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm",children:["MODE: ",e?"EVENT EDIT":"NEW EVENT"]})]}),i.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-2",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-blue-500/10 text-blue-500 border border-blue-500/20 flex items-center justify-center font-bold",children:e?i.jsx(Bi,{className:"w-5 h-5"}):i.jsx(ra,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:e?"Veranstaltung & Schichten Bearbeiten":"Neue Veranstaltung Erstellen"}),i.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Konfiguriere Stammdaten, Co-Verwalter, Aufgabenfelder, Schichtzeiten & Qualifikationen"})]})]})}),L&&i.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:L})]}),i.jsxs("form",{onSubmit:M,className:"space-y-6",children:[i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main border-b border-grid pb-2",children:"1. Stammdaten & Verwalter der Veranstaltung"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),i.jsx("input",{type:"text",required:!0,value:a,onChange:x=>o(x.target.value),placeholder:"z. B. Sommerfest 2026",className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),i.jsx("input",{type:"date",required:!0,value:d,onChange:x=>w(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),i.jsx("input",{type:"date",required:!0,value:y,onChange:x=>N(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),i.jsx("input",{type:"text",value:f,onChange:x=>g(x.target.value),placeholder:"z. B. Vereinsheim, Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),i.jsx("textarea",{rows:2,value:u,onChange:x=>c(x.target.value),placeholder:"Details zur Veranstaltung...",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs font-sans"})]}),h.length>0&&i.jsxs("div",{className:"sm:col-span-2 pt-3 border-t border-grid space-y-2",children:[i.jsxs("label",{className:"block text-main font-bold flex items-center gap-1.5",children:[i.jsx(Wg,{className:"w-4 h-4 text-indigo-400"})," Co-Verwalter / Mit-Organisatoren (optional)"]}),i.jsx("p",{className:"text-[11px] text-muted font-sans",children:"Wähle registrierte Benutzer aus, die dieses Event ebenfalls verwalten, bearbeiten und Gäste eintragen dürfen:"}),i.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:h.map(x=>{const $=R.includes(x.id);return i.jsxs("button",{type:"button",onClick:()=>{v($?R.filter(I=>I!==x.id):[...R,x.id])},className:`px-3 py-1.5 rounded-sm text-xs font-mono font-bold transition flex items-center gap-1.5 border ${$?"bg-indigo-500/20 text-indigo-300 border-indigo-500/50 shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:[i.jsx(xf,{className:`w-3.5 h-3.5 ${$?"text-indigo-400":"opacity-40"}`}),i.jsx("span",{children:x.display_name||x.username})]},x.id)})})]})]})]}),i.jsxs("div",{className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-grid pb-2",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-main flex items-center gap-2",children:[i.jsx(ou,{className:"w-4 h-4 text-blue-500"})," 2. Aufgabenfelder & Schichten"]}),i.jsxs("button",{type:"button",onClick:Y,className:"px-3.5 py-1.5 rounded-sm text-xs font-mono font-bold bg-blue-500/10 text-blue-500 border border-blue-500/20 hover:bg-blue-500/20 transition flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," BEREICH HINZUFÜGEN"]})]}),_.map((x,$)=>i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("input",{type:"text",required:!0,placeholder:"Name des Aufgabenfeldes (z. B. Tresendienst)",value:x.name,onChange:I=>le($,"name",I.target.value),className:"flex-1 px-3 py-1.5 rounded-sm input-field text-xs font-bold"}),i.jsx("button",{type:"button",onClick:()=>ae($),className:"p-1.5 text-muted hover:text-red-400 transition",title:"Bereich entfernen",children:i.jsx(cn,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs text-muted font-bold",children:[i.jsx("span",{children:"Schichten & Zeitfenster"}),i.jsxs("button",{type:"button",onClick:()=>ke($),className:"text-blue-500 hover:underline flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),x.shifts.map((I,K)=>i.jsxs("div",{className:"p-3 rounded-sm bg-surface border border-grid space-y-2",children:[i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[i.jsx("input",{type:"text",placeholder:"Titel",value:I.title,onChange:W=>Te($,K,"title",W.target.value),className:"sm:col-span-3 px-2.5 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"date",title:"Schichtdatum",min:d,max:y,value:I.date||d,onChange:W=>Te($,K,"date",W.target.value),className:"sm:col-span-3 px-2 py-1 rounded-sm input-field text-xs font-mono text-indigo-400 font-bold"}),i.jsx("input",{type:"text",placeholder:"Start (14:00)",value:I.start_time,onChange:W=>Te($,K,"start_time",W.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"text",placeholder:"Ende (18:00)",value:I.end_time,onChange:W=>Te($,K,"end_time",W.target.value),className:"sm:col-span-2 px-2.5 py-1 rounded-sm input-field text-xs"}),i.jsx("div",{className:"sm:col-span-1 flex items-center gap-1",children:i.jsx("input",{type:"number",min:"1",title:"Max. Plätze",value:I.max_participants,onChange:W=>Te($,K,"max_participants",parseInt(W.target.value)||1),className:"w-full px-1.5 py-1 rounded-sm input-field text-xs font-bold text-center"})}),i.jsx("button",{type:"button",onClick:()=>ue($,K),className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",title:"Schicht löschen",children:i.jsx(cn,{className:"w-3.5 h-3.5 mx-auto"})})]}),t&&t.length>0&&i.jsxs("div",{className:"pt-2 border-t border-grid flex flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:"text-[10px] text-muted font-bold mr-1",children:"Erforderlich:"}),t.map(W=>{const ee=(I.required_skill_ids||[]).includes(W.id);return i.jsxs("button",{type:"button",onClick:()=>V($,K,W.id),style:{backgroundColor:ee?`${W.color}25`:"transparent",borderColor:ee?W.color:"var(--color-border-grid)",color:ee?W.color:"var(--color-text-muted)"},className:"px-2 py-0.5 rounded-sm text-[10px] border font-bold transition flex items-center gap-1",children:[i.jsx("span",{children:W.name}),ee&&i.jsx(Ln,{className:"w-3 h-3"})]},W.id)})]})]},K))]})]},$))]}),i.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2 font-mono",children:[e&&l&&n&&(n.is_admin_user||n.is_staff||n.is_superuser||e.created_by===n.id||((U=e.created_by)==null?void 0:U.id)===n.id)?i.jsxs("button",{type:"button",onClick:()=>l(e),className:"px-4 py-2.5 rounded-sm text-xs font-bold bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 transition flex items-center gap-1.5",children:[i.jsx(cn,{className:"w-4 h-4"})," VERANSTALTUNG LÖSCHEN"]}):i.jsx("div",{}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"button",onClick:r,className:"px-5 py-2.5 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),i.jsxs("button",{type:"submit",disabled:E,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4"}),E?"Speichern...":"Veranstaltung Speichern"]})]})]})]})]})}function qb({onBack:e,onInstantiateTemplate:t,user:n,skills:r}){const[s,l]=A.useState([]),[a,o]=A.useState(!0),[u,c]=A.useState(""),[f,g]=A.useState(null),[d,w]=A.useState(""),[y,N]=A.useState(new Date().toISOString().split("T")[0]),[R,v]=A.useState(new Date().toISOString().split("T")[0]),[h,m]=A.useState(""),[_,C]=A.useState(!1),[E,j]=A.useState(!1),[L,G]=A.useState(""),[P,Y]=A.useState(""),[ae,le]=A.useState([{name:"Tresendienst",description:"Getränkeausschank und Bar",shifts:[{title:"Frühschicht",start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]},{title:"Spätschicht",start_time:"22:00",end_time:"02:00",max_participants:3,required_skill_ids:[]}]}]);A.useEffect(()=>{ke()},[]);const ke=async()=>{o(!0);try{const x=await J("/templates/");l(x.results||x)}catch(x){c(x.message||"Laden der Vorlagen fehlgeschlagen.")}finally{o(!1)}},ue=x=>{g(x),w(x.name)},Te=async x=>{if(x.preventDefault(),!!f){C(!0);try{await t(f.id,{title:d,start_date:y,end_date:R,location:h})}catch($){c($.message||"Erstellen der Veranstaltung aus Vorlage fehlgeschlagen.")}finally{C(!1)}}},V=async x=>{if(x.preventDefault(),!L.trim()){c("Bitte gib einen Vorlagen-Namen an.");return}C(!0);try{const $={name:L,description:P,template_data:{task_areas:ae.map(I=>({name:I.name,description:I.description,shifts:(I.shifts||[]).map(K=>({title:K.title,start_time:K.start_time,end_time:K.end_time,max_participants:K.max_participants,required_skill_ids:K.required_skill_ids}))}))}};await J("/templates/",{method:"POST",body:JSON.stringify($)}),j(!1),G(""),Y(""),ke()}catch($){c($.message||"Erstellen der Vorlage fehlgeschlagen.")}finally{C(!1)}},M=()=>{le([...ae,{name:"Neuer Bereich",description:"",shifts:[{title:"Schicht 1",start_time:"14:00",end_time:"18:00",max_participants:2,required_skill_ids:[]}]}])},U=x=>{const $=[...ae];$[x].shifts.push({title:`Schicht ${$[x].shifts.length+1}`,start_time:"18:00",end_time:"22:00",max_participants:2,required_skill_ids:[]}),le($)};return i.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-in fade-in duration-200 font-sans",children:[i.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[i.jsxs("button",{onClick:e,className:"px-3.5 py-1.5 rounded-sm bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-2 font-bold",children:[i.jsx(Ug,{className:"w-4 h-4"})," [ ZURÜCK ZUR ÜBERSICHT ]"]}),i.jsxs("span",{className:"text-muted border border-grid px-2.5 py-0.5 rounded-sm uppercase",children:["SYSTEM VORLAGEN (",s.length,")"]})]}),i.jsx("div",{className:"hallmark-panel rounded-sm p-6 sm:p-8 border border-grid space-y-4",children:i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-sm bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 flex items-center justify-center font-bold",children:i.jsx(ou,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-serif text-3xl font-bold uppercase tracking-tight text-main",children:"Veranstaltungs-Vorlagen Zentrale"}),i.jsx("p",{className:"text-xs text-muted font-mono mt-0.5",children:"Erstelle neue Veranstaltungen mit voreingestellten Schichten und Aufgabenbereichen"})]})]}),n&&i.jsxs("button",{onClick:()=>j(!E),className:"px-3.5 py-2 rounded-sm text-xs font-mono font-bold bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 hover:bg-indigo-500/20 transition flex items-center gap-1.5 shrink-0",children:[i.jsx(Zn,{className:"w-4 h-4"}),E?"Schließen":"Neue Vorlage Erstellen"]})]})}),u&&i.jsxs("div",{className:"p-4 rounded-sm bg-red-500/10 border border-red-500/20 text-red-500 text-xs font-mono flex items-center gap-2",children:[i.jsx(Cl,{className:"w-4 h-4 shrink-0"}),i.jsx("span",{children:u})]}),E&&i.jsxs("form",{onSubmit:V,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2 flex items-center justify-between",children:[i.jsx("span",{children:"Neue Vorlage mit voreingestellten Schichten anlegen"}),i.jsxs("button",{type:"button",onClick:M,className:"text-xs font-mono font-bold bg-indigo-500/20 text-indigo-300 px-3 py-1 rounded-sm border border-indigo-500/30 flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3.5 h-3.5"})," Bereich Hinzufügen"]})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Vorlagen Name"}),i.jsx("input",{type:"text",required:!0,placeholder:"z. B. Standard Kneipenabend / Bar-Event",value:L,onChange:x=>G(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Beschreibung (optional)"}),i.jsx("input",{type:"text",placeholder:"z. B. Inklusive 2 Barschichten und Aufbau",value:P,onChange:x=>Y(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),i.jsx("div",{className:"space-y-4 pt-2",children:ae.map((x,$)=>i.jsxs("div",{className:"p-4 rounded-sm bg-subtle border border-grid space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("input",{type:"text",required:!0,placeholder:"Bereichs-Name (z. B. Bar)",value:x.name,onChange:I=>{const K=[...ae];K[$].name=I.target.value,le(K)},className:"flex-1 px-3 py-1 rounded-sm input-field text-xs font-bold"}),i.jsx("button",{type:"button",onClick:()=>{le(ae.filter((I,K)=>K!==$))},className:"text-muted hover:text-red-400 p-1",children:i.jsx(cn,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"pl-3 border-l-2 border-grid space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-muted text-[11px] font-bold",children:[i.jsx("span",{children:"Voreingestellte Schichten"}),i.jsxs("button",{type:"button",onClick:()=>U($),className:"text-indigo-400 hover:underline flex items-center gap-1",children:[i.jsx(Zn,{className:"w-3 h-3"})," Schicht hinzufügen"]})]}),x.shifts.map((I,K)=>i.jsxs("div",{className:"p-2.5 rounded-sm bg-surface border border-grid grid grid-cols-1 sm:grid-cols-12 gap-2 items-center text-xs",children:[i.jsx("input",{type:"text",placeholder:"Schichtname",value:I.title,onChange:W=>{const ee=[...ae];ee[$].shifts[K].title=W.target.value,le(ee)},className:"sm:col-span-4 px-2 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"text",placeholder:"Start (18:00)",value:I.start_time,onChange:W=>{const ee=[...ae];ee[$].shifts[K].start_time=W.target.value,le(ee)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),i.jsx("input",{type:"text",placeholder:"Ende (22:00)",value:I.end_time,onChange:W=>{const ee=[...ae];ee[$].shifts[K].end_time=W.target.value,le(ee)},className:"sm:col-span-2 px-2 py-1 rounded-sm input-field text-xs"}),i.jsxs("div",{className:"sm:col-span-3 flex items-center gap-1",children:[i.jsx("span",{className:"text-[10px] text-muted",children:"Plätze:"}),i.jsx("input",{type:"number",min:"1",value:I.max_participants,onChange:W=>{const ee=[...ae];ee[$].shifts[K].max_participants=parseInt(W.target.value)||1,le(ee)},className:"w-full px-2 py-1 rounded-sm input-field text-xs font-bold"})]}),i.jsx("button",{type:"button",onClick:()=>{const W=[...ae];W[$].shifts=W[$].shifts.filter((ee,Ae)=>Ae!==K),le(W)},className:"sm:col-span-1 p-1 text-muted hover:text-red-400 text-center",children:i.jsx(cn,{className:"w-3.5 h-3.5 mx-auto"})})]},K))]})]},$))}),i.jsxs("div",{className:"pt-3 flex justify-end gap-2 border-t border-grid",children:[i.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-sm text-xs font-semibold text-muted hover:bg-surface-hover transition border border-grid",children:"Abbrechen"}),i.jsxs("button",{type:"submit",disabled:_,style:{backgroundColor:"var(--brand-primary)"},className:"px-5 py-2 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-1.5",children:[i.jsx(Ln,{className:"w-4 h-4"})," Vorlage Speichern"]})]})]}),i.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[i.jsx("h3",{className:"font-serif text-lg font-bold uppercase text-main",children:"Verfügbare Vorlagen"}),a?i.jsx("div",{className:"hallmark-panel p-8 text-center text-muted",children:"Lade Vorlagen..."}):s.length===0?i.jsx("div",{className:"hallmark-panel p-8 text-center text-muted italic",children:'[ Noch keine Vorlagen gespeichert. Klicke oben auf "Neue Vorlage Erstellen" um Vorlagen mit voreingestellten Schichten anzulegen. ]'}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map(x=>{var $;return i.jsxs("div",{onClick:()=>ue(x),className:`hallmark-panel p-5 rounded-sm border cursor-pointer transition space-y-3 ${(f==null?void 0:f.id)===x.id?"bg-indigo-500/10 border-indigo-500 shadow-md":"bg-surface border-grid hover:border-muted"}`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"font-serif text-base font-bold text-main uppercase",children:x.name}),(f==null?void 0:f.id)===x.id&&i.jsx("span",{className:"text-[10px] font-mono text-indigo-400 bg-indigo-500/20 px-2 py-0.5 rounded-sm border border-indigo-500/30 font-bold",children:"[ AUSGEWÄHLT ]"})]}),x.description&&i.jsx("p",{className:"text-xs font-sans text-muted",children:x.description}),(($=x.template_data)==null?void 0:$.task_areas)&&x.template_data.task_areas.length>0&&i.jsxs("div",{className:"space-y-2 pt-2 border-t border-grid text-[11px]",children:[i.jsx("div",{className:"font-bold text-muted uppercase text-[10px]",children:"📌 Voreingestellte Schichten:"}),x.template_data.task_areas.map((I,K)=>{var W;return i.jsxs("div",{className:"bg-subtle p-2 rounded-sm border border-grid space-y-1",children:[i.jsxs("div",{className:"font-bold text-main flex items-center justify-between",children:[i.jsx("span",{children:I.name}),i.jsxs("span",{className:"text-[10px] text-muted font-normal",children:[((W=I.shifts)==null?void 0:W.length)||0," Schichten"]})]}),i.jsx("div",{className:"flex flex-wrap gap-1",children:(I.shifts||[]).map((ee,Ae)=>i.jsxs("span",{className:"px-2 py-0.5 rounded-sm bg-surface border border-grid text-[10px] flex items-center gap-1 font-mono",children:[i.jsx(Vi,{className:"w-3 h-3 text-muted shrink-0"}),i.jsx("strong",{className:"text-main",children:ee.title}),i.jsxs("span",{className:"text-muted",children:["(",ee.start_time,"-",ee.end_time,", ",ee.max_participants," Plätze)"]})]},Ae))})]},K)})]}),i.jsxs("div",{className:"text-[10px] text-muted pt-2 border-t border-grid flex items-center justify-between",children:[i.jsxs("span",{children:["Erstellt von: ",i.jsx("strong",{children:x.created_by_name||"Admin"})]}),i.jsx("span",{className:"text-indigo-400 font-bold",children:"Klick zum Auswählen"})]})]},x.id)})})]}),f&&i.jsxs("form",{onSubmit:Te,className:"hallmark-panel rounded-sm p-6 border border-grid space-y-4 font-mono text-xs animate-in fade-in duration-200",children:[i.jsxs("h3",{className:"font-serif text-lg font-bold uppercase text-indigo-400 border-b border-grid pb-2",children:['Neue Veranstaltung aus Vorlage "',f.name,'" Erstellen']}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Titel der Veranstaltung"}),i.jsx("input",{type:"text",required:!0,value:d,onChange:x=>w(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-sm font-bold"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Startdatum"}),i.jsx("input",{type:"date",required:!0,value:y,onChange:x=>N(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Enddatum"}),i.jsx("input",{type:"date",required:!0,value:R,onChange:x=>v(x.target.value),className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("label",{className:"block text-main mb-1 font-bold",children:"Ort (optional)"}),i.jsx("input",{type:"text",value:h,onChange:x=>m(x.target.value),placeholder:"z. B. Großer Saal",className:"w-full px-3.5 py-2 rounded-sm input-field text-xs"})]})]}),i.jsx("div",{className:"pt-3 flex justify-end border-t border-grid",children:i.jsxs("button",{type:"submit",disabled:_,style:{backgroundColor:"var(--brand-primary)"},className:"px-6 py-2.5 rounded-sm text-xs font-mono font-bold text-white transition hover:brightness-110 shadow-sm flex items-center gap-2",children:[i.jsx(uy,{className:"w-4 h-4 fill-white"}),_?"Erstellen...":"Veranstaltung Jetzt Aus Vorlage Erstellen"]})})]})]})}function Qb(){const[e,t]=A.useState(null),[n,r]=A.useState(null),[s,l]=A.useState([]),[a,o]=A.useState([]),[u,c]=A.useState(null),[f,g]=A.useState(null),[d,w]=A.useState(!0),[y,N]=A.useState("home"),[R,v]=A.useState(!1),[h,m]=A.useState(!1),[_,C]=A.useState(null),[E,j]=A.useState(!1),[L,G]=A.useState(!1),[P,Y]=A.useState(localStorage.getItem("theme_mode")||"auto"),[ae,le]=A.useState(null),[ke,ue]=A.useState(null);A.useEffect(()=>{window.addEventListener("beforeinstallprompt",z=>{z.preventDefault(),ue(z)}),$()},[]),A.useEffect(()=>{localStorage.setItem("theme_mode",P);const z=()=>{let q=P;P==="auto"&&(q=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),document.documentElement.setAttribute("data-theme",q)};if(z(),P==="auto"){const q=window.matchMedia("(prefers-color-scheme: dark)"),Ee=()=>z();return q.addEventListener("change",Ee),()=>q.removeEventListener("change",Ee)}},[P]),A.useEffect(()=>{n!=null&&n.primary_color&&(document.documentElement.style.setProperty("--brand-primary",n.primary_color),document.documentElement.style.setProperty("--brand-secondary",n.secondary_color||n.primary_color))},[n]);const[Te,V]=A.useState(null),[M,U]=A.useState(null),x=z=>{le(z),setTimeout(()=>le(null),5e3)},$=async()=>{w(!0);try{try{const xe=await J("/branding/");r(xe)}catch{}if(wd())try{const xe=await J("/users/me/");t(xe),!xe.is_admin_user&&!xe.is_staff&&!xe.is_superuser&&y==="admin"&&N("home")}catch{hl(null),t(null),N("home")}const z=new URLSearchParams(window.location.search),q=z.get("verify_email");if(q)try{const xe=await J("/users/verify-email/",{method:"POST",body:JSON.stringify({token:q})});hl(xe.token),t(xe.user),x(xe.message||"✅ E-Mail-Adresse erfolgreich bestätigt!"),window.history.replaceState({},document.title,window.location.pathname)}catch(xe){x(`⚠️ E-Mail Bestätigung: ${xe.message}`)}const Ee=z.get("claim_token"),en=z.get("guest_name");Ee&&en&&(V(Ee),U(en),wd()||v(!0)),await K(),await W()}catch(z){console.error(z)}finally{w(!1)}},I=async z=>{try{const q=await J(`/users/signups/${z.id}/generate-claim-link/`,{method:"POST"}),Ee=`${window.location.origin}/?claim_token=${q.token}&guest_name=${encodeURIComponent(q.guest_name)}`;navigator.clipboard?(await navigator.clipboard.writeText(Ee),x(`✅ Einladungs-Link für ${q.guest_name} in Zwischenablage kopiert!`)):prompt(`Einladungs-Link für ${q.guest_name} kopieren:`,Ee)}catch(q){alert(q.message||"Fehler beim Erstellen des Links.")}},K=async()=>{try{const z=await J("/skills/");l(z.results||z)}catch{}},W=async()=>{try{const z=await J("/events/"),q=z.results||z;o(q),q.length>0&&!u?(c(q[0].id),ee(q[0].id)):u&&ee(u)}catch{}},ee=async z=>{try{const q=await J(`/events/${z}/matrix/`);g(q)}catch{}},Ae=z=>{c(z),ee(z),N("schedule")},gt=()=>{hl(null),t(null),N("home"),x("Erfolgreich abgemeldet."),u&&ee(u)},Dn=(z,q)=>{t(z),z&&!z.is_admin_user&&!z.is_staff&&!z.is_superuser&&y==="admin"&&N("home"),x(q||"Erfolgreich angemeldet!"),u&&ee(u)},F=async z=>{if(!e)C(z),m(!0);else try{const q=await J(`/shifts/${z.id}/signup/`,{method:"POST"});x(q.message||"Erfolgreich für Schicht eingetragen!"),u&&ee(u)}catch(q){x(`Fehler: ${q.message}`)}},be=async z=>{if(!_)return;const q=await J(`/shifts/${_.id}/signup/`,{method:"POST",body:JSON.stringify(z)});x(q.message||"Als Gast eingetragen!"),u&&ee(u)},_t=async z=>{try{const q=await J(`/shifts/${z.id}/signup/`,{method:"DELETE"});x(q.message||"Eintragung storniert."),u&&ee(u)}catch(q){x(`Fehler: ${q.message}`)}},rr=async z=>{if(!(!z||!z.id)&&window.confirm(`Möchtest du die Veranstaltung "${z.title}" und alle zugehörigen Schichten wirklich unwiderruflich löschen?`))try{await J(`/events/${z.id}/`,{method:"DELETE"}),x(`Veranstaltung "${z.title}" wurde erfolgreich gelöscht.`),u===z.id&&c(null),y==="event-editor"&&N("home"),W()}catch(q){x(`Fehler beim Löschen: ${q.message}`)}},[zn,yn]=A.useState(null),Nr=async z=>{let q=z.id;q?await J(`/events/${q}/`,{method:"PATCH",body:JSON.stringify({title:z.title,description:z.description,location:z.location,start_date:z.start_date,end_date:z.end_date,co_manager_ids:z.co_manager_ids||[]})}):q=(await J("/events/",{method:"POST",body:JSON.stringify({title:z.title,description:z.description,location:z.location,start_date:z.start_date,end_date:z.end_date,co_manager_ids:z.co_manager_ids||[]})})).id;for(let Ee of z.task_areas){if(!Ee.name)continue;let en=Ee.id;en?await J(`/task-areas/${en}/`,{method:"PATCH",body:JSON.stringify({name:Ee.name,description:Ee.description||""})}):en=(await J("/task-areas/",{method:"POST",body:JSON.stringify({event:q,name:Ee.name,description:Ee.description||""})})).id;for(let xe of Ee.shifts){const In=xe.date||z.start_date;xe.id?await J(`/shifts/${xe.id}/`,{method:"PATCH",body:JSON.stringify({title:xe.title,date:In,start_time:xe.start_time,end_time:xe.end_time,max_participants:xe.max_participants,required_skill_ids:xe.required_skill_ids||[]})}):await J("/shifts/",{method:"POST",body:JSON.stringify({task_area:en,title:xe.title,date:In,start_time:xe.start_time,end_time:xe.end_time,max_participants:xe.max_participants,required_skill_ids:xe.required_skill_ids||[]})})}}x(z.id?"Veranstaltung & Schichten aktualisiert!":"Veranstaltung erfolgreich erstellt!"),await W(),Ae(q)},nt=async(z,q)=>{const Ee=await J(`/templates/${z}/instantiate/`,{method:"POST",body:JSON.stringify(q)});x("Veranstaltung aus Vorlage erstellt!"),await W(),Ee.id&&Ae(Ee.id)},rt=()=>{u&&window.open(`/api/events/${u}/export_pdf/`,"_blank")},Ds=()=>{window.print()},zs=()=>{ke&&(ke.prompt(),ke.userChoice.then(z=>{z.outcome==="accepted"&&x("PWA Installation gestartet!"),ue(null)}))};return i.jsxs("div",{className:"min-h-screen bg-canvas text-main flex flex-col font-sans selection:bg-surface-hover transition-colors duration-200",children:[ae&&i.jsxs("div",{className:"fixed bottom-6 right-6 z-50 bg-emerald-600 text-white px-4 py-2.5 rounded-sm shadow-2xl font-mono text-xs flex items-center gap-2 border border-emerald-400 animate-in fade-in slide-in-from-bottom-3 duration-200",children:[i.jsx(Ln,{className:"w-4 h-4"}),i.jsx("span",{children:ae})]}),i.jsx(vy,{branding:n,user:e,activeTab:y,onChangeTab:N,themeMode:P,onChangeThemeMode:Y,onLogout:gt,onOpenAuth:()=>v(!0),onOpenCreateEvent:()=>{yn(null),N("event-editor")},onOpenTemplates:()=>N("templates"),onOpenProfile:()=>G(!0),onOpenAdmin:()=>N("admin"),pwaInstallPrompt:!!ke,onInstallPwa:zs}),i.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-6",children:d?i.jsx("div",{className:"hallmark-panel p-16 text-center text-xs text-muted font-mono border border-grid",children:"Lade Daten..."}):y==="home"?i.jsx(Hb,{events:a,user:e,onSelectEvent:Ae,onOpenCreateEvent:()=>{yn(null),N("event-editor")},onToggleEventActive:async z=>{try{await J(`/events/${z.id}/`,{method:"PATCH",body:JSON.stringify({is_active:z.is_active===!1})}),W()}catch(q){alert(q.message||"Aktion fehlgeschlagen.")}},onEditEvent:z=>{yn(z),N("event-editor")},onDeleteEvent:rr,branding:n}):y==="calendar"?i.jsx(Kb,{events:a,onSelectEvent:Ae,branding:n}):y==="admin"&&e&&(e.is_admin_user||e.is_staff||e.is_superuser)?i.jsx(Wb,{branding:n,onRefreshBranding:async()=>{const z=await J("/branding/");r(z)},onRefreshEvents:W,skills:s,onRefreshSkills:K}):y==="event-editor"?i.jsx(Gb,{eventToEdit:zn,skills:s,user:e,onBack:()=>N("schedule"),onSubmit:Nr,onDeleteEvent:rr}):y==="templates"?i.jsx(qb,{onBack:()=>N("schedule"),onInstantiateTemplate:nt,user:e,skills:s}):i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between gap-4 overflow-x-auto pb-2 no-scrollbar font-mono",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs font-bold text-muted uppercase tracking-wider whitespace-nowrap",children:"Ausgewähltes Event:"}),a.map(z=>{const q=u===z.id;return i.jsx("button",{onClick:()=>Ae(z.id),style:{backgroundColor:q?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0,borderColor:q?(n==null?void 0:n.primary_color)||"var(--brand-primary)":void 0},className:`px-3.5 py-1.5 rounded-sm text-xs font-bold transition whitespace-nowrap border ${q?"text-white shadow-sm":"bg-subtle text-muted border-grid hover:text-main"}`,children:z.title},z.id)})]}),e&&i.jsxs("button",{onClick:()=>{yn(null),N("event-editor")},className:"px-3.5 py-1.5 rounded-sm text-xs font-bold bg-subtle hover:bg-surface-hover text-main border border-grid transition flex items-center gap-1.5 shrink-0",children:[i.jsx(Zn,{className:"w-4 h-4"})," Neues Event"]})]}),i.jsx(xy,{event:f,user:e,onSignupClick:F,onCancelClick:_t,onEditEvent:z=>{yn(z),N("event-editor")},onDeleteEvent:rr,onRemoveUserFromShift:async(z,q)=>{try{const Ee=await J(`/shifts/${z.id}/signup/${q}/`,{method:"DELETE"});x(Ee.message||"Eintragung entfernt."),W(),u&&Ae(u)}catch(Ee){alert(Ee.message||"Entfernen der Person fehlgeschlagen.")}},onGenerateClaimLink:I,onExportPdf:rt,onPrintView:Ds})]})}),i.jsx("footer",{className:"border-t border-grid py-6 text-center text-xs text-muted font-mono no-print",children:i.jsxs("p",{children:[(n==null?void 0:n.app_name)||"Veranstaltungsschichtplaner"," • PWA Enabled • PostgreSQL & Docker Ready"]})}),R&&i.jsx(Bb,{onClose:()=>{v(!1),V(null),U(null)},onSuccess:Dn,claimToken:Te,prefilledGuestName:M}),h&&i.jsx(Fb,{shift:_,onClose:()=>m(!1),onSubmit:be})]})}ic.createRoot(document.getElementById("root")).render(i.jsx(Si.StrictMode,{children:i.jsx(Qb,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 78bc01f..e9f53a6 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -11,7 +11,7 @@ Schichtplaner — Veranstaltungsschichtpläne - + diff --git a/frontend/src/components/GuestSignupModal.jsx b/frontend/src/components/GuestSignupModal.jsx index 9ff67f6..26eef18 100644 --- a/frontend/src/components/GuestSignupModal.jsx +++ b/frontend/src/components/GuestSignupModal.jsx @@ -164,7 +164,7 @@ export default function GuestSignupModal({ shift, onClose, onSubmit }) {
{shift.signups.map((su) => { - const isOwnGuest = isGuest && su.is_guest && guestDisplayName && su.display_name?.trim().toLowerCase() === guestDisplayName.trim().toLowerCase(); + const isOwnGuest = isGuest && su.is_guest && (su.is_self || (guestDisplayName && su.display_name?.trim().toLowerCase() === guestDisplayName.trim().toLowerCase())); return (