1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-IinEbi41.js","assets/ui-vendor-Bh7_beny.js","assets/react-vendor-BoSAEcqU.js","assets/firebase-vendor-DblBUUbW.js","assets/fabric-vendor-T6PTpD9i.js","assets/index-DOlKsMzD.css"])))=>i.map(i=>d[i]); 2var e,t,a=Object.defineProperty,s=Object.defineProperties,r=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,o=(e,t,s)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,d=(e,t)=>{for(var a in t||(t={}))i.call(t,a)&&o(e,a,t[a]);if(n)for(var a of n(t))l.call(t,a)&&o(e,a,t[a]);return e},c=(e,t)=>s(e,r(t)),u=(e,t)=>{var a={};for(var s in e)i.call(e,s)&&t.indexOf(s)<0&&(a[s]=e[s]);if(null!=e&&n)for(var s of n(e))t.indexOf(s)<0&&l.call(e,s)&&(a[s]=e[s]);return a},m=(e,t,a)=>new Promise(((s,r)=>{var n=e=>{try{l(a.next(e))}catch(t){r(t)}},i=e=>{try{l(a.throw(e))}catch(t){r(t)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(n,i);l((a=a.apply(e,t)).next())}));import{j as p}from"./ui-vendor-Bh7_beny.js";import{g as x,r as h,d as g,R as b,b as v,c as f,u as j,e as y,h as N,i as _,N as w}from"./react-vendor-BoSAEcqU.js";import{P as k}from"./ProjectShell-dK8tRMZr.js";import{hn as C,ho as S,hp as z,hq as I,hr as P,hs as D,ht as B,u as T,cd as A,e2 as E,B as V,cG as M,aa as L,b as $,x as O,ad as F,bi as U,p as K,d as W,y as H,k as R,bf as q,cb as G,er as J,q as Y,M as Z,hu as X,hv as Q,aW as ee,e as te,n as ae,C as se,eg as re,eh as ne,e$ as ie,ei as le,cx as oe,Y as de,ej as ce,ek as ue,b9 as me,h as pe,f as xe,I as he,bg as ge,cy as be,aI as ve,aF as fe,hl as je,a as ye,cw as Ne,S as _e,hw as we,R as ke,o as Ce,j as Se,as as ze,bj as Ie,a4 as Pe,hx as De,aS as Be,F as Te,c4 as Ae,aN as Ee,Q as Ve,d9 as Me,hy as Le,G as $e,c as Oe,aK as Fe,a5 as Ue,aP as Ke,J as We,O as He,X as Re,av as qe,a7 as Ge,w as Je,aw as Ye,P as Ze,E as Xe,aR as Qe,bc as et,dS as tt,ay as at,hz as st,T as rt,dm as nt,aQ as it,e4 as lt,cF as ot,U as dt,ca as ct,A as ut,hA as mt,d2 as pt,K as xt,e6 as ht,hB as gt,d6 as bt}from"./index-IinEbi41.js";import{T as vt,i as ft,j as jt,k as yt,b as Nt,g as _t,q as wt,l as kt,w as Ct,u as St,t as zt,A as It,B as Pt,C as Dt,m as Bt,O as Tt,D as At}from"./firebase-vendor-DblBUUbW.js";import{B as Et}from"./briefcase-DFyO5hJ4.js";import{L as Vt}from"./landmark-BpLFD53k.js";import{H as Mt}from"./hash-DVQSc7FK.js";import{E as Lt}from"./earth-C2I8llHP.js";import{C as $t}from"./clock-BNoH4qBR.js";import{B as Ot}from"./banknote-CQZGITaN.js";import{C as Ft}from"./circle-BolqbE9a.js";import{s as Ut,a as Kt,S as Wt,v as Ht,u as Rt}from"./sortable.esm-zwnw_w4z.js";import{G as qt}from"./grip-vertical-YBUJQHY2.js";import{S as Gt}from"./Select-Cno2wtBb.js";import{A as Jt,R as Yt,C as Zt,M as Xt,V as Qt,H as ea,a as ta,b as aa,c as sa}from"./variable-LYMkUBl0.js";import{L as ra}from"./languages-CDv1dU5W.js";import{R as na}from"./RichTextEditor-DjpjmAai.js";import{o as ia,i as la}from"./productService-D_29DoHf.js";import"./assetIndex-CpVmIQag.js";import{S as oa}from"./shellSchemeExtras-CRYhP7C2.js";import{A as da}from"./assetCatalog-BHI-c1l7.js";import{d as ca,n as ua}from"./viewerSettings-Nb6nPqYf.js";import{s as ma}from"./floorplanFirestoreService-Ce8deQoF.js";import{I as pa}from"./ImageDropField-GwxBXFpg.js";import{I as xa}from"./ImagePreview-Dw3tARKW.js";import{g as ha,a as ga,d as ba,s as va,b as fa,S as ja}from"./startPageService-BuhhVQBg.js";import{S as ya}from"./send-DlR3fIA2.js";import{U as Na}from"./user-BSHBAeXR.js";import{B as _a}
2from"./building-2-D5X7dcSf.js";import{B as wa}from"./bell-ring-wpVI3MYs.js";import{C as ka}from"./rocket-Pzx9utRp.js";import{U as Ca,f as Sa}from"./AdminShell-ADtbTeyw.js";import{K as za}from"./key-round-DSUbxNd2.js";import{R as Ia}from"./rotate-ccw-CrcgHT5Z.js";import{W as Pa}from"./wand-sparkles-BIUGdFMl.js";import{L as Da}from"./lock-BMXVGeKY.js";import{u as Ba,a as Ta}from"./useInvoiceSettings-uuDdmb_B.js";import{a as Aa}from"./paymentLinkService-DZTFC-7v.js";import{P as Ea}from"./invoiceSettings.types-DdVMJpnf.js";import{S as Va}from"./save-YuIXh42j.js";import{getForms as Ma}from"./firestoreForms-DONSGZPr.js";import{u as La}from"./useAITranslation-SzjqFFH3.js";import{r as $a,n as Oa,a as Fa}from"./sidebarMenuConfig-DQIot0Wm.js";import{E as Ua}from"./eye-off-DDuGLUIA.js";import{E as Ka}from"./ErrorState-CNJ0q3LO.js";import{l as Wa,k as Ha,a as Ra,t as qa}from"./meetingPlannerService-CR27WnAs.js";import{C as Ga}from"./calendar-plus-BtjWqgDH.js";import{d as Ja}from"./defaultTemplate-BstQmqE6.js";import{g as Ya}from"./projectProductService-Bzl3JmHw.js";import{S as Za}from"./shield-check-DwauxGE8.js";import{c as Xa,g as Qa,n as es,v as ts,b as as}from"./advertisementHelpers-Crz96L7G.js";import{T as ss}from"./trending-up-A1GBCvuL.js";import{M as rs}from"./minimize-2-Bg2--4dJ.js";import{P as ns}from"./pen-DMQ5sI6K.js";import{C as is}from"./circle-check-big-DebaTnsY.js";import{d as ls,u as os,c as ds,a as cs,A as us,F as ms,L as ps,e as xs,D as hs,f as gs,h as bs,B as vs,i as fs,r as js}from"./BannerCanvas-BYgn7bop.js";import{S as ys}from"./square-pen-K1AJEm-6.js";import{P as Ns}from"./power-off-fYDlFITw.js";import{P as _s}from"./power-BgSDxpJn.js";import{A as ws}from"./arrow-left-BrJBGWSN.js";import"./useProjectShell-Bi5VYpE0.js";import"./resetAllFloorplanStores-BqByHRA7.js";import"./TrashIcon-BGnRVOUo.js";import"./PencilIcon-CV81eE09.js";import"./pin-DVUlEbsH.js";import"./fabric-vendor-T6PTpD9i.js";import"./assetPlacement-CqjdzxXi.js";import"./undoStore-Cob-GWEn.js";import"./ShellSchemeGenerator-jqI93Mix.js";import"./index.module-DjHmMTOo.js";import"./crop-BFimjs_K.js";import"./ruler-BmfflDlq.js";import"./message-square-B0WZRk8c.js";import"./scan-line-ByZHStzT.js";const ks=x(t?e:(t=1,e={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}));var Cs=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Ss(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},a=e.match(/<\/?([^\s]+?)[/\s>]/);if(a&&(t.name=a[1],(ks[a[1]]||"/"===e.charAt(e.length-2))&&(t.voidElement=!0),t.name.startsWith("!--"))){var s=e.indexOf("--\x3e");return{type:"comment",comment:-1!==s?e.slice(4,s):""}}for(var r=new RegExp(Cs),n=null;null!==(n=r.exec(e));)if(n[0].trim())if(n[1]){var i=n[1].trim(),l=[i,""];i.indexOf("=")>-1&&(l=i.split("=")),t.attrs[l[0]]=l[1],r.lastIndex--}else n[2]&&(t.attrs[n[2]]=n[3].trim().substring(1,n[3].length-1));return t}var zs=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Is=/^\s*$/,Ps=Object.create(null);var Ds=function(e,t){t||(t={}),t.components||(t.components=Ps);var a,s=[],r=[],n=-1,i=!1;if(0!==e.indexOf("<")){var l=e.indexOf("<");s.push({type:"text",content:-1===l?e:e.substring(0,l)})}return e.replace(zs,(function(l,o){if(i){if(l!=="</"+a.name+">")return;i=!1}var d,c="/"!==l.charAt(1),u=l.startsWith("\x3c!--"),m=o+l.length,p=e.charAt(m);if(u){var x=Ss(l);return n<0?(s.push(x),s):((d=r[n]).children.push(x),s)}if(c&&(n++,"tag"===(a=Ss(l)).type&&t.components[a.name]&&(a.type="component",i=!0),a.voidElement||i||!p||"<"===p||a.children.push({type:"text",content:e.slice(m,e.indexOf("<",m))}),0===n&&s.push(a),(d=r[n-1])&&d.children.push(a),r[n]=a),(!c||a.voidElement)&&(n>-1&&(a.voidElement||a.name===l.slice(2,-1))&&(n--,a=-1===n?s:r[n]),!i&&"<"!==p&&p)){d=-1===n?s:r[n].children;var h=e.indexOf("<",m),g=e.slice(m,-1===h?void 0:h);Is.test(g)&&(g=" "),(h>-1&&n+d.length>=0||" "!==g)&&d.push({type:"text",content:g})}})),s};const Bs=(e,t)=>{var a,s;if(!e)return!1;const r=null!=(s=null==(a=e.props)?void 0:a.children)?s:e.children;return t?r.length>0:!!r},Ts=e=>{var t,a,s;if(!e)return[];const r=null!=(a=null==(t=e.props)?void 0:t.children)?a:e.children;return(null==(s=e.props)?void 0:s.i18nIsDynamicList)?As(r):r},As=e=>Array.isArray(e)?e:[e],Es=(e,t,a,s)=>{var r;if(!e)return"";let n="";const i=As(e),l=(null==t?void 0:t.transSupportBasicHtmlNodes)&&null!=(r=t.transKeepBasicHtmlNodesFor)?r:[];
2return i.forEach(((e,r)=>{if(I(e))n+=`${e}`;else if(h.isValidElement(e)){const{props:i,type:o}=e,d=Object.keys(i).length,c=l.indexOf(o)>-1,u=i.children;if(!u&&c&&!d)return void(n+=`<${o}/>`);if(!u&&(!c||d)||i.i18nIsDynamicList)return void(n+=`<${r}></${r}>`);if(c&&1===d&&I(u))return void(n+=`<${o}>${u}</${o}>`);const m=Es(u,t,a,s);n+=`<${r}>${m}</${r}>`}else if(null!==e)if(D(e)){const t=e,{format:r}=t,i=u(t,["format"]),l=Object.keys(i);if(1===l.length){const e=r?`${l[0]}, ${r}`:l[0];return void(n+=`{{${e}}}`)}P(a,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:s,child:e})}else P(a,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:s,child:e});else P(a,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:s})})),n},Vs=(e,t,a,s,r,n)=>{if(""===t)return[];const i=s.transKeepBasicHtmlNodesFor||[],l=t&&new RegExp(i.map((e=>`<${e}`)).join("|")).test(t);if(!e&&!l&&!n)return[t];const o={},u=e=>{As(e).forEach((e=>{I(e)||(Bs(e)?u(Ts(e)):D(e)&&!h.isValidElement(e)&&Object.assign(o,e))}))};u(e);const m=Ds(`<0>${t}</0>`),p=d(d({},o),r),x=(e,t,a)=>{var s;const r=Ts(e),n=b(r,t.children,a);return(e=>Array.isArray(e)&&e.every(h.isValidElement))(r)&&0===n.length||(null==(s=e.props)?void 0:s.i18nIsDynamicList)?r:n},g=(e,t,a,s,r)=>{e.dummy?(e.children=t,a.push(h.cloneElement(e,{key:s},r?void 0:t))):a.push(...h.Children.map([e],(e=>{var a;const n=d({},e.props);return delete n.i18nIsDynamicList,h.createElement(e.type,c(d({},n),{key:s,ref:null!=(a=e.props.ref)?a:e.ref}),r?null:t)})))},b=(t,r,o)=>{const c=As(t);return As(r).reduce(((t,r,u)=>{var m,v;const f=(null==(v=null==(m=r.children)?void 0:m[0])?void 0:v.content)&&a.services.interpolator.interpolate(r.children[0].content,p,a.language);if("tag"===r.type){let n=c[parseInt(r.name,10)];1!==o.length||n||(n=o[0][r.name]),n||(n={});const m=0!==Object.keys(r.attrs).length?((e,t)=>{const a=d({},t);return a.props=Object.assign(e.props,t.props),a})({props:r.attrs},n):n,v=h.isValidElement(m),j=v&&Bs(r,!0)&&!r.voidElement,y=l&&D(m)&&m.dummy&&!v,N=D(e)&&Object.hasOwnProperty.call(e,r.name);if(I(m)){const e=a.services.interpolator.interpolate(m,p,a.language);t.push(e)}else if(Bs(m)||j){const e=x(m,r,o);g(m,e,t,u)}else if(y){const e=b(c,r.children,o);g(m,e,t,u)}else if(Number.isNaN(parseFloat(r.name)))if(N){const e=x(m,r,o);g(m,e,t,u,r.voidElement)}else if(s.transSupportBasicHtmlNodes&&i.indexOf(r.name)>-1)if(r.voidElement)t.push(h.createElement(r.name,{key:`${r.name}-${u}`}));else{const e=b(c,r.children,o);t.push(h.createElement(r.name,{key:`${r.name}-${u}`},e))}else if(r.voidElement)t.push(`<${r.name} />`);else{const e=b(c,r.children,o);t.push(`<${r.name}>${e}</${r.name}>`)}else if(D(m)&&!v){const e=r.children[0]?f:null;e&&t.push(e)}else g(m,f,t,u,1!==r.children.length||!f)}else if("text"===r.type){const e=s.transWrapTextNodes,i=n?s.unescape(a.services.interpolator.interpolate(r.content,p,a.language)):a.services.interpolator.interpolate(r.content,p,a.language);e?t.push(h.createElement(e,{key:`${r.name}-${u}`},i)):t.push(i)}return t}),[])},v=b([{dummy:!0,children:e||[]}],m,As(e||[]));return Ts(v[0])},Ms=(e,t,a)=>{const s=e.key||t,r=h.cloneElement(e,{key:s});if(!r.props||!r.props.children||a.indexOf(`${t}/>`)<0&&a.indexOf(`${t} />`)<0)return r;return h.createElement((function(){return h.createElement(h.Fragment,null,r)}),{key:s})},Ls=(e,t,a,s)=>e?Array.isArray(e)?((e,t)=>e.map(((e,a)=>Ms(e,a,t))))(e,t):D(e)?((e,t)=>{const a={};return Object.keys(e).forEach((s=>{Object.assign(a,{[s]:Ms(e[s],s,t)})})),a})(e,t):(C(a,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:s}),null):null;function $s(e){var t,a=e,{children:s,count:r,parent:n,i18nKey:i,context:l,tOptions:o={},values:m,defaults:p,components:x,ns:g,i18n:b,t:v,shouldUnescape:f}=a,j=u(a,["children","count","parent","i18nKey","context","tOptions","values","defaults","components","ns","i18n","t","shouldUnescape"]);const{i18n:y,defaultNS:N}=h.useContext(B)||{},_=b||y||S(),w=v||(null==_?void 0:_.t.bind(_));return function(e){var t,a,s,r,n,i,l=e,{children:o,count:m,parent:p,i18nKey:x,context:g,tOptions:b={}
2,values:v,defaults:f,components:j,ns:y,i18n:N,t:_,shouldUnescape:w}=l,k=u(l,["children","count","parent","i18nKey","context","tOptions","values","defaults","components","ns","i18n","t","shouldUnescape"]);const P=N||S();if(!P)return C(P,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:x}),o;const D=_||P.t.bind(P)||(e=>e),B=d(d({},z()),null==(t=P.options)?void 0:t.react);let T=y||D.ns||(null==(a=P.options)?void 0:a.defaultNS);T=I(T)?[T]:T||["translation"];const A=Es(o,B,P,x),E=f||A||B.transEmptyNodeValue||x,{hashTransKey:V}=B,M=x||(V?V(A||E):A||E);(null==(r=null==(s=P.options)?void 0:s.interpolation)?void 0:r.defaultVariables)&&(v=v&&Object.keys(v).length>0?d(d({},v),P.options.interpolation.defaultVariables):d({},P.options.interpolation.defaultVariables));const L=v||void 0!==m&&!(null==(i=null==(n=P.options)?void 0:n.interpolation)?void 0:i.alwaysFormat)||!o?b.interpolation:{interpolation:c(d({},b.interpolation),{prefix:"#$?",suffix:"?$#"})},$=c(d(d(c(d({},b),{context:g||b.context,count:m}),v),L),{defaultValue:E,ns:T}),O=M?D(M,$):E,F=Ls(j,O,P,x),U=Vs(F||o,O,P,B,$,w),K=null!=p?p:B.defaultTransParent;return K?h.createElement(K,k,U):U}(d({children:s,count:r,parent:n,i18nKey:i,context:l,tOptions:o,values:m,defaults:p,components:x,ns:g||(null==w?void 0:w.ns)||N||(null==(t=null==_?void 0:_.options)?void 0:t.defaultNS),i18n:_,t:v,shouldUnescape:f},j))}const Os={enabled:!1,bookingDeadline:null,maxAppointmentsPerVisitor:5,cancellationDeadlineHours:2,walkingBufferMinutes:10,walkingBufferMode:"warn",requireEmailVerification:!0,holdMinutes:15,privacyStatementUrl:"",consentTextVersion:"v1",locales:["nl","en","de"],defaultLocale:"nl",retentionMonths:6,eventDays:[],defaultSlotDurationMinutes:10,defaultBufferMinutes:5},Fs=["nl","en","de"],Us=[1,2,3,5,8,10],Ks=[0,1,2,4,12,24],Ws=[5,10,15,20,30],Hs=[3,6,12,24],Rs=()=>{const{t:e,i18n:t}=T("meetingPlanner"),{id:a}=g(),[s,r]=h.useState(Os),[n,i]=h.useState(!0),[l,o]=h.useState(!1),[u,x]=h.useState(!1),b=h.useCallback((()=>m(null,null,(function*(){if(!a)return o(!0),void i(!1);i(!0),o(!1);try{const e=yield Wa(a);r(c(d({},e.config),{eventDays:e.config.eventDays.length>0?e.config.eventDays:e.eventDays}))}catch(t){o(!0),A.error(e("admin.load_failed"))}finally{i(!1)}}))),[a,e]);h.useEffect((()=>{b()}),[b]);const v=e=>r((t=>d(d({},t),e))),f=h.useCallback((()=>m(null,null,(function*(){if(a){x(!0);try{const t=yield Ha(a,s);r(t),A.success(e("admin.saved"))}catch(t){A.error(e("admin.save_failed"))}finally{x(!1)}}}))),[a,s,e]);E(n||l?null:p.jsx(V,{type:"button",variant:"primary",size:"md",loading:u,onClick:()=>{f()},children:e("admin.save")}),[u,f,n,l]);const j=h.useMemo((()=>[...s.eventDays].sort(((e,t)=>e.date.localeCompare(t.date)))),[s.eventDays]),y=(e,t)=>v({eventDays:s.eventDays.map((a=>a.date===e?d(d({},a),t):a))});return n?p.jsx("p",{className:"py-12 text-center text-sm text-[var(--color-text-muted)]",children:e("admin.loading")}):l?p.jsx(Ka,{title:e("admin.config_load_error_title"),description:e("admin.config_load_error_description"),action:p.jsx(V,{variant:"secondary",onClick:()=>{b()},children:e("admin.retry")})}):p.jsxs("div",{className:"space-y-10 pb-8",children:[p.jsxs(qs,{title:e("admin.module_title"),description:e("admin.module_description"),children:[p.jsx(M,{checked:s.enabled,onChange:e=>v({enabled:e}),label:e("admin.enabled_label"),description:e("admin.enabled_description")}),s.enabled&&p.jsxs("p",{className:"mt-3 text-sm text-[var(--color-text-muted)]",children:[e("admin.menu_hint")," ",p.jsxs("a",{href:`/projects/${a}/setup/menu`,className:"inline-flex items-center gap-1 font-medium text-[var(--color-accent)] hover:underline",children:[e("admin.menu_link"),p.jsx(L,{className:"h-3.5 w-3.5","aria-hidden":!0})]})]})]}),p.jsxs(qs,{title:e("admin.days_title"),description:e("admin.days_description"),children:[0===j.length?p.jsx("p",{className:"rounded-[var(--radius-md)] border border-dashed border-[var(--color-border-strong)] px-4 py-6 text-center text-sm text-[var(--color-text-muted)]",children:e("admin.days_empty")}):p.jsx("ul",{className:"divide-y divide-[var(--color-border)] border-y border-[var(--color-border)]",children:j.map((a=>p.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[p.jsx("input",{type:"date",value:a.date,"aria-label":e("admin.day_date"),onChange:e=>y(a.date,{date:e.target.value}),className:"h-9 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-2.5 text-sm text-[var(--color-text)] focu
2s:border-[var(--color-accent)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-ring)]/30"}),p.jsx("span",{className:"min-w-0 flex-1 text-sm text-[var(--color-text-muted)]",children:Ra(a.date,t.language)}),p.jsx("input",{type:"time",value:a.opensAt,step:300,"aria-label":e("admin.day_opens"),onChange:e=>y(a.date,{opensAt:e.target.value}),className:"h-9 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-2.5 font-mono text-sm focus:border-[var(--color-accent)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-ring)]/30"}),p.jsx("span",{"aria-hidden":!0,className:"text-[var(--color-text-subtle)]",children:"â"}),p.jsx("input",{type:"time",value:a.closesAt,step:300,"aria-label":e("admin.day_closes"),onChange:e=>y(a.date,{closesAt:e.target.value}),className:"h-9 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-2.5 font-mono text-sm focus:border-[var(--color-accent)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-ring)]/30"}),p.jsx($,{variant:"ghost",size:"sm","aria-label":e("admin.day_remove"),icon:p.jsx(O,{className:"h-4 w-4"}),onClick:()=>{return e=a.date,v({eventDays:s.eventDays.filter((t=>t.date!==e))});var e}})]},a.date)))}),p.jsx(V,{variant:"ghost",size:"sm",icon:p.jsx(Ga,{className:"h-4 w-4"}),onClick:()=>{var e,t;const a=j[j.length-1],r=a?new Date(new Date(`${a.date}T12:00:00Z`).getTime()+864e5).toISOString().slice(0,10):(new Date).toISOString().slice(0,10);s.eventDays.some((e=>e.date===r))||v({eventDays:[...s.eventDays,{date:r,opensAt:null!=(e=null==a?void 0:a.opensAt)?e:"10:00",closesAt:null!=(t=null==a?void 0:a.closesAt)?t:"18:00"}]})},className:"mt-3",children:e("admin.day_add")})]}),p.jsx(qs,{title:e("admin.booking_title"),description:e("admin.booking_description"),children:p.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[p.jsx(F,{label:e("admin.deadline_label"),description:e("admin.deadline_hint"),type:"datetime-local",value:qa(s.bookingDeadline),onChange:e=>v({bookingDeadline:e.target.value?new Date(e.target.value).getTime():null})}),p.jsx(Gt,{label:e("admin.max_label"),hint:e("admin.max_hint"),value:s.maxAppointmentsPerVisitor,onChange:e=>v({maxAppointmentsPerVisitor:e}),options:Us.map((t=>({value:t,label:e("admin.max_option",{count:t})})))}),p.jsx(Gt,{label:e("admin.cancel_label"),hint:e("admin.cancel_hint"),value:s.cancellationDeadlineHours,onChange:e=>v({cancellationDeadlineHours:e}),options:Ks.map((t=>({value:t,label:0===t?e("admin.cancel_until_start"):e("admin.cancel_option",{count:t})})))}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(Gt,{label:e("admin.walking_mode_label"),hint:e("admin.walking_mode_hint"),value:s.walkingBufferMode,onChange:e=>v({walkingBufferMode:e}),options:[{value:"warn",label:e("admin.walking_mode_warn")},{value:"block",label:e("admin.walking_mode_block")},{value:"off",label:e("admin.walking_mode_off")}]}),"off"!==s.walkingBufferMode&&p.jsx(Gt,{label:e("admin.walking_minutes_label"),value:s.walkingBufferMinutes,onChange:e=>v({walkingBufferMinutes:e}),options:Ws.map((t=>({value:t,label:e("admin.minutes",{count:t})})))})]})]})}),p.jsx(qs,{title:e("admin.verification_title"),description:e("admin.verification_description"),children:p.jsx(M,{checked:s.requireEmailVerification,onChange:e=>v({requireEmailVerification:e}),label:e("admin.verification_label"),description:e("admin.verification_hint",{minutes:s.holdMinutes})})}),p.jsx(qs,{title:e("admin.defaults_title"),description:e("admin.defaults_description"),children:p.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[p.jsx(Gt,{label:e("admin.default_duration"),value:s.defaultSlotDurationMinutes,onChange:e=>v({defaultSlotDurationMinutes:e}),options:[5,10,15,20,30,45,60].map((t=>({value:t,label:e("admin.minutes",{count:t})})))}),p.jsx(Gt,{label:e("admin.default_buffer"),value:s.defaultBufferMinutes,onChange:e=>v({defaultBufferMinutes:e}),options:[0,5,10,15].map((t=>({value:t,label:0===t?e("admin.no_buffer"):e("admin.minutes",{count:t})})))})]})}),p.jsx(qs,{title:e("admin.privacy_title"),description:e("admin.privacy_description"),children:p.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[p.jsx(F,{label:e("admin.privacy_url"),type:"url",inputMode:"url",placeholder:"https://â¦/privacy",value:s.privacyStatementUrl,onChange:e=>v({privacyStatementUrl:e.target.value})}),p.jsx(Gt,{label:e("admin.retention_label"),hint:e("admin.retention_hint"),value:s.retentionMonths,onChange:e=>v({retentionMonths:e}),options:Hs.map((t=>({value:t,label:e("admin.retention_option",{count:t})})))}),p.jsx(F,{label:e("admin.consent_version"),description:e("admin.consent_version_hint"),value:s.consentTextVersion,onChange:e=>v({consentTextVersion:e.target.value})})]})}),p.jsxs(qs,{title:e("admin.languages_title"),description:e("admin.languages_description"),children:[p.jsx("div",{className:"flex flex-wrap gap-2",children:Fs.map((e=>{const t=s.locales.includes(e);return p.jsx("button",{type:"button",onClick:()=>(e=>{const t=s.locales.includes(e)?s.locales.filter((t=>t!==e)):[...Fs.filter((t=>s.locales.includes(t)||t===e))];0!==t.length&&v({locales:t,defaultLocale:t.includes(s.defaultLocale)?s.defaultLocale:t[0]})})(e),"aria-pressed":t,className:"rounded-[var(--radius-full)] border px-4 py-1.5 text-sm font-medium uppercase tracking-wide transition-colors "+(t?"border-[var(--color-accent)] bg-[var(--color-accent-soft)] text-[var(--color-accent)]":"border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)]"),children:e},e)}))}),p.jsx("div",{className:"mt-4 max-w-xs",children:p.jsx(Gt,{label:e("admin.default_locale"),value:s.defaultLocale,onChange:e=>v({defaultLocale:e}),options:s.locales.map((e=>({value:e,label:e.toUpperCase()})))})})]})]})},qs=({title:e,description:t,children:a})=>p.jsxs("section",{children:[p.jsxs("div",{className:"mb-4 max-w-prose",children:[p.jsx("h2",{className:"text-base font-semibold text-[var(--color-text)]",children:e}),p.jsx("p",{className:"mt-1 text-sm text-[var(--color-text-muted)]",children:t})]}),a]}),Gs=h.createContext(null);const Js=[{createdAt:vt.now(),fields:[{id:"field_1747720709590",label:"Bedrijfsprofiel",labelKey:"Profile_1856696499961.bedrijfsprofiel",labelI18n:{nl:"Bedrijfsprofiel",en:"Company Profile",de:"Unternehmensprofil"},order:0,placeholder:"Plaats hier je bedrijfsprofiel",placeholderI18n:{nl:"Plaats hier je bedrijfsprofiel",en:"Enter your company profile here",de:"Geben Sie hier Ihr Unternehmensprofil ein"},required:!1,type:"textarea",useRichText:!0,richTextEditor:"tinymce"},{id:"field_1747720731224",label:"Logo",labelKey:"Profile_1856696499961.logo",labelI18n:{nl:"Logo",en:"Logo",de:"Logo"},order:1,required:!0,ownCollectionName:"logo",storeInOwnCollection:!0,type:"image",imageLongestSide:"300",imageRatio:"1:1",imageWidth:"300"},{id:"field_1747720727229",label:"Email",labelKey:"Profile_1856696499961.email",labelI18n:{nl:"Email",en:"Email",de:"E-Mail"},order:2,required:!0,type:"email"},{id:"field_1747720901025",label:"Afbeelding",labelKey:"Profile_1856696499961.afbeelding",labelI18n:{nl:"Afbeelding",en:"Image",de:"Bild"},order:3,required:!0,type:"image",imageLongestSide:"1280",imageRatio:"3:2",description:"Afbeelding bij je bedrijfsprofiel"},{id:"field_1747721042332",label:"Link naar Website",labelKey:"Profile_1856696499961.link_naar_website",labelI18n:{nl:"Link naar Website",en:"Link to Website",de:"Link zur Website"},order:4,required:!1,type:"url"},{id:"field_1747721037823",label:"Link naar Facebook",labelKey:"Profile_1856696499961.link_naar_facebook",labelI18n:{nl:"Link naar Facebook",en:"Link to Facebook",de:"Link zu Facebook"},order:5,required:!1,type:"url"},{id:"field_1747721064485",label:"Link naar Instagram",labelKey:"Profile_1856696499961.link_naar_instagram",labelI18n:{nl:"Link naar Instagram",en:"Link to Instagram",de:"Link zu Instagram"},order:6,required:!1,type:"url"}],formId:"Profile_1856696499961",isActive:!0,title:"Bedrijfsomschrijving_test",validation:{customMessage:"Dit is een verplicht veld"}},{createdAt:vt.now(),fields:[{id:"field_1747029968206",label:"Badges",labelKey:"Badges_1745828215684.badges",labelI18n:{nl:"Badges",en:"Badges",de:"Ausweise"},type:"repeating",order:0,required:!0,ownCollectionName:"ExhibitorPasses",storeInOwnCollection:!0,maxRows:"15",columns:[{id:"col1747030038794",label:"Naam",type:"text",labelKey:"Badges_1745828215684.naam",labelI18n:{nl:"Naam",en:"Name",de:"Name"}},{id:"col1747030050360",label:"Bedrijfsnaam",type:"text",labelKey:"Badges_1745828215684.bedrijfsnaam",labelI18n:{nl:"Bedrijfsnaam",en:"Company Name",de:"Firmenname"}}],description:"Vul hier de namen in voor het beurspersoneel"}],formId:"Badges_1745828215684",isActive:!0,title:"Badges",validation:{customMessage:"Dit is een verplicht veld"}},{createdAt:vt.now(),fields:[{id:"field_1746696518003",label:"Titel",labelKey:"Newsitems_1746696499522.titel",labelI18n:{nl:"Titel",en:"Title",de:"Titel"},type:"text",order:0,required:!0,description:"Plaats hier een pakkende titel"},{id:"field_1746696572527",label:"Nieuwsbericht",labelKey:"Newsitems_1746696499522.nieuwsbericht",labelI18n:{nl:"Nieuwsbericht",en:"News Item",de:"Nachrichtenmeldung"},type:"textarea",order:1,required:!0,description:"Plaats hier je bericht.",useRichText:!0,richTextEditor:"tinymce"},{id:"field_1746696664831",label:"Featured image",labelKey:"Newsitems_1746696499522.featured_image",labelI18n:{nl:"Featured image",en:"Featured image",de:"Hauptbild"},type:"image",order:2,required:!0,imageLongestSide:"1200",imageRatio:"3:2",description:"Dit is de hoofd afbeelding en komt onder de titel en boven het bericht te staan."},{id:"field_1746696788739",label:"Website voor meer informatie",labelKey:"Newsitems_1746696499522.website_voor_meer_informatie",labelI18n:{nl:"Website voor meer informatie",en:"Website for more information",de:"Website für weitere Informationen"},type:"url",order:3,required:!1}],formId:"Newsitems_1746696499522",isActive:!0,title:"Nieuwsberichten",subject:"newsitems"}
2,{createdAt:vt.now(),entriesCollection:"public_d",fields:[{id:"field_1746696518003",label:"Titel",labelKey:"Newsitems_01.titel",labelI18n:{nl:"Titel",en:"Title",de:"Titel"},type:"text",order:0,required:!0,description:"Plaats hier een pakkende titel"},{id:"field_1746696572527",label:"Nieuwsbericht",labelKey:"Newsitems_01.nieuwsbericht",labelI18n:{nl:"Nieuwsbericht",en:"News Item",de:"Nachrichtenmeldung"},type:"textarea",order:1,required:!0,description:"Plaats hier je bericht.",useRichText:!0,richTextEditor:"tinymce"},{id:"field_1746696664831",label:"Featured image",labelKey:"Newsitems_01.featured_image",labelI18n:{nl:"Featured image",en:"Featured image",de:"Hauptbild"},type:"image",order:2,required:!0,imageLongestSide:"1200",imageRatio:"3:2",description:"Dit is de hoofd afbeelding en komt onder de titel en boven het bericht te staan."},{id:"imageCaption",label:"Bijschrift bij afbeelding",labelKey:"Newsitems_01.image_caption",labelI18n:{nl:"Bijschrift bij afbeelding",en:"Image Caption",de:"Bildbeschriftung"},type:"text",order:2.1,required:!1,description:"Optioneel bijschrift dat onder de afbeelding wordt getoond"},{id:"imageCopyright",label:"Copyright / Fotograaf",labelKey:"Newsitems_01.image_copyright",labelI18n:{nl:"Copyright / Fotograaf",en:"Copyright / Photographer",de:"Copyright / Fotograf"},type:"text",order:2.2,required:!1,description:"Naam van de fotograaf of bron (wordt weergegeven als © [jouw tekst])"},{id:"field_1746696788739",label:"Website voor meer informatie",labelKey:"Newsitems_01.website_voor_meer_informatie",labelI18n:{nl:"Website voor meer informatie",en:"Website for more information",de:"Website für weitere Informationen"},type:"url",required:!1,description:"Optionele link naar meer informatie"},{id:"field_1755584786864",label:"Categorieën",labelKey:"Newsitems_01.categories",labelI18n:{nl:"Categorieën",en:"Categories",de:"Kategorien",fr:"Catégories"},type:"category_checkboxes",required:!1,description:"Selecteer de categorieën waar dit nieuwsbericht relevant voor is"},{id:"field_tags",label:"Tags",labelKey:"Newsitems_01.tags",labelI18n:{nl:"Tags",en:"Tags",de:"Tags",fr:"Tags"},type:"tags",required:!1,description:"Voeg relevante tags toe voor dit nieuwsbericht (bijv. duiken, beurs2026, standenbouw)"},{id:"scheduledPublishAt",label:"Geplande publicatiedatum (optioneel)",labelKey:"Newsitems_01.scheduled_publish_at",labelI18n:{nl:"Geplande publicatiedatum (optioneel)",en:"Scheduled publication date (optional)",de:"Geplantes Veröffentlichungsd
2atum (optional)"},type:"datetime",required:!1,description:"Laat dit veld leeg om het artikel direct te publiceren. Kies een datum en tijd om het artikel later automatisch te publiceren.",placeholder:"Selecteer datum en tijd",placeholderI18n:{nl:"Selecteer datum en tijd",en:"Select date and time",de:"Datum und Uhrzeit auswählen"}}],formId:"Newsitems_01",isActive:!0,title:"Nieuwsberichten public",subject:"newsitems"},{createdAt:vt.now(),entriesCollection:"public_d",fields:[{id:"field_1750079703582",label:"Bedrijfsnaam",labelKey:"Profile_01.bedrijfsnaam",labelI18n:{nl:"Bedrijfsnaam",en:"Company Name",de:"Firmenname"},order:0,placeholder:"Vul hier je bedrijfsnaam in",placeholderI18n:{nl:"Vul hier je bedrijfsnaam in",en:"Enter your company name here",de:"Geben Sie hier Ihren Firmennamen ein"},required:!0,type:"text"},{id:"field_1747720709590",label:"Bedrijfsprofiel",labelKey:"Profile_01.bedrijfsprofiel",labelI18n:{nl:"Bedrijfsprofiel",en:"Company Profile",de:"Unternehmensprofil"},order:1,placeholder:"Plaats hier je bedrijfsprofiel",placeholderI18n:{nl:"Plaats hier je bedrijfsprofiel",en:"Enter your company profile here",de:"Geben Sie hier Ihr Unternehmensprofil ein"},required:!1,type:"textarea",useRichText:!0,richTextEditor:"tinymce"},{id:"field_1747720731224",label:"Logo",labelKey:"Profile_01.logo",labelI18n:{nl:"Logo",en:"Logo",de:"Logo"},order:2,required:!0,ownCollectionName:"logo",storeInOwnCollection:!0,type:"image",imageLongestSide:"300",imageRatio:"1:1",imageWidth:"300"},{id:"field_1747720727229",label:"Email",labelKey:"Profile_01.email",labelI18n:{nl:"Email",en:"Email",de:"E-Mail"},order:3,required:!0,type:"email"},{id:"field_1747720901025",label:"Afbeelding",labelKey:"Profile_01.afbeelding",labelI18n:{nl:"Afbeelding",en:"Image",de:"Bild"},order:4,required:!0,type:"image",imageLongestSide:"1280",imageRatio:"3:2",description:"Afbeelding bij je bedrijfsprofiel"},{id:"field_1747721042332",label:"Link naar Website",labelKey:"Profile_01.link_naar_website",labelI18n:{nl:"Link naar Website",en:"Link to Website",de:"Link zur Website"},order:5,required:!1,type:"url"},{id:"field_1747721037823",label:"Link naar Facebook",labelKey:"Profile_01.link_naar_facebook",labelI18n:{nl:"Link naar Facebook",en:"Link to Facebook",de:"Link zu Facebook"},order:6,required:!1,type:"url"},{id:"field_1747721064485",label:"Link naar Instagram",labelKey:"Profile_01.link_naar_instagram",labelI18n:{nl:"Link naar Instagram",en:"",de:""},order:7,required:!1,type:"url"},{id:"field_1755586301405",label:"Categorieën",labelKey:"Profile_01.categories",labelI18n:{nl:"Categorieën",en:"Categories",de:"Kategorien"},order:8,required:!1,type:"category_checkboxes",description:"Selecteer de categorieën die bij uw bedrijf passen"}],formId:"Profile_01",isActive:!0,title:"Bedrijfsomschrijving",validation:{customMessage:"Dit is een verplicht veld"}},{createdAt:vt.now(),entriesCollection:"public_d",fields:[{description:"Plaats hier een duidelijke titel",id:"field_1755590075656",label:"Titel van de presentatie",labelI18n:{de:"Titel der Präsentation",en:"Presentation Title",nl:"Titel van de presentatie"},labelKey:"form_1755590050533.text-veld",order:0,placeholderI18n:{de:"",en:"",nl:""},required:!0,type:"text"},{description:"Geef een duidelijke omschrijving.",id:"field_1755590125757",label:"Omschrijving van de presentatie",labelI18n:{de:"Beschreibung der Präsentation",en:"Presentation Description",nl:"Omschrijving van de presentatie"},labelKey:"form_1755590050533.wysiwyg-veld",order:1,placeholderI18n:{de:"",en:"",nl:""},required:!1,type:"wysiwyg"},{id:"field_1755590190663",label:"Naam van de spreker",labelI18n:{de:"Name des Sprechers",en:"Speaker Name",nl:"Naam van de spreker"},labelKey:"form_1755590050533.text-veld",order:2,placeholderI18n:{de:"",en:"",nl:""},required:!1,type:"text"},{id:"field_1755590231147",label:"Biografie van de spreker",labelI18n:{de:"Biografie des Sprechers",en:"Speaker Biography",nl:"Biografie van de spreker"},labelKey:"form_1755590050533.wysiwyg-veld",order:3,placeholderI18n:{de:"",en:"",nl:""},required:!1,type:"wysiwyg"},{id:"field_1755590413650",imageRatio:"1:1",label:"Foto van de spreker",labelI18n:{de:"Foto des Sprechers",en:"Speaker Photo",nl:"Foto van de spreker"},labelKey:"form_1755590050533.image-veld",order:4,placeholderI18n:{de:"",en:"",nl:""},required:!1,type:"image"},{id:"field_1755590460419",imageRatio:"3:2",label:"Foto bij het onderwerp",labelI18n:{de:"Foto zum Thema",en:"Topic Photo",nl:"Foto bij het onderwerp"},labelKey:"form_1755590050533.image-veld",order:5,placeholderI18n:{de:"",en:"",nl:""},required:!1,type:"image"}],formId:"form_1755590050533",isActive:!0,title:"Presentatie aanmelden"}
2,{createdAt:vt.now(),entriesCollection:"public_d",fields:[{id:"field_offer_title",label:"Titel van de aanbieding",labelKey:"FairOffers_01.offer_title",labelI18n:{nl:"Titel van de aanbieding",en:"Offer Title",de:"Titel des Angebots"},type:"text",order:0,required:!0,placeholder:"Bijv. 20% korting op alle duikuitrusting",placeholderI18n:{nl:"Bijv. 20% korting op alle duikuitrusting",en:"E.g. 20% discount on all diving equipment",de:"Z.B. 20% Rabatt auf alle Tauchausrüstung"},description:"Geef een pakkende titel voor je beursaanbieding"},{id:"field_offer_description",label:"Omschrijving van de aanbieding",labelKey:"FairOffers_01.offer_description",labelI18n:{nl:"Omschrijving van de aanbieding",en:"Offer Description",de:"Beschreibung des Angebots"},type:"textarea",order:1,required:!0,placeholder:"Beschrijf je aanbieding in detail...",placeholderI18n:{nl:"Beschrijf je aanbieding in detail...",en:"Describe your offer in detail...",de:"Beschreiben Sie Ihr Angebot im Detail..."},description:"Geef een duidelijke omschrijving van wat de aanbieding inhoudt",useRichText:!0,richTextEditor:"tinymce"},{id:"field_offer_image",label:"Afbeelding bij de aanbieding",labelKey:"FairOffers_01.offer_image",labelI18n:{nl:"Afbeelding bij de aanbieding",en:"Offer Image",de:"Angebotsbild"},type:"image",order:2,required:!1,imageLongestSide:"1200",imageRatio:"3:2",description:"Upload een afbeelding die je aanbieding illustreert (optioneel)"},{id:"field_offer_valid_until",label:"Aanbieding geldig tot",labelKey:"FairOffers_01.valid_until",labelI18n:{nl:"Aanbieding geldig tot",en:"Offer Valid Until",de:"Angebot gültig bis"},type:"date",order:3,required:!1,description:"Tot wanneer is deze aanbieding geldig? (optioneel)"},{id:"field_offer_conditions",label:"Voorwaarden",labelKey:"FairOffers_01.conditions",labelI18n:{nl:"Voorwaarden",en:"Terms & Conditions",de:"Bedingungen"},type:"textarea",order:4,required:!1,placeholder:"Bijv. Alleen geldig tijdens de beurs, max. 1 per klant",placeholderI18n:{nl:"Bijv. Alleen geldig tijdens de beurs, max. 1 per klant",en:"E.g. Only valid during the fair, max. 1 per customer",de:"Z.B. Nur während der Messe gültig, max. 1 pro Kunde"},description:"Eventuele voorwaarden of beperkingen (optioneel)"},{id:"field_offer_website",label:"Website voor meer informatie",labelKey:"FairOffers_01.website",labelI18n:{nl:"Website voor meer informatie",en:"Website for More Information",de:"Website für weitere Informationen"},type:"url",order:5,required:!1,description:"Link naar je website of productpagina (optioneel)"},{id:"field_offer_categories",label:"Categorieën",labelKey:"FairOffers_01.categories",labelI18n:{nl:"Categorieën",en:"Categories",de:"Kategorien"},type:"category_checkboxes",order:6,required:!1,description:"Selecteer de categorieën waar deze aanbieding bij past"}],formId:"FairOffers_01",isActive:!0,title:"Beursaanbiedingen",subject:"fairoffers"},{createdAt:vt.now(),fields:[{id:"field_guestlist_repeating",label:"Gastenlijst",labelKey:"Guestlist_01.gastenlijst",labelI18n:{nl:"Gastenlijst",en:"Guest List",de:"Gästeliste"},type:"repeating",order:0,required:!0,ownCollectionName:"GuestList",storeInOwnCollection:!0,maxRows:"50",columns:[{id:"col_guest_name",label:"Naam",type:"text",required:!0,labelKey:"Guestlist_01.naam",labelI18n:{nl:"Naam",en:"Name",de:"Name"}},{id:"col_guest_company",label:"Bedrijfsnaam",type:"text",required:!1,labelKey:"Guestlist_01.bedrijfsnaam",labelI18n:{nl:"Bedrijfsnaam",en:"Company Name",de:"Firmenname"}}],description:"Vul hier de namen in van uw genodigden"}],formId:"Guestlist_01",isActive:!0,title:"Gastenlijst",validation:{customMessage:"Dit is een verplicht veld"}},{createdAt:vt.now(),formId:"ShowcaseProducts_v1",isActive:!0,title:"Showcase-producten",entriesCollection:"public_d",layout:"two-column",fields:[{id:"name",type:"text",required:!0,order:0,region:"main",label:"Productnaam",labelKey:"ShowcaseProducts_v1.name",labelI18n:{nl:"Productnaam",en:"Product name",de:"Produktname"},placeholderI18n:{nl:"Bijv. Italiaanse pasta",en:"E.g. Italian pasta",de:"z.B. italienische Pasta"}},{id:"description",type:"textarea",useRichText:!0,richTextEditor:"tinymce",required:!1,order:1,region:"main",label:"Omschrijving",labelKey:"ShowcaseProducts_v1.description",labelI18n:{nl:"Omschrijving",en:"Description",de:"Beschreibung"}},{id:"website",type:"url",required:!1,order:2,region:"main",label:"Meer informatie (link)",labelKey:"ShowcaseProducts_v1.website",labelI18n:{nl:"Meer informatie (link)",en:"More information (link)",de:"Mehr Informationen (Link)"},placeholderI18n:{nl:"https://...",en:"https://...",de:"https://..."}},{id:"photo",type:"image",required:!0,order:3,region:"sidebar",label:"Productfoto",labelKey:"ShowcaseProducts_v1.photo",labelI18n:{nl:"Productfoto",en:"Product photo",de:"Produktfoto"},imageRatio:"1:1",imageLongestSide:"1200",imageWidth:"1200"},{id:"categoryId",type:"category_checkboxes",required:!0,order:4,region:"sidebar",label:"Categorie",labelKey:"ShowcaseProducts_v1.category",labelI18n:{nl:"Categorie",en:"Category",de:"Kategorie"}},{id:"extraProjectIds",type:"project_checkboxes",required:!1,order:5,region:"sidebar",label:"Ook tonen bij andere beurzen",labelKey:"ShowcaseProducts_v1.extra_projects",labelI18n:{nl:"Ook tonen bij andere beurzen",en:"Also show at other fairs",de:"Auch auf anderen Messen zeigen"}},{id:"tags",type:"tags",required:!1,order:6,region:"sidebar",label:"Trefwoorden",labelKey:"ShowcaseProducts_v1.tags",labelI18n:{nl:"Trefwoorden",en:"Tags",de:"Schlagwörter"}}]}],Ys=()=>{const{t:e}=T("projects"),t=U((e=>e.tenantId)),{id:a}=g(),{isAdmin:s}=K(),[r,n]=h.useState([]),[i,l]=h.useState(!1),[o,u]=h.useState([]);b.useEffect((()=>
2{if(!t||!a)return;m(null,null,(function*(){try{const e=Nt(W,`tenants/${t}/projects/${a}/forms`),s=(yield _t(e)).docs.map((e=>e.id));u(s)}catch(e){const s=[];for(const r of Js){const e=ft(W,`tenants/${t}/projects/${a}/forms/${r.formId}`);(yield jt(e)).exists()&&s.push(r.formId)}u(s)}}))}),[t,a]);const x=h.useCallback((()=>m(null,null,(function*(){l(!0);try{if(!t||!a)return A.error(e("setup.no_context")),void l(!1);const s=Js.filter((e=>r.includes(e.formId)));let i=0;const o=[];for(const e of s){const s=ft(W,`tenants/${t}/projects/${a}/forms/${e.formId}`);(yield jt(s)).exists()||(yield yt(s,c(d({},e),{tenantId:t,projectId:a,createdAt:e.createdAt||{seconds:Math.floor(Date.now()/1e3),nanoseconds:0}})),i++,o.push(e.formId))}A.success(e("setup.init_success",{count:i})),n([]),u((e=>[...e,...o]))}catch(s){A.error(e("setup.init_error"))}finally{l(!1)}}))),[t,a,r,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:0===r.length||i,onClick:x,children:e("setup.select_forms_button")}),[i,r.length,x,e]),s?t&&a?p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.step2_header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.step2_desc")}),p.jsx("form",{className:"mt-5 space-y-4",onSubmit:e=>e.preventDefault(),children:Js.map((t=>{const a=o.includes(t.formId),s=r.includes(t.formId);return p.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-5",children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx(H,{id:t.formId,checked:s,onChange:()=>{return e=t.formId,void n((t=>t.includes(e)?t.filter((t=>t!==e)):[...t,e]));var e},disabled:i||a,boxSize:"md"}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("label",{htmlFor:t.formId,className:["[font-size:var(--text-base)] font-semibold text-[var(--color-text)] select-none",a?"cursor-not-allowed opacity-60":"cursor-pointer"].join(" "),children:t.title}),a&&p.jsx(R,{variant:"success",size:"sm",dot:!0,children:e("setup.initialized_badge")})]}),p.jsx("div",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:t.fields.map((e=>e.label)).join(", ")}),t.subject&&p.jsxs("div",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-subtle)]",children:[e("setup.subject_label"),": ",t.subject]})]})]})},t.formId)}))})]}):p.jsx("div",{className:"text-[var(--color-text-muted)] [font-size:var(--text-sm)]",children:e("setup.no_context")}):p.jsx("div",{className:"text-[var(--color-text-muted)] [font-size:var(--text-sm)]",children:e("setup.no_admin")})},Zs={address:"",postalCode:"",city:"",country:"",websiteUrl:"",emailAddress:""};function Xs(e){return m(this,null,(function*(){var t,a;const{sourceProjectId:s,targetProjectId:r,executorUserId:n,executorUserName:i,newFloorplanName:l,targetStatus:o="concept"}=e;if(!s.trim())throw new Error("sourceProjectId is verplicht.");if(!r.trim())throw new Error("targetProjectId is verplicht.");if(!n.trim())throw new Error("executorUserId is verplicht.");if(s.trim()===r.trim())throw new Error("Bron- en doelproject moeten verschillend zijn.");const u=yield function(e){return m(this,null,(function*(){const t=Nt(W,"projects",e,"floorplans"),a=wt(t,Ct("status","==","base"),kt(1)),s=yield _t(a);if(s.empty)throw new Error(`Geen base floorplan gevonden voor project ${e}.`);const r=s.docs[0];return d({id:r.id},r.data())}))}(s),p=null!=(t=u.data)?t:{},x=Array.isArray(p.booths)?p.booths:[],{transformedBooths:h}=function(e){const t=new Map;return e.forEach((e=>{t.set(e.id,q())})),{transformedBooths:e.map((e=>{var a,s;const r=null!=(a=t.get(e.id))?a:q(),n=e.parentBoothId?t.get(e.parentBoothId):void 0;return c(d({},e),{id:r,objectType:e.objectType,boothNumber:e.boothNumber,status:G.Available,companyName:"",expoId:"",notes:"",userId:void 0,partners:[],categories:[],om
2schrijving:"",logoUrl:"",featuredImageUrl:"",companyDetails:d({},Zs),parentBoothId:n,relatedBoothIds:(null!=(s=e.relatedBoothIds)?s:[]).map((e=>t.get(e))).filter((e=>Boolean(e)))})})),boothIdMap:t}}(x),g=yield function(e){return m(this,null,(function*(){const t=ft(W,"projects",e),a=yield jt(t);if(!a.exists())return;const s=a.data();return"string"==typeof s.name?s.name:void 0}))}(r),b=c(d({},p),{booths:h,boothElements:[],categories:[]}),v={name:(null==l?void 0:l.trim())||`${u.name||"Base floorplan"} - copy`,description:u.description||"",projectId:r,projectName:g||u.projectName,createdBy:n,createdByName:i||void 0,tenantId:u.tenantId,tenantName:u.tenantName,data:b,isPublic:null!=(a=u.isPublic)&&a,status:o,versionString:u.versionString},f=yield ma(r,v);return{sourceFloorplanId:u.id,newFloorplanId:f,duplicatedBoothCount:h.length,targetProjectId:r}}))}function Qs(e){return e?"string"==typeof e?e.trim()?{nl:e}:{}:Object.entries(e).reduce(((e,[t,a])=>("string"==typeof a&&a.trim()&&(e[t]=a),e)),{}):{}}function er(e){return m(this,null,(function*(){const{sourceProjectId:t,targetProjectId:a}=e;if(!t.trim())throw new Error("sourceProjectId is verplicht.");if(!a.trim())throw new Error("targetProjectId is verplicht.");if(t.trim()===a.trim())throw new Error("Bron- en doelproject moeten verschillend zijn.");const s=ft(W,"projects",t),r=yield jt(s);if(!r.exists())throw new Error(`Bronproject ${t} bestaat niet.`);const n=r.data(),i=Array.isArray(n.participationInfo)?n.participationInfo:[],l=i.map(((e,t)=>({id:e.id||`${Date.now()}-${t}`,titel:Qs(e.titel),omschrijving:Qs(e.omschrijving),actief:Boolean(e.actief),volgorde:"number"==typeof e.volgorde?e.volgorde:t,allowedRoles:e.allowedRoles&&e.allowedRoles.length>0?e.allowedRoles.map((e=>"spreker"===e?"presenter":e)):["exhibitor","presenter","supplier"]})));const o={participationInfo:l,updatedAt:new Date},u=ft(W,"projects",a);yield St(u,o);const p=ft(W,"public_projects",a);return yield St(p,o).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;yield yt(p,c(d({},o),{projectId:a}))})))),{sourceProjectId:t,targetProjectId:a,copiedItemsCount:l.length}}))}function tr(e){return e?"string"==typeof e?e.trim()?{nl:e}:{}:Object.entries(e).reduce(((e,[t,a])=>("string"==typeof a&&a.trim()&&(e[t]=a),e)),{}):{}}function ar(e){return m(this,null,(function*(){const{sourceProjectId:t,targetProjectId:a}=e;if(!t.trim())throw new Error("sourceProjectId is verplicht.");if(!a.trim())throw new Error("targetProjectId is verplicht.");if(t.trim()===a.trim())throw new Error("Bron- en doelproject moeten verschillend zijn.");const s=ft(W,"projects",t),r=yield jt(s);if(!r.exists())throw new Error(`Bronproject ${t} bestaat niet.`);const n=r.data(),i=Array.isArray(n.termsConditions)?n.termsConditions:[],l=i.map(((e,t)=>({id:e.id||`${Date.now()}-${t}`,titel:tr(e.titel),omschrijving:tr(e.omschrijving),actief:Boolean(e.actief),volgorde:"number"==typeof e.volgorde?e.volgorde:t})));const o={termsConditions:l,updatedAt:new Date},u=ft(W,"projects",a);yield St(u,o);const p=ft(W,"public_projects",a);return yield St(p,o).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;yield yt(p,c(d({},o),{projectId:a}))})))),{sourceProjectId:t,targetProjectId:a,copiedItemsCount:l.length}}))}function sr(e){return e?"string"==typeof e?e.trim()?{nl:e}:{}:Object.entries(e).reduce(((e,[t,a])=>("string"==typeof a&&a.trim()&&(e[t]=a),e)),{}):{}}function rr(e){return m(this,null,(function*(){const{sourceProjectId:t,targetProjectId:a}=e;if(!t.trim())throw new Error("sourceProjectId is verplicht.");if(!a.trim())throw new Error("targetProjectId is verplicht.");if(t.trim()===a.trim())throw new Error("Bron- en doelproject moeten verschillend zijn.");const s=ft(W,"projects",t),r=yield jt(s);if(!r.exists())throw new Error(`Bronproject ${t} bestaat niet.`);const n=r.data(),i=Array.isArray(n.exhibitorCategories)?n.exhibitorCategories:[],l=i.map(((e,t)=>({id:e.id||`${Date.now()}-${t}`,name:sr(e.name),description:sr(e.description),color:e.color||"#3B82F6",createdAt:e.createdAt||new Date})));const o={exhibitorCategories:l,updatedAt:new Date},u=ft(W,"projects",a);yield St(u,o);const p=ft(W,"public_projects",a);return yield St(p,o).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;yield yt(p,c(d({},o),{projectId:a}))})))),{sourceProjectId:t,targetProjectId:a,copiedItemsCount:l.length}}))}const nr=()=>{const{currentUser:e}=K(),t=U((e=>e.tenantId)),{id:a}=g(),[s,r]=h.useState([]),[n,i]=h.useState(!1),[l,o]=h.useState(null),[u,x]=h.useState(""),[b,v]=h.useState(!1),[f,j]=h.useState(!1),[y,N]=h.useState(null),[_,w]=h.useState(null);h.useEffect((()=>{m(null,null,(function*(){const a=(null==e?void 0:e.isSuperAdmin)?null:t||(null==e?void 0:e.tenantId)||null;if(e)if(e.isSuperAdmin||a){i(!0),o(null);try{const e=yield Y(a);r(e)}catch(s){o("Projecten laden is mislukt. Probeer de pagina opnieuw te openen.")}finally{i(!1)}}else o("Geen tenant gevonden. Daardoor kunnen projecten niet worden geladen.")}))}),[e,t]);const k=h.useMemo((()=>s.filter((e=>e.id!==a))),[s,a]);h.useEffect((()=>{k.length?x((e=>e&&k.some((t=>
2t.id===e))?e:k[0].id)):x("")}),[k]);const C=h.useMemo((()=>k.find((e=>e.id===u))||null),[k,u]);return p.jsxs("div",{className:"rounded-lg bg-slate-50 border border-slate-200 p-4",children:[p.jsx("h3",{className:"text-base font-semibold text-slate-900 mb-2",children:"Organization Contact Details dupliceren"}),p.jsx("p",{className:"text-sm text-slate-600 mb-4",children:"Kopieer de Organization Contact Details van een ander project naar dit huidige project."}),n&&p.jsx("div",{className:"rounded bg-blue-50 text-blue-700 text-sm p-3 mb-3",children:"Projecten laden..."}),l&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3 mb-3",children:l}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"sourceContactProjectId",className:"block text-sm font-medium text-slate-900 mb-1",children:"Bronproject"}),p.jsxs("select",{id:"sourceContactProjectId",value:u,onChange:e=>x(e.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm",disabled:f||n||0===k.length,children:[p.jsx("option",{value:"",children:"Selecteer bronproject"}),k.map((e=>p.jsx("option",{value:e.id,children:e.name},e.id)))]}),0===k.length&&p.jsx("p",{className:"text-xs text-amber-700 mt-1",children:"Geen ander project beschikbaar als bronproject."})]}),p.jsxs("label",{className:"flex items-start gap-2 text-sm text-slate-700",children:[p.jsx("input",{type:"checkbox",checked:b,onChange:e=>v(e.target.checked),className:"mt-1 h-4 w-4 rounded border-gray-300",disabled:f}),p.jsx("span",{children:"Ik bevestig dat ik de huidige Organization Contact Details wil overschrijven met de gegevens uit het bronproject."})]}),y&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3",children:y}),_&&p.jsx("div",{className:"rounded bg-green-50 text-green-700 text-sm p-3",children:_}),p.jsx("div",{className:"flex justify-end",children:p.jsx(J,{onClick:()=>m(null,null,(function*(){if(N(null),w(null),a)if(u.trim())if(u.trim()!==a.trim())if(b){j(!0);try{const e=yield function(e){return m(this,null,(function*(){const{sourceProjectId:t,targetProjectId:a}=e;if(!t.trim())throw new Error("sourceProjectId is verplicht.");if(!a.trim())throw new Error("targetProjectId is verplicht.");if(t.trim()===a.trim())throw new Error("Bron- en doelproject moeten verschillend zijn.");const s=ft(W,"projects",t),r=yield jt(s);if(!r.exists())throw new Error(`Bronproject ${t} bestaat niet.`);const n=r.data(),i={Company_organiser:n.Company_organiser||"",addressStreet:n.addressStreet||"",addressPostalCode:n.addressPostalCode||"",addressCity:n.addressCity||"",addressCountry:n.addressCountry||"",phone:n.phone||"",email:n.email||"",website:n.website||"",openingHoursWeekdays:n.openingHoursWeekdays||"",openingHoursWeekend:n.openingHoursWeekend||"",kvk:n.kvk||"",bankName:n.bankName||"",bankAddress:n.bankAddress||"",accountHolder:n.accountHolder||"",iban:n.iban||"",swiftCode:n.swiftCode||"",updatedAt:new Date},l=ft(W,"projects",a);yield St(l,i);const o=ft(W,"public_projects",a);return yield St(o,i).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;yield yt(o,c(d({},i),{projectId:a}))})))),{sourceProjectId:t,targetProjectId:a,copiedFieldsCount:Object.keys(i).length}}))}({sourceProjectId:u.trim(),targetProjectId:a.trim()});w(`Organization Contact Details gedupliceerd (${e.copiedFieldsCount} velden) vanuit ${(null==C?void 0:C.name)||e.sourceProjectId}.`),v(!1)}catch(e){N(e instanceof Error?e.message:"Duplicatie van Organization Contact Details is mislukt. Probeer opnieuw.")}finally{j(!1)}}else N("Bevestig eerst dat je de contactgegevens wilt dupliceren.");else N("Bron- en doelproject moeten verschillend zijn.");else N("Selecteer een bronproject.");else N("Geen doelproject gevonden in je sessie.")})),disabled:f||n||!!l||!u||!a||!b,loading:f,children:"Dupliceer Organization Contact Details"})})]})]})},ir={companyName:"",addressStreet:"",addressPostalCode:"",addressCity:"",addressCountry:"",phone:"",email:"",website:"",openingHoursWeekdays:"",openingHoursWeekend:"",kvk:"",bankName:"",bankAddress:"",accountHolder:"",iban:"",swiftCode:""},lr=[{id:"organisation",icon:Et,tone:"info"},{id:"address",icon:Z,tone:"success"},{id:"contact",icon:X,tone:"accent"},{id:"finance",icon:Vt,tone:"warning"},{id:"advanced",icon:Q,tone:"neutral"}],or={info:{color:"var(--color-info)",soft:"var(--color-info-soft)"},success:{color:"var(--color-success)",soft:"var(--color-success-soft)"},accent:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},warning:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"},neutral:{color:"var(--color-text-muted)",soft:"var(--color-bg)"}},dr=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(ir),[r,n]=h.useState(!1),[i,l]=h.useState("organisation"),o=h.useRef({organisation:null,address:null,contact:null,finance:null,advanced:null});h.useEffect((()=>
2{if(!t)return;m(null,null,(function*(){try{const e=ft(W,`projects/${t}`),a=yield jt(e);if(a.exists()){const e=a.data(),t=c(d({},e),{companyName:e.Company_organiser||""});s((e=>d(d({},e),t)))}}catch(e){}}))}),[t]),h.useEffect((()=>{const e=new IntersectionObserver((e=>{const t=e.filter((e=>e.isIntersecting)).sort(((e,t)=>t.intersectionRatio-e.intersectionRatio));if(t[0]){const e=t[0].target.getAttribute("data-section");e&&l(e)}}),{rootMargin:"-20% 0px -60% 0px",threshold:[0,.25,.5,.75,1]});return lr.forEach((({id:t})=>{const a=o.current[t];a&&e.observe(a)})),()=>e.disconnect()}),[]);const x=h.useCallback((()=>m(null,null,(function*(){if(t){n(!0);try{const s=ft(W,`projects/${t}`),r=ft(W,`public_projects/${t}`),n=a,{companyName:i}=n,l=u(n,["companyName"]),o=c(d({},l),{Company_organiser:i,updatedAt:new Date});yield St(s,o),yield St(r,o).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;yield yt(r,c(d({},o),{projectId:t}))})))),A.success(e("setup.success_save"))}catch(s){A.error(e("setup.error_save"))}finally{n(!1)}}}))),[t,a,e]),b=h.useMemo((()=>{const e=e=>e.trim().length>0,t=[a.companyName,a.kvk],s=[a.addressStreet,a.addressPostalCode,a.addressCity,a.addressCountry],r=[a.phone,a.email,a.website,a.openingHoursWeekdays,a.openingHoursWeekend],n=[a.bankName,a.bankAddress,a.accountHolder,a.iban,a.swiftCode];return{organisation:{filled:t.filter(e).length,total:t.length},address:{filled:s.filter(e).length,total:s.length},contact:{filled:r.filter(e).length,total:r.length},finance:{filled:n.filter(e).length,total:n.length},advanced:{filled:0,total:0}}}),[a]),v=h.useMemo((()=>["organisation","address","contact","finance"].reduce(((e,t)=>({filled:e.filled+b[t].filled,total:e.total+b[t].total})),{filled:0,total:0})),[b]),f=v.filled>0;E(p.jsxs("div",{className:"flex items-center gap-3",children:[f&&p.jsxs("span",{className:"hidden items-center gap-1.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)] sm:flex tabular-nums",children:[p.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-[var(--color-warning)]"}),e("setup.contact_v2.unsaved_indicator")]}),p.jsx(V,{type:"button",variant:"primary",size:"md",loading:r,disabled:r,onClick:x,children:e("setup.save_button")})]}),[r,x,e,f]);const j=e=>t=>{const a=t.target.value;s((t=>c(d({},t),{[e]:a})))};return p.jsxs("div",{className:"space-y-6",children:[p.jsx(cr,{form:a,completion:v,labels:{preview:e("setup.contact_v2.preview.label"),subtitle:e("setup.contact_v2.preview.subtitle"),noCompany:e("setup.contact_v2.preview.no_company"),noAddress:e("setup.contact_v2.preview.no_address"),noContact:e("setup.contact_v2.preview.no_contact"),hoursTitle:e("setup.contact_v2.preview.hours_title"),financeLabel:e("setup.contact_v2.preview.finance_label"),completionLabel:e("setup.contact_v2.preview.completion_label",{filled:v.filled,total:v.total})}}),p.jsx(mr,{sections:lr,activeSection:i,onJump:e=>{var t;null==(t=o.current[e])||t.scrollIntoView({behavior:"smooth",block:"start"})},getLabel:t=>e(`setup.contact_v2.sections.${t}.title`),getCompletion:e=>b[e]}),p.jsx(pr,{id:"organisation",icon:Et,tone:"info",title:e("setup.contact_v2.sections.organisation.title"),subtitle:e("setup.contact_v2.sections.organisation.subtitle"),completion:b.organisation,completionLabel:e("setup.contact_v2.section_completion",{filled:b.organisation.filled,total:b.organisation.total}),sectionRef:e=>o.current.organisation=e,children:p.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-5",children:[p.jsx("div",{className:"lg:col-span-3",children:p.jsx(F,{label:e("setup.contact.company_name_label"),value:a.companyName,onChange:j("companyName"),placeholder:e("setup.contact.company_name_placeholder"),isValid:a.companyName.trim().length>0,required:!0})}),p.jsx("div",{className:"lg:col-span-2",children:p.jsx(F,{label:e("setup.contact.kvk_label"),value:a.kvk,onChange:j("kvk"),placeholder:e("setup.contact.kvk_placeholder"),leadingIcon:p.jsx(Mt,{size:16,strokeWidth:2.25}),description:e("setup.contact_v2.kvk_helper"),isValid:a.kvk.trim().length>0})})]})}),p.jsxs(pr,{id:"address",icon:Z,tone:"success",title:e("setup.contact_v2.sections.address.title"),subtitle:e("setup.contact_v2.sections.address.subtitle"),completion:b.address,completionLabel:e("setup.contact_v2.section_completion",{filled:b.address.filled,total:b.address.total}),sectionRef:e=>o.current.address=e,children:[p.jsx(F,{label:e("setup.address_street"),value:a.addressStreet,onChange:j("addressStreet"),placeholder:e("setup.placeholder_address_street")}),p.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[p.jsx(F,{label:e("setup.address_postal"),value:a.addressPostalCode,onChange:j("addressPostalCode"),placeholder:e("setup.placeholder_postal")}),p.jsx(F,{label:e("setup.address_city"),value:a.addressCity,onChange:j("addressCity"),placeholder:e("setup.placeholder_city"),containerClassName:"sm:col-span-2"})]}),p.jsx(F,{label:e("setup.address_country"),value:a.addressCountry,onChange:j("addressCountry"),placeholder:e("setup.placeholder_country"),leadingIcon:p.jsx(Lt,{size:16,strokeWidth:2.25})})]}),p.jsxs(pr,{id:"contact",icon:X,tone:"accent",title:e("setup.contact_v2.sections.contact.title"),subtitle:e("setup.contact_v2.sections.contact.subtitle"),completion:b.contact,completionLabel:e("setup.contact_v2.section_completion",{filled:b.contact.filled,total:b.contact.total}),sectionRef:e=>o.current.contact=e,children:[p.jsxs("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:[p.jsx(F,{label:e("setup.phone"),type:"tel",value:a.p
2hone,onChange:j("phone"),placeholder:e("setup.placeholder_phone"),leadingIcon:p.jsx(ee,{size:16,strokeWidth:2.25}),isValid:a.phone.trim().length>0}),p.jsx(F,{label:e("setup.email"),type:"email",value:a.email,onChange:j("email"),placeholder:e("setup.placeholder_email"),leadingIcon:p.jsx(te,{size:16,strokeWidth:2.25}),isValid:a.email.trim().length>0})]}),p.jsx(F,{label:e("setup.contact.website_label"),type:"url",value:a.website,onChange:j("website"),placeholder:e("setup.contact.website_placeholder"),leadingIcon:p.jsx(Lt,{size:16,strokeWidth:2.25}),isValid:a.website.trim().length>0}),p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsxs("p",{className:"mb-3 flex items-center gap-1.5 [font-size:var(--text-xs)] font-medium uppercase tracking-wide text-[var(--color-text-muted)]",children:[p.jsx($t,{size:12,strokeWidth:2.5}),e("setup.contact_v2.hours_card_title")]}),p.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[p.jsx(F,{label:e("setup.opening_week"),value:a.openingHoursWeekdays,onChange:j("openingHoursWeekdays"),placeholder:e("setup.placeholder_open_week")}),p.jsx(F,{label:e("setup.opening_weekend"),value:a.openingHoursWeekend,onChange:j("openingHoursWeekend"),placeholder:e("setup.placeholder_open_weekend")})]})]})]}),p.jsxs(pr,{id:"finance",icon:Vt,tone:"warning",title:e("setup.contact_v2.sections.finance.title"),subtitle:e("setup.contact_v2.sections.finance.subtitle"),completion:b.finance,completionLabel:e("setup.contact_v2.section_completion",{filled:b.finance.filled,total:b.finance.total}),sectionRef:e=>o.current.finance=e,children:[p.jsxs("div",{className:"flex items-start gap-2.5 rounded-[var(--radius-md)] border border-[var(--color-warning)]/20 bg-[var(--color-warning-soft)] px-3.5 py-2.5",children:[p.jsx(Ot,{size:16,strokeWidth:2,className:"mt-0.5 shrink-0 text-[var(--color-warning)]"}),p.jsx("p",{className:"[font-size:var(--text-xs)] text-[var(--color-text)]",children:e("setup.contact_v2.finance_helper")})]}),p.jsxs("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:[p.jsx(F,{label:e("setup.contact.bank_name_label"),value:a.bankName,onChange:j("bankName"),placeholder:e("setup.contact.bank_name_placeholder")}),p.jsx(F,{label:e("setup.contact.bank_address_label"),value:a.bankAddress,onChange:j("bankAddress"),placeholder:e("setup.contact.bank_address_placeholder")})]}),p.jsx(F,{label:e("setup.contact.account_holder_label"),value:a.accountHolder,onChange:j("accountHolder"),placeholder:e("setup.contact.account_holder_placeholder")}),p.jsxs("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-3",children:[p.jsx("div",{className:"sm:col-span-2",children:p.jsx(F,{label:e("setup.contact.iban_label"),value:a.iban,onChange:j("iban"),placeholder:e("setup.contact.iban_placeholder"),className:"font-mono tracking-wider",isValid:a.iban.trim().length>0})}),p.jsx(F,{label:e("setup.contact.swift_label"),value:a.swiftCode,onChange:j("swiftCode"),placeholder:e("setup.contact.swift_placeholder"),className:"font-mono tracking-wider"})]})]}),p.jsx(pr,{id:"advanced",icon:Q,tone:"neutral",title:e("setup.contact_v2.sections.advanced.title"),subtitle:e("setup.contact_v2.sections.advanced.subtitle"),completion:b.advanced,completionLabel:"",sectionRef:e=>o.current.advanced=e,children:p.jsx(nr,{})})]})};function cr({form:e,completion:t,labels:a}){const s=0===t.total?0:t.filled/t.total,r=Math.round(100*s),n=e.companyName.trim()||a.noCompany,i=!e.companyName.trim(),l=[];e.addressStreet.trim()&&l.push(e.addressStreet.trim());const o=[e.addressPostalCode.trim(),e.addressCity.trim()].filter(Boolean).join(" ");o&&l.push(o),e.addressCountry.trim()&&l.push(e.addressCountry.trim());const d=[e.phone.trim()&&{icon:ee,value:e.phone.trim()},e.email.trim()&&{icon:te,value:e.email.trim()},e.website.trim()&&{icon:Lt,value:e.website.trim()}].filter(Boolean),c=e.openingHoursWeekdays.trim()||e.openingHoursWeekend.trim(),u=e.iban.trim()||e.bankName.trim();return p.jsxs("section",{className:"relative overflow-hidden rounded-[var(--radius-lg)] border border-[var(--color-border)] shadow-[var(--shadow-sm)]",style:{background:"linear-gradient(135deg, var(--color-info-soft) 0%, var(--color-accent-soft) 60%, var(--color-warning-soft) 100%)"}
2,children:[p.jsx("div",{"aria-hidden":!0,className:"absolute inset-0",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 65%, transparent) 0%, color-mix(in srgb, var(--color-surface) 90%, transparent) 100%)"}}),p.jsxs("div",{className:"relative grid grid-cols-1 gap-6 p-6 sm:p-8 md:grid-cols-[1fr_auto]",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"mb-2 flex items-center gap-2 [font-size:var(--text-xs)] font-medium uppercase tracking-wider text-[var(--color-text-muted)]",children:[p.jsx(ae,{size:12,strokeWidth:2.5}),a.preview]}),p.jsx("h2",{className:"truncate [font-size:var(--text-2xl)] font-bold "+(i?"text-[var(--color-text-subtle)]":"text-[var(--color-text)]"),children:n}),p.jsxs("div",{className:"mt-3 flex items-start gap-2 [font-size:var(--text-sm)]",children:[p.jsx(Z,{size:14,strokeWidth:2,className:"mt-1 shrink-0 text-[var(--color-text-muted)]"}),l.length>0?p.jsx("address",{className:"not-italic text-[var(--color-text)]",children:l.map(((e,t)=>p.jsx("span",{className:"block leading-snug",children:e},t)))}):p.jsx("span",{className:"text-[var(--color-text-subtle)]",children:a.noAddress})]}),d.length>0?p.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:d.map((({icon:e,value:t},a)=>p.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-[var(--color-border)] bg-[var(--color-surface)] px-2.5 py-1 [font-size:var(--text-xs)] text-[var(--color-text)] shadow-[var(--shadow-xs)]",children:[p.jsx(e,{size:12,strokeWidth:2.25,className:"text-[var(--color-text-muted)]"}),p.jsx("span",{className:"max-w-[18ch] truncate font-mono",children:t})]},a)))}):p.jsx("p",{className:"mt-4 [font-size:var(--text-xs)] text-[var(--color-text-subtle)]",children:a.noContact}),(c||u)&&p.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[c&&p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx($t,{size:12,strokeWidth:2}),p.jsxs("span",{className:"font-medium",children:[a.hoursTitle,":"]})," ",e.openingHoursWeekdays.trim()||"â",e.openingHoursWeekend.trim()&&p.jsxs(p.Fragment,{children:[p.jsx("span",{"aria-hidden":!0,className:"px-1 text-[var(--color-text-subtle)]",children:"|"}),e.openingHoursWeekend.trim()]})]}),u&&p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx(Vt,{size:12,strokeWidth:2}),p.jsxs("span",{className:"font-medium",children:[a.financeLabel,":"]})," ",p.jsx("span",{className:"font-mono",children:e.iban.trim()||e.bankName.trim()})]})]}),p.jsx("p",{className:"mt-4 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:a.subtitle})]}),p.jsx("div",{className:"flex shrink-0 items-center justify-center md:justify-end",children:p.jsx(ur,{ratio:s,label:a.completionLabel,percent:r})})]})]})}function ur({ratio:e,label:t,percent:a}){const s=92,r=2*Math.PI*42,n=r*(1-e);return p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("div",{className:"relative",style:{width:s,height:s},children:[p.jsxs("svg",{width:s,height:s,className:"-rotate-90",children:[p.jsx("circle",{cx:46,cy:46,r:42,fill:"none",strokeWidth:8,stroke:"var(--color-border)"}),p.jsx("circle",{cx:46,cy:46,r:42,fill:"none",strokeWidth:8,stroke:"var(--color-accent)",strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:n,style:{transition:"stroke-dashoffset var(--duration-base) var(--ease-out)"}})]}),p.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:p.jsxs("span",{className:"[font-size:var(--text-lg)] font-bold text-[var(--color-text)] tabular-nums",children:[a,"%"]})})]}),p.jsxs("div",{className:"hidden flex-col text-left md:flex",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] font-semibold uppercase tracking-wider text-[var(--color-text-muted)]",children:t.split("â¢")[0]}),p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-subtle)] tabular-nums",children:t.includes("â¢")?t.split("â¢")[1].trim():""})]})]})}function mr({sections:e,activeSection:t,onJump:a,getLabel:s,getCompletion:r}){return p.jsx("nav",{"aria-label":"Setup-secties",className:"sticky top-2 z-10 -mx-1 flex gap-2 overflow-x-auto rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)]/95 p-1.5 shadow-[var(--shadow-xs)] backdrop-blur scrollbar-thin",children:e.map((({id:e,icon:n,tone:i})=>{const l=t===e,o=r(e),d=o.total>0&&o.filled===o.total,c=o.total>0,u=or[i];return p.jsxs("button",{type:"button",onClick:()=>a(e),"aria-current":l?"true":void 0,className:["group flex shrink-0 items-center gap-2 rounded-[var(--radius-md)] px-3 py-2 transition-colors duration-[var(--duration-fast)]",l?"bg-[var(--color-text)] text-[var(--color-surface)]":"bg-transparent text-[var(--color-text)] hover:bg-[var(--color-bg)]"].join(" "),children:[p.jsx("span",{"aria-hidden":!0,
2className:"flex h-6 w-6 items-center justify-center rounded-[var(--radius-sm)]",style:{background:l?"color-mix(in srgb, var(--color-surface) 18%, transparent)":u.soft,color:l?"var(--color-surface)":u.color},children:p.jsx(n,{size:14,strokeWidth:2.25})}),p.jsx("span",{className:"[font-size:var(--text-sm)] font-medium whitespace-nowrap",children:s(e)}),c&&(d?p.jsx(se,{size:14,strokeWidth:2.25,className:l?"text-[var(--color-surface)]":"text-[var(--color-success)]"}):p.jsxs("span",{className:"tabular-nums [font-size:var(--text-xs)] font-medium "+(l?"text-[var(--color-surface)]/80":"text-[var(--color-text-muted)]"),children:[o.filled,"/",o.total]}))]},e)}))})}function pr({id:e,icon:t,tone:a,title:s,subtitle:r,completion:n,completionLabel:i,children:l,sectionRef:o}){const d=or[a],c=n.total>0,u=c&&n.filled===n.total;return p.jsxs("section",{ref:o,"data-section":e,id:`section-${e}`,className:"relative overflow-hidden rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] shadow-[var(--shadow-xs)]",style:{scrollMarginTop:"5rem"},children:[p.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-1",style:{background:d.color}}),p.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-[var(--color-border)] px-6 py-5 pl-7",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("span",{"aria-hidden":!0,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[var(--radius-md)]",style:{background:d.soft,color:d.color},children:p.jsx(t,{size:20,strokeWidth:2})}),p.jsxs("div",{children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:s}),p.jsx("p",{className:"mt-0.5 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:r})]})]}),c&&p.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 rounded-full px-2.5 py-1 [font-size:var(--text-xs)] font-medium tabular-nums",style:{background:u?"var(--color-success-soft)":d.soft,color:u?"var(--color-success)":d.color},children:[u?p.jsx(se,{size:12,strokeWidth:2.5}):p.jsx(Ft,{size:12,strokeWidth:2.5}),p.jsx("span",{children:i})]})]}),p.jsx("div",{className:"space-y-5 px-6 py-6 pl-7",children:l})]})}const xr={primaryColor:"#3B82F6",secondaryColor:"#10B981"},hr=/^#[0-9A-F]{6}$/i,gr=[{name:"Blue",primary:"#3B82F6",secondary:"#10B981"},{name:"Purple",primary:"#8B5CF6",secondary:"#EC4899"},{name:"Red",primary:"#EF4444",secondary:"#F59E0B"},{name:"Green",primary:"#10B981",secondary:"#3B82F6"},{name:"Orange",primary:"#F97316",secondary:"#8B5CF6"},{name:"Teal",primary:"#14B8A6",secondary:"#06B6D4"},{name:"Indigo",primary:"#6366F1",secondary:"#A855F7"},{name:"Pink",primary:"#EC4899",secondary:"#F43F5E"}],br=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(xr),[r,n]=h.useState(!1),[i,l]=h.useState(null),[o,u]=
2h.useState(null),[x,b]=h.useState({});h.useEffect((()=>{if(!t)return;m(null,null,(function*(){try{const e=ft(W,`projects/${t}`),a=yield jt(e);if(a.exists()){const e=a.data();s((t=>c(d({},t),{primaryColor:e.primaryColor||xr.primaryColor,secondaryColor:e.secondaryColor||xr.secondaryColor})))}}catch(e){}}))}),[t]);const v=e=>hr.test(e),f=e=>{const{name:t,value:a}=e.target;s((e=>c(d({},e),{[t]:a}))),x[t]&&b((e=>c(d({},e),{[t]:void 0})))};return p.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-200 p-6",children:[p.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:e("setup.step4_header","Visuele Instellingen")}),p.jsx("p",{className:"text-sm text-gray-600 mb-6",children:e("setup.step4_desc","Configureer de kleuren voor je project")}),p.jsxs("div",{className:"space-y-8",children:[p.jsxs("div",{children:[p.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-3",children:["ð¨ ",e("setup.visuals.presets_title","Snelle Kleurenschema's")]}),p.jsx("p",{className:"text-sm text-gray-600 mb-4",children:e("setup.visuals.presets_desc","Kies een vooraf ingesteld kleurenschema of pas de kleuren handmatig aan")}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:gr.map((e=>p.jsxs("button",{type:"button",onClick:()=>(e=>{s({primaryColor:e.primary,secondaryColor:e.secondary}),b({})})(e),className:"group relative flex flex-col items-center p-3 rounded-xl border-2 border-gray-200 hover:border-blue-400 transition-all duration-200 hover:shadow-md",style:{WebkitTapHighlightColor:"transparent"},children:[p.jsxs("div",{className:"flex gap-2 mb-2",children:[p.jsx("div",{className:"w-8 h-8 rounded-lg shadow-sm",style:{backgroundColor:e.primary}}),p.jsx("div",{className:"w-8 h-8 rounded-lg shadow-sm",style:{backgroundColor:e.secondary}})]}),p.jsx("span",{className:"text-xs font-medium text-gray-700 group-hover:text-blue-600",children:e.name}),a.primaryColor===e.primary&&a.secondaryColor===e.secondary&&p.jsx("div",{className:"absolute -top-1 -right-1 bg-blue-600 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs",children:"â"})]},e.name)))})]}),p.jsxs("div",{className:"border-t pt-6",children:[p.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4",children:["ð¯ ",e("setup.visuals.custom_title","Aangepaste Kleuren")]}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[p.jsxs("div",{className:"space-y-3",children:[p.jsx("label",{htmlFor:"primaryColor",className:"block text-sm font-semibold text-gray-900",children:e("setup.visuals.primary_color","Primaire Kleur")}),p.jsx("p",{className:"text-xs text-gray-500",children:e("setup.visuals.primary_color_desc","Gebruikt voor headers, knoppen en accenten")}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx("div",{className:"relative",children:p.jsx("input",{type:"color",value:a.primaryColor,onChange:e=>{s((t=>c(d({},t),{primaryColor:e.target.value}))),b((e=>c(d({},e),{primaryColor:void 0})))},className:"w-16 h-16 rounded-xl cursor-pointer border-2 border-gray-300 hover:border-blue-400 transition-colors",style:{WebkitTapHighlightColor:"transparent"}})}),p.jsxs("div",{className:"flex-1",children:[p.jsx("input",{id:"primaryColor",name:"primaryColor",type:"text",value:a.primaryColor,onChange:f,placeholder:"#3B82F6",className:"w-full border-2 rounded-xl px-4 py-3 text-sm font-mono uppercase transition-colors "+(x.primaryColor?"border-red-500 bg-red-50":"border-gray-300 hover:border-blue-400 focus:border-blue-500 focus:ring-2 focus:ring-blue-200")}),x.primaryColor&&p.jsxs("p",{className:"text-red-500 text-xs mt-1 flex items-center gap-1",children:[p.jsx("span",{children:"â ï¸"})," ",x.primaryColor]})]})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("label",{htmlFor:"secondaryColor",className:"block text-sm font-semibold text-gray-900",children:e("setup.visuals.secondary_color","Secundaire Kleur")}),p.jsx("p",{className:"text-xs text-gray-500",children:e("setup.visuals.secondary_color_desc","Gebruikt voor secundaire elementen en highlights")}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx("div",{className:"relative",children:p.jsx("input",{type:"color",value:a.secondaryColor,onChange:e=>{s((t=>c(d({},t),{secondaryColor:e.target.value}))),b((e=>c(d({},e),{secondaryColor:void 0})))},className:"w-16 h-16 rounded-xl cursor-pointer border-2 border-gray-300 hover:border-blue-400 transition-colors",style:{WebkitTapHighlightColor:"transparent"}})}),p.jsxs("div",{className:"flex-1",children:[p.jsx("input",{id:"secondaryColor",name:"secondaryColor",type:"text",value:a.secondaryColor,onChange:f,placeholder:"#10B981",className:"w-full border-2 rounded-xl px-4 py-3 text-sm font-mono uppercase transition-colors "+(x.secondaryColor?"border-red-500 bg-red-50":"border-gray-300 hover:border-blue-400 focus:border-blue-500 focus:ring-2 focus:ring-blue-200")}),x.secondaryColor&&p.jsxs("p",{className:"text-red-500 text-xs mt-1 flex items-center gap-1",children:[p.jsx("span",{children:"â ï¸"})," ",x.secondaryColor]})]})]})]})]})]}),p.jsxs("div",{className:"border-t pt-6",children:[p.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4",children:["ðï¸ ",e("setup.visual
2s.preview","Live Voorbeeld")]}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-3",children:[p.jsx("div",{className:"h-32 rounded-2xl shadow-lg flex items-center justify-center transition-all duration-300",style:{backgroundColor:v(a.primaryColor)?a.primaryColor:"#FFFFFF"},children:p.jsxs("div",{className:"text-center",children:[p.jsx("p",{className:"text-white font-bold text-lg drop-shadow-md",children:e("setup.visuals.primary","Primair")}),p.jsx("p",{className:"text-white/90 text-sm font-mono drop-shadow",children:a.primaryColor.toUpperCase()})]})}),p.jsxs("div",{className:"flex items-center justify-between px-2",children:[p.jsx("span",{className:"text-xs font-medium text-gray-600",children:e("setup.visuals.primary_usage","Headers & Knoppen")}),p.jsxs("button",{type:"button",onClick:()=>navigator.clipboard.writeText(a.primaryColor),className:"text-xs text-blue-600 hover:text-blue-700 font-medium",children:["ð ",e("setup.visuals.copy","Kopieer")]})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("div",{className:"h-32 rounded-2xl shadow-lg flex items-center justify-center transition-all duration-300",style:{backgroundColor:v(a.secondaryColor)?a.secondaryColor:"#FFFFFF"},children:p.jsxs("div",{className:"text-center",children:[p.jsx("p",{className:"text-white font-bold text-lg drop-shadow-md",children:e("setup.visuals.secondary","Secundair")}),p.jsx("p",{className:"text-white/90 text-sm font-mono drop-shadow",children:a.secondaryColor.toUpperCase()})]})}),p.jsxs("div",{className:"flex items-center justify-between px-2",children:[p.jsx("span",{className:"text-xs font-medium text-gray-600",children:e("setup.visuals.secondary_usage","Accenten & Highlights")}),p.jsxs("button",{type:"button",onClick:()=>navigator.clipboard.writeText(a.secondaryColor),className:"text-xs text-blue-600 hover:text-blue-700 font-medium",children:["ð ",e("setup.visuals.copy","Kopieer")]})]})]})]}),p.jsxs("div",{className:"mt-6 p-6 rounded-2xl border-2 border-gray-200 bg-gradient-to-br from-gray-50 to-white",children:[p.jsx("p",{className:"text-xs font-medium text-gray-500 mb-3 uppercase tracking-wide",children:e("setup.visuals.combined_preview","Gecombineerd Voorbeeld")}),p.jsxs("div",{className:"flex flex-wrap gap-3",children:[p.jsx("button",{type:"button",className:"px-6 py-3 rounded-xl font-semibold text-white shadow-md transition-transform hover:scale-105",style:{backgroundColor:v(a.primaryColor)?a.primaryColor:"#3B82F6",WebkitTapHighlightColor:"transparent"},children:e("setup.visuals.primary_button","Primaire Knop")}),p.jsx("button",{type:"button",className:"px-6 py-3 rounded-xl font-semibold text-white shadow-md transition-transform hover:scale-105",style:{backgroundColor:v(a.secondaryColor)?a.secondaryColor:"#10B981",WebkitTapHighlightColor:"transparent"},children:e("setup.visuals.secondary_button","Secundaire Knop")}),p.jsx("span",{className:"px-4 py-2 rounded-full text-sm font-medium text-white",style:{backgroundColor:v(a.primaryColor)?a.primaryColor:"#3B82F6"},children:e("setup.visuals.badge_example","Badge")})]})]})]}),i&&p.jsxs("div",{className:"bg-red-50 border-2 border-red-200 rounded-xl p-4 flex items-start gap-3",children:[p.jsx("span",{className:"text-red-600 text-xl",children:"â"}),p.jsxs("div",{className:"flex-1",children:[p.jsx("p",{className:"text-sm font-medium text-red-900",children:e("setup.visuals.error_title","Fout bij opslaan")}),p.jsx("p",{className:"text-sm text-red-700 mt-1",children:i})]})]}),o&&p.jsxs("div",{className:"bg-green-50 border-2 border-green-200 rounded-xl p-4 flex items-start gap-3",children:[p.jsx("span",{className:"text-green-600 text-xl",children:"â
"}),p.jsxs("div",{className:"flex-1",children:[p.jsx("p",{className:"text-sm font-medium text-green-900",children:e("setup.visuals.success_title","Succesvol opgeslagen")}),p.jsx("p",{className:"text-sm text-green-700 mt-1",children:o})]})]}),p.jsx("div",{className:"flex justify-end pt-4 border-t",children:p.jsx(J,{type:"button",variant:"primary",size:"lg",onClick:()=>m(null,null,(function*(){if(t){if((()=>{const t={};let s=!0;
2return v(a.primaryColor)||(t.primaryColor=e("setup.visuals.invalid_hex_format"),s=!1),v(a.secondaryColor)||(t.secondaryColor=e("setup.visuals.invalid_hex_format"),s=!1),b(t),s})()){n(!0),l(null),u(null);try{const s=ft(W,`projects/${t}`),r=ft(W,`public_projects/${t}`);yield St(s,c(d({},a),{updatedAt:new Date})),yield St(r,c(d({},a),{updatedAt:new Date})).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;yield yt(r,c(d({},a),{projectId:t,updatedAt:new Date}))})))),u(e("setup.success_save"))}catch(s){l(e("setup.error_save"))}finally{n(!1)}}}else l(e("setup.no_project_id"))})),loading:r,disabled:r,children:r?"ð¾ "+e("setup.buttons.saving","Opslaan..."):"ð¾ "+e("setup.save_button","Opslaan")})})]})]})},vr=["aanmelden","news","exhibitors","products","program","my-program","floorplan","floorplan-3d","afspraak","contact"],fr=new Set(["news","exhibitors","program","floorplan","floorplan-3d","contact"]),jr={floorplan:"floorplan",news:"news",exhibitors:"exhibitors",contact:"contact",program:"program"},yr=vr.reduce(((e,t)=>c(d({},e),{[t]:!1})),{}),Nr={maintenance:!1,maintenanceTitle:"",maintenanceMessage:"",maintenanceStart:"",maintenanceEnd:"",menuItems:vr.map((e=>({key:e,visible:"contact"===e}))),restricted:yr},_r=({item:e,onVisibleChange:t,onRestrictedChange:a,restricted:s,disabled:r,visibleLabel:n,loginLabel:i,title:l,description:o,dragLabel:u})=>{const{attributes:m,listeners:x,setNodeRef:h,transform:g,transition:b,isDragging:v}=Rt({id:e.key,disabled:r}),f={transform:me.Transform.toString(g),transition:b,zIndex:v?10:void 0,boxShadow:v?"var(--shadow-md)":void 0,opacity:v?.96:1},j=fr.has(e.key);return p.jsxs("div",{ref:h,style:f,className:"flex flex-col gap-3 rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 sm:flex-row sm:items-center sm:justify-between",children:[p.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[p.jsx("button",c(d(d({type:"button"},m),x),{"aria-label":u,disabled:r,className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[var(--radius-sm)] text-[var(--color-text-subtle)] transition-colors hover:bg-[var(--color-surface)] hover:text-[var(--color-text)] disabled:cursor-not-allowed disabled:opacity-50",style:{cursor:r?"not-allowed":"grab",touchAction:"none"},children:p.jsx(qt,{className:"h-4 w-4"})})),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("h4",{className:"font-medium text-[var(--color-text)]",children:l}),p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:o})]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-4 sm:shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:n}),p.jsx(M,{id:`menu-${e.key}-visible`,name:`menu-${e.key}-visible`,checked:e.visible,onChange:a=>t(e.key,a),disabled:r})]}),j&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:i}),p.jsx(M,{id:`menu-${e.key}-auth`,name:`menu-${e.key}-auth`,checked:s,onChange:t=>a(e.key,t),disabled:r})]})]})]})},wr=()=>{var e,t;const{t:a}=T("projects"),{id:s}=g(),{isAdmin:r}=K(),[n,i]=h.useState(Nr),[l,o]=h.useState(!1),[u,x]=h.useState(null),b=re(ne(le,{activationConstraint:{distance:4}}),ne(ie,{coordinateGetter:Ut}));h.useEffect((()=>{if(!s)return;m(null,null,(function*(){var e,t,a,r;try{const n=ft(W,`projects/${s}`),l=yield jt(n);if(!l.exists())return;const o=l.data(),d=e=>{if(!e&&0!==e)return"";let t=null;if("number"==typeof e)t=e;else if("object"==typeof e&&null!==e){const a=e;"function"==typeof a.toMillis?t=a.toMillis():"number"==typeof a.seconds&&(t=1e3*a.seconds)}if(null===t){const a=new Date(e);t=isNaN(a.getTime())?null:a.getTime()}return null===t?"":new Date(t).toISOString()},c=null!=(e=o.enabledModules)?e:{},u=null!=(t=o.restrictedPages)?t:{},m={aanmelden:!0===(null==(a=o.applicationFormConfig)?void 0:a.menuVisible),news:!0===c.news,exhibitors:!0===c.exhibitors,products:!1,program:!0===c.program,"my-program":!0===c.program||!0===c.exhibitors||!0===c.floorplan,floorplan:!0===c.floorplan,"floorplan-3d":!1,afspraak:!1,contact:!1!==c.contact},p=Array.isArray(o.menuItems)?o.menuItems:[],x=new Set,h=[];for(const e of p){if(!e||"object"!=typeof e)continue;const t=e.key;vr.includes(t)&&!x.has(t)&&(x.add(t),h.push({key:t,visible:!1!==e.visible}))}for(const e of vr)x.has(e)||h.push({key:e,visible:m[e]});const g={aanmelden:!1,news:!0===u.news,exhibitors:!0===u.exhibitors,products:!1,program:!0===u.program,"my-program":!1,floorplan:!0===u.floorplan,"floorplan-3d":!0===(null==(r=o.restrictedPages)?void 0:r["floorplan-3d"]),afspraak:!1,contact:!0===u.contact};i({maintenance:"boolean"==typeof o.maintenance?o.maintenance:Nr.maintenance,maintenanceTitle:"string"==typeof o.maintenanceTitle?o.maintenanceTitle:"",maintenanceMessage:"string"==typeof o.maintenanceMessage?o.maintenanceMessage:"",maintenanceStart:d(o.maintenanceStart),maintenanceEnd:d(o.maintenanceEnd),menuItems:h,restricted:g})}catch(n){}}))}),[s]);const v=h.useCallback((e=>{const{active:t,over:a}=e;a&&t.id!==a.id&&i((e=>{const s=e.menuItems.findIndex((e=>e.key===t.id)),r=e.menuItems.findIndex((e=>e.key===a.id));return s<0||r<0?e:c(d({},e),{menuItems:Kt(e.menuItems,s,r)})}))}),[]),f=h.useCallback(((e,t)=>{i((a=>c(d({},a),{menuItems:a.menuItems.map((a=>a.key===e?c(d({},a),{visible:t}):a))})))}),[]),j=h.useCallback(((e,t)=>{i((a=>c(d({},a),{restricted:c(d({},a.restricted),{[e]:t})})))}),[]),y=h.useCallback((()=>m(null,null,(function*(){if(r)if(s){if(n.maintenanceStart&&n.maintenanceEnd){const e=new Date(n.maintenanceStart).getTime(),t=new Date(n.maintenanceEnd).getTime();if(!isNaN(e)&&!isNaN(t)&&e>t){const e=a("setup.maintenance_dates_invalid");return x(e),void A.error(e)}}x(null),o(!0);try{const e=ft(W,`projects/${s}`),t=ft(W,`public_projects/${s}`),r=e=>{if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?null:t},i={floorplan:!1,news:!1,exhibitors:!1,contact:!1,program:!1},l={floorplan:!1,news:!1,exhibitors:!1,contact:!1,program:!1};for(const a of n.menuItems){const e=jr[a.key];e&&(i[e]=a.visible,l[e]=!0===n.restricted[a.key])}const o=n.menuItems.find((e=>"aanmelden"===e.key)),u=!0===(null==o?void 0:o.visible),p={maintenance:n.maintenance,maintenanceTitle:n.maintenanceTitle||"",maintenanceMessage:n.maintenanceMessage||"",maintenanceStart:r(n.maintenanceStart),maintenanceEnd:r(n.maintenanceEnd),menuItems:n.menuItems,enabledModules:i,restrictedPages:l,"applicationFormConfig.menuVisible":u,updatedAt:new Date},x=p;yield St(e,x),yield St(t,x).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;{const e=c(d({},p),{applicationFormConfig:{menuVisible:u},projectId:s});delete e["applicationFormConfig.menuVisible"],yield yt(t,e)}})))),A.success(a("setup.success_save"))}catch(e){A.error(a("setup.error_save"))}finally{o(!1)}}else A.error(a("setup.no_project_id"));else A.error(a("setup.unauthorized"))}))),[r,s,n,a]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:l,disabled:l||!r,onClick:y,children:a("setup.save_button")}),[l,r,y,a]);const N=h.useMemo((()=>n.menuItems.map((e=>e.key))),[n.menuItems]);return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:a("setup.website_modules_header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:a("setup.menu_order_desc")}),!r&&p.jsx("div",{role:"status",className:"mt-4 rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:a("setup.admin_only_notice")}),p.jsxs("div",{className:"mt-6 space-y-4",children:[p.jsxs("div",{className:"flex flex-col gap-3 rounded-[var(--radius-lg)] bg-[var(--color-bg)] p-3 sm:flex-row sm:items-center sm:justify-between",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("h4",{className:"font-medium text-[var(--color-text)]",children:a("setup.maintenance")}),p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:a("setup.maintenance_desc")})]}),p.jsx(M,{id:"maintenance",name:"maintenance",checked:n.maintenance,onChange:e=>i((t=>c(d({},t),{maintenance:e}))),disabled:!r})]}),p.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[p.jsx(F,{label:a("setup.maintenance_title"),value:null!=(e=n.maintenanceTitle)?e:"",onChange:e=>i((t=>c(d({},t),{maintenanceTitle:e.target.value}))),disabled:!r}),p.jsx(oe,{label:a("setup.maintenance_start"),value:n.maintenanceStart,onCh
2ange:e=>i((t=>c(d({},t),{maintenanceStart:e}))),disabled:!r}),p.jsx("div",{className:"md:col-span-2",children:p.jsx(de,{label:a("setup.maintenance_message"),rows:3,value:null!=(t=n.maintenanceMessage)?t:"",onChange:e=>i((t=>c(d({},t),{maintenanceMessage:e.target.value}))),disabled:!r})}),p.jsx(oe,{label:a("setup.maintenance_end"),value:n.maintenanceEnd,onChange:e=>i((t=>c(d({},t),{maintenanceEnd:e}))),disabled:!r,error:null!=u?u:void 0})]})]}),p.jsxs("div",{className:"mt-8",children:[p.jsx("h4",{className:"[font-size:var(--text-base)] font-semibold text-[var(--color-text)]",children:a("setup.menu_order_header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:a("setup.menu_order_hint")}),p.jsx("div",{className:"mt-4",children:p.jsx(ce,{sensors:b,collisionDetection:ue,onDragEnd:v,children:p.jsx(Wt,{items:N,strategy:Ht,children:p.jsx("div",{className:"space-y-2",children:n.menuItems.map(((e,t)=>{var s;return p.jsx(_r,{item:e,index:t,onVisibleChange:f,onRestrictedChange:j,restricted:null!=(s=n.restricted[e.key])&&s,disabled:!r,visibleLabel:a("setup.visible_label"),loginLabel:a("setup.login_required"),title:a(`setup.menu_items.${e.key}.label`),description:a(`setup.menu_items.${e.key}.desc`),dragLabel:a("setup.menu_drag_handle")},e.key)}))})})})})]})]})};function kr(e,t){return m(this,null,(function*(){const a=pe(xe,"getIntegrationConfig");return(yield a({projectId:e,integration:t})).data}))}function Cr(e){return m(this,null,(function*(){const t=pe(xe,"saveIntegrationConfig");yield t(e)}))}const Sr={},zr=[{value:"claude-opus-4-7",label:"Claude Opus 4.7 (krachtigst, duurst)"},{value:"claude-sonnet-4-6",label:"Claude Sonnet 4.6 (gebalanceerd â aanbevolen)"},{value:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5 (snel, voordelig)"}],Ir="claude-sonnet-4-6",Pr=({apiKey:e,model:t,hasStoredKey:a,onApiKeyChange:s,onModelChange:r})=>{const{t:n}=T("projects"),{id:i}=g(),l=(null==Sr?void 0:Sr.VITE_CLAUDE_PROXY_URL)||"https://us-central1-floorplan-138cc.cloudfunctions.net/proxyClaude",[o,d]=h.useState(e),[c,u]=h.useState(t);h.useEffect((()=>d(e)),[e]),h.useEffect((()=>u(t)),[t]);const[x,b]=h.useState(!1),[v,f]=h.useState(null),[j,y]=h.useState(null);return p.jsxs("div",{className:"space-y-5",children:[p.jsx(Gt,{label:n("setup.claude.fields.model_label"),value:c,onChange:e=>{u(e),r(e)},options:zr.map((e=>({value:e.value,label:e.label}))),hint:n("setup.claude.fields.model_help")}),p.jsx(he,{label:n("setup.claude.fields.api_key_label"),type:"password",value:o,onChange:e=>{d(e.target.value),s(e.target.value)},placeholder:n(a?"setup.claude.fields.api_key_stored":"setup.claude.fields.api_key_placeholder"),hint:n("setup.claude.fields.api_key_help")}),p.jsxs("div",{className:"border-t border-[var(--color-border)] pt-5",children:[p.jsx("h4",{className:"mb-1 [font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:n("setup.claude.test_header")}),p.jsx("p",{className:"mb-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:n("setup.claude.test_hint")}),p.jsx(V,{type:"button",variant:"secondary",size:"md",loading:x,disabled:x,onClick:()=>m(null,null,(function*(){if(b(!0),f(null),y(null),!a)return y(n("setup.claude.messages.missing_key")),void b(!1);try{if(!i)return y(n("setup.claude.messages.no_project_id")),void b(!1);const t=yield ge(),a=yield fetch(l,{method:"POST",headers:t,body:JSON.stringify({projectId:i,action:"ping"})}),s=yield a.text();let r=null;try{r=JSON.parse(s)}catch(e){}(null==r?void 0:r.ok)?f(n("setup.claude.messages.test_success",{model:r.model,latency:r.latencyMs,sample:r.sample||"â"})):y(r?n("setup.claude.messages.test_failure",{status:r.status,error:r.error||n("setup.claude.messages.unknown_error")}):`${a.status}: ${s}`)}catch(t){const e=t instanceof Error?t.message:n("setup.claude.messages.unknown_error");y(e)}finally{b(!1)}})),children:x?n("setup.common.testing","Testen..."):n("setup.common.test_button","Test verbinding")}),j&&p.jsx("div",{role:"alert",className:"mt-3 rounded-[var(--radius-md)] border border-[var(--color-danger)]/30 bg-[var(--color-danger-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)] whitespace-pre-wrap",children:j}),v&&p.jsx("div",{role:"status",className:"mt-3 rounded-[var(--radius-md)] border border-[var(--color-success)]/30 bg-[var(--color-success-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)] whitespace-pre-wrap",children:v})]})]})},Dr={apiKey:"",model:Ir},Br=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(Dr),[r,n]=h.useState(!1),[i,l]=h.useState(!1);h.useEffect((()=>
2{if(!t)return;m(null,null,(function*(){try{const e=ft(W,`projects/${t}`),[a,r]=yield Promise.all([jt(e),kr(t,"claude")]),i=a.exists()?a.data():{};s((e=>c(d({},e),{model:i.claudeModel||Ir,apiKey:""}))),n(r.configured)}catch(e){}}))}),[t]);const o=h.useCallback((()=>m(null,null,(function*(){if(t){l(!0);try{if(yield St(ft(W,`projects/${t}`),{claudeModel:a.model,updatedAt:new Date}),a.apiKey.trim())try{yield Cr({projectId:t,integration:"claude",secret:a.apiKey.trim()})}catch(r){return A.error(e("setup.claude.messages.encrypt_error")),void l(!1)}n((e=>e||!!a.apiKey.trim())),s((e=>c(d({},e),{apiKey:""}))),A.success(e("setup.claude.messages.save_success"))}catch(i){A.error(e("setup.claude.messages.save_error"))}finally{l(!1)}}else A.error(e("setup.claude.messages.no_project_id"))}))),[a,t,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!t,onClick:o,children:e("setup.save_button")}),[i,t,o,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx(be,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.claude.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.claude.desc")})]})]}),p.jsx("div",{className:"mb-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-info-soft)] p-4",children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx(ve,{size:18,strokeWidth:2,"aria-hidden":!0,className:"shrink-0 mt-0.5 text-[var(--color-info)]"}),p.jsxs("div",{className:"min-w-0 space-y-3",children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:e("setup.claude.help.title")}),p.jsxs("ol",{className:"list-decimal list-outside pl-5 [font-size:var(--text-sm)] text-[var(--color-text)] space-y-1",children:[p.jsx("li",{children:e("setup.claude.help.step_console")}),p.jsx("li",{children:e("setup.claude.help.step_billing")}),p.jsx("li",{children:e("setup.claude.help.step_keys")}),p.jsx("li",{children:e("setup.claude.help.step_create")}),p.jsx("li",{children:e("setup.claude.help.step_copy")}),p.jsx("li",{children:e("setup.claude.help.step_paste")})]}),p.jsx("p",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.claude.help.security_note")}),p.jsxs("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 [font-size:var(--text-sm)] font-medium text-[var(--color-info)] hover:underline",children:[e("setup.claude.help.cta"),p.jsx(L,{size:14,strokeWidth:2,"aria-hidden":!0})]})]})]})}),p.jsx(Pr,{apiKey:a.apiKey,model:a.model,hasStoredKey:r,onApiKeyChange:e=>s((t=>c(d({},t),{apiKey:e}))),onModelChange:e=>s((t=>c(d({},t),{model:e})))})]})},Tr={},Ar=[{value:"GET",label:"GET"},{value:"POST",label:"POST"},{value:"PUT",label:"PUT"},{value:"DELETE",label:"DELETE"}],Er=({baseUrl:e,dbName:t,username:a,password:s,onBaseUrlChange:r,onDbNameChange:n,onUsernameChange:i,onPasswordChange:l})=>{const{t:o}=T("projects"),{id:d}=g(),[c,u]=h.useState(""),[x,b]=h.useState("GET"),[v,f]=h.useState(""),[j,y]=h.useState(!1),[N,_]=h.useState(null),[w,k]=h.useState(null),C=(null==Tr?void 0:Tr.VITE_FILEMAKER_PROXY_URL)||"https://proxyfilemaker-dmm7wgl6hq-uc.a.run.app";return p.jsxs("div",{className:"space-y-5",children:[p.jsx(he,{label:o("setup.filemaker.fields.base_url","FileMaker Base URL"),type:"text",value:e,onChange:e=>r(e.target.value),placeholder:o("setup.filemaker.fields.base_url_placeholder","https://.../fmi/data/vLatest"),hint:o("setup.filemaker.fields.base_url_help","Bijv. https://server.com/fmi/data/vLatest")}),p.jsx(he,{label:o("setup.filemaker.fields.db_label","Database (.fmp12)"),type:"text",value:t,onChange:e=>n(e.target.value),placeholder:o("setup.filemaker.fields.db_placeholder","floorplanDV.fmp12")}),p.jsx(he,{label:o("setup.filemaker.fields.username","Username"),type:"text",value:a,onChange:e=>i(e.target.value)}),p.jsx(he,{label:o("setup.filemaker.fields.password","Password"),type:"password",value:s,onChange:e=>l(e.target.value),placeholder:o("setup.common.password_placeholder","â¢â¢â¢â¢â¢â¢â¢â¢")}),p.jsxs("div",{className:"border-t border-[var(--color-border)] pt-5",children:[p.jsx("h4",{className:"mb-3 [font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:o("setup.filemaker.test_header","Test verbinding")}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(he,{label:o("setup.filemaker.fields.path","FileMaker path"),type:"text",value:c,onChange:e=>u(e.target.value),placeholder:o("setup.filemaker.fields.path_placeholder","databases/Boothly.fmp12/layouts/Boothly/records/21")}),p.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[auto_1fr]",children:[p.jsx("div",{className:"md:w-32",children:p.jsx(Gt,{label:o("setup.filemaker.fields.method","Methode"),value:x,onChange:e=>b(e),options:Ar})}),p.jsx(de,{label:o("setup.filemaker.fields.body","Body (JSON)"),rows:4,value:v,onCh
2ange:e=>f(e.target.value),placeholder:o("setup.filemaker.fields.body_placeholder","{ }")})]}),p.jsx("div",{children:p.jsx(V,{type:"button",variant:"secondary",size:"md",loading:j,disabled:j,onClick:()=>m(null,null,(function*(){if(d)if(c.trim()){y(!0),k(null),_(null);try{const t={projectId:d,filemakerPath:c.trim(),method:x};if(v.trim())try{t.body=JSON.parse(v)}catch(e){return k(o("setup.filemaker.messages.body_invalid_json")),void y(!1)}const a=yield fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s=yield a.text();_(`${a.status}: ${s}`)}catch(t){const e=t instanceof Error?t.message:o("setup.filemaker.messages.unknown_error");k(e)}finally{y(!1)}}else k(o("setup.filemaker.messages.path_required"));else k(o("setup.common.no_project_id"))})),children:j?o("setup.common.testing","Testen..."):o("setup.common.test_button","Test verbinding")})}),w&&p.jsx("div",{role:"alert",className:"rounded-[var(--radius-md)] border border-[var(--color-danger)]/30 bg-[var(--color-danger-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)] whitespace-pre-wrap",children:w}),N&&p.jsx("pre",{className:"overflow-auto rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)] whitespace-pre-wrap max-h-60",children:N})]})]})]})},Vr={baseUrl:"",dbName:"",username:"",password:""},Mr=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(Vr),[r,n]=h.useState(!1),[i,l]=h.useState(!1),[o,u]=h.useState(null);h.useEffect((()=>{if(!t)return;m(null,null,(function*(){try{const e=yield kr(t,"filemaker");s((t=>c(d({},t),{baseUrl:e.baseUrl||"",dbName:e.db||"",username:e.username||"",password:""})))}catch(e){}}))}),[t]);const x=h.useCallback((()=>m(null,null,(function*(){if(a.baseUrl&&a.dbName&&a.username&&a.password)if(t){l(!0),u(null);try{yield Cr({projectId:t,integration:"filemaker",baseUrl:a.baseUrl,db:a.dbName,username:a.username,secret:a.password.trim()});const{auth:s}=yield fe((()=>m(null,null,(function*(){const{auth:e}=yield import("./index-IinEbi41.js").then((e=>e.ij));return{auth:e}}))),__vite__mapDeps([0,1,2,3,4,5])),r=s.currentUser;if(!r)throw new Error(e("setup.filemaker.messages.no_user"));const n=yield r.getIdToken(),i="https://proxyfilemaker-dmm7wgl6hq-uc.a.run.app",l=yield fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:t,filemakerPath:`databases/${encodeURIComponent(a.dbName)}/sessions`,method:"POST",body:{}})});if(l.ok)u({variant:"success",message:`${e("setup.filemaker.messages.test_success")} ${e("setup.filemaker.messages.test_success_details",{db:a.dbName})}`});else{const t=yield l.text();502===l.status?u({variant:"warning",message:`${e("setup.filemaker.messages.test_502")}\n\n${t}`}):401===l.status?u({variant:"warning",message:e("setup.filemaker.messages.test_401")}):404===l.status?u({variant:"warning",message:e("setup.filemaker.messages.test_404",{db:a.dbName})}):400===l.status?u({variant:"warning",message:`${e("setup.filemaker.messages.test_400")}\n\n${t}`}):u({variant:"warning",message:`${e("setup.filemaker.messages.test_generic_error",{status:l.status})}\n\n${t}`})}}catch(s){const t=s instanceof Error?s.message:e("setup.filemaker.messages.unknown_error");u({variant:"warning",message:e("setup.filemaker.messages.test_failed",{message:t})})}finally{l(!1)}}else u({variant:"warning",message:e("setup.filemaker.messages.no_project_id")});else u({variant:"warning",message:e("setup.filemaker.messages.missing_fields_for_test")})}))),[a,t,e]),b=h.useCallback((()=>m(null,null,(function*(){if(t){n(!0);try{yield Cr({projectId:t,integration:"filemaker",baseUrl:a.baseUrl,db:a.dbName,username:a.username,secret:a.password.trim()||void 0}),A.success(e("setup.filemaker.messages.save_success")),s((e=>c(d({},e),{password:""})))}catch(r){A.error(e("setup.filemaker.messages.save_error"))}finally{n(!1)}}else A.error(e("setup.filemaker.messages.no_project_id"))}))),[a,t,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:r,disabled:r||i||
2!t,onClick:b,children:e("setup.save_button")}),[r,i,t,b,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-info-soft)] p-3",children:p.jsx(je,{size:20,strokeWidth:1.5,className:"text-[var(--color-info)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.filemaker.header","FileMaker koppeling")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.filemaker.desc","Stel hier de URL, database naam, gebruikersnaam en API-key in voor koppeling met FileMaker Data API.")})]})]}),p.jsx(Er,{baseUrl:a.baseUrl,dbName:a.dbName,username:a.username,password:a.password,onBaseUrlChange:e=>s((t=>c(d({},t),{baseUrl:e}))),onDbNameChange:e=>s((t=>c(d({},t),{dbName:e}))),onUsernameChange:e=>s((t=>c(d({},t),{username:e}))),onPasswordChange:e=>s((t=>c(d({},t),{password:e})))}),p.jsx("div",{className:"mt-6 flex justify-end",children:p.jsx(V,{type:"button",variant:"secondary",size:"md",onClick:x,disabled:i||r,loading:i,children:i?e("setup.common.testing","Testen..."):e("setup.filemaker.test_button","Test verbinding")})}),o&&p.jsx("div",{role:"success"===o.variant?"status":"alert",className:["mt-4 rounded-[var(--radius-md)] border p-3 [font-size:var(--text-sm)] text-[var(--color-text)] whitespace-pre-wrap","success"===o.variant?"border-[var(--color-success)]/30 bg-[var(--color-success-soft)]":"border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)]"].join(" "),children:o.message})]})},Lr={},$r=({apiKey:e,serverPrefix:t,hasStoredKey:a,onApiKeyChange:s,onServerPrefixChange:r})=>{const{t:n}=T("projects"),{id:i}=g(),l="localhost"!==window.location.hostname,o=(null==Lr?void 0:Lr.VITE_MAILCHIMP_PROXY_URL)||(l?"https://us-central1-floorplan-138cc.cloudfunctions.net/proxyMailchimp":"/proxyMailchimp"),[d,c]=h.useState(e),[u,x]=h.useState(t);h.useEffect((()=>c(e)),[e]),h.useEffect((()=>x(t)),[t]);const[b,v]=h.useState(!1),[f,j]=h.useState(null),[y,N]=h.useState(null);return p.jsxs("div",{className:"space-y-5",children:[p.jsx(he,{label:n("setup.mailchimp.fields.server_label","Mailchimp server prefix"),type:"text",value:u,onChange:e=>{x(e.target.value),r(e.target.value)},placeholder:n("setup.mailchimp.fields.server_placeholder","us19"),hint:n("setup.mailchimp.fields.server_help","Bijv. us19 (zie URL in Mailchimp: https://us19.admin.mailchimp.com)")}),p.jsx(he,{label:n("setup.mailchimp.fields.api_key_label","Mailchimp API-key"),type:"password",value:d,onChange:e=>{c(e.target.value),s(e.target.value)},placeholder:n("setup.mailchimp.fields.api_key_placeholder","â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢")}),p.jsxs("div",{className:"border-t border-[var(--color-border)] pt-5",children:[p.jsx("h4",{className:"mb-3 [font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:n("setup.mailchimp.test_header","Test verbinding")}),p.jsx(V,{type:"button",variant:"secondary",size:"md",loading:b,disabled:b,onClick:()=>m(null,null,(function*(){if(v(!0),j(null),N(null),!u.trim())return N(n("setup.mailchimp.messages.missing_server")),void v(!1);if(!d.trim()&&!a)return N(n("setup.mailchimp.messages.missing_fields")),void v(!1);try{if(!i)return N(n("setup.mailchimp.messages.no_project_id")),void v(!1);const e=yield ge(),t=yield fetch(o,{method:"POST",headers:e,body:JSON.stringify({projectId:i})}),a=yield t.text();j(`${t.status}: ${a}`)}catch(e){const t=e instanceof Error?e.message:n("setup.mailchimp.messages.unknown_error");N(t)}finally{v(!1)}})),children:b?n("setup.common.testing","Testen..."):n("setup.common.test_button","Test verbinding")}),y&&p.jsx("div",{role:"alert",className:"mt-3 rounded-[var(--radius-md)] border border-[var(--color-danger)]/30 bg-[var(--color-danger-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)] whitespace-pre-wrap",children:y}),f&&p.jsx("pre",{className:"mt-3 overflow-auto rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)] whitespace-pre-wrap max-h-60",children:f})]})]})},Or={apiKey:"",serverPrefix:""},Fr=/^[a-z]{2,4}[0-9]{1,3}$/,Ur=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(Or),[r,n]=h.useState(!1),[i,l]=h.useState(!1);h.useEffect((()=>
2{if(!t)return;m(null,null,(function*(){try{const e=yield kr(t,"mailchimp");s((t=>c(d({},t),{serverPrefix:e.serverPrefix||"",apiKey:""}))),n(e.configured)}catch(e){}}))}),[t]);const o=h.useCallback((()=>m(null,null,(function*(){if(t)if(Fr.test(a.serverPrefix.trim())){l(!0);try{yield Cr({projectId:t,integration:"mailchimp",serverPrefix:a.serverPrefix.trim(),secret:a.apiKey.trim()||void 0}),n(!0),s((e=>c(d({},e),{apiKey:""}))),A.success(e("setup.mailchimp.messages.save_success"))}catch(r){A.error(e("setup.mailchimp.messages.save_error"))}finally{l(!1)}}else A.error(e("setup.mailchimp.messages.invalid_server"));else A.error(e("setup.mailchimp.messages.no_project_id"))}))),[a,t,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!t,onClick:o,children:e("setup.save_button")}),[i,t,o,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx(te,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.mailchimp.header","Mailchimp koppeling")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.mailchimp.desc","Stel hier de Mailchimp server prefix en API-key in om de Marketing API te gebruiken.")})]})]}),p.jsx($r,{apiKey:a.apiKey,serverPrefix:a.serverPrefix,hasStoredKey:r,onApiKeyChange:e=>s((t=>c(d({},t),{apiKey:e}))),onServerPrefixChange:e=>s((t=>c(d({},t),{serverPrefix:e})))})]})},Kr=({apiKey:e,hasStoredKey:t,onApiKeyChange:a})=>{var s;const{t:r}=T("projects"),{id:n}=g(),i="https://us-central1-floorplan-138cc.cloudfunctions.net/proxyGooglePlaces",[l,o]=h.useState(e);h.useEffect((()=>o(e)),[e]);const[d,c]=h.useState(!1),[u,x]=h.useState(!1),[b,v]=h.useState(null),[f,j]=h.useState(null),[y,N]=h.useState(""),[_,w]=h.useState(""),[k,C]=h.useState(""),[S,z]=h.useState(""),[I,P]=h.useState(null),[D,B]=h.useState(null);return p.jsxs("div",{className:"space-y-5",children:[p.jsx(he,{label:r("setup.googleplaces.fields.api_key_label","Google Places API-key"),type:"password",value:l,onChange:e=>{o(e.target.value),a(e.target.value)},placeholder:r("setup.googleplaces.fields.api_key_placeholder","â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢")}),p.jsxs("div",{className:"border-t border-[var(--color-border)] pt-5",children:[p.jsx("h4",{className:"mb-3 [font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:r("setup.googleplaces.test_header","Test verbinding")}),p.jsx(V,{type:"button",variant:"secondary",size:"md",loading:d,disabled:d,onClick:()=>m(null,null,(function*(){if(c(!0),P(null),B(null),!l.trim()&&!t)return B(r("setup.googleplaces.messages.missing_key")),void c(!1);if(!n)return B(r("setup.googleplaces.messages.no_project_id")),void c(!1);try{const e=ye.currentUser;if(!e)return B(r("setup.googleplaces.messages.not_logged_in")),void c(!1);const t=yield e.getIdToken(),a=yield fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:n})}),s=yield a.text();P(`${a.status}: ${s}`)}catch(e){const t=e instanceof Error?e.message:r("setup.googleplaces.messages.unknown_error");B(t)}finally{c(!1)}})),children:d?r("setup.common.testing","Testen..."):r("setup.common.test_button","Test verbinding")}),D&&p.jsx("div",{role:"alert",className:"mt-3 rounded-[var(--radius-md)] border border-[var(--color-danger)]/30 bg-[var(--color-danger-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)] whitespace-pre-wrap",children:D}),I&&p.jsx("pre",{className:"mt-3 overflow-auto rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)] whitespace-pre-wrap max-h-60",children:I})]}),p.jsxs("div",{className:"border-t border-[var(--color-border)] pt-5 space-y-4",children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:r("setup.googleplaces.search.header","Google Places Search test")}),p.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[p.jsx(he,{label:r("setup.googleplaces.search.business_placeholder","Bedrijfsnaam"),type:"text",value:y,onChange:e=>N(e.target.value)}),p.jsx(he,{label:r("setup.googleplaces.search.street_placeholder","Straat"),type:"text",value:_,onCh
2ange:e=>w(e.target.value)}),p.jsx(he,{label:r("setup.googleplaces.search.city_placeholder","Plaats"),type:"text",value:k,onChange:e=>C(e.target.value)}),p.jsx(he,{label:r("setup.googleplaces.search.country_placeholder","Land"),type:"text",value:S,onChange:e=>z(e.target.value)})]}),p.jsx(V,{type:"button",variant:"secondary",size:"md",loading:u,disabled:u,onClick:()=>m(null,null,(function*(){var e;if(x(!0),v(null),j(null),!n)return v(r("setup.googleplaces.messages.no_project_id")),void x(!1);const t=`${y} ${_} ${k} ${S}`.trim();if(!t)return v(r("setup.googleplaces.messages.no_address")),void x(!1);try{const a=ye.currentUser;if(!a)return v(r("setup.googleplaces.messages.not_logged_in")),void x(!1);const s=yield a.getIdToken(),l=yield fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({projectId:n,action:"textSearch",query:t})}),o=yield l.text();if(!l.ok)throw new Error(o);const d=JSON.parse(o);(null==(e=d.places)?void 0:e.length)?j(d.places[0]):v(r("setup.googleplaces.messages.no_results"))}catch(a){const e=a instanceof Error?a.message:r("setup.googleplaces.messages.unknown_error");v(e)}finally{x(!1)}})),children:u?r("setup.googleplaces.search.loading","Zoeken..."):r("setup.googleplaces.search.button","Zoek adres")}),b&&p.jsx("div",{role:"alert",className:"rounded-[var(--radius-md)] border border-[var(--color-danger)]/30 bg-[var(--color-danger-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)] whitespace-pre-wrap",children:b}),f&&p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4 space-y-2",children:[p.jsx("p",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:(null==(s=f.displayName)?void 0:s.text)||"â"}),f.formattedAddress&&p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:f.formattedAddress}),f.internationalPhoneNumber&&p.jsxs("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:[r("setup.googleplaces.labels.tel","Tel"),": ",f.internationalPhoneNumber]}),f.websiteUri&&p.jsx("p",{className:"[font-size:var(--text-sm)]",children:p.jsx("a",{href:f.websiteUri,target:"_blank",rel:"noreferrer",className:"text-[var(--color-accent)] underline hover:text-[var(--color-accent-hover)]",children:r("setup.googleplaces.labels.website","Website")})}),null!=f.rating&&p.jsxs("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:[r("setup.googleplaces.labels.rating","Rating"),": ",f.rating," / 5"]}),f.location&&p.jsx("iframe",{title:"map",className:"h-64 w-full rounded-[var(--radius-md)]",src:`https://maps.google.com/maps?q=${f.location.latitude},${f.location.longitude}&z=15&output=embed`,allowFullScreen:!0})]})]})]})},Wr={apiKey:""},Hr=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(Wr),[r,n]=h.useState(!1),[i,l]=h.useState(!1);h.useEffect((()=>{if(!t)return;m(null,null,(function*(){try{const e=yield kr(t,"googlePlaces");n(e.configured)}catch(e){}}))}),[t]);const o=h.useCallback((()=>m(null,null,(function*(){if(t){l(!0);try{yield Cr({projectId:t,integration:"googlePlaces",secret:a.apiKey.trim()||void 0}),n(!0),s((e=>c(d({},e),{apiKey:""}))),A.success(e("setup.googleplaces.messages.save_success"))}catch(r){A.error(e("setup.googleplaces.messages.save_error"))}finally{l(!1)}}else A.error(e("setup.googleplaces.messages.no_project_id"))}))),[a,t,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!t,onClick:o,children:e("setup.save_button")}),[i,t,o,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-info-soft)] p-3",children:p.jsx(Z,{size:20,strokeWidth:1.5,className:"text-[var(--color-info)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.googleplaces.header","Google Places koppeling")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.googleplaces.desc","Voer hier de Google Places API-key in om Places Search & Details te gebruiken.")})]})]}),p.jsx("p",{className:"mb-5 [font-size:var(--text-sm)]",children:p.jsxs("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[var(--color-accent)] underline hover:text-[var(--color-accent-hover)]",children:[e("setup.googleplaces.where_to_get","API-key aanmaken in Google Cloud Console"),p.jsx(L,{size:14,strokeWidth:1.5})]})}),p.jsx(Kr,{apiKey:a.apiKey,hasStoredKey:r,onApiKeyChange:e=>s((t=>c(d({},t),{apiKey:e})))})]})},Rr=[{key:"linkedin",labelKey:"setup.zernio.fields.linkedin_label"},{key:"facebook",labelKey:"setup.zernio.fields.facebook_label"},{key:"instagram",labelKey:"setup.zernio.fields.instagram_label"}],qr=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState({}),[r,n]=h.useState(!1),[i,l]=h.useState(!1);h.useEffect((()=>
2{if(!t)return;m(null,null,(function*(){var e,a,r,i;try{const l=ft(W,`projects/${t}`),o=yield jt(l);if(o.exists()){const t=null!=(e=o.data().zernioAccounts)?e:{};s({linkedin:null!=(a=t.linkedin)?a:"",facebook:null!=(r=t.facebook)?r:"",instagram:null!=(i=t.instagram)?i:""}),n(!!(t.linkedin||t.facebook||t.instagram))}}catch(l){}}))}),[t]);const o=h.useCallback((()=>m(null,null,(function*(){var s,r,i;if(t){l(!0);try{const l=ft(W,`projects/${t}`),o={linkedin:(null!=(s=a.linkedin)?s:"").trim(),facebook:(null!=(r=a.facebook)?r:"").trim(),instagram:(null!=(i=a.instagram)?i:"").trim()};yield St(l,{zernioAccounts:o,updatedAt:new Date}),n(!!(o.linkedin||o.facebook||o.instagram)),A.success(e("setup.zernio.messages.save_success"))}catch(o){A.error(e("setup.zernio.messages.save_error"))}finally{l(!1)}}else A.error(e("setup.zernio.messages.no_project_id"))}))),[a,t,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!t,onClick:o,children:e("setup.save_button")}),[i,t,o,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-info-soft)] p-3",children:p.jsx(Ne,{size:20,strokeWidth:1.5,className:"text-[var(--color-info)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.zernio.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.zernio.desc")})]})]}),p.jsx("p",{className:"mb-5 [font-size:var(--text-sm)]",children:p.jsxs("a",{href:"https://zernio.com/dashboard",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[var(--color-accent)] underline hover:text-[var(--color-accent-hover)]",children:[e("setup.zernio.where_to_get"),p.jsx(L,{size:14,strokeWidth:1.5})]})}),r&&p.jsxs("div",{className:"mb-5 flex items-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-success)]/30 bg-[var(--color-success-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:[p.jsx(se,{size:16,strokeWidth:1.5,className:"text-[var(--color-success)]"}),e("setup.zernio.stored_hint")]}),p.jsx("div",{className:"space-y-4",children:Rr.map((({key:t,labelKey:r})=>{var n;return p.jsx(he,{label:e(r),value:null!=(n=a[t])?n:"",onChange:e=>s((a=>c(d({},a),{[t]:e.target.value}))),placeholder:e("setup.zernio.fields.account_id_placeholder"),hint:e("setup.zernio.fields.account_id_help")},t)}))})]})},Gr=["off","daily","hourly","30m","15m","1m"],Jr=()=>{var e,t,a,s;const{t:r}=T("projects"),{id:n}=g(),{hasRole:i}=K(),l=i("admin"),[o,d]=h.useState(!0),[c,u]=h.useState(!1),[x,b]=h.useState(!1),[v,f]=h.useState([]),[j,y]=h.useState(null),[N,_]=h.useState({}),[w,k]=h.useState(""),[C,S]=h.useState("daily"),[z,I]=h.useState(null),P=h.useCallback((()=>m(null,null,(function*(){var e,t,a,s;if(n){d(!0);try{const r=null!=(t=null==(e=(yield jt(ft(zt(),"projects",n))).data())?void 0:e.ticketScan)?t:{};_(r),k(null!=(a=r.eventId)?a:""),S(null!=(s=r.syncInterval)?s:"daily")}catch(i){A.error(i instanceof Error?i.message:r("ticketScan.errors.load"))}finally{d(!1)}}}))),[n,r]),D=h.useCallback((()=>m(null,null,(function*(){if(n){y(null);try{const e=pe(xe,"listShowRegistrationEvents"),t=yield e({projectId:n});f(t.data.events)}catch(e){y(e instanceof Error?e.message:r("ticketScan.errors.events"))}}}))),[n,r]);h.useEffect((()=>{P(),D()}),[P,D]);const B=h.useCallback(((e,t)=>m(null,null,(function*(){var a,s;if(n&&l){u(!0);try{const i=null!=(a=v.find((t=>t.id===e)))?a:null,l=pe(xe,"saveTicketScanConfig");yield l({projectId:n,eventId:e||null,eventName:null!=(s=null==i?void 0:i.name)?s:null,syncInterval:t}),I(new Date),A.success(r("ticketScan.saved")),yield P()}catch(i){A.error(i instanceof Error?i.message:r("ticketScan.errors.save"))}finally{u(!1)}}}))),[n,l,v,P,r]),E=h.useCallback((e=>{k(e),B(e,C)}),[B,C]),M=h.useCallback((e=>{S(e),B(w,e)}),[B,w]),L=h.useCallback((()=>m(null,null,(function*(){if(n){b(!0);try{const e=pe(xe,"syncTicketScanNow"),t=yield e({projectId:n});A.success(r("ticketScan.synced",{visitors:t.data.visitors,orders:t.data.orders})),yield P()}catch(e){A.error(e instanceof Error?e.message:r("ticketScan.errors.sync"))}finally{b(!1)}}}))),[n,P,r]),$=null==(t=null==(e=N.lastSyncAt)?void 0:e.toDate)?void 0:t.call(e);return o?p.jsx("div",{className:"flex items-center justify-center py-16",children:p.jsx(_e,{})}):p.jsxs("div",{className:"mx-auto max-w-3xl space-y-8",children:[p.jsxs("header",{className:"flex items-start gap-4",children:[p.jsx("div",{className:"rounded-xl bg-[var(--color-accent-soft,rgba(79,70,229,0.12))] p-3 text-[var(--color-accent,#4f46e5)]",children:p.jsx(we,{size:22})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-xl font-semibold text-[var(--color-text,#11111a)]",children:r("ticketScan.title")}),p.jsx("p",{className:"mt-1 text-sm text-[var(--color-text-muted,#5e5e6e)]",children:r("ticketScan.intro")})]})]}),p.jsxs("section",{className:"space-y-4 rounded-2xl bg-[var(--color-surface,#fff)] p-6 shadow-sm",children:[p.jsx("h2",{className:"text-base font-semibold",children:r("ticketScan.event.title")}),p.jsx("p",{className:"text-sm text-[var(--color-text-muted,#5e5e6e)]",children:r("ticketScan.event.help")}),j?p.jsxs("div",{className:"rounded-lg bg-amber-50 p-3 text-sm text-amber-900",children:[p.jsx("p",{className:"font-medium",children:r("ticketScan.errors.events")}),p.jsx("p",{className:"mt-1 break-words text-xs",children:j}),p.jsx("p",{className:"mt-2 text-xs",children:r("ticketScan.errors.eventsHint")}),p.jsx(V,{type:"button",variant:"secondary",size:"sm",className:"mt-3",onClick:D,children:r("ticketScan.retry")})]}):p.jsx(Gt,{label:r("ticketScan.event.label"),value:w,onChange:E,disabled:!l||c,options:[{value:"",label:r("ticketScan.event.none")},...v.map((e=>({value:e.id,label:`${e.name}${e.startDate?` · ${new Date(e.startDate).toLocaleDateString("nl-NL")}`:""}${null!=e.currentRegistrations?` · ${e.currentRegistrations} ${r("ticketScan.event.registrations")}`:""}`})))]})]}),p.jsxs("section",{className:"space-y-4 rounded-2xl bg-[var(--color-surface,#fff)] p-6 shadow-sm",children:[p.jsx("h2",{className:"text-base font-semibold",children:r("ticketScan.interval.title")}),p.jsx("p",{className:"text-sm text-[var(--color-text-muted,#5e5e6e)]",children:r("ticketScan.interval.help")}),p.jsx(Gt,{label:r("ticketScan.interval.label"),value:C,onChange:e=>M(e),disabled:!l,options:Gr.map((e=>({value:e,label:r(`ticketScan.interval.options.${e}`)})))}),!l&&p.jsx("p",{className:"text-xs text-[var(--color-text-subtle,#8b8b9c)]",children:r("ticketScan.adminOnly")}),l&&p.jsx("p",{className:"text-xs text-[var(--color-text-subtle,#8b8b9c)]",children:c?r("ticketScan.saving"):z?r("ticketScan.savedAt",{time:z.toLocaleTimeString("nl-NL")}):r("ticketScan.autosave")})]}),p.jsx("section",{className:"space-y-4 rounded-2xl bg-[var(--color-surface,#fff)] p-6 shadow-sm",children:p.jsxs("div",{className:"flex items-center justify-between gap-4",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-base font-semibold",children:r("ticketScan.status.title")}),p.jsx("p",{className:"text-sm text-[var(--color-text-muted,#5e5e6e)]",children:$?r("ticketScan.status.last",{when:$.toLocaleStr
2ing("nl-NL"),count:null!=(a=N.lastSyncCount)?a:0,checkedIn:null!=(s=N.lastSyncCheckedIn)?s:0}):r("ticketScan.status.never")}),N.lastSyncError&&p.jsx("p",{className:"mt-2 break-words text-sm text-red-700",children:N.lastSyncError})]}),p.jsxs(V,{type:"button",variant:"secondary",size:"md",loading:x,disabled:x||c||!N.eventId,onClick:L,children:[p.jsx(ke,{size:16,className:"mr-2 inline"}),r("ticketScan.status.syncNow")]})]})}),p.jsxs("section",{className:"rounded-2xl bg-[var(--color-surface-sunken,#ebeef5)] p-6 text-sm text-[var(--color-text-muted,#5e5e6e)]",children:[p.jsx("h2",{className:"mb-2 text-base font-semibold text-[var(--color-text,#11111a)]",children:r("ticketScan.how.title")}),p.jsxs("ul",{className:"list-disc space-y-1 pl-5",children:[p.jsx("li",{children:r("ticketScan.how.iphone")}),p.jsx("li",{children:r("ticketScan.how.sync")}),p.jsx("li",{children:r("ticketScan.how.checkin")})]})]})]})},Yr=()=>{const{currentUser:e}=K(),{t:t}=T("projects"),[a,s]=h.useState(""),[r,n]=h.useState(!0),[i,l]=h.useState(!1),[o,u]=h.useState("nl"),[x,b]=h.useState(null),[v,f]=h.useState(!1),[j,y]=h.useState(14),[N,_]=h.useState(5),[w,k]=h.useState(3),[C,S]=h.useState(15),z=U((e=>e.tenantId)),{id:I}=g();h.useEffect((()=>{m(null,null,(function*(){if(I)try{n(!0);const e=zt(),t=ft(e,`projects/${I}`),a=yield jt(t);if(a.exists()){const e=a.data(),t=e.badgesInstructionText||"";s("string"==typeof t?{nl:t}:t||{}),f(!!e.badgeRequestsClosed),y(e.badgeExtraPrice||14),_(e.badgeSquareMetersPerBadge||5),k(e.badgeMinimum||3),S(e.badgeMaximum||15)}else s({nl:""}),f(!1),y(14),_(5),k(3),S(15)}catch(e){A.error(t("setup.badges.messages.load_error"))}finally{n(!1)}else n(!1)}))}),[z,I,t]);const P=h.useMemo((()=>"string"==typeof a?"nl"===o?a:"":(null==a?void 0:a[o])||""),[a,o]),D=h.useCallback((r=>m(null,null,(function*(){if(!I)return void A.error(t("setup.errors.no_project_id"));if(null!==x)return;const n="string"==typeof a?{nl:a}:a||{};let i="nl";n.nl&&""!==n.nl.trim()||(i=n.en&&""!==n.en.trim()?"en":n.de&&""!==n.de.trim()?"de":void 0);const l=i&&n[i]||"";if(l&&""!==l.trim())if(i!==r)try{b(r);const a=pe(xe,"translateText",{timeout:3e5}),o=(yield a({text:l,targetLang:r,sourceLang:i,projectId:I})).data;if(!o||"success"!==o.status||!o.translated)throw new Error("Translation failed");const u=c(d({},n),{[r]:o.translated});s(u);const m=zt(),p=ft(m,`projects/${I}`),x=e=>{const t={};return Object.entries(e).forEach((([e,a])=>{a&&""!==a.trim()&&(t[e]=a)})),t};yield yt(p,{badgesInstructionText:x(u),updatedAt:new Date,updatedBy:(null==e?void 0:e.uid)||"unknown"},{merge:!0}),A.success(t("setup.badges.messages.translate_saved"))}catch(o){A.error(t("setup.badges.messages.translate_error"))}finally{b(null)}else A.error(t("setup.badges.messages.translate_same_lang"));else A.error(t("setup.badges.messages.translate_no_source"))}))),[a,I,e,t,x]),B=h.useCallback((()=>m(null,null,(function*(){if(I)try{l(!0);const s=zt(),r=ft(s,`projects/${I}`),n=e=>"string"==typeof e?{nl:e}:e||{},i=e=>{const t={};return Object.entries(e).forEach((([e,a])=>{a&&""!==a.trim()&&(t[e]=a)})),t};yield yt(r,{badgesInstructionText:i(n(a)),badgeRequestsClosed:v,badgeExtraPrice:j,badgeSquareMetersPerBadge:N,badgeMinimum:w,badgeMaximum:C,updatedAt:new Date,updatedBy:(null==e?void 0:e.uid)||"unknown"},{merge:!0}),A.success(t("setup.badges.messages.saved_success"))}catch(s){A.error(t("setup.badges.messages.save_error"))}finally{l(!1)}else A.error(t("setup.errors.no_project_id"))}))),[I,a,v,j,N,w,C,e,t]);if(E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!I,onClick:B,children:t("setup.save_button")}),[i,I,B,t]),r)return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:t("setup.badges.header")}),p.jsxs("div",{className:"mt-4 flex items-center gap-2 text-[var(--color-text-muted)]",children:[p.jsx(_e,{size:"sm"}),p.jsx("span",{className:"[font-size:var(--text-sm)]",children:t("setup.loading")})]})]});const L=Math.floor(25/Math.max(1,N)),$=Math.min(C,Math.max(w,L));return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[!I&&p.jsx("div",{role:"status",className:"mb-4 rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:t("setup.badges.missing_project_id")}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx(Jt,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:t("setup.badges.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:t("setup.badges.desc")})]})]}),p.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:t("setup.badges.language_label")}),p.jsx(Ce,{size:"sm",value:o,onChange:u,"aria-label":t("setup.badges.language_label"),items:[{value:"nl",label:"NL"},{value:"en",label:"EN"},{value:"de",label:"DE"}]}),p.jsx("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:["en","de"].map((e=>p.jsx(V,{type:"button",variant:"secondary",size:"sm",icon:p.jsx(ra,{size:14,strokeWidth:1.5}),loading:x===e,disabled:!I||null!==x,onClick:()=>D(e),children:t("setup.badges.buttons.translate_to",{locale:e.toUpperCase()})},e)))})]}),p.jsx("div",{className:"mt-4 space-y-3",children:p.jsx(de,{label:t("setup.badges.fields.badges_text_label"),rows:6,placeholder:t("setup.badges.fields.badges_text_placeholder",{locale:o.toUpperCase()}),value:P,onChange:e=>{const t=e.target.value;s((e=>c(d({},e&&"string"!=typeof e?e:{nl:"string"==typeof e?e:""}),{[o]:t}
2)))}})}),p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h4",{className:"mb-3 [font-size:var(--text-base)] font-medium text-[var(--color-text)]",children:t("setup.badges.calc.header")}),p.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[p.jsx(he,{label:t("setup.badges.calc.per_m2_label"),type:"number",min:1,max:50,value:N,onChange:e=>_(Number(e.target.value)),hint:t("setup.badges.calc.per_m2_help")}),p.jsx(he,{label:t("setup.badges.calc.extra_price_label"),type:"number",min:0,step:.01,value:j,onChange:e=>y(Number(e.target.value)),hint:t("setup.badges.calc.extra_price_help")}),p.jsx(he,{label:t("setup.badges.calc.min_label"),type:"number",min:1,max:50,value:w,onChange:e=>k(Number(e.target.value)),hint:t("setup.badges.calc.min_help")}),p.jsx(he,{label:t("setup.badges.calc.max_label"),type:"number",min:1,max:100,value:C,onChange:e=>S(Number(e.target.value)),hint:t("setup.badges.calc.max_help")})]}),p.jsxs("div",{className:"mt-4 rounded-[var(--radius-md)] border border-[var(--color-info)]/20 bg-[var(--color-info-soft)] p-3",children:[p.jsx("h5",{className:"mb-2 [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:t("setup.badges.calc.example_header")}),p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text)]",children:t("setup.badges.calc.example_text",{badges:$,divisor:N,rawBadges:L,min:w,max:C,price:j.toFixed(2)})})]})]}),p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h4",{className:"[font-size:var(--text-base)] font-medium text-[var(--color-text)]",children:t("setup.badges.requests.header")}),p.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[p.jsx(M,{id:"badgeRequestsClosed",name:"badgeRequestsClosed",checked:v,onChange:f}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:t("setup.badges.requests.close")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t("setup.badges.requests.close_help")})]})]})]}),P&&p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h4",{className:"mb-2 [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:t("setup.badges.preview.header",{locale:o.toUpperCase()})}),p.jsx("div",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)] whitespace-pre-wrap",children:P})]})]})},Zr=e=>"string"==typeof e?{nl:e}:e||{},Xr=e=>{const t={};return Object.entries(e).forEach((([e,a])=>{a&&""!==a.trim()&&(t[e]=a)})),t},Qr=(e,t)=>"string"==typeof e?"nl"===t?e:"":(null==e?void 0:e[t])||"",en=()=>{const{t:e}=T("projects"),{currentUser:t}=K(),[a,s]=h.useState([]),[r,n]=h.useState(!0),[i,l]=h.useState(!1),[o,u]=h.useState("nl"),[x,b]=h.useState(null),[v,f]=h.useState(null),[j,y]=h.useState(null),[N,_]=h.useState(!1),w=Se(),k=U((e=>e.tenantId)),{id:C}=g();h.useEffect((()=>{m(null,null,(function*(){if(C)try{n(!0);const e=zt(),t=ft(e,`projects/${C}`),a=yield jt(t);if(a.exists()){const e=a.data(),t=(e.projectDeadlines||[]).map((e=>({id:e.id,kenmerk:"string"==typeof e.kenmerk?{nl:e.kenmerk}:e.kenmerk||{},omschrijving:"string"==typeof e.omschrijving?{nl:e.omschrijving}:e.omschrijving||{},datum:e.datum||""})));s(t)}else s([])}catch(t){A.error(e("setup.deadlines.messages.load_error"))}finally{n(!1)}else n(!1)}))}),[k,C,e]);const S=h.useCallback(((r,n)=>m(null,null,(function*(){if(!C)return void A.error(e("setup.deadlines.messages.no_project_selected"));const i=o,l=a.find((e=>e.id===r));if(!l)return;const u=Zr(l[n]);let m="nl";u.nl&&""!==u.nl.trim()||(m=u.en&&""!==u.en.trim()?"en":u.de&&""!==u.de.trim()?"de":void 0);const p=m&&u[m]||"";if(p&&""!==p.trim())if(m!==i)try{b(`${r}:${n}`);const l=pe(xe,"translateText",{timeout:3e5}),o=(yield l({text:p,targetLang:i,sourceLang:m,projectId:C})).data;if(!o||"success"!==o.status||!o.translated)throw new Error("Translation failed");const x=a.map((e=>{if(e.id!==r)return e;const t=c(d({},u),{[i]:o.translated});return c(d({},e),{[n]:t})}));s(x);const h=zt(),g=ft(h,`projects/${C}`),v=x.map((e=>({id:e.id,kenmerk:Xr(Zr(e.kenmerk)),omschrijving:Xr(Zr(e.omschrijving)),datum:e.datum||""})));yield yt(g,{projectDeadlines:v,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0}),A.success(e("setup.deadlines.messages.translate_saved"))}catch(x){A.error(e("setup.deadlines.messages.translate_error"))}finally{b(null)}else A.error(e("setup.deadlines.messages.translate_same_lang"));else A.error(e("setup.deadlines.messages.translate_no_source"))}))),[o,a,C,t,e]),z=h.useCallback(((r,n="missing")=>m(null,null,(function*(){if(!C)return void A.error(e("setup.deadlines.messages.no_project_selected"));if(null!==x||null!==v)return;if("overwrite"===n){if(!(yield w({title:e("setup.deadlines.messages.batch_overwrite_confirm_title"),description:e("setup.deadlines.messages.batch_overwrite_confirm_desc",{locale:r.toUpperCase()}),variant:"danger",confirmLabel:e("setup.deadlines.messages.batch_overwrite_confirm_label")})))return}const i=[];
2if(a.forEach((e=>{["kenmerk","omschrijving"].forEach((t=>{const a=Zr(e[t]);if("missing"===n){const e=a[r];if(e&&""!==e.trim())return}let s="nl";if(a.nl&&""!==a.nl.trim()||(s=a.en&&""!==a.en.trim()?"en":a.de&&""!==a.de.trim()?"de":void 0),!s||s===r)return;const l=a[s]||"";l.trim()&&i.push({id:e.id,field:t,sourceLang:s,sourceText:l})}))})),0===i.length)return void A.info(e("setup.deadlines.messages.batch_translate_none"));f(r),y({done:0,total:i.length});let l=a,o=0,u=0;const m=pe(xe,"translateText",{timeout:3e5});for(const e of i)try{const t=(yield m({text:e.sourceText,targetLang:r,sourceLang:e.sourceLang,projectId:C})).data;if(!t||"success"!==t.status||!t.translated)throw new Error("Translation failed");l=l.map((a=>{if(a.id!==e.id)return a;const s=c(d({},Zr(a[e.field])),{[r]:t.translated});return c(d({},a),{[e.field]:s})})),s(l)}catch(p){o+=1}finally{u+=1,y({done:u,total:i.length})}try{const e=zt(),a=ft(e,`projects/${C}`),s=l.map((e=>({id:e.id,kenmerk:Xr(Zr(e.kenmerk)),omschrijving:Xr(Zr(e.omschrijving)),datum:e.datum||""})));yield yt(a,{projectDeadlines:s,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0})}catch(p){A.error(e("setup.deadlines.messages.save_error"))}finally{f(null),y(null)}o>0?A.error(e("setup.deadlines.messages.batch_translate_partial",{count:o})):A.success(e("setup.deadlines.messages.batch_translate_done"))}))),[v,w,t,a,C,e,x]),I=h.useCallback((()=>m(null,null,(function*(){if(C)try{l(!0);const s=zt(),r=ft(s,`projects/${C}`),n=a.map((e=>({id:e.id,kenmerk:Xr(Zr(e.kenmerk)),omschrijving:Xr(Zr(e.omschrijving)),datum:e.datum||""})));yield yt(r,{projectDeadlines:n,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0}),A.success(e("setup.deadlines.messages.saved_success"))}catch(s){A.error(e("setup.deadlines.messages.save_error"))}finally{l(!1)}else A.error(e("setup.deadlines.messages.no_project_selected"))}))),[a,C,t,e]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!C,onClick:I,children:e("setup.save_button")}),[i,C,I,e]);const P=(e,t,a,r)=>{s((s=>s.map((s=>{if(s.id!==e)return s;const n=Zr(s[t]);return c(d({},s),{[t]:c(d({},n),{[a]:r})})}))))};return r?p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.deadlines.header")}),p.jsxs("div",{className:"mt-4 flex items-center gap-2 text-[var(--color-text-muted)]",children:[p.jsx(_e,{size:"sm"}),p.jsx("span",{className:"[font-size:var(--text-sm)]",children:e("setup.loading")})]})]}):p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[!C&&p.jsx("div",{role:"status",className:"mb-4 rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.deadlines.missing_project_id")}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-danger-soft)] p-3",children:p.jsx($t,{size:20,strokeWidth:1.5,className:"text-[var(--color-danger)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.deadlines.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.deadlines.desc")})]})]}),p.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.deadlines.language_label")}),p.jsx(Ce,{size:"sm",value:o,onChange:u,"aria-label":e("setup.deadlines.language_label"),items:[{value:"nl",label:"NL"},{value:"en",label:"EN"},{value:"de",label:"DE"}]}),p.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-3",children:[v&&j&&p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.deadlines.messages.batch_translate_progress",{done:j.done,total:j.total})}),p.jsxs("label",{className:"flex items-center gap-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[p.jsx(M,{id:"deadlines-overwrite-mode",name:"deadlines-overwrite-mode",checked:N,onChange:_,disabled:null!==v}),e("setup.deadlines.overwrite_toggle_label")]}),["en","de"].map((t=>p.jsx(V,{type:"button",variant:N?"danger":"secondary",size:"sm",icon:p.jsx(ra,{size:14,strokeWidth:1.5}),loading:v===t,disabled:!C||null!==x||null!==v,onClick:()=>z(t,N?"overwrite":"missing"),children:e(N?"setup.deadlines.translate_all_over
2write_button":"setup.deadlines.translate_all_button",{locale:t.toUpperCase()})},t)))]})]}),p.jsxs("div",{className:"mt-6 space-y-4",children:[a.map((t=>p.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:p.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[p.jsxs("div",{className:"flex items-end gap-2",children:[p.jsx("div",{className:"flex-1",children:p.jsx(he,{label:e("setup.deadlines.fields.kenmerk_label"),type:"text",inputSize:"sm",placeholder:e("setup.deadlines.fields.kenmerk_placeholder_localized",{locale:o.toUpperCase()}),value:Qr(t.kenmerk,o),onChange:e=>P(t.id,"kenmerk",o,e.target.value)})}),p.jsx($,{"aria-label":e("setup.deadlines.translate_kenmerk_title",{locale:o.toUpperCase()}),title:e("setup.deadlines.translate_kenmerk_title",{locale:o.toUpperCase()}),variant:"secondary",size:"sm",loading:x===`${t.id}:kenmerk`,disabled:x===`${t.id}:kenmerk`||!C,icon:p.jsx(ra,{size:14,strokeWidth:1.5}),onClick:()=>S(t.id,"kenmerk")})]}),p.jsxs("div",{className:"flex items-end gap-2",children:[p.jsx("div",{className:"flex-1",children:p.jsx(he,{label:e("setup.deadlines.fields.omschrijving_label"),type:"text",inputSize:"sm",placeholder:e("setup.deadlines.fields.omschrijving_placeholder_localized",{locale:o.toUpperCase()}),value:Qr(t.omschrijving,o),onChange:e=>P(t.id,"omschrijving",o,e.target.value)})}),p.jsx($,{"aria-label":e("setup.deadlines.translate_omschrijving_title",{locale:o.toUpperCase()}),title:e("setup.deadlines.translate_omschrijving_title",{locale:o.toUpperCase()}),variant:"secondary",size:"sm",loading:x===`${t.id}:omschrijving`,disabled:x===`${t.id}:omschrijving`||!C,icon:p.jsx(ra,{size:14,strokeWidth:1.5}),onClick:()=>S(t.id,"omschrijving")})]}),p.jsxs("div",{className:"flex items-end gap-2",children:[p.jsx("div",{className:"flex-1",children:p.jsx(he,{label:e("setup.deadlines.fields.date_label"),type:"date",inputSize:"sm",value:t.datum,onChange:e=>{return a=t.id,r="datum",n=e.target.value,void s((e=>e.map((e=>e.id===a?c(d({},e),{[r]:n}):e))));var a,r,n}})}),p.jsx($,{"aria-label":e("setup.deadlines.remove_title"),title:e("setup.deadlines.remove_title"),variant:"ghost",size:"sm",icon:p.jsx(O,{size:14,className:"text-[var(--color-danger)]"}),onClick:()=>{return e=t.id,void s((t=>t.filter((t=>t.id!==e))));var e}})]})]})},t.id))),0===a.length&&p.jsx("div",{className:"rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] py-8 text-center [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.deadlines.empty_list_text")})]}),p.jsx("div",{className:"mt-6",children:p.jsx(V,{type:"button",variant:"secondary",size:"md",onClick:()=>{s((e=>[...e,{id:Date.now().toString(),kenmerk:{nl:""},omschrijving:{nl:""},datum:""}]))},children:e("setup.deadlines.add_button")})}),a.length>0&&p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h4",{className:"mb-3 [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.deadlines.preview.header_localized",{locale:o.toUpperCase()})}),p.jsx("div",{className:"space-y-2",children:a.filter((e=>Qr(e.kenmerk,o)&&e.datum)).sort(((e,t)=>new Date(e.datum).getTime()-new Date(t.datum).getTime())).map((e=>p.jsxs("div",{className:"flex items-center justify-between gap-3 [font-size:var(--text-sm)]",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-[var(--color-text)]",children:Qr(e.kenmerk,o)}),Qr(e.omschrijving,o)&&p.jsxs("span",{className:"ml-2 text-[var(--color-text-muted)]",children:["- ",Qr(e.omschrijving,o)]})]}),p.jsx("span",{className:"text-[var(--color-text-muted)] tabular-nums",children:new Date(e.datum).toLocaleDateString("nl"===o?"nl-NL":"de"===o?"de-DE":"en-GB")})]},e.id)))})]})]})},tn=()=>{const{currentUser:e}=K(),t=U((e=>e.tenantId)),{id:a}=g(),s=!1,[r,n]=h.useState([]),[i,l]=h.useState(!1),[o,d]=h.useState(null),[c,u]=h.useState(""),[x,b]=h.useState(!1),[v,f]=h.useState(!1),[j,y]=h.useState(null),[N,_]=h.useState(null);h.useEffect((()=>{m(null,null,(function*(){const a=(null==e?void 0:e.isSuperAdmin)?null:t||(null==e?void 0:e.tenantId)||null;if(e)if(e.isSuperAdmin||a){l(!0),d(null);try{const e=yield Y(a);n(e)}catch(s){d("Projecten laden is mislukt. Probeer de pagina opnieuw te openen.")}finally{l(!1)}}else d("Geen tenant gevonden. Daardoor kunnen projecten niet worden geladen.")}))}),[e,t]);const w=h.useMemo((()=>r.filter((e=>e.id!==a))),[r,a]);h.useEffect((()=>{w.length?u((e=>e&&w.some((t=>
2t.id===e))?e:w[0].id)):u("")}),[w]);const k=h.useMemo((()=>w.find((e=>e.id===c))||null),[w,c]);return p.jsxs("div",{className:"rounded-lg bg-slate-50 border border-slate-200 p-4",children:[p.jsx("h3",{className:"text-base font-semibold text-slate-900 mb-2",children:"Participation Information dupliceren"}),p.jsx("p",{className:"text-sm text-slate-600 mb-4",children:"Kopieer de Participation Information van een ander project naar dit huidige project."}),i&&p.jsx("div",{className:"rounded bg-blue-50 text-blue-700 text-sm p-3 mb-3",children:"Projecten laden..."}),o&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3 mb-3",children:o}),s,p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"sourceParticipationProjectId",className:"block text-sm font-medium text-slate-900 mb-1",children:"Bronproject"}),p.jsxs("select",{id:"sourceParticipationProjectId",value:c,onChange:e=>u(e.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm",disabled:v||i||0===w.length,children:[p.jsx("option",{value:"",children:"Selecteer bronproject"}),w.map((e=>p.jsx("option",{value:e.id,children:e.name},e.id)))]}),0===w.length&&p.jsx("p",{className:"text-xs text-amber-700 mt-1",children:"Geen ander project beschikbaar als bronproject."})]}),p.jsxs("label",{className:"flex items-start gap-2 text-sm text-slate-700",children:[p.jsx("input",{type:"checkbox",checked:x,onChange:e=>b(e.target.checked),className:"mt-1 h-4 w-4 rounded border-gray-300",disabled:v}),p.jsx("span",{children:"Ik bevestig dat ik de huidige Participation Information wil overschrijven met de gegevens uit het bronproject."})]}),j&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3",children:j}),N&&p.jsx("div",{className:"rounded bg-green-50 text-green-700 text-sm p-3",children:N}),p.jsx("div",{className:"flex justify-end",children:p.jsx(J,{onClick:()=>m(null,null,(function*(){if(y(null),_(null),a)if(c.trim())if(c.trim()!==a.trim())if(x){f(!0);try{const e=yield er({sourceProjectId:c.trim(),targetProjectId:a.trim()});_(`Participation Information gedupliceerd (${e.copiedItemsCount} items) vanuit ${(null==k?void 0:k.name)||e.sourceProjectId}.`),b(!1)}catch(e){y(e instanceof Error?e.message:"Duplicatie van Participation Information is mislukt. Probeer opnieuw.")}finally{f(!1)}}else y("Bevestig eerst dat je de Participation Information wilt dupliceren.");else y("Bron- en doelproject moeten verschillend zijn.");else y("Selecteer een bronproject.");else y("Geen doelproject gevonden in je sessie.")})),disabled:v||i||!!o||!c||!a||!x,loading:v,children:"Dupliceer Participation Information"})})]})]})},an=[{value:"exhibitor",tKey:"setup.participation.role_access.exhibitor"},{value:"presenter",tKey:"setup.participation.role_access.presenter"},{value:"supplier",tKey:"setup.participation.role_access.supplier"}],sn=e=>"string"==typeof e?{nl:e}:e||{},rn=e=>{const t={};return Object.entries(e).forEach((([e,a])=>{a&&""!==a.trim()&&(t[e]=a)})),t},nn=(e,t)=>"string"==typeof e?"nl"===t?e:"":(null==e?void 0:e[t])||"",ln=()=>{const{t:e}=T("projects"),{currentUser:t}=K(),[a,s]=h.useState([]),[r,n]=h.useState(!0),[i,l]=h.useState(!1),[o,u]=h.useState(new Set),[x,b]=h.useState("nl"),[v,f]=h.useState(null),[j,y]=h.useState(null),[N,_]=h.useState(null),[w,k]=h.useState(!1),C=Se(),S=U((e=>e.tenantId)),{id:z}=g(),I=!1;h.useEffect((()=>{m(null,null,(function*(){if(z)try{n(!0);const e=zt(),t=ft(e,`projects/${z}`),a=yield jt(t);if(a.exists()){const e=a.data(),t=(e.participationInfo||[]).map((e=>{let t=e.allowedRoles||["exhibitor","presenter","supplier"];return Array.isArray(t)&&(t=t.map((e=>"spreker"===e?"presenter":e))),{id:e.id,titel:"string"==typeof e.titel?{nl:e.titel}:e.titel||{},omschrijving:"string"==typeof e.omschrijving?{nl:e.omschrijving}:e.omschrijving||{},actief:Boolean(e.actief),volgorde:"number"==typeof e.volgorde?e.volgorde:0,allowedRoles:t}}));s(t.sort(((e,t)=>e.volgorde-t.volgorde)))}else s([])}catch(t){A.error(e("setup.participation.messages.load_error"))}finally{n(!1)}else n(!1)}))}),[S,z,I,e]);const P=h.useCallback(((r,n)=>m(null,null,(function*(){if(!z)return void A.error(e("setup.participation.messages.no_project_selected"));const i=x,l=a.find((e=>e.id===r));if(!l)return;const o=sn(l[n]);let u="nl";o.nl&&""!==o.nl.trim()||(u=o.en&&""!==o.en.trim()?"en":o.de&&""!==o.de.trim()?"de":void 0);const m=u&&o[u]||"";if(m&&""!==m.trim())if(u!==i)try{f(`${r}:${n}`);const l=pe(xe,"translateText",{timeout:3e5}),p=(yield l({text:m,targetLang:i,sourceLang:u,projectId:z})).data;if(!p||"success"!==p.status||!p.translated)throw new Error("Translation failed");const x=a.map((e=>{if(e.id!==r)return e;const t=c(d({},o),{[i]:p.translated});return c(d({},e),{[n]:t})}));s(x);const h=zt(),g=ft(h,`projects/${z}`),b=x.map((e=>({id:e.id,titel:rn(sn(e.titel)),omschrijving:rn(sn(e.omschrijving)),actief:e.actief,volgorde:e.volgorde,allowedRoles:e.allowedRoles||["exhibitor","presenter","supplier"]})));yield yt(g,{participationInfo:b,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0}),A.success(e("setup.participation.messages.translate_saved"))}catch(p){A.error(e("setup.participation.messages.translate_error"))}finally{f(null)}else A.error(e("setup.participation.messages.translate_same_lang"));else A.error(e("setup.participation.messages.translate_no_source"))}))),[x,I,a,z,t,e]),D=h.useCallback(((r,n="missing")=>m(null,null,(function*(){if(!z)return void A.error(e("setup.participation.messages.no_project_selected"));if(null!==v||null!==j)return;if("overwrite"===n){if(!(yield C({title:e("setup.participation.messages.batch_overwrite_confirm_title"),description:e("setup.participation.messages.batch_overwrite_confirm_desc",{locale:r.toUpperCase()}),variant:"danger",confirmLabel:e("setup.participation.messages.batch_overwrite_confirm_label")})))return}const i=[];
2if(a.forEach((e=>{["titel","omschrijving"].forEach((t=>{const a=sn(e[t]);if("missing"===n){const e=a[r];if(e&&""!==e.trim())return}let s="nl";if(a.nl&&""!==a.nl.trim()||(s=a.en&&""!==a.en.trim()?"en":a.de&&""!==a.de.trim()?"de":void 0),!s||s===r)return;const l=a[s]||"";l.trim()&&i.push({id:e.id,field:t,sourceLang:s,sourceText:l})}))})),0===i.length)return void A.info(e("setup.participation.messages.batch_translate_none"));y(r),_({done:0,total:i.length});let l=a,o=0,u=0;const m=pe(xe,"translateText",{timeout:3e5});for(const e of i)try{const t=(yield m({text:e.sourceText,targetLang:r,sourceLang:e.sourceLang,projectId:z})).data;if(!t||"success"!==t.status||!t.translated)throw new Error("Translation failed");l=l.map((a=>{if(a.id!==e.id)return a;const s=c(d({},sn(a[e.field])),{[r]:t.translated});return c(d({},a),{[e.field]:s})})),s(l)}catch(p){o+=1}finally{u+=1,_({done:u,total:i.length})}try{const e=zt(),a=ft(e,`projects/${z}`),s=l.map((e=>({id:e.id,titel:rn(sn(e.titel)),omschrijving:rn(sn(e.omschrijving)),actief:e.actief,volgorde:e.volgorde,allowedRoles:e.allowedRoles||["exhibitor","presenter","supplier"]})));yield yt(a,{participationInfo:s,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0})}catch(p){A.error(e("setup.participation.messages.save_error"))}finally{y(null),_(null)}o>0?A.error(e("setup.participation.messages.batch_translate_partial",{count:o})):A.success(e("setup.participation.messages.batch_translate_done"))}))),[j,C,t,I,a,z,e,v]),B=h.useCallback((()=>m(null,null,(function*(){if(z)try{l(!0);const s=zt(),r=ft(s,`projects/${z}`),n=a.map((e=>({id:e.id,titel:rn(sn(e.titel)),omschrijving:rn(sn(e.omschrijving)),actief:e.actief,volgorde:e.volgorde,allowedRoles:e.allowedRoles||["exhibitor","presenter","supplier"]})));yield yt(r,{participationInfo:n,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0}),A.success(e("setup.participation.messages.saved_success"))}catch(s){A.error(e("setup.participation.messages.save_error"))}finally{l(!1)}else A.error(e("setup.participation.messages.no_project_selected"))}))),[a,z,I,t,e]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!z||I,onClick:B,children:e("setup.save_button")}),[i,z,I,B,e]);const L=(e,t,a)=>{s((s=>s.map((s=>s.id===e?c(d({},s),{[t]:a}):s))))},F=(e,t,a,r)=>{s((s=>s.map((s=>{if(s.id!==e)return s;const n=sn(s[t]);return c(d({},s),{[t]:c(d({},n),{[a]:r})})}))))},W=(e,t)=>{const r=e+t;if(r<0||r>=a.length)return;const n=[...a];[n[e],n[r]]=[n[r],n[e]],s(n.map(((e,t)=>c(d({},e),{volgorde:t}))))};return r?p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.participation.header")}),p.jsxs("div",{className:"mt-4 flex items-center gap-2 text-[var(--color-text-muted)]",children:[p.jsx(_e,{size:"sm"}),p.jsx("span",{className:"[font-size:var(--text-sm)]",children:e("setup.loading")})]})]}):p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[I,!z&&p.jsx("div",{role:"status",className:"mb-4 rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.participation.missing_project_id")}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-info-soft)] p-3",children:p.jsx(ve,{size:20,strokeWidth:1.5,className:"text-[var(--color-info)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.participation.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.participation.desc")})]})]}),p.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.participation.language_label")}),p.jsx(Ce,{size:"sm",value:x,onChange:b,"aria-label":e("setup.participation.language_label"),items:[{value:"nl",label:"NL"},{value:"en",label:"EN"},{value:"de",label:"DE"}]}),p.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-3",children:[j&&N&&p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.participation.messages.batch_translate_progress",{done:N.done,total:N.total})}),p.jsxs("label",{className:"flex items-center gap-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[p.jsx(M,{id:"participation-overwrite-mode",name:"participation-overwrite-mode",checked:w,onChange:k,disabled:null!==j}),e("setup.participation.overwrite_toggle_label")]}),["en","de"].map((t=>p.jsx(V,{type:"button",variant:w?"danger":"secondary",size:"sm",icon:p.jsx(ra,{size:14,strokeWidth:1.5}),loading:j===t,disabled:!z||null!==v||null!==j,onClick:()=>D(t,w?"overwrite":"missing"),children:e(w?"setup.participation.translate_all_over
2write_button":"setup.participation.translate_all_button",{locale:t.toUpperCase()})},t)))]})]}),p.jsxs("div",{className:"mt-6 space-y-4",children:[a.map(((t,r)=>{const n=o.has(t.id);return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)]",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-[var(--color-border)] bg-[var(--color-bg)] p-3",children:[p.jsxs("div",{className:"flex flex-col",children:[p.jsx($,{"aria-label":e("setup.participation.fields.order_up_title"),title:e("setup.participation.fields.order_up_title"),variant:"ghost",size:"sm",icon:p.jsx(ze,{size:14,className:"rotate-180"}),disabled:0===r,onClick:()=>W(r,-1)}),p.jsx($,{"aria-label":e("setup.participation.fields.order_down_title"),title:e("setup.participation.fields.order_down_title"),variant:"ghost",size:"sm",icon:p.jsx(ze,{size:14}),disabled:r===a.length-1,onClick:()=>W(r,1)})]}),p.jsx("div",{className:"min-w-[200px] flex-1",children:p.jsx(he,{type:"text",inputSize:"sm",placeholder:e("setup.participation.fields.title_placeholder",{locale:x.toUpperCase()}),value:nn(t.titel,x),onChange:e=>F(t.id,"titel",x,e.target.value)})}),p.jsx($,{"aria-label":e("setup.participation.translate_title",{locale:x.toUpperCase()}),title:e("setup.participation.translate_title",{locale:x.toUpperCase()}),variant:"secondary",size:"sm",loading:v===`${t.id}:titel`,disabled:v===`${t.id}:titel`||!z,icon:p.jsx(ra,{size:14,strokeWidth:1.5}),onClick:()=>P(t.id,"titel")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(M,{id:`actief-${t.id}`,name:`actief-${t.id}`,checked:t.actief,onChange:e=>L(t.id,"actief",e)}),p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.participation.fields.active_label")})]}),p.jsx($,{"aria-label":e(n?"setup.participation.collapse_title":"setup.participation.expand_title"),title:e(n?"setup.participation.collapse_title":"setup.participation.expand_title"),variant:"ghost",size:"sm",icon:p.jsx(ze,{size:14,className:"transition-transform "+(n?"rotate-180":"")}),onClick:()=>{return e=t.id,void u((t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a}));var e}}),p.jsx($,{"aria-label":e("setup.participation.remove_title"),title:e("setup.participation.remove_title"),variant:"ghost",size:"sm",icon:p.jsx(O,{size:14,className:"text-[var(--color-danger)]"}),onClick:()=>{return e=t.id,s((t=>t.filter((t=>t.id!==e)))),void u((t=>{const a=new Set(t);return a.delete(e),a}));var e}})]}),n&&p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"border-b border-[var(--color-border)] pb-4",children:[p.jsx("span",{className:"mb-3 block [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.participation.role_access.label")}),p.jsx("div",{className:"flex flex-wrap gap-4",children:an.map((a=>{var s,r;return p.jsx(H,{label:e(a.tKey),checked:null==(r=null==(s=t.allowedRoles)?void 0:s.includes(a.value))||r,onChange:e=>{const s=t.allowedRoles||["exhibitor","presenter","supplier"],r=e.target.checked?[...s,a.value]:s.filter((e=>e!==a.value));L(t.id,"allowedRoles",r)}},a.value)}))}),p.jsx("p",{className:"mt-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.participation.role_access.help")})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.participation.fields.description_label",{locale:x.toUpperCase()})}),p.jsx($,{"aria-label":e("setup.participation.translate_description",{locale:x.toUpperCase()}),title:e("setup.participation.translate_description",{locale:x.toUpperCase()}),variant:"secondary",size:"sm",loading:v===`${t.id}:omschrijving`,disabled:v===`${t.id}:omschrijving`||!z,icon:p.jsx(ra,{size:14,strokeWidth:1.5}),onClick:()=>P(t.id,"omschrijving")})]}),p.jsx(na,{value:nn(t.omschrijving,x),onChange:e=>F(t.id,"omschrijving",x,e),preset:"minimal",height:300,delayMount:!0})]})]},t.id)})),0===a.length&&p.jsx("div",{className:"rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] py-8 text-center [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.participation.empty_list_text")})]}),p.jsx("div",{className:"mt-6",children:p.jsx(V,{type:"button",variant:"secondary",size:"md",onClick:()=>{const e=a.length>0?Math.max(...a.map((e=>e.volgorde))):-1,t={id:Date.now().toString(),titel:{nl:""},omschrijving:{nl:""},actief:!0,volgorde:e+1,allowedRoles:["exhibitor","presenter","supplier"]};s((e=>[...e,t])),u((e=>new Set([...e,t.id])))},disabled:I,children:e("setup.participation.add_button")})}),a.filter((e=>e.actief&&nn(e.titel,x))).length>0&&p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h4",{className:"mb-3 [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.participation.preview.header_localized",{locale:x.toUpperCase()})}),p.jsx("div",{className:"space-y-3",children:a.filter((e=>e.actief&&nn(e.titel,x))).sort(((e,t)=>e.volgorde-t.volgorde)).map((e=>p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3",children:[p.jsx("h5",{className:"mb-2 font-medium text-[var(--color-text)]",children:nn(e.titel,x)}),nn(e.omschrijving,x)&&p.jsx("div",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",dangerouslySetInnerHTML:{__html:Ie.sanitize(nn(e.omschrijving,x))}})]},e.id)))})]}),p.jsx("div",{className:"mt-8 border-t border-[var(--color-border)] pt-6",children:p.jsx(tn,{})})]})},on=()=>{const{currentUser:e}=K(),t=U((e=>e.tenantId)),{id:a}=g(),[s,r]=h.useState([]),[n,i]=h.useState(!1),[l,o]=h.useState(null),[d,c]=h.useState(""),[u,x]=h.useState(!1),[b,v]=h.useState(!1),[f,j]=h.useState(null),[y,N]=h.useState(null);h.useEffect((()=>{m(null,null,(function*(){const a=(null==e?void 0:e.isSuperAdmin)?null:t||(null==e?void 0:e.tenantId)||null;if(e)if(e.isSuperAdmin||a){i(!0),o(null);try{const e=yield Y(a);r(e)}catch(s){o("Projecten laden is mislukt. Probeer de pagina opnieuw te openen.")}finally{i(!1)}}else o("Geen tenant gevonden. Daardoor kunnen projecten niet worden geladen.")}))}),[e,t]);const _=h.useMemo((()=>s.filter((e=>e.id!==a))),[s,a]);h.useEffect((()=>{_.length?c((e=>e&&_.some((t=>
2t.id===e))?e:_[0].id)):c("")}),[_]);const w=h.useMemo((()=>_.find((e=>e.id===d))||null),[_,d]);return p.jsxs("div",{className:"rounded-lg bg-slate-50 border border-slate-200 p-4",children:[p.jsx("h3",{className:"text-base font-semibold text-slate-900 mb-2",children:"Algemene Voorwaarden dupliceren"}),p.jsx("p",{className:"text-sm text-slate-600 mb-4",children:"Kopieer de Algemene Voorwaarden van een ander project naar dit huidige project."}),n&&p.jsx("div",{className:"rounded bg-blue-50 text-blue-700 text-sm p-3 mb-3",children:"Projecten laden..."}),l&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3 mb-3",children:l}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"sourceTermsProjectId",className:"block text-sm font-medium text-slate-900 mb-1",children:"Bronproject"}),p.jsxs("select",{id:"sourceTermsProjectId",value:d,onChange:e=>c(e.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm",disabled:b||n||0===_.length,children:[p.jsx("option",{value:"",children:"Selecteer bronproject"}),_.map((e=>p.jsx("option",{value:e.id,children:e.name},e.id)))]}),0===_.length&&p.jsx("p",{className:"text-xs text-amber-700 mt-1",children:"Geen ander project beschikbaar als bronproject."})]}),p.jsxs("label",{className:"flex items-start gap-2 text-sm text-slate-700",children:[p.jsx("input",{type:"checkbox",checked:u,onChange:e=>x(e.target.checked),className:"mt-1 h-4 w-4 rounded border-gray-300",disabled:b}),p.jsx("span",{children:"Ik bevestig dat ik de huidige Algemene Voorwaarden wil overschrijven met de gegevens uit het bronproject."})]}),f&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3",children:f}),y&&p.jsx("div",{className:"rounded bg-green-50 text-green-700 text-sm p-3",children:y}),p.jsx("div",{className:"flex justify-end",children:p.jsx(J,{onClick:()=>m(null,null,(function*(){if(j(null),N(null),a)if(d.trim())if(d.trim()!==a.trim())if(u){v(!0);try{const e=yield ar({sourceProjectId:d.trim(),targetProjectId:a.trim()});N(`Algemene Voorwaarden gedupliceerd (${e.copiedItemsCount} items) vanuit ${(null==w?void 0:w.name)||e.sourceProjectId}.`),x(!1)}catch(e){j(e instanceof Error?e.message:"Duplicatie van Algemene Voorwaarden is mislukt. Probeer opnieuw.")}finally{v(!1)}}else j("Bevestig eerst dat je de Algemene Voorwaarden wilt dupliceren.");else j("Bron- en doelproject moeten verschillend zijn.");else j("Selecteer een bronproject.");else j("Geen doelproject gevonden in je sessie.")})),disabled:b||n||!!l||!d||!a||!u,loading:b,children:"Dupliceer Algemene Voorwaarden"})})]})]})},dn=e=>"string"==typeof e?{nl:e}:e||{},cn=e=>{const t={};return Object.entries(e).forEach((([e,a])=>{a&&""!==a.trim()&&(t[e]=a)})),t},un=(e,t)=>"string"==typeof e?"nl"===t?e:"":(null==e?void 0:e[t])||"",mn=()=>{const{t:e}=T("projects"),{currentUser:t}=K(),[a,s]=h.useState([]),[r,n]=h.useState(!0),[i,l]=h.useState(!1),[o,u]=h.useState(new Set),[x,b]=h.useState("nl"),[v,f]=h.useState(null),[j,y]=h.useState(null),[N,_]=h.useState(!1),w=Se(),k=U((e=>e.tenantId)),{id:C}=g();h.useEffect((()=>{m(null,null,(function*(){if(C)try{n(!0);const e=zt(),t=ft(e,`projects/${C}`),a=yield jt(t);if(a.exists()){const e=a.data(),t=(e.termsConditions||[]).map((e=>({id:e.id,titel:"string"==typeof e.titel?{nl:e.titel}:e.titel||{},omschrijving:"string"==typeof e.omschrijving?{nl:e.omschrijving}:e.omschrijving||{},actief:Boolean(e.actief),volgorde:"number"==typeof e.volgorde?e.volgorde:0})));s(t.sort(((e,t)=>e.volgorde-t.volgorde)))}else s([])}catch(t){A.error(e("setup.terms.messages.load_error"))}finally{n(!1)}else n(!1)}))}),[k,C,e]);const S=h.useCallback(((r,n="missing")=>m(null,null,(function*(){if(!C)return void A.error(e("setup.terms.messages.no_project_selected"));if(null!==v)return;if("overwrite"===n){if(!(yield w({title:e("setup.terms.messages.batch_overwrite_confirm_title"),description:e("setup.terms.messages.batch_overwrite_confirm_desc",{locale:r.toUpperCase()}),variant:"danger",confirmLabel:e("setup.terms.messages.batch_overwrite_confirm_label")})))return}const i=[];if(a.forEach((e=>{["titel","omschrijving"].forEach((t=>{const a=dn(e[t]);if("missing"===n){const e=a[r];if(e&&""!==e.trim())return}let s="nl";if(a.nl&&""!==a.nl.trim()||(s=a.en&&""!==a.en.trim()?"en":a.de&&""!==a.de.trim()?"de":void 0),!s||s===r)return;const l=a[s]||"";l.trim()&&i.push({id:e.id,field:t,sourceLang:s,sourceText:l})}))})),0===i.length)return void A.info(e("setup.terms.messages.batch_translate_none"));f(r),y({done:0,total:i.length});let l=a,o=0,u=0;const m=pe(xe,"translateText",{timeout:3e5});for(const e of i)try{const t=(yield m({text:e.sourceText,targetLang:r,sourceLang:e.sourceLang,projectId:C})).data;if(!t||"success"!==t.status||!t.translated)throw new Error("Translation failed");l=l.map((a=>
2{if(a.id!==e.id)return a;const s=c(d({},dn(a[e.field])),{[r]:t.translated});return c(d({},a),{[e.field]:s})})),s(l)}catch(p){o+=1}finally{u+=1,y({done:u,total:i.length})}try{const e=zt(),a=ft(e,`projects/${C}`),s=l.map((e=>({id:e.id,titel:cn(dn(e.titel)),omschrijving:cn(dn(e.omschrijving)),actief:e.actief,volgorde:e.volgorde})));yield yt(a,{termsConditions:s,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0})}catch(p){A.error(e("setup.terms.messages.save_error"))}finally{f(null),y(null)}o>0?A.error(e("setup.terms.messages.batch_translate_partial",{count:o})):A.success(e("setup.terms.messages.batch_translate_done"))}))),[v,w,t,a,C,e]),z=h.useCallback((()=>m(null,null,(function*(){if(C)try{l(!0);const s=zt(),r=ft(s,`projects/${C}`),n=a.map((e=>({id:e.id,titel:cn(dn(e.titel)),omschrijving:cn(dn(e.omschrijving)),actief:e.actief,volgorde:e.volgorde})));yield yt(r,{termsConditions:n,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0}),A.success(e("setup.terms.messages.saved_success"))}catch(s){A.error(e("setup.terms.messages.save_error"))}finally{l(!1)}else A.error(e("setup.terms.messages.no_project_selected"))}))),[a,C,t,e]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!C,onClick:z,children:e("setup.save_button")}),[i,C,z,e]);const I=(e,t,a,r)=>{s((s=>s.map((s=>{if(s.id!==e)return s;const n=dn(s[t]);return c(d({},s),{[t]:c(d({},n),{[a]:r})})}))))},P=(e,t)=>{const r=e+t;if(r<0||r>=a.length)return;const n=[...a];[n[e],n[r]]=[n[r],n[e]],s(n.map(((e,t)=>c(d({},e),{volgorde:t}))))};return r?p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.terms.header")}),p.jsxs("div",{className:"mt-4 flex items-center gap-2 text-[var(--color-text-muted)]",children:[p.jsx(_e,{size:"sm"}),p.jsx("span",{className:"[font-size:var(--text-sm)]",children:e("setup.loading")})]})]}):p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[!C&&p.jsx("div",{role:"status",className:"mb-4 rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.terms.missing_project_id")}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx(Pe,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.terms.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.terms.desc")})]})]}),p.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.terms.language_label")}),p.jsx(Ce,{size:"sm",value:x,onChange:b,"aria-label":e("setup.terms.language_label"),items:[{value:"nl",label:"NL"},{value:"en",label:"EN"},{value:"de",label:"DE"}]}),p.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-3",children:[v&&j&&p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.terms.messages.batch_translate_progress",{done:j.done,total:j.total})}),p.jsxs("label",{className:"flex items-center gap-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[p.jsx(M,{id:"terms-overwrite-mode",name:"terms-overwrite-mode",checked:N,onChange:_,disabled:null!==v}),e("setup.terms.overwrite_toggle_label")]}),["en","de"].map((t=>p.jsx(V,{type:"button",variant:N?"danger":"secondary",size:"sm",icon:p.jsx(ra,{size:14,strokeWidth:1.5}),loading:v===t,disabled:!C||null!==v,onClick:()=>S(t,N?"overwrite":"missing"),children:e(N?"setup.terms.translate_all_over
2write_button":"setup.terms.translate_all_button",{locale:t.toUpperCase()})},t)))]})]}),p.jsxs("div",{className:"mt-6 space-y-4",children:[a.map(((t,r)=>{const n=o.has(t.id);return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)]",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-[var(--color-border)] bg-[var(--color-bg)] p-3",children:[p.jsxs("div",{className:"flex flex-col",children:[p.jsx($,{"aria-label":e("setup.terms.fields.order_up_title"),title:e("setup.terms.fields.order_up_title"),variant:"ghost",size:"sm",icon:p.jsx(ze,{size:14,className:"rotate-180"}),disabled:0===r,onClick:()=>P(r,-1)}),p.jsx($,{"aria-label":e("setup.terms.fields.order_down_title"),title:e("setup.terms.fields.order_down_title"),variant:"ghost",size:"sm",icon:p.jsx(ze,{size:14}),disabled:r===a.length-1,onClick:()=>P(r,1)})]}),p.jsx("div",{className:"min-w-[200px] flex-1",children:p.jsx(he,{type:"text",inputSize:"sm",placeholder:e("setup.terms.fields.title_placeholder",{locale:x.toUpperCase()}),value:un(t.titel,x),onChange:e=>I(t.id,"titel",x,e.target.value)})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(M,{id:`actief-${t.id}`,name:`actief-${t.id}`,checked:t.actief,onChange:e=>{return a=t.id,r="actief",n=e,void s((e=>e.map((e=>e.id===a?c(d({},e),{[r]:n}):e))));var a,r,n}}),p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.terms.fields.active_label")})]}),p.jsx($,{"aria-label":e(n?"setup.terms.collapse_title":"setup.terms.expand_title"),title:e(n?"setup.terms.collapse_title":"setup.terms.expand_title"),variant:"ghost",size:"sm",icon:p.jsx(ze,{size:14,className:"transition-transform "+(n?"rotate-180":"")}),onClick:()=>{return e=t.id,void u((t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a}));var e}}),p.jsx($,{"aria-label":e("setup.terms.remove_title"),title:e("setup.terms.remove_title"),variant:"ghost",size:"sm",icon:p.jsx(O,{size:14,className:"text-[var(--color-danger)]"}),onClick:()=>{return e=t.id,s((t=>t.filter((t=>t.id!==e)))),void u((t=>{const a=new Set(t);return a.delete(e),a}));var e}})]}),n&&p.jsx("div",{className:"p-4",children:p.jsx(na,{value:un(t.omschrijving,x),onChange:e=>I(t.id,"omschrijving",x,e),label:e("setup.terms.fields.description_label",{locale:x.toUpperCase()}),preset:"minimal",height:300,delayMount:!0})})]},t.id)})),0===a.length&&p.jsx("div",{className:"rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] py-8 text-center [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.terms.empty_list_text")})]}),p.jsx("div",{className:"mt-6",children:p.jsx(V,{type:"button",variant:"secondary",size:"md",onClick:()=>{const e=a.length>0?Math.max(...a.map((e=>e.volgorde))):-1,t={id:Date.now().toString(),titel:{nl:""},omschrijving:{nl:""},actief:!0,volgorde:e+1};s((e=>[...e,t])),u((e=>new Set([...e,t.id])))},children:e("setup.terms.add_button")})}),a.filter((e=>e.actief&&un(e.titel,x))).length>0&&p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h4",{className:"mb-3 [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.terms.preview.header_localized",{locale:x.toUpperCase()})}),p.jsx("div",{className:"space-y-3",children:a.filter((e=>e.actief&&un(e.titel,x))).sort(((e,t)=>e.volgorde-t.volgorde)).map((e=>p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3",children:[p.jsx("h5",{className:"mb-2 font-medium text-[var(--color-text)]",children:un(e.titel,x)}),un(e.omschrijving,x)&&p.jsx("div",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",dangerouslySetInnerHTML:{__html:Ie.sanitize(un(e.omschrijving,x))}})]},e.id)))})]}),p.jsx("div",{className:"mt-8 border-t border-[var(--color-border)] pt-6",children:p.jsx(on,{})})]})},pn=e=>e.internalName||e.name_nl||e.sku,xn=da.filter((e=>"floor"===e.mount)).map((e=>({id:e.id,label:e.name.nl}))),hn=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(null),[r,n]=h.useState([]),[i,l]=h.useState(""),[o,u]=
2h.useState(!1),[x,b]=h.useState(!1),[v,f]=h.useState({});h.useEffect((()=>{if(!t)return;m(null,null,(function*(){var a;try{const e=yield jt(ft(W,`projects/${t}`));if(!e.exists())return;const r=e.data();s(null!=(a=r.tenantId)?a:null);const i=r.shellSchemeTypes;n(Array.isArray(i)?i:[])}catch(r){A.error(e("setup.error_fetch"))}}))}),[t,e]),h.useEffect((()=>{let e=!1;return r.length>0?m(null,null,(function*(){var t;const a={};for(const e of r)try{const s=yield la(e.productId);if(!(null==(t=null==s?void 0:s.bundleItems)?void 0:t.length)){a[e.id]=[];continue}const r=yield Promise.all(s.bundleItems.map((e=>m(null,null,(function*(){var t;const a=yield la(e.productId);return{productId:e.productId,sku:null!=(t=null==a?void 0:a.sku)?t:e.productId,label:a?`${pn(a)} (${a.sku})`:e.productId}})))));a[e.id]=r}catch(s){a[e.id]=[]}e||f(a)})):f({}),()=>{e=!0}}),[r]);const j=h.useCallback((()=>m(null,null,(function*(){const t=i.trim();if(t&&a)if(r.some((e=>e.sku.toUpperCase()===t.toUpperCase())))A.error(e("setup.floorplanBuilder.duplicate_sku",{sku:t}));else{u(!0);try{const s=yield ia(a,t);if(!s)return void A.error(e("setup.floorplanBuilder.sku_not_found",{sku:t}));n((e=>[...e,{id:q(),sku:s.sku,productId:s.id,name:pn(s)}])),l("")}catch(s){A.error(e("setup.error_fetch"))}finally{u(!1)}}}))),[i,a,r,e]),y=h.useCallback((e=>{n((t=>t.filter((t=>t.id!==e))))}),[]),N=h.useCallback(((e,t,a)=>{n((s=>s.map((s=>{var r;if(s.id!==e)return s;const n=null!=(r=s.drawItems)?r:[];return c(d({},s),a?{drawItems:[...n,{productId:t.productId,sku:t.sku,assetId:""}]}:{drawItems:n.filter((e=>e.productId!==t.productId))})}))))}),[]),_=h.useCallback(((e,t,a)=>{n((s=>s.map((s=>{var r;return s.id===e?c(d({},s),{drawItems:(null!=(r=s.drawItems)?r:[]).map((e=>e.productId===t?c(d({},e),{assetId:a}):e))}):s}))))}),[]),w=h.useCallback((()=>m(null,null,(function*(){if(t){b(!0);try{yield St(ft(W,`projects/${t}`),{shellSchemeTypes:r}),A.success(e("setup.success_save"))}catch(a){A.error(e("setup.error_save"))}finally{b(!1)}}}))),[t,r,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:x,disabled:x||!t,onClick:w,children:e("setup.save_button")}),[x,t,w,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx(De,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.floorplanBuilder.title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.floorplanBuilder.description")})]})]}),p.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("label",{htmlFor:"shellSchemeSku",className:"mb-1 block [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.floorplanBuilder.sku_label")}),p.jsx("input",{id:"shellSchemeSku",type:"text",value:i,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),j())},placeholder:e("setup.floorplanBuilder.sku_placeholder"),className:"block w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] px-3 py-2 [font-size:var(--text-sm)] text-[var(--color-text)] focus:border-[var(--color-accent)] focus:outline-none"})]}),p.jsx(V,{type:"button",variant:"secondary",size:"md",loading:o,disabled:o||!i.trim()||!a,onClick:j,children:e("setup.floorplanBuilder.add_button")})]}),0===r.length?p.jsx("div",{className:"rounded-[var(--radius-md)] bg-[var(--color-bg)] p-4 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.floorplanBuilder.empty")}):p.jsx("ul",{className:"space-y-3",children:r.map((t=>p.jsx("li",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("p",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:[t.name," ",p.jsxs("span",{className:"font-mono text-[var(--color-text-muted)]",children:["(",t.sku,")"]})]}),void 0===v[t.id]?p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.floorplanBuilder.loading_items")}):0===v[t.id].length?p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.floorplanBuilder.no_items")}):p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"mt-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.floorplanBuilder.draw_hint")}),p.jsx("ul",{className:"mt-2 space-y-2",children:v[t.id].map((a=>{var s;const r=(null!=(s=t.drawItems)?s:[]).find((e=>e.productId===a.productId));return p.jsxs("li",{className:"flex flex-wrap items-center gap-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[p.jsx(Be,{size:12,strokeWidth:1.5,className:"shrink-0"}),p.jsx("span",{className:"min-w-0 flex-1",children:a.label}),p.jsxs("label",{className:"flex shrink-0 items-center gap-1.5",children:[p.jsx("input",{type:"checkbox",checked:void 0!==r,onChange:e=>N(t.id,a,e.target.checked),className:"rounded text-[var(--color-accent)]"}),p.jsx("span",{children:e("setup.floorplanBuilder.draw_label")})]}),void 0!==r&&p.jsxs("select",{value:r.assetId,onChange:e=>_(t.id,a.productId,e.target.value),className:"shrink-0 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-2 py-1 [font-size:var(--text-xs)] text-[var(--color-text)]",children:[p.jsx("option",{value:"",children:e("setup.floorplanBuilder.draw_asset_placeholder")}),p.jsx("option",{value:oa,children:e("setup.floorplanBuilder.storage_room_option")}),xn.map((e=>p.jsx("option",{value:e.id,children:e.label},e.id)))]})]},a.productId)}))})]})]}),p.jsx("button",{type:"button",onClick:()=>y(t.id),className:"rounded-[var(--radius-md)] p-2 text-[var(--color-text-muted)] transition-colors hover:bg-[var(--color-surface)] hover:text-[var(--color-danger,#dc2626)]","aria-label":e("setup.floorplanBuilder.remove_button"),children:p.jsx(O,{size:16,strokeWidth:1.5})})]})},t.id)))})]})},gn={showParticipantNames:!0,showOptionNames:!0,showAvailableNames:!1,useNeutralColors:!1,enableBoothClick:!0,enableSearch:!0,show3DBoothButton:!0},bn=({id:e,label:t,help:a,checked:s,onChange:r,disabled:n})=>p.jsxs("div",{className:"flex flex-col gap-2 rounded-[var(--radius-md)] bg-[var(--color-bg)] p-3 sm:flex-row sm:items-start sm:justify-between",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:t}),p.jsx("p",{className:"mt-0.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:a})]}),p.jsx(M,{id:e,name:e,checked:s,onChange:r,disabled:n})]}),vn=({title:e,description:t,defaultOpen:a=!1,children:s})=>{const[r,n]=h.useState(a);return p.jsxs("div",{className:"overflow-hidden rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]",children:[p.jsxs("button",{type:"button",onClick:()=>n((e=>!e)),"aria-expanded":r,className:"flex w-full items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-[var(--color-bg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent-ring)] focu
2s-visible:ring-inset",children:[p.jsxs("span",{className:"min-w-0",children:[p.jsx("span",{className:"block [font-size:var(--text-base)] font-medium text-[var(--color-text)]",children:e}),t&&p.jsx("span",{className:"mt-0.5 block [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t})]}),p.jsx(ze,{size:18,strokeWidth:1.75,className:Te("shrink-0 text-[var(--color-text-muted)] transition-transform duration-[var(--duration-fast)]",r&&"rotate-180")})]}),r&&p.jsx("div",{className:"space-y-3 border-t border-[var(--color-border)] p-4",children:s})]})},fn=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(gn),[r,n]=h.useState(ca),[i,l]=h.useState(!1);h.useEffect((()=>{if(!t)return;m(null,null,(function*(){var a,r,i,l,o,d,c;try{const e=ft(W,`projects/${t}`),u=yield jt(e);if(u.exists()){const e=u.data(),t=e.floorplanViewerSettings;t&&s({showParticipantNames:null!=(a=t.showParticipantNames)?a:gn.showParticipantNames,showOptionNames:null!=(r=t.showOptionNames)?r:gn.showOptionNames,showAvailableNames:null!=(i=t.showAvailableNames)?i:gn.showAvailableNames,useNeutralColors:null!=(l=t.useNeutralColors)?l:gn.useNeutralColors,enableBoothClick:null!=(o=t.enableBoothClick)?o:gn.enableBoothClick,enableSearch:null!=(d=t.enableSearch)?d:gn.enableSearch,show3DBoothButton:null!=(c=t.show3DBoothButton)?c:gn.show3DBoothButton}),n(ua(e.floorplan3DViewerSettings))}}catch(u){A.error(e("setup.floorplanViewer.errors.load_settings"))}}))}),[t,e]);const o=h.useCallback((()=>m(null,null,(function*(){if(t){l(!0);try{const s=ft(W,`projects/${t}`);yield St(s,{floorplanViewerSettings:a,floorplan3DViewerSettings:r});const n=ft(W,`public_projects/${t}`);yield yt(n,{floorplanViewerSettings:a,floorplan3DViewerSettings:r},{merge:!0}),A.success(e("setup.floorplanViewer.success.saved"))}catch(s){A.error(e("setup.floorplanViewer.errors.save_settings"))}finally{l(!1)}}else A.error(e("setup.floorplanViewer.errors.no_project_id"))}))),[t,a,r,e]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i,onClick:o,children:e("setup.floorplanViewer.buttons.save")}),[i,o,e]);const u=e=>t=>s((a=>c(d({},a),{[e]:t}))),x=e=>t=>n((a=>c(d({},a),{[e]:t}))),b=e=>t=>n((a=>c(d({},a),{public:c(d({},a.public),{[e]:t})}))),v=e=>e?"text-[var(--color-success)]":"text-[var(--color-danger)]",f=r.enabled||r.enabledForSuppliers;return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.floorplanViewer.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.desc")}),p.jsx("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-info)]/20 bg-[var(--color-info-soft)] p-4 [font-size:var(--text-sm)] text-[var(--color-text)]",children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx(ve,{size:18,strokeWidth:1.5,className:"mt-0.5 flex-shrink-0 text-[var(--color-info)]"}),p.jsxs("div",{children:[p.jsx("h4",{className:"font-semibold",children:e("setup.floorplanViewer.infoBox.title")}),p.jsxs("div",{className:"mt-2 space-y-2",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:e("setup.floorplanViewer.infoBox.exhibitorDashboard.title")}),p.jsx("p",{className:"ml-4 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.infoBox.exhibitorDashboard.desc")})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:e("setup.floorplanViewer.infoBox.publicWebsite.t
2itle")}),p.jsx("p",{className:"ml-4 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.infoBox.publicWebsite.desc")})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:e("setup.floorplanViewer.infoBox.liveEffect.title")}),p.jsx("p",{className:"ml-4 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.infoBox.liveEffect.desc")})]})]})]})]})}),p.jsxs("form",{onSubmit:e=>{e.preventDefault(),o()},className:"mt-6 space-y-6",children:[p.jsxs(vn,{title:e("setup.floorplanViewer.sections.viewer2d.title"),description:e("setup.floorplanViewer.sections.viewer2d.desc"),defaultOpen:!0,children:[p.jsxs("div",{className:"space-y-3",children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold uppercase tracking-wide text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.namesSection.header")}),p.jsx(bn,{id:"showParticipantNames",label:e("setup.floorplanViewer.showParticipantNames.label"),help:e("setup.floorplanViewer.showParticipantNames.help"),checked:a.showParticipantNames,onChange:u("showParticipantNames"),disabled:i}),p.jsx(bn,{id:"showOptionNames",label:e("setup.floorplanViewer.showOptionNames.label"),help:e("setup.floorplanViewer.showOptionNames.help"),checked:a.showOptionNames,onChange:u("showOptionNames"),disabled:i}),p.jsx(bn,{id:"showAvailableNames",label:e("setup.floorplanViewer.showAvailableNames.label"),help:e("setup.floorplanViewer.showAvailableNames.help"),checked:a.showAvailableNames,onChange:u("showAvailableNames"),disabled:i})]}),p.jsxs("div",{className:"space-y-3 border-t border-[var(--color-border)] pt-4",children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold uppercase tracking-wide text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.interactivitySection.header")}),p.jsx(bn,{id:"enableBoothClick",label:e("setup.floorplanViewer.enableBoothClick.label"),help:e("setup.floorplanViewer.enableBoothClick.help"),checked:a.enableBoothClick,onChange:u("enableBoothClick"),disabled:i}),p.jsx(bn,{id:"enableSearch",label:e("setup.floorplanViewer.enableSearch.label"),help:e("setup.floorplanViewer.enableSearch.help"),checked:a.enableSearch,onChange:u("enableSearch"),disabled:i}),p.jsx(bn,{id:"show3DBoothButton",label:e("setup.floorplanViewer.show3DBoothButton.label",{defaultValue:"Link naar 3D-booth tonen"}),help:e("setup.floorplanViewer.show3DBoothButton.help",{defaultValue:"Toont in de 2D-booth-drawer een knop naar de 3D-stand (alleen als de 3D-booth aan staat)."}),checked:a.show3DBoothButton,onChange:u("show3DBoothButton"),disabled:i})]}),p.jsxs("div",{className:"space-y-3 border-t border-[var(--color-border)] pt-4",children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold uppercase tracking-wide text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.colorsSection.header")}),p.jsx(bn,{id:"useNeutralColors",label:e("setup.floorplanViewer.neutralColors.label"),help:e("setup.floorplanViewer.neutralColors.help"),checked:a.useNeutralColors,onChange:u("useNeutralColors"),disabled:i})]})]}),p.jsxs(vn,{title:e("setup.floorplanViewer.sections.access.title"),description:e("setup.floorplanViewer.sections.access.desc"),defaultOpen:!0,children:[p.jsx(bn,{id:"threeDEnabled",label:e("setup.floorplanViewer.threeD.access.exhibitors.label"),help:e("setup.floorplanViewer.threeD.access.exhibitors.help"),checked:r.enabled,onChange:x("enabled"),disabled:i}),p.jsx(bn,{id:"threeDEnabledForSuppliers",label:e("setup.floorplanViewer.threeD.access.suppliers.label"),help:e("setup.floorplanViewer.threeD.access.suppliers.help"),checked:r.enabledForSuppliers,onChange:x("enabledForSuppliers"),disabled:i})]}),p.jsxs(vn,{title:e("setup.floorplanViewer.sections.viewer3d.title"),description:e("setup.floorplanViewer.sections.viewer3d.desc"),children:[!f&&p.jsx("p",{className:"rounded-[var(--radius-md)] bg-[var(--color-bg)] p-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.floorplanViewer.threeD.desc")}),p.jsx(bn,{id:"threeDShowParticipantNames",label:e("setup.floorplanViewer.showParticipantNames.label"),help:e("setup.floorplanViewer.showParticipantNames.help"),checked:r.showParticipantNames,onChange:x("showParticipantNames"),disabled:i||!f}),p.jsx(bn,{id:"threeDShowOptionNames",label:e("setup.floorplanViewer.showOptionNames.label"),help:e("setup.floorplanViewer.showOptionNames.help"),checked:r.showOptionNames,onChange:x("showOptionNames"),disabled:i||!f}),p.jsx(bn,{id:"threeDShowAvailableNames",label:e("setup.floorplanViewer.showAvailableNames.label"),help:e("setup.floorplanViewer.showAvailableNames.help"),checked:r.showAvailableNames,onChange:x("showAvailableNames"),disabled:i||!f}),p.jsx(bn,{id:"threeDUseNeutralColors",label:e("setup.floorplanViewer.neutralColors.label"),help:e("setup.floorplanViewer.neutralColors.help"),checked:r.useNeutralColors,onChange:x("useNeutralColors"),disabled:i||!f}),p.jsx(bn,{id:"threeDEnableBoothClick",label:e("setup.floorplanViewer.threeD.boothClick.label"),help:e("setup.floorplanViewer.threeD.boothClick.help"),checked:r.enableBoothClick,onChange:x("enableBoothClick"),disabled:i||!f}),p.jsx(bn,{id:"threeDEnableSearch",label:e("setup.floorplanViewer.enableSearch.label"),help:e("setup.floorplanViewer.enableSearch.help"),checked:r.enableSearch,onChange:x("enableSearch"),disabled:i||!f}),p.jsx(bn,{id:"threeDShow3DBoothLink",label:e("setup.floorplanViewer.threeD.show3DBoothLink.label",{defaultValue:"Link naar 3D-stand tonen"}),help:e("setup.floorplanViewer.threeD.show3DBoothLink.help",{defaultValue:'Toont op de 3D-plattegrond de zwevende "3D"-badges waarmee bezoekers de 3D-stand van een exposant openen (alleen als de 3D-booth aan staat).'}),checked:r.show3DBoothLink,onChange:x("show3DBoothLink"),disabled:i||!f})]}),p.jsxs(vn,{title:e("setup.floorplanViewer.sections.public3d.title"),description:e("setup.floorplanViewer.sections.public3d.desc"),children:[p.jsx(bn,{id:"public3DEnabled",label:e("setup.floorplanViewer.public3d.enabled.label"),help:e("setup.floorplanViewer.public3d.enabled.help"),checked:r.public.enabled,onChange:b("enabled"),disabled:i}),p.jsx(bn,{id:"public3DShowParticipantNames",label:e("setup.floorplanViewer.public3d.showParticipantNames.label"),help:e("setup.floorplanViewer.public3d.showParticipantNames.help"),checked:r.public.showParticipantNames,onChange:b("showParticipantNames"),disabled:i||!r.public.enabled}),p.jsx(bn,{id:"public3DShowAvailableNames",label:e("setup.floorplanViewer.public3d.showAvailableNames.label"),help:e("setup.floorplanViewer.public3d.showAvailableNames.help"),checked:r.public.showAvailableNames,onChange:b("showAvailableNames"),disabled:i||!r.public.enabled}),p.jsx(bn,{id:"public3DEnableBoothClick",label:e("setup.floorplanViewer.public3d.enableBoothClick.label"),help:e("setup.floorplanViewer.public3d.enableBoothClick.help"),checked:r.public.enableBoothClick,onChange:b("enableBoothClick"),disabled:i||!r.public.enabled}),p.jsx(bn,{id:"public3DEnableSearch",label:e("setup.floorplanViewer.public3d.enableSearch.label"),help:e("setup.floorplanViewer.public3d.enableSearch.help"),checked:r.public.enableSearch,onChange:b("enableSearch"),disabled:i||!r.public.enabled}),p.jsx(bn,{id:"public3DShowBoothLinks",label:e("setup.floorplanViewer.public3d.showBoothLinks.label"),help:e("setup.floorplanViewer.public3d.showBoothLinks.help"),checked:r.public.showBoothLinks,onChange:b("showBoothLinks"),disabled:i||!r.public.enabled}),p.jsx(bn,{id:"public3DAllowEmbed",label:e("setup.floorplanViewer.public3d.allowEmbed.label"),help:e("setup.floorplanViewer.public3d.allowEmbed.help"),checked:r.public.allowEmbed,onChange:b("allowEmbed"),disabled:i||!r.public.enabled})]}),p.jsx(vn,{title:e("setup.floorplanViewer.preview.header"),children:p.jsxs("div",{className:"grid grid-cols-1 gap-3 [font-size:var(--text-xs)] sm:grid-cols-2",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-[var(--color-text)]",children:e("setup.floorplanViewer.preview.participants")}
2),p.jsx("span",{className:`ml-2 ${v(a.showParticipantNames)}`,children:a.showParticipantNames?e("setup.floorplanViewer.preview.participants_visible"):e("setup.floorplanViewer.preview.participants_hidden")})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-[var(--color-text)]",children:e("setup.floorplanViewer.preview.options")}),p.jsx("span",{className:`ml-2 ${v(a.showOptionNames)}`,children:a.showOptionNames?e("setup.floorplanViewer.preview.options_visible"):e("setup.floorplanViewer.preview.options_hidden")})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-[var(--color-text)]",children:e("setup.floorplanViewer.preview.available")}),p.jsx("span",{className:`ml-2 ${v(a.showAvailableNames)}`,children:a.showAvailableNames?e("setup.floorplanViewer.preview.available_visible"):e("setup.floorplanViewer.preview.available_hidden")})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-[var(--color-text)]",children:e("setup.floorplanViewer.preview.clickable")}),p.jsx("span",{className:`ml-2 ${v(a.enableBoothClick)}`,children:a.enableBoothClick?e("setup.floorplanViewer.preview.clickable_enabled"):e("setup.floorplanViewer.preview.clickable_disabled")})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-[var(--color-text)]",children:e("setup.floorplanViewer.preview.search")}),p.jsx("span",{className:`ml-2 ${v(a.enableSearch)}`,children:a.enableSearch?e("setup.floorplanViewer.preview.search_enabled"):e("setup.floorplanViewer.preview.search_disabled")})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-[var(--color-text)]",children:e("setup.floorplanViewer.preview.colors")}),p.jsx("span",{className:"ml-2 "+(a.useNeutralColors?"text-[var(--color-text-muted)]":"text-[var(--color-info)]"),children:a.useNeutralColors?e("setup.floorplanViewer.preview.colors_neutral"):e("setup.floorplanViewer.preview.colors_status")})]})]})})]})]})},jn=()=>{const{t:e}=T("projects"),{currentUser:t}=K(),{id:a}=g(),s=U((e=>e.tenantId)),r=U((e=>e.userId)),n=U((e=>e.userName)),[i,l]=h.useState([]),[o,u]=h.useState(!1),[x,b]=h.useState(!1),[v,f]=h.useState(new Set),[j,y]=h.useState({sourceProjectId:"",targetProjectId:"",newFloorplanName:""}),[N,_]=h.useState(!1),[w,k]=h.useState(!1);h.useEffect((()=>{m(null,null,(function*(){const a=(null==t?void 0:t.isSuperAdmin)?null:s||(null==t?void 0:t.tenantId)||null;if(t)if(t.isSuperAdmin||a){u(!0);try{const e=yield Y(a);l(e)}catch(r){A.error(e("setup.floorplanDuplicate.messages.projects_load_error"))}finally{u(!1)}}else A.error(e("setup.floorplanDuplicate.messages.no_tenant"))}))}),[t,s,e]),h.useEffect((()=>{if(0===i.length)return void f(new Set);m(null,null,(function*(){b(!0);try{const e=yield Promise.all(i.map((e=>m(null,null,(function*(){return{projectId:e.id,hasBase:yield m(null,null,(function*(){try{return yield function(e){return m(this,null,(function*(){const t=Nt(W,"projects",e,"floorplans"),a=wt(t,Ct("status","==","base"),kt(1));return!(yield _t(a)).empty}))}(e.id)}catch(t){return!1}}))}}))))),t=e.filter((e=>e.hasBase)).map((e=>e.projectId));f(new Set(t))}catch(t){f(new Set),A.error(e("setup.floorplanDuplicate.messages.base_status_error"))}finally{b(!1)}}))}),[i,e]),h.useEffect((()=>{var e,t;if(0===i.length)return;const s=i.filter((e=>v.has(e.id))),r=a&&s.some((e=>e.id===a))&&a||(null==(e=s[0])?void 0:e.id)||"",n=(null==(t=i.find((e=>e.id!==r)))?void 0:t.id)||"";y((e=>({sourceProjectId:e.sourceProjectId&&s.some((t=>t.id===e.sourceProjectId))?e.sourceProjectId:r,targetProjectId:e.targetProjectId&&i.some((t=>t.id===e.targetProjectId))&&e.targetProjectId!==r?e.targetProjectId:n,newFloorplanName:e.newFloorplanName})))}),[a,i,v]);const C=h.useMemo((()=>r||(null==t?void 0:t.uid)||""),[null==t?void 0:t.uid,r]),S=h.useMemo((()=>n||(null==t?void 0:t.displayName)||(null==t?void 0:t.email)||null),[null==t?void 0:t.displayName,null==t?void 0:t.email,n]),z=h.useMemo((()=>i.find((e=>e.id===j.sourceProjectId))||null),[j.sourceProjectId,i]),I=h.useMemo((()=>i.find((e=>e.id===j.targetProjectId))||null),[j.targetProjectId,i]),P=h.useMemo((()=>i.filter((e=>v.has(e.id)))),[i,v]),D=h.useMemo((()=>i.filter((e=>e.id!==j.sourceProjectId))),[j.sourceProjectId,i]),B=h.useCallback((()=>m(null,null,(function*(){if(N)if(j.sourceProjectId.trim())if(v.has(j.sourceProjectId.trim()))if(j.targetProjectId.trim())if(j.sourceProjectId.trim()!==j.targetProjectId.trim())if(C.trim()){k(!0);try{const t=yield Xs({sourceProjectId:j.sourceProjectId.trim(),targetProjectId:j.targetProjectId.trim(),newFloorplanName:j.newFloorplanName.trim()||void 0,executorUserId:C,executorUserName:S});
2A.success(e("setup.floorplanDuplicate.messages.success",{floorplanId:t.newFloorplanId,boothCount:t.duplicatedBoothCount})),_(!1)}catch(t){A.error(t instanceof Error?t.message:e("setup.floorplanDuplicate.messages.generic_error"))}finally{k(!1)}}else A.error(e("setup.floorplanDuplicate.messages.no_executor"));else A.error(e("setup.floorplanDuplicate.messages.same_project"));else A.error(e("setup.floorplanDuplicate.messages.select_target"));else A.error(e("setup.floorplanDuplicate.messages.source_no_base"));else A.error(e("setup.floorplanDuplicate.messages.select_source"));else A.error(e("setup.floorplanDuplicate.messages.confirm_required"))}))),[N,j.sourceProjectId,j.targetProjectId,j.newFloorplanName,v,C,S,e]),M=w||!N||o||x||0===P.length||!j.sourceProjectId||!j.targetProjectId||0===D.length;return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:w,disabled:M,icon:p.jsx(Ae,{size:14}),onClick:B,children:e("setup.floorplanDuplicate.duplicate_button")}),[w,M,B,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.floorplanDuplicate.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.floorplanDuplicate.desc")}),o&&p.jsx("div",{role:"status",className:"mt-4 rounded-[var(--radius-md)] border border-[var(--color-info)]/30 bg-[var(--color-info-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.floorplanDuplicate.projects_loading")}),x&&p.jsx("div",{role:"status",className:"mt-4 rounded-[var(--radius-md)] border border-[var(--color-info)]/30 bg-[var(--color-info-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.floorplanDuplicate.base_status_loading")}),p.jsxs("div",{className:"mt-6 space-y-4",children:[p.jsx("div",{children:p.jsx(Gt,{label:e("setup.floorplanDuplicate.source_label"),value:j.sourceProjectId,onChange:e=>y((t=>c(d({},t),{sourceProjectId:e}))),placeholder:e("setup.floorplanDuplicate.source_placeholder"),options:[{value:"",label:e("setup.floorplanDuplicate.source_placeholder")},...P.map((e=>({value:e.id,label:e.name})))],disabled:w||o||x||0===P.length,hint:0===P.length?e("setup.floorplanDuplicate.source_empty"):z?e("setup.floorplanDuplicate.source_id_label",{id:z.id}):void 0})}),p.jsx("div",{children:p.jsx(Gt,{label:e("setup.floorplanDuplicate.target_label"),value:j.targetProjectId,onChange:e=>y((t=>c(d({},t),{targetProjectId:e}))),placeholder:e("setup.floorplanDuplicate.target_placeholder"),options:[{value:"",label:e("setup.floorplanDuplicate.target_placeholder")},...D.map((e=>({value:e.id,label:v.has(e.id)?`${e.name} · (heeft al base â wordt concept)`:e.name})))],disabled:w||o||x||0===i.length,hint:0===D.length?e("setup.floorplanDuplicate.target_empty"):I?v.has(I.id)?`${e("setup.floorplanDuplicate.target_id_label",{id:I.id})} â Doelproject heeft al een base; de duplicatie komt als 'concept' binnen, het bestaande base blijft ongewijzigd.`:e("setup.floorplanDuplicate.target_id_label",{id:I.id}):void 0})}),p.jsx(he,{label:e("setup.floorplanDuplicate.new_name_label"),type:"text",inputSize:"md",placeholder:e("setup.floorplanDuplicate.new_name_placeholder"),value:j.newFloorplanName,onChange:e=>y((t=>c(d({},t),{newFloorplanName:e.target.value}))),disabled:w}),p.jsx(H,{label:e("setup.floorplanDuplicate.confirm"),checked:N,onChange:e=>_(e.target.checked),disabled:w})]})]})},yn=()=>{const{currentUser:e}=K(),t=U((e=>e.tenantId)),{id:a}=g(),[s,r]=h.useState([]),[n,i]=h.useState(!1),[l,o]=h.useState(null),[d,c]=h.useState(""),[u,x]=h.useState(!1),[b,v]=h.useState(!1),[f,j]=h.useState(null),[y,N]=h.useState(null);h.useEffect((()=>{m(null,null,(function*(){const a=(null==e?void 0:e.isSuperAdmin)?null:t||(null==e?void 0:e.tenantId)||null;if(e)if(e.isSuperAdmin||a){i(!0),o(null);try{const e=yield Y(a);r(e)}catch(s){o("Projecten laden is mislukt. Probeer de pagina opnieuw te openen.")}finally{i(!1)}}else o("Geen tenant gevonden. Daardoor kunnen projecten niet worden geladen.")}))}),[e,t]);const _=h.useMemo((()=>s.filter((e=>e.id!==a))),[s,a]);h.useEffect((()=>{_.length?c((e=>e&&_.some((t=>
2t.id===e))?e:_[0].id)):c("")}),[_]);const w=h.useMemo((()=>_.find((e=>e.id===d))||null),[_,d]);return p.jsxs("div",{className:"rounded-lg bg-slate-50 border border-slate-200 p-4",children:[p.jsx("h3",{className:"text-base font-semibold text-slate-900 mb-2",children:"Exposant Categorieën dupliceren"}),p.jsx("p",{className:"text-sm text-slate-600 mb-4",children:"Kopieer de Exposant Categorieën van een ander project naar dit huidige project."}),n&&p.jsx("div",{className:"rounded bg-blue-50 text-blue-700 text-sm p-3 mb-3",children:"Projecten laden..."}),l&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3 mb-3",children:l}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"sourceCategoriesProjectId",className:"block text-sm font-medium text-slate-900 mb-1",children:"Bronproject"}),p.jsxs("select",{id:"sourceCategoriesProjectId",value:d,onChange:e=>c(e.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm",disabled:b||n||0===_.length,children:[p.jsx("option",{value:"",children:"Selecteer bronproject"}),_.map((e=>p.jsx("option",{value:e.id,children:e.name},e.id)))]}),0===_.length&&p.jsx("p",{className:"text-xs text-amber-700 mt-1",children:"Geen ander project beschikbaar als bronproject."})]}),p.jsxs("label",{className:"flex items-start gap-2 text-sm text-slate-700",children:[p.jsx("input",{type:"checkbox",checked:u,onChange:e=>x(e.target.checked),className:"mt-1 h-4 w-4 rounded border-gray-300",disabled:b}),p.jsx("span",{children:"Ik bevestig dat ik de huidige Exposant Categorieën wil overschrijven met de gegevens uit het bronproject."})]}),f&&p.jsx("div",{className:"rounded bg-red-50 text-red-700 text-sm p-3",children:f}),y&&p.jsx("div",{className:"rounded bg-green-50 text-green-700 text-sm p-3",children:y}),p.jsx("div",{className:"flex justify-end",children:p.jsx(J,{onClick:()=>m(null,null,(function*(){if(j(null),N(null),a)if(d.trim())if(d.trim()!==a.trim())if(u){v(!0);try{const e=yield rr({sourceProjectId:d.trim(),targetProjectId:a.trim()});N(`Exposant Categorieën gedupliceerd (${e.copiedItemsCount} items) vanuit ${(null==w?void 0:w.name)||e.sourceProjectId}.`),x(!1)}catch(e){j(e instanceof Error?e.message:"Duplicatie van Exposant Categorieën is mislukt. Probeer opnieuw.")}finally{v(!1)}}else j("Bevestig eerst dat je de Exposant Categorieën wilt dupliceren.");else j("Bron- en doelproject moeten verschillend zijn.");else j("Selecteer een bronproject.");else j("Geen doelproject gevonden in je sessie.")})),disabled:b||n||!!l||!d||!a||!u,loading:b,children:"Dupliceer Exposant Categorieën"})})]})]})},Nn=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#F97316","#06B6D4","#84CC16","#EC4899","#6B7280"],_n=e=>"string"==typeof e?{nl:e}:e||{},wn=e=>{const t={};return Object.entries(e).forEach((([e,a])=>{a&&""!==a.trim()&&(t[e]=a)})),t},kn=(e,t)=>{var a,s,r,n;const i=_n(e);return null!=(n=null!=(r=null!=(s=null!=(a=i[t])?a:i.nl)?s:i.en)?r:i.de)?n:""},Cn=()=>{const{t:e}=T("projects"),{currentUser:t}=K(),[a,s]=h.useState([]),[r,n]=h.useState(!0),[i,l]=h.useState(!1),[o,u]=h.useState(!1),[x,b]=h.useState("nl"),[v,f]=h.useState(null),[j,y]=h.useState(null),[N,_]=h.useState(null),[w,k]=h.useState(!1),C=Se(),[S,z]=h.useState({name:"",description:"",color:"#3B82F6"}),I=U((e=>e.tenantId)),{id:P}=g();h.useEffect((()=>{m(null,null,(function*(){if(I&&P)try{n(!0);const e=zt(),t=ft(e,`projects/${P}`),a=yield jt(t);if(a.exists()){const e=a.data().exhibitorCategories||[];s(e.map((e=>({id:e.id,name:"string"==typeof e.name?{nl:e.name}:e.name||{},description:"string"==typeof e.description?{nl:e.description}:e.description||{},color:e.color,createdAt:e.createdAt&&"object"==typeof e.createdAt&&"toDate"in e.createdAt?e.createdAt.toDate():e.createdAt||new Date}))))}else s([])}catch(t){A.error(e("setup.categories.messages.load_error"))}finally{n(!1)}else n(!1)}))}),[I,P,e]);const D=h.useCallback((()=>m(null,null,(function*(){if(I&&P)try{l(!0);const s=zt(),r=ft(s,`projects/${P}`),n=a.map((e=>({id:e.id,name:wn(_n(e.name)),description:wn(_n(e.description)),color:e.color,createdAt:e.createdAt||new Date})));yield yt(r,{exhibitorCategories:n,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0});const i=ft(s,`public_projects/${P}`);yield yt(i,{exhibitorCategories:n,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0}),A.success(e("setup.categories.messages.saved_success"))}catch(s){A.error(e("setup.categories.messages.save_error"))}finally{l(!1)}else A.error(e("setup.categories.messages.no_project_selected"))}))),[a,P,I,t,e]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!P,onClick:D,children:e("setup.save_button")}),[i,P,D,e]);const B=(e,t,a,r)=>{s((s=>s.map((s=>{if(s.id!==e)return s;const n=_n(s[t]);return c(d({},s),{[t]:c(d({},n),{[a]:r})})}))))},L=h.useCallback(((r,n)=>m(null,null,(function*(){if(!P)return void A.error(e("setup.categories.messages.no_project_selected"));const i=x,l=a.find((e=>e.id===r));if(!l)return;const o=_n(l[n]);let u="nl";o.nl&&""!==o.nl.trim()||(u=o.en&&""!==o.en.trim()?"en":o.de&&""!==o.de.trim()?"de":void 0);const m=u&&o[u]||"";if(m&&""!==m.trim())if(u!==i)try{f(`${r}:${n}`);const l=pe(xe,"translateText",{timeout:3e5}),p=(yield l({text:m,targetLang:i,sourceLang:u,projectId:P})).data;if(!p||"success"!==p.status||!p.translated)throw new Error("Translation failed");const x=a.map((e=>{if(e.id!==r)return e;const t=c(d({},o),{[i]:p.translated});return c(d({},e),{[n]:t})}));s(x);const h=zt(),g=ft(h,`projects/${P}`),b=x.map((e=>({id:e.id,name:wn(_n(e.name)),description:wn(_n(e.description)),color:e.color,createdAt:e.createdAt||new Date})));yield yt(g,{exhibitorCategories:b,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0});const v=ft(h,`public_projects/${P}`);yield yt(v,{exhibitorCategories:b,updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"},{merge:!0}),A.success(e("setup.categories.messages.translate_saved"))}catch(p){A.error(e("setup.categories.messages.translate_error"))}finally{f(null)}else A.error(e("setup.categories.messages.translate_same_lang"));else A.error(e("setup.categories.messages.translate_no_source"))}))),[x,a,P,t,e]),F=h.useCallback(((r,n="missing")=>m(null,null,(function*(){if(!P)return void A.error(e("setup.categories.messages.no_project_selected"));if(null!==v||null!==j)return;if("overwrite"===n){if(!(yield C({title:e("setup.categories.messages.batch_overwrite_confirm_title"),description:e("setup.categories.messages.batch_overwrite_confirm_desc",{locale:r.toUpperCase()}),variant:"danger",confirmLabel:e("setup.categories.messages.batch_overwrite_confirm_label")})))return}const i=[];
2if(a.forEach((e=>{["name","description"].forEach((t=>{const a=_n(e[t]);if("missing"===n){const e=a[r];if(e&&""!==e.trim())return}let s="nl";if(a.nl&&""!==a.nl.trim()||(s=a.en&&""!==a.en.trim()?"en":a.de&&""!==a.de.trim()?"de":void 0),!s||s===r)return;const l=a[s]||"";l.trim()&&i.push({id:e.id,field:t,sourceLang:s,sourceText:l})}))})),0===i.length)return void A.info(e("setup.categories.messages.batch_translate_none"));y(r),_({done:0,total:i.length});let l=a,o=0,u=0;const m=pe(xe,"translateText",{timeout:3e5});for(const e of i)try{const t=(yield m({text:e.sourceText,targetLang:r,sourceLang:e.sourceLang,projectId:P})).data;if(!t||"success"!==t.status||!t.translated)throw new Error("Translation failed");l=l.map((a=>{if(a.id!==e.id)return a;const s=c(d({},_n(a[e.field])),{[r]:t.translated});return c(d({},a),{[e.field]:s})})),s(l)}catch(p){o+=1}finally{u+=1,_({done:u,total:i.length})}try{const e=zt(),a={exhibitorCategories:l.map((e=>({id:e.id,name:wn(_n(e.name)),description:wn(_n(e.description)),color:e.color,createdAt:e.createdAt||new Date}))),updatedAt:new Date,updatedBy:(null==t?void 0:t.uid)||"unknown"};yield yt(ft(e,`projects/${P}`),a,{merge:!0}),yield yt(ft(e,`public_projects/${P}`),a,{merge:!0})}catch(p){A.error(e("setup.categories.messages.save_error"))}finally{y(null),_(null)}o>0?A.error(e("setup.categories.messages.batch_translate_partial",{count:o})):A.success(e("setup.categories.messages.batch_translate_done"))}))),[j,C,t,a,P,e,v]);return r?p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.categories.header")}),p.jsxs("div",{className:"mt-4 flex items-center gap-2 text-[var(--color-text-muted)]",children:[p.jsx(_e,{size:"sm"}),p.jsx("span",{className:"[font-size:var(--text-sm)]",children:e("setup.loading")})]})]}):p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.categories.language_label")}),p.jsx(Ce,{size:"sm",value:x,onChange:b,"aria-label":e("setup.categories.language_label"),items:[{value:"nl",label:"NL"},{value:"en",label:"EN"},{value:"de",label:"DE"}]}),p.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-3",children:[j&&N&&p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.categories.messages.batch_translate_progress",{done:N.done,total:N.total})}),p.jsxs("label",{className:"flex items-center gap-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[p.jsx(M,{id:"categories-overwrite-mode",name:"categories-overwrite-mode",checked:w,onChange:k,disabled:null!==j}),e("setup.categories.overwrite_toggle_label")]}),["en","de"].map((t=>p.jsx(V,{type:"button",variant:w?"danger":"secondary",size:"sm",icon:p.jsx(ra,{size:14,strokeWidth:1.5}),loading:j===t,disabled:!P||null!==v||null!==j,onClick:()=>F(t,w?"overwrite":"missing"),children:e(w?"setup.categories.translate_all_overwrite_button":"setup.categories.translate_all_button",{locale:t.toUpperCase()})},t)))]})]}),p.jsxs("div",{className:"mt-6 flex flex-wrap items-start justify-between gap-4",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-info-soft)] p-3",children:p.jsx(Ee,{size:20,strokeWidth:1.5,className:"text-[var(--color-info)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.categories.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.categories.desc")})]})]}),p.jsx(V,{type:"button",variant:"primary",size:"md",icon:p.jsx(Ve,{size:16,strokeWidth:2}),onClick:()=>u((e=>!e)),children:e("setup.categories.add_button")})]}),o&&p.jsxs("div",{className:"mt-6 rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h4",{className:"mb-4 [font-size:var(--text-base)] font-medium text-[var(--color-text)]",children:e("setup.categories.add_form.header")}),p.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[p.jsx(he,{label:e("setup.categories.add_form.name_required"),type:"text",inputSize:"sm",placeholder:e("setup.categories.add_form.name_placeholder"),value:S.name,onChange:e=>z(c(d({},S),{name:e.target.value}))}),p.jsxs("div",{children:[p.jsx("span",{className:"mb-1 block [font-size:var(--text-xs)] font-medium text-[var(--color-text)]",children:e("setup.categories.add_form.color_label")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"color",className:"h-10 w-16 cursor-pointer rounded-[var(--radius-md)] border border-[var(--color-border)]",value:S.color,onChange:e=>z(c(d({},S),{color:e.target.value})),"aria-label":e("setup.categories.add_form.color_label")}),p.jsx("div",{className:"flex flex-wrap gap-1",children:Nn.map((e=>p.jsx("button",{type:"button",className:"h-6 w-6 rounded-full border-2 transition-transform hover:scale-110 "+(S.color===e?"border-[var(--color-text)]":"border-[var(--color-border)]"),style:{backgroundColor:e},onClick:()=>z(c(d({},S),{color:e})),"aria-label":e},e)))})]})]}),p.jsx("div",{className:"md:col-span-2",children:p.jsx(de,{label:e("setup.categories.add_form.description_label"),rows:3,placeholder:e("setup.categories.add_form.description_placeholder"),value:S.description,onChange:e=>z(c(d({},S),{description:e.target.value}))})})]}),p.jsxs("div",{className:"mt-4 flex items-center justify-end gap-3",children:[p.jsx(V,{type:"button",variant:"secondary",size:"md",onClick:()=>{u(!1),z({name:"",description:"",color:"#3B82F6"})},children:e("setup.categories.add_form.cancel")}),p.jsx(V,{type:"button",variant:"primary",size:"md",onClick:()=>
2{if(!S.name.trim())return void A.error(e("setup.categories.messages.name_required"));const t={id:Date.now().toString(),name:{nl:S.name.trim()},description:{nl:S.description.trim()},color:S.color,createdAt:new Date};s((e=>[...e,t])),z({name:"",description:"",color:"#3B82F6"}),u(!1)},children:e("setup.categories.add_form.submit")})]})]}),a.length>0?p.jsx("div",{className:"mt-6 space-y-4",children:a.map((t=>p.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4",children:p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[p.jsx("div",{className:"h-6 w-6 shrink-0 rounded-full border-2 border-[var(--color-border)]",style:{backgroundColor:t.color},"aria-hidden":!0}),p.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx(he,{type:"text",inputSize:"sm",placeholder:e("setup.categories.fields.name_placeholder_localized",{locale:x.toUpperCase()}),value:kn(t.name,x),onChange:e=>B(t.id,"name",x,e.target.value)})}),p.jsx($,{"aria-label":e("setup.categories.translate_name_title",{locale:x.toUpperCase()}),title:e("setup.categories.translate_name_title",{locale:x.toUpperCase()}),variant:"secondary",size:"sm",loading:v===`${t.id}:name`,disabled:!P||v===`${t.id}:name`,icon:p.jsx(ra,{size:14,strokeWidth:1.5}),onClick:()=>L(t.id,"name")})]}),p.jsxs("div",{children:[p.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.categories.fields.description_label_short")}),p.jsx($,{"aria-label":e("setup.categories.translate_description_title",{locale:x.toUpperCase()}),title:e("setup.categories.translate_description_title",{locale:x.toUpperCase()}),variant:"secondary",size:"sm",loading:v===`${t.id}:description`,disabled:!P||v===`${t.id}:description`,icon:p.jsx(ra,{size:14,strokeWidth:1.5}),onClick:()=>L(t.id,"description")})]}),p.jsx(de,{label:e("setup.categories.fields.description_label_short"),rows:2,placeholder:e("setup.categories.fields.description_placeholder_localized",{locale:x.toUpperCase()}),value:kn(t.description,x),onChange:e=>B(t.id,"description",x,e.target.value)})]})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"color",className:"h-8 w-12 cursor-pointer rounded border border-[var(--color-border)]",value:t.color,onChange:e=>{return a=t.id,r=e.target.value,void s((e=>e.map((e=>e.id===a?c(d({},e),{color:r}):e))));var a,r},"aria-label":e("setup.categories.add_form.color_label")}),p.jsx($,{"aria-label":e("setup.categories.remove_title"),title:e("setup.categories.remove_title"),variant:"ghost",size:"sm",icon:p.jsx(O,{size:16,className:"text-[var(--color-danger)]"}),onClick:()=>{return e=t.id,void s((t=>t.filter((t=>t.id!==e))));var e}})]})]})},t.id)))}):p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] py-8 text-center",children:[p.jsx(Ee,{size:36,strokeWidth:1.5,className:"mx-auto mb-3 text-[var(--color-text-subtle)]"}),p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text)]",children:e("setup.categories.empty_list.title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.categories.empty_list.help")})]}),a.length>0&&p.jsxs("div",{className:"mt-6 rounded-[var(--radius-md)] border border-[var(--color-info)]/20 bg-[var(--color-info-soft)] p-4",children:[p.jsx("h4",{className:"mb-2 [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.categories.overview_header")}),p.jsx("div",{className:"flex flex-wrap gap-2",children:a.map((e=>p.jsx("span",{className:"inline-flex items-center rounded-full px-3 py-1 [font-size:var(--text-sm)] font-medium text-white",style:{backgroundColor:e.color},children:kn(e.name,x)||"â"},e.id)))})]}),p.jsx("div",{className:"mt-8 border-t border-[var(--color-border)] pt-6",children:p.jsx(yn,{})})]})},Sn=[{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash (snel, voordelig)"},{value:"gemini-2.0-flash",label:"Gemini 2.0 Flash"},{value:"gemini-1.5-flash",label:"Gemini 1.5 Flash"},{value:"gemini-2.0-pro",label:"Gemini 2.0 Pro (krachtiger, duurder)"},{value:"gemini-1.5-pro",label:"Gemini 1.5 Pro"}],zn="gemini-2.5-flash",In=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(zn),[r,n]=h.useState(Sn),[i,l]=h.useState(!1),[o,d]=h.useState(!1);h.useEffect((()=>{m(null,null,(function*(){if(t){l(!0);try{const e=pe(xe,"listAvailableModels"),a=(yield e({})).data,r=Array.isArray(null==a?void 0:a.models)&&a.models.length>0?a.models:Sn;n(r);const i=ft(W,`projects/${t}`),l=yield jt(i);if(l.exists()){const e=l.data();if("string"==typeof e.aiModel&&e.aiModel.trim().length>0){const t=e.aiModel.trim(),a=r.some((e=>e.value===t));s(a?t:zn)}else s(zn)}else s(zn)}catch(a){n(Sn),A.error(e("setup.aiModel.messages.load_error"))}finally{l(!1)}}}))}),[t,e]);const c=h.useCallback((()=>m(null,null,(function*(){if(t){d(!0);try{if(!r.some((e=>e.value===a)))return void A.error(e("setup.aiModel.messages.invalid_model"));const s=ft(W,`projects/${t}`);yield St(s,{aiModel:a,updatedAt:new Date}),A.success(e("setup.aiModel.messages.save_success"))}catch(s){A.error(e("setup.aiModel.messages.save_error"))}finally{d(!1)}}else A.error(e("setup.aiModel.messages.no_project_selected"))}))),[t,a,r,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:o,disabled:o||i||!t,onClick:c,children:e("setup.aiModel.save_button")}),[o,i,t,c,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx(ae,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.aiModel.title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.aiModel.description")})]})]}),p.jsx("div",{className:"max-w-md",children:p.jsx(Gt,{label:e("setup.aiModel.label"),value:a,onChange:e=>s(e),options:r,disabled:i,hint:e("setup.aiModel.help")})})]})},Pn=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState({infoText:"",infoImage:null,infoImageFile:null}),[r,n]=h.useState(!1);h.useEffect((()=>
2{if(!t)return;m(null,null,(function*(){try{const e=ft(W,`projects/${t}`),a=yield jt(e);if(a.exists()){const e=a.data();s({infoText:e.dashboardInfoText||"",infoImage:e.dashboardInfoImageUrl||null,infoImageFile:null})}}catch(a){A.error(e("setup.error_fetch"))}}))}),[t,e]);const i=h.useCallback((()=>m(null,null,(function*(){if(t){n(!0);try{const n=ft(W,`projects/${t}`),i={dashboardInfoText:a.infoText,updatedAt:new Date};if(a.infoImageFile){const e=`projects/${t}/dashboard_info_${Date.now()}`,n=yield(s=a.infoImageFile,r=e,m(null,null,(function*(){const e=It(Me,r);return yield Pt(e,s),yield Dt(e)})));i.dashboardInfoImageUrl=n}yield St(n,i),A.success(e("setup.success_save"))}catch(i){A.error(e("setup.error_save"))}finally{n(!1)}var s,r}else A.error(e("setup.project_not_found"))}))),[t,a.infoText,a.infoImageFile,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:r,disabled:r,onClick:i,children:e("setup.save_button")}),[r,i,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.dashboard_info.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.dashboard_info.description")}),p.jsxs("div",{className:"mt-6",children:[p.jsx("span",{className:"mb-1 block [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.dashboard_info.text_label")}),p.jsx("p",{className:"mb-3 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.dashboard_info.text_desc")}),p.jsx(na,{value:a.infoText,onChange:e=>{s((t=>c(d({},t),{infoText:e})))},preset:"minimal",height:400,delayMount:!0})]}),p.jsxs("div",{className:"mt-6",children:[p.jsx("span",{className:"mb-1 block [font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.dashboard_info.image_label")}),p.jsx("p",{className:"mb-3 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.dashboard_info.image_desc")}),p.jsx(pa,{onChange:e=>{if(e.converted){const t=new FileReader;t.onload=t=>{s((a=>{var s;return c(d({},a),{infoImage:null==(s=t.target)?void 0:s.result,infoImageFile:e.converted})}))},t.readAsDataURL(e.converted)}else s((e=>c(d({},e),{infoImage:null,infoImageFile:null})))},name:"dashboardInfoImage",ratio:"3:2",width:1200,height:800,validation:{minWidth:600,minHeight:400,maxSizeMB:5,allowedTypes:["image/jpeg","image/png","image/webp"]}}),"string"==typeof a.infoImage&&a.infoImage&&p.jsxs("div",{className:"mt-4",children:[p.jsx("p",{className:"mb-2 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.dashboard_info.image_preview")}),p.jsx(xa,{src:a.infoImage,alt:e("setup.dashboard_info.image_preview_alt"),maxWidth:400,maxHeight:267})]})]})]})},Dn=()=>{const{t:e}=T("projects"),{currentUser:t,isAdmin:a}=K(),s=U((e=>e.tenantId)),{id:r}=g(),[n,i]=h.useState([]),[l,o]=h.useState(null!=r?r:""),[u,x]=h.useState({enabled:!1,activeProjectId:null}),[b,v]=h.useState({}),[f,j]=h.useState(!0),[y,N]=h.useState(!1),[_,w]=h.useState(!1),[k,C]=h.useState(!1);h.useEffect((()=>{let t=!1;return m(null,null,(function*(){j(!0);try{const[e,a]=yield Promise.all([Y(s),ha()]);if(t)return;i(e),x(a),o((t=>{var s;return t||r||a.activeProjectId||(null==(s=e[0])?void 0:s.id)||""}))}catch(a){t||A.error(e("setup.startPages.load_error"))}finally{t||j(!1)}})),()=>{t=!0}}),[s,r,e]),h.useEffect((()=>{if(!l)return void v({});let t=!1;return m(null,null,(function*(){N(!0);try{const e=yield ga(l);t||v(e)}catch(a){t||A.error(e("setup.startPages.load_error"))}finally{t||N(!1)}})),()=>{t=!0}}),[l,e]);const S=h.useMemo((()=>n.map((e=>({value:e.id,label:e.name||e.id}))).sort(((e,t)=>String(e.label).localeCompare(String(t.label))))),[n]),z=h.useMemo((()=>{var e;return(null==(e=n.find((e=>e.id===l)))?void 0:e.name)||l}),[n,l]),I=h.useMemo((()=>{var e;return(null==(e=n.find((e=>e.id===u.activeProjectId)))?void 0:e.name)||u.activeProjectId}),[n,u.activeProjectId]),P=u.enabled&&u.activeProjectId===l,D=h.useCallback(((e,t)=>{v((a=>{var s;const r=null!=(s=a[e])?s:{pageId:"",enabled:!1};return c(d({},a),{[e]:d(d({},r),t)})}))}),[]),B=h.useCallback(((e,t)=>D(e,{pageId:t})),[D]),E=h.useCallback(((e,t)=>{var a,s;if(t&&!(null==(a=b[e])?void 0:a.pageId)){const a=ba(e)[0];D(e,{enabled:t,pageId:null!=(s=null==a?void 0:a.id)?s:""})}else D(e,{enabled:t})}),[b,D]),L=h.useCallback((()=>
2m(null,null,(function*(){if(a&&(null==t?void 0:t.uid)&&l){w(!0);try{yield va(l,b,t.uid),A.success(e("setup.startPages.save_success"))}catch(s){A.error(e("setup.startPages.save_error"))}finally{w(!1)}}}))),[a,null==t?void 0:t.uid,l,b,e]),$=h.useCallback((s=>m(null,null,(function*(){if(!a||!(null==t?void 0:t.uid)||!l)return;C(!0);const r=s?{enabled:!0,activeProjectId:l}:{enabled:!1,activeProjectId:null};try{yield fa(r,t.uid),x(r),A.success(e(s?"setup.startPages.active_on_success":"setup.startPages.active_off_success"))}catch(n){A.error(e("setup.startPages.save_error"))}finally{C(!1)}}))),[a,null==t?void 0:t.uid,l,e]);return f?p.jsx("div",{className:"flex items-center justify-center py-16",children:p.jsx(_e,{})}):p.jsxs("div",{className:"space-y-6",children:[p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.startPages.description")}),p.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4",children:p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2 [font-size:var(--text-base)] font-semibold text-[var(--color-text)]",children:[p.jsx(Le,{className:"h-4 w-4 text-[var(--color-accent)]"}),e("setup.startPages.active_title")]}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:u.enabled&&u.activeProjectId?e("setup.startPages.active_status_on",{name:I}):e("setup.startPages.active_status_off")})]}),p.jsx(M,{checked:P,onChange:$,disabled:!a||k||!l,label:e("setup.startPages.active_switch_label",{name:z})})]})}),p.jsx(Gt,{label:e("setup.startPages.event_label"),value:l||null,onChange:e=>o(e),options:S,placeholder:e("setup.startPages.event_placeholder"),disabled:!a}),p.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] divide-y divide-[var(--color-border)]",children:y?p.jsx("div",{className:"flex items-center justify-center py-12",children:p.jsx(_e,{})}):ja.map((t=>{var s;const r=b[t],n=ba(t).map((t=>({value:t.id,label:e(t.labelKey)})));return p.jsxs("div",{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-end sm:gap-4",children:[p.jsx("div",{className:"sm:w-48 shrink-0",children:p.jsx("div",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e(`setup.startPages.roles.${t}`)})}),p.jsx("div",{className:"flex-1",children:p.jsx(Gt,{"aria-label":e("setup.startPages.page_label"),value:(null==r?void 0:r.pageId)||null,onChange:e=>B(t,e),options:n,placeholder:e("setup.startPages.page_placeholder"),disabled:!a})}),p.jsx("div",{className:"shrink-0",children:p.jsx(M,{checked:null!=(s=null==r?void 0:r.enabled)&&s,onChange:e=>E(t,e),disabled:!a,label:e("setup.startPages.role_switch_label")})})]},t)}))}),p.jsx("div",{className:"flex justify-end",children:p.jsx(V,{onClick:L,disabled:!a||_||y,loading:_,children:e("setup.startPages.save_button")})})]})},Bn={appHost:"",mailFromAddress:"",mailFromName:"",replyTo:"",contactEmail:"",contactPhone:"",brandName:"",senderName:""},Tn="https://exhibitor-portal.nl",An="(SMTP-user â bv. [email protected])",En="The Exhibition Company",Vn="(geen reply-to header)",Mn="[email protected]",Ln="+31 (0)30 6666 358",$n="The Exhibition Company",On="Patrick van Brienen",Fn=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(Bn),[r,n]=h.useState(Bn),[i,l]=h.useState(!1),[o,u]=h.useState(!1);h.useEffect((()=>{if(!t)return;let a=!1;return l(!0),m(null,null,(function*(){try{const e=yield jt(ft(W,`projectBranding/${t}`));if(a)return;if(e.exists()){const t=e.data()||{},a={appHost:t.appHost||t.publicDomain||"",mailFromAddress:t.mailFromAddress||"",mailFromName:t.mailFromName||"",replyTo:t.replyTo||"",contactEmail:t.contactEmail||"",contactPhone:t.contactPhone||"",brandName:t.brandName||"",senderName:t.senderName||""};s(a),n(a)}else s(Bn),n(Bn)}catch(r){A.error(e("setup.mail_branding.error_load",{defaultValue:"Kon mail-instellingen niet laden."}))}finally{a||l(!1)}})),()=>{a=!0}}),[t,e]);const x=e=>t=>{s((a=>c(d({},a),{[e]:t.target.value})))},b=h.useCallback((()=>m(null,null,(function*(){if(t){u(!0);try{const s={};
2Object.keys(a).forEach((e=>{const t=a[e].trim();s[e]=t.length>0?t:null})),yield yt(ft(W,`projectBranding/${t}`),s,{merge:!0}),n(a),A.success(e("setup.mail_branding.saved",{defaultValue:"Mail-instellingen opgeslagen."}))}catch(s){A.error(e("setup.mail_branding.error_save",{defaultValue:"Opslaan mislukt."}))}finally{u(!1)}}}))),[t,a,e]),v=JSON.stringify(a)!==JSON.stringify(r);return E(p.jsxs("div",{className:"flex items-center gap-3",children:[v&&p.jsxs("span",{className:"hidden items-center gap-1.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)] sm:flex",children:[p.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-[var(--color-warning)]"}),e("setup.unsaved_indicator",{defaultValue:"Niet opgeslagen wijzigingen"})]}),p.jsx(V,{type:"button",variant:"primary",size:"md",loading:o,disabled:o||!v,onClick:b,children:e("setup.save_button",{defaultValue:"Opslaan"})})]}),[o,b,e,v]),t?p.jsxs("div",{className:"space-y-8",children:[p.jsx("div",{className:"rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-elevated)] p-5",children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-lg bg-[var(--color-info-soft)] p-2 text-[var(--color-info)]",children:p.jsx(te,{size:20})}),p.jsxs("div",{className:"flex-1",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.mail_branding.intro_title",{defaultValue:"Mail-branding voor dit project"})}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.mail_branding.intro_body",{defaultValue:"Deze instellingen bepalen hoe invitation-, password-reset- en email-change-mails er voor dit project uitzien. Leeg laten = de globale fallback wordt gebruikt (zichtbaar als grijze placeholder)."})})]})]})}),p.jsx(Un,{icon:p.jsx($e,{size:18}),title:e("setup.mail_branding.section.host",{defaultValue:"Inlog-host"}),description:e("setup.mail_branding.section.host_desc",{defaultValue:"De link in elke mail (set-password, verify-email-change) wijst naar deze host. Standaard exhibitor-portal.nl."}),children:p.jsx(F,{label:e("setup.mail_branding.field.appHost",{defaultValue:"Inlog-host (URL)"}),placeholder:Tn,value:a.appHost,onChange:x("appHost"),disabled:i,description:e("setup.mail_branding.field.appHost_hint",{defaultValue:"Inclusief https://, zonder trailing slash. Bv. https://exhibitor-portal.nl"})})}),p.jsxs(Un,{icon:p.jsx(ya,{size:18}),title:e("setup.mail_branding.section.sender",{defaultValue:"Afzender (from / reply-to)"}),description:e("setup.mail_branding.section.sender_desc",{defaultValue:"Verschijnt in de e-mail-client als afzender. Reply-to is optioneel; leeg = antwoorden gaan naar het from-adres."}),children:[p.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[p.jsx(F,{label:e("setup.mail_branding.field.mailFromAddress",{defaultValue:"From-adres"}),placeholder:An,value:a.mailFromAddress,onChange:x("mailFromAddress"),disabled:i,type:"email"}),p.jsx(F,{label:e("setup.mail_branding.field.mailFromName",{defaultValue:"Afzender-naam (display)"}),placeholder:En,value:a.mailFromName,onChange:x("mailFromName"),disabled:i})]}),p.jsx("div",{className:"mt-4",children:p.jsx(F,{label:e("setup.mail_branding.field.replyTo",{defaultValue:"Reply-to (optioneel)"}),placeholder:Vn,value:a.replyTo,onChange:x("replyTo"),disabled:i,type:"email",leadingIcon:p.jsx(Yt,{size:16})})})]}),p.jsx(Un,{icon:p.jsx(X,{size:18}),title:e("setup.mail_branding.section.contact",{defaultValue:"Contact-info in mail-body"}),description:e("setup.mail_branding.section.contact_desc",{defaultValue:'De "voor vragen kun je contact opnemen via..."-regel onderaan elke mail.'}),children:p.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[p.jsx(F,{label:e("setup.mail_branding.field.contactEmail",{defaultValue:"Contact-mail"}),placeholder:Mn,value:a.contactEmail,onChange:x("contactEmail"),disabled:i,type:"email",leadingIcon:p.jsx(X,{size:16})}),p.jsx(F,{label:e("setup.mail_branding.field.contactPhone",{defaultValue:"Contact-telefoon"}),placeholder:Ln,value:a.contactPhone,onChange:x("contactPhone"),disabled:i,leadingIcon:p.jsx(ee,{size:16})})]})}),p.jsx(Un,{icon:p.jsx(Na,{size:18}),title:e("setup.mail_branding.section.signoff",{defaultValue:"Sign-off (afsluiting)"}),description:e("setup.mail_branding.section.signoff_desc",{defaultValue:'Persoonlijke naam + brand-naam onderaan de mail. Brand-naam wordt ook gebruikt voor de generieke "Het [brand]-team" tekst.'}),children:p.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[p.jsx(F,{label:e("setup.mail_branding.field.senderName",{defaultValue:"Persoonlijke naam (sign-off)"}),placeholder:On,value:a.senderName,onChange:x("senderName"),disabled:i,leadingIcon:p.jsx(Na,{size:16})}),p.jsx(F,{label:e("setup.mail_branding.field.brandName",{defaultValue:"Brand / organisatie"}),placeholder:$n,value:a.brandName,onChange:x("brandName"),disabled:i,leadingIcon:p.jsx(_a,{size:16})})]})})]}):p.jsx("div",{className:"py-12 text-center text-[var(--color-text-muted)]",children:e("participants_missing_project_id",{defaultValue:"Geen project gevonden."})})},Un=({icon:e,title:t,description:a,children:s})=>p.jsxs("section",{className:"rounded-xl border border-[var(--color-border)] bg-[var(--color-bg)] p-5",children:[p.jsxs("div",{className:"mb-4 flex items-start gap-3",children:[p.jsx("div",{className:"rounded-lg bg-[var(--color-bg-elevated)] p-2 text-[var(--color-text-muted)]",children:e}),p.jsxs("div",{className:"flex-1",children:[p.jsx("h4",{className:"[font-size:var(--text-base)] font-semibold text-[var(--color-text)]",children:t}),a&&p.jsx("p",{className:"mt-0.5 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:a})]})]}),s]}),Kn=new Set(["password_reset","email_change_verification","invoice_sent","credit_note_sent","invoice_reminder_1","invoice_reminder_2","invoice_final_notice"]);function Wn(e){return!Kn.has(e)}function Hn(){return m(this,null,(function*(){const e=ye.currentUser;if(!e)throw new Error("Niet ingelogd");const t=yield e.getIdToken(),a=yield fetch(Oe("getMailTemplateDefaults"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:"{}"});if(!a.ok){const e=yield a.text().catch((()=>""));throw new Error(e||`getMailTemplateDefaults faalde (HTTP ${a.status})`)}return a.json()}))}function Rn(e){return m(this,null,(function*(){const t=yield jt(ft(W,"projectMailTemplates",e));return t.exists()?t.data():null}))}function qn(e,t,a,s){return m(this,null,(function*(){const r=ye.currentUser;if(!r)throw new Error("Niet ingelogd");const n=ft(W,"projectMailTemplates",e);yield yt(n,{templates:{[t]:{[a]:s}},updatedAt:Bt(),updatedBy:r.uid},{merge:!0})}
2))}function Gn(e,t){var a,s;return!!Wn(t)&&!1!==(null==(s=null==(a=null==e?void 0:e.templateSettings)?void 0:a[t])?void 0:s.requireConfirmation)}function Jn(e,t,a,s){return m(this,null,(function*(){const r=ft(W,"projectMailTemplates",e);yield yt(r,{templates:{[t]:{[a]:{[s]:Tt()}}},updatedAt:Bt()},{merge:!0})}))}const Yn={invite_exhibitor:{id:"invite_exhibitor",name:"Uitnodiging â exposant",tagline:"Standhouders welkom heten in hun exposantenomgeving",description:"De eerste mail die een exposant ontvangt nadat je 'm uitnodigt. Bevat de set-password-link (90 dagen geldig), uitleg over wat ze in hun omgeving kunnen doen (plattegrond, badges, profiel, nieuws) en jouw contact-info.",recipient:"Exposant (nieuwe gebruiker met rol exhibitor)",trigger:"Admin nodigt uit via /admin/users of via een booth in de plattegrond-builder",cfName:"inviteUser â createInvitedUser",keyVariables:["salutation","firstName","projectName","passwordResetLink","brandName","senderName"],icon:_a,tone:"invite",multilingual:!0},invite_presenter:{id:"invite_presenter",name:"Uitnodiging â spreker",tagline:"Sprekers en trainers toegang tot het sprekersÂportaal",description:"Variant op de exhibitor-mail, specifiek voor sprekers/presentatoren. Verwijst naar het sprekersportaal waarin ze hun titel, bio, foto's en presentatie-materiaal kunnen beheren.",recipient:"Spreker (rol presenter/spreker)",trigger:'Admin selecteert rol "Spreker" in de invite-wizard',cfName:"inviteUser â createInvitedUser",keyVariables:["salutation","firstName","projectName","passwordResetLink","brandName"],icon:Xt,tone:"invite",multilingual:!0},invite_supplier:{id:"invite_supplier",name:"Uitnodiging â leverancier",tagline:"Leveranciers toegang tot het bestellingen-portaal",description:"Voor leveranciers die orders moeten kunnen inzien en bevestigen. Vermeldt het leveranciersportaal en welke acties beschikbaar zijn.",recipient:"Leverancier (rol supplier, gekoppeld aan tenant-supplier)",trigger:'Admin selecteert rol "Leverancier" + kiest een supplier-koppeling',cfName:"inviteUser â createInvitedUser",keyVariables:["salutation","firstName","supplierName","passwordResetLink","brandName"],icon:He,tone:"invite",multilingual:!0},invite_user:{id:"invite_user",name:"Uitnodiging â beheerÂomgeving",tagline:"Admins, project-managers en viewers",description:"Voor interne rollen â admin, project-manager, viewer. Geen exposanten- of leverancierscontext; gewoon een uitnodiging om het admin-dashboard te gebruiken.",recipient:"Interne gebruiker (admin / project_manager / viewer)",trigger:"Admin selecteert een interne rol in de invite-wizard",cfName:"inviteUser â createInvitedUser",keyVariables:["salutation","firstName","projectName","passwordResetLink","brandName"],icon:Sa,tone:"invite",multilingual:!0}
2,password_reset:{id:"password_reset",name:"Wachtwoord resetten",tagline:"Gebruiker vraagt zelf reset aan",description:'Verzonden wanneer een gebruiker op de login-page op "wachtwoord vergeten" klikt. Bevat een reset-link die 1 uur geldig is.',recipient:"Bestaande gebruiker die reset aanvraagt",trigger:'Login-page "Wachtwoord vergeten"-flow',cfName:"sendPasswordReset",keyVariables:["salutation","firstName","resetLink","validityHours","brandName"],icon:za,tone:"lifecycle",multilingual:!0},email_change_verification:{id:"email_change_verification",name:"E-mailÂwijziging bevestigen",tagline:"Verifieer een nieuw e-mailadres",description:"Wordt verstuurd naar het NIEUWE e-mailadres wanneer een admin een gebruiker's mail wijzigt. Pas na klik op de bevestigingslink wordt het adres echt aangepast. Link is 24 uur geldig.",recipient:"Gebruiker (op het nieuwe adres)",trigger:"Admin wijzigt e-mailadres via UserDetailDrawer",cfName:"updateUserEmail",keyVariables:["oldEmail","newEmail","verificationLink","validityHours"],icon:X,tone:"lifecycle",multilingual:!0},reminder_day7:{id:"reminder_day7",name:"Herinnering â dag 7",tagline:"Eerste nudge na 7 dagen geen activatie",description:'Automatische reminder voor exposanten die hun account 7 dagen na de uitnodiging nog niet geactiveerd hebben. Vriendelijke "heads up" met de originele set-password-link.',recipient:"Pending exposant (7+ dagen oude uitnodiging)",trigger:"Scheduled job (dagelijks 10:00 NL) â `sendInvitationReminders`",cfName:"sendInvitationReminders",keyVariables:["salutation","firstName","projectName","passwordResetLink","contactEmail"],icon:We,tone:"lifecycle",multilingual:!0},reminder_day14:{id:"reminder_day14",name:"Herinnering â dag 14 (laatste)",tagline:"Tweede en laatste reminder",description:"Urgentere reminder voor exposanten met een 14+ dagen oude uitnodiging. Na deze mail wordt er niet opnieuw gepushed â de uitnodiging blijft beschikbaar, maar admin moet contact opnemen als de exposant niet reageert.",recipient:"Pending exposant (14+ dagen oude uitnodiging)",trigger:"Scheduled job (dagelijks 10:00 NL) â `sendInvitationReminders`",cfName:"sendInvitationReminders",keyVariables:["salutation","firstName","projectName","passwordResetLink","contactEmail"],icon:wa,tone:"lifecycle",multilingual:!0},project_access_granted:{id:"project_access_granted",name:"Project-toegang verleend",tagline:"Bestaande gebruiker krijgt toegang tot een nieuw project",description:"Wordt verstuurd wanneer een gebruiker die al een account heeft (bv. een Duikvaker-exhibitor) wordt toegevoegd aan een nieuw project (Duikvaker 2027). Anders dan `invite_user`: geen wachtwoord-link â gebruiker logt in met bestaande gegevens. Bevat een directe portal-link + uitleg over wat hij in het nieuwe project kan doen.",recipient:"Bestaande gebruiker met status `active`",trigger:"Admin vinkt project aan in `ProjectAccessModal` (CF `addUserToProject`), of admin wijst booth toe in nieuw project (CF `assignBoothToUser` met `addedProjectMembership=true`)",cfName:"addUserToProject / assignBoothToUser â sendProjectAccessGrantedMail",keyVariables:["salutation","firstName","projectName","appHost","contactEmail","brandName"],icon:Ca,tone:"lifecycle",multilingual:!0},booth_reservation_admin_notification:{id:"booth_reservation_admin_notification",name:"Standreservering â adminÂnotificatie",tagline:"Notificatie naar organisator bij booking-aanvraag",description:"Verstuurd naar de project-organizer wanneer iemand op de publieke plattegrond een booth reserveert. Bevat alle ingevulde gegevens (bedrijf, contact, adres, eventuele opmerkingen).",recipient:"Project-organizer (projects.email)",trigger:"Publieke booth-reservation-widget op /web/{project}",cfName:"submitBoothReservation",keyVariables:["boothNumber","companyName","contactName","senderEmail","projectName"],icon:ka,tone:"submission",multilingual:!0},application_form_confirmation:{id:"application_form_confirmation",name:"Order- & aanmeldbevestiging",tagline:"Orderbevestiging + aanmeld-approval (met PDF's)",description:"Dé bevestigingsmail bij orders/aanmeldingen. Wordt verstuurd (1) als ORDERBEVESTIGING vanuit het orderoverzicht (/projects/â¦/orders â verstuur-modal) en (2) naar de aanmelder NA admin-approval van een aanmeldformulier. Bevat orderÂoverzicht + algemene voorwaarden als PDF-bijlagen, plus admin-getypte tekst. Pas deze template aan om de orderbevestiging te wijzigen.",recipient:"Exposant / aanmelder",trigger:"Verstuur een orderbevestiging vanuit het orderoverzicht, óf admin keurt een aanmeldformulier goed via /admin/applications",cfName:"sendOrderConfirmation / sendExhibitorConfirmation / sendApplicationFormConfirmation",keyVariables:["salutation","firstName","projectName","submissionDetail
2sHtml","brandName"],icon:Ke,tone:"submission",multilingual:!0},application_form_quote:{id:"application_form_quote",name:"Order- & aanmeldbevestiging â offerte",tagline:"Offerte-variant van de orderbevestiging (met PDF's)",description:'Verstuurd wanneer een order/bevestiging als OFFERTE wordt verzonden (switch "offerte" in de verstuur-modal). Kopie van de aanmeldformulier-bevestiging, met offerte-tekst en {{quoteValidUntil}}. Bevat orderoverzicht + voorwaarden als PDF-bijlagen.',recipient:"Exposant (in spe)",trigger:"Verstuur bevestiging met de offerte-switch aan, vanuit het orderoverzicht",cfName:"sendOrderConfirmation / sendExhibitorConfirmation",keyVariables:["salutation","firstName","projectName","submissionDetailsHtml","quoteValidUntil","brandName"],icon:Ke,tone:"submission",multilingual:!0},application_form_organizer_notification:{id:"application_form_organizer_notification",name:"AanmeldingsÂformulier â naar organisator",tagline:"Notificatie zodra een aanmelding binnenkomt",description:'Verstuurd naar de project-organizer zodra een exposant een aanmeldformulier indient (vóór bevestiging), zodat een nieuwe aanmelding niet onopgemerkt blijft. Bevat de ingevulde gegevens (zonder prijzen â die staan in het dashboard). Niet te verwarren met "Aanmeldingsformulier â bevestiging", die ná goedkeuring naar de aanmelder gaat.',recipient:"Project-organizer (projects.email)",trigger:"Exposant dient aanmeldformulier in op de publieke site (Firestore-trigger onApplicationFormSubmissionCreated)",cfName:"onApplicationFormSubmissionCreated",keyVariables:["companyName","contactName","contactEmail","projectName","submissionDetailsHtml"],icon:ka,tone:"submission",multilingual:!0},contact_form_organizer_notification:{id:"contact_form_organizer_notification",name:"Contactformulier â naar organisator",tagline:"Bericht via /contact-pagina van de publieke site",description:"Verstuurd naar de project-organizer wanneer iemand het contactformulier op de publieke site invult. Reply-to staat op de oorspronkelijke sender zodat antwoorden direct gaat.",recipient:"Project-organizer (projects.email)",trigger:"Publieke contact-form op /web/{project}/contact",cfName:"sendContactForm (index.ts)",keyVariables:["fullName","senderEmail","subject","message","projectName"],icon:te,tone:"submission",multilingual:!0},contact_form_sender_confirmation:{id:"contact_form_sender_confirmation",name:"Contactformulier â bevestiging sender",tagline:'Automatische "we hebben het ontvangen" mail',description:"Automatische bevestigingsmail aan degene die het contactformulier heeft ingevuld. Toont een samenvatting van wat ze hebben gestuurd.",recipient:"Sender (degene die contactformulier invulde)",trigger:"Publieke contact-form (gelijktijdig met organizer-notificatie)",cfName:"sendContactForm (index.ts)",keyVariables:["fullName","subject","message","projectName","brandName"],icon:ya,tone:"submission",multilingual:!0},form_submission_organizer_notification:{id:"form_submission_organizer_notification",name:"Tenant-form â organisatorÂnotificatie",tagline:"Admin-getriggerde formulier-inzendingen",description:"Voor formulieren die binnen het tenant-portaal zijn ingevuld door geauthenticeerde gebruikers (bv. exposanten). Bevat alle ingevulde velden + sender-context.",recipient:"Project-organizer (projects.email)",trigger:"Geauthenticeerde gebruiker submit een tenant-form (`onFormSubmissionCreated`)",cfName:"onFormSubmissionCreated (index.ts)",keyVariables:["formTitle","submissionId","submissionDetailsHtml","projectName"],icon:Ke,tone:"submission",multilingual:!0},public_form_submission_organizer:{id:"public_form_submission_organizer",name:"Publiek form â organisatorÂnotificatie",tagline:"Publieke formulier-inzendingen (eventueel met scheduled publish)",description:"Voor publieke formulieren op /web/{project}-pagina's. Bevat extra status-info zoals geplande publicatie-datum als de submission daarvoor geconfigureerd is.",recipient:"Project-organizer (projects.email)",trigger:"Anonieme submission van publieke form (`onPublicFormSubmissionCreated`)",cfName:"onPublicFormSubmissionCreated (index.ts)",keyVariables:["formTitle","submissionId","submissionDetail
2sHtml","projectName"],icon:ae,tone:"submission",multilingual:!0},shop_order_notification:{id:"shop_order_notification",name:"Bestelling â organisatorÂnotificatie",tagline:"Nieuwe shop-bestelling van een exposant",description:"Wordt verstuurd zodra een exposant een bestelling plaatst via de shop (extra's, badges, services). Bevat ordernummer, bestelregels-tabel, totalen en eventueel een opmerking van de klant. Reply-to staat op het mailadres van de exposant zodat direct kan worden teruggemaild.",recipient:"Project-organizer (projects.email)",trigger:"Exposant rondt bestelling af in de shop (`createShopOrder`)",cfName:"createShopOrder",keyVariables:["orderNumber","companyName","orderItemsHtml","total","customerNote"],icon:Ue,tone:"operations",multilingual:!0},order_changed_notification:{id:"order_changed_notification",name:"Order gewijzigd â organisatorÂnotificatie",tagline:"Exposant wijzigt of annuleert zelf een geplaatste order",description:"Gaat uit zodra een exposant zélf een reeds geplaatste order aanpast of annuleert. Voorheen gebeurde dat stil â de mutatie stond alleen in het order-auditlog, terwijl de organisator de spullen al bij de leverancier besteld kon hebben. Bevat het ordernummer, wat er is gewijzigd, de nieuwe status en het nieuwe totaal. Wordt niet verstuurd wanneer een admin de wijziging doet.",recipient:"Project-organizer (projects.email)",trigger:"Exposant muteert zijn eigen order (`mutateExhibitorOrder`)",cfName:"mutateExhibitorOrder",keyVariables:["orderNumber","companyName","changeSummary","orderStatus","total"],icon:Ue,tone:"operations",multilingual:!0},fair_planning_visitor:{id:"fair_planning_visitor",name:"Beursprogramma â bezoeker",tagline:"Bezoeker stuurt zichzelf een persoonlijk beursprogramma",description:"Bezoekers van de publieke beurs-site kunnen hun eigen samengesteld programma (sessies + te bezoeken exposanten) naar zichzelf mailen. De CF rendert de programma- en exposanten-blokken als HTML; admin kan de wrapper-copy, header en footer aanpassen.",recipient:"Bezoeker (zelf-ingevuld e-mailadres)",trigger:'Bezoeker klikt "Stuur naar mij" op /web/{project}/mijn-programma (`sendFairPlanningEmail`)',cfName:"sendFairPlanningEmail (index.ts)",keyVariables:["projectName","programHtml","exhibitorsHtml","currentDate"],icon:Zt,tone:"operations",multilingual:!0},invoice_sent:{id:"invoice_sent",name:"Factuur â naar klant",tagline:"De factuur als pdf naar de klant, met betaalgegevens",description:'Wordt verstuurd wanneer een beheerder op een concept-factuur op "Versturen" klikt. De pdf zit als bijlage; de mail toont factuurnummer, te betalen bedrag, vervaldatum, IBAN en betalingskenmerk. Bij termijnfacturen staat het label (Aanbetaling 50% / Restant 50%) erbij. Onderaan zit een onzichtbare pixel waarmee de status "Bekeken" wordt gezet.',recipient:"Klant (buyer.email op de factuur)",trigger:"Beheerder verstuurt een concept-factuur (`invoicingSendInvoice`)",cfName:"invoicingSendInvoice",keyVariables:["invoiceNumber","amountDue","dueDate","paymentIban","installmentLabel","sellerCompanyName"],icon:Fe,tone:"invoicing",multilingual:!0},credit_note_sent:{id:"credit_note_sent",name:"Creditnota â naar klant",tagline:"De creditnota als pdf naar de klant",description:"Wordt verstuurd wanneer een beheerder een concept-creditnota verstuurt. Zelfde flow als de factuur; het bedrag is negatief.",recipient:"Klant (buyer.email op de creditnota)",trigger:"Beheerder verstuurt een concept-creditnota (`invoicingSendInvoice`)",cfName:"invoicingSendInvoice",keyVariables:["invoiceNumber","total","orderNumber","sellerCompanyName"],icon:Fe,tone:"invoicing",multilingual:!0},invoice_reminder_1:{id:"invoice_reminder_1",name:"Factuur â 1e herinnering",tagline:"Vriendelijke herinnering na de vervaldatum",description:'Handmatig via "Herinnering versturen" op de factuur, of automatisch door de dagelijkse check zodra "Automatisch herinneringen versturen" aanstaat in de factuurinstellingen en het ingestelde aantal dagen is verstreken. De factuur-pdf gaat opnieuw mee.',recipient:"Klant (buyer.email op de factuur)",trigger:"Knop op de factuur of dagelijkse check 08:00 (`invoicingCheckOverdueInvoices`)",cfName:"invoicingSend
2Reminder / invoicingCheckOverdueInvoices",keyVariables:["invoiceNumber","amountDue","dueDate","daysPastDue","paymentIban"],icon:wa,tone:"invoicing",multilingual:!0},invoice_reminder_2:{id:"invoice_reminder_2",name:"Factuur â 2e herinnering",tagline:"Tweede herinnering, dringender van toon",description:"Volgt op de eerste herinnering volgens het schema in de factuurinstellingen. Handmatig of automatisch.",recipient:"Klant (buyer.email op de factuur)",trigger:"Knop op de factuur of dagelijkse check (`invoicingCheckOverdueInvoices`)",cfName:"invoicingSendReminder / invoicingCheckOverdueInvoices",keyVariables:["invoiceNumber","amountDue","dueDate","daysPastDue"],icon:wa,tone:"invoicing",multilingual:!0},invoice_final_notice:{id:"invoice_final_notice",name:"Factuur â aanmaning",tagline:"Laatste stap vóór verdere maatregelen",description:"Derde en laatste stap in de escalatie. Handmatig of automatisch volgens het schema.",recipient:"Klant (buyer.email op de factuur)",trigger:"Knop op de factuur of dagelijkse check (`invoicingCheckOverdueInvoices`)",cfName:"invoicingSendReminder / invoicingCheckOverdueInvoices",keyVariables:["invoiceNumber","amountDue","dueDate","daysPastDue"],icon:wa,tone:"invoicing",multilingual:!0}},Zn={invite:{bg:"rgb(99 102 241 / 0.08)",fg:"rgb(67 56 202)",border:"rgb(99 102 241 / 0.3)"},lifecycle:{bg:"rgb(20 184 166 / 0.08)",fg:"rgb(13 148 136)",border:"rgb(20 184 166 / 0.3)"},submission:{bg:"rgb(245 158 11 / 0.08)",fg:"rgb(180 83 9)",border:"rgb(245 158 11 / 0.3)"},operations:{bg:"rgb(168 85 247 / 0.08)",fg:"rgb(126 34 206)",border:"rgb(168 85 247 / 0.3)"},invoicing:{bg:"rgb(26 54 93 / 0.08)",fg:"rgb(26 54 93)",border:"rgb(26 54 93 / 0.3)"}},Xn={invite:"Uitnodiging",lifecycle:"Lifecycle",submission:"Submission",operations:"Operations",invoicing:"Facturatie"},Qn={nl:"Dutch (Nederlands)",en:"English",de:"German (Deutsch)"},ei=["firstName","lastName","fullName","salutation","email","projectName","brandName","senderName","appHost","contactEmail","contactPhone","supplierName","passwordResetLink","resetLink","verificationLink","oldEmail","newEmail","validityHours","urgencyMessage","daysUntilExpiry","subject","message","senderEmail","senderCompany","senderPhone","formTitle","submissionId","applicationId","boothNumber","boothDimensions","companyName","contactName","submissionDetailsHtml","boothDataHtml","headerImageHtml","orderNumber","orderDate","subtotal","vatAmount","total","customerNote","currentDate","orderItemsHtml","programHtml","exhibitorsHtml","invoiceNumber","invoiceDate","dueDate","amountDue","daysPastDue","sellerCompanyName","installmentLabel","paymentIban","invoiceTrackingPixelHtml"].map((e=>`{{${e}}}`)).join(", ");function ti(e){return m(this,null,(function*(){var t,a;const s=ye.currentUser;if(!s)throw new Error("Niet ingelogd");const r=yield s.getIdToken(),n=yield fetch(Oe("proxyClaude"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({projectId:e.projectId,action:"message",payload:{system:e.systemPrompt,messages:[{role:"user",content:e.userMessage}],max_tokens:null!=(t=e.maxTokens)?t:4096,temperature:null!=(a=e.temperature)?a:.3}})});if(!n.ok){const e=yield n.text().catch((()=>""));if(400===n.status&&/credentials/i.test(e))throw new Error("Geen Claude-API-key voor dit project. Configureer een API-key in Setup â Claude.");throw new Error(e||`Claude-call faalde (HTTP ${n.status})`)}const i=yield n.json();if(i.error)throw new Error(i.error.message||"Claude returned an error");const l=(i.content||[]).filter((e=>"text"===e.type&&"string"==typeof e.text)).map((e=>e.text||"")).join("\n").trim();if(!l)throw new Error("Claude returned an empty response");return l}))}function ai(e){const t=function(e){try{return JSON.parse(e)}catch(s){}const t=e.match(/```(?:json)?\s*([\s\S]*?)```/);if(t)try{return JSON.parse(t[1])}catch(s){}const a=e.match(/\{[\s\S]*\}/);if(a)try{return JSON.parse(a[0])}catch(s){}throw new Error("Claude reply was geen valide JSON")}(e),a="string"==typeof t.subject?t.subject:"",s="string"==typeof t.html?t.html:"",r="string"==typeof t.plainText?t.plainText:null;if(!a||!s)throw new Error("Claude-reply mist verplichte velden 'subject' of 'html'");return{subject:a,html:s,plainText:r}}const si={firstName:"Jan",lastName:"Janssen",fullName:"Jan Janssen",email:"[email protected]",brandName:"Voorbeeld Brand",senderName:"Patrick van Brienen",appHost:"https://exhibitor-portal.nl",contactEmail:"[email protected]",contactPhone:"+31 (0)30 1234567",supplierName:"Voorbeeld Leverancier",passwordResetLink:"https://exhibitor-portal.nl/set-password/sample",resetLink:"https://exhibitor-portal.nl/reset/sample",verificationLink:"https://exhibitor-portal.nl/verify/sample",oldEmail:"[email protected]",newEmail:"[email protected]",validityHours:"24",subject:"[Voorbeeld]",message:"Voorbeeld-berichtâ¦",senderEmail:"[email protected]",senderCompany:"Voorbeeld BV",senderPhone:"+31 (0)6 12345678",formTitle:"Voorbeeldformulier",submissionId:"abc123",applicationId:"app-789",boothNumber:"A-12",boothDimensions:"4x3",companyName:"Voorbeeld BV",contactName:"Jan Janssen",submissionDetail
2sHtml:'<div style="padding:16px;background:#f9fafb;border-radius:6px;color:#6b7280;font-size:13px;">[ ingediende velden komen hier ]</div>',boothDataHtml:'<div style="padding:16px;background:#f9fafb;border-radius:6px;color:#6b7280;font-size:13px;">[ booth-gegevens-tabel komt hier ]</div>',urgencyMessage:"",daysUntilExpiry:"7",invoiceNumber:"INV-2026-0042",invoiceDate:"07 september 2026",dueDate:"07 oktober 2026",amountDue:"⬠1.512,50",daysPastDue:"14",sellerCompanyName:"The Exhibition Company B.V.",installmentLabel:"Aanbetaling 50%",paymentIban:"NL00 BANK 0123 4567 89",invoiceTrackingPixelHtml:"",orderNumber:"ORD-2026-0042",orderDate:"16-05-2026, 14:32",subtotal:"⬠1.250,00",vatAmount:"⬠262,50",total:"⬠1.512,50",customerNote:"Graag voor opening leveren.",currentDate:"donderdag 16 mei 2026",orderItemsHtml:'<tr><td style="padding:10px 12px;color:#374151;">Stoel</td><td style="padding:10px 12px;color:#6b7280;text-align:center;">4</td><td style="padding:10px 12px;color:#6b7280;text-align:right;">⬠25,00</td><td style="padding:10px 12px;color:#374151;text-align:right;font-weight:600;">⬠100,00</td></tr>',programHtml:'<div style="padding:16px;background:#f9fafb;border-radius:6px;color:#6b7280;font-size:13px;">[ programma-blok komt hier ]</div>',exhibitorsHtml:'<div style="padding:16px;background:#f9fafb;border-radius:6px;color:#6b7280;font-size:13px;">[ exposanten-tabel komt hier ]</div>'};function ri(e,t){return e?e.replace(/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g,((e,a)=>void 0!==t[a]?t[a]:e)):""}function ni(e,t,a){const s=c(d({},si),{projectName:t||"[Project]"}),r=ri(e.html,s).replace(/\{\{headerImageHtml\}\}/g,(n=a)?`<div style="margin-bottom: 24px;"><img src="${n}" alt="" style="max-width: 100%; height: auto; display: block;" /></div>`:"");var n;const i=ri(e.subject,s);return`<!DOCTYPE html><html><head>\n<meta charset="utf-8" />\n<style>\nbody{margin:0;padding:16px;background:#f8fafc;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;color:#0f172a;}\n.subj{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:10px 14px;margin-bottom:12px;font-size:12px;color:#475569;}\n.subj .l{font-size:9px;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;font-weight:600;display:block;margin-bottom:3px;}\n.subj .v{color:#0f172a;font-size:13px;font-weight:500;}\n.body{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:20px;box-shadow:0 2px 6px rgba(15,23,42,0.04);}\n</style>\n</head><body>\n<div class="subj"><span class="l">Onderwerp</span><span class="v">${l=i||"â",l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}</span></div>\n<div class="body">${r}</div>\n</body></html>`;var l}const ii=({open:e,onClose:t,onAccept:a,actionLabel:s,current:r,proposed:n,language:i,projectName:l,headerImageUrl:o})=>{const{t:d}=T("projects"),c=h.useMemo((()=>ni(r,l,o)),[r,l,o]),u=h.useMemo((()=>n?ni({subject:n.subject,html:n.html},l,o):""),[n,l,o]);return e&&n?p.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:t,children:p.jsxs("div",{className:"relative w-full max-w-6xl max-h-[92vh] flex flex-col rounded-2xl bg-[var(--color-bg-elevated)] border border-[var(--color-border)] shadow-2xl",onClick:e=>e.stopPropagation(),children:[p.jsxs("div",{className:"flex items-start justify-between gap-4 p-5 border-b border-[var(--color-border)]",children:[p.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[p.jsx("div",{className:"flex-shrink-0 rounded-lg p-2.5",style:{background:"linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(168,85,247,0.15) 100%)",color:"rgb(99 102 241)"},children:p.jsx(ae,{size:22})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"font-semibold text-[var(--color-text)]",style:{fontSize:"var(--text-lg)"},children:d("setup.mail_templates.ai_proposal_title",{defaultValue:"AI-voorstel klaar"})}),p.jsxs("p",{className:"mt-0.5 text-[var(--color-text-muted)]",style:{fontSize:"var(--text-sm)"},children:[s," · ",d("setup.mail_templates.ai_proposal_subtitle",{defaultValue:"Vergelijk huidig met voorgesteld en kies of je het toepast op de editor."})]})]})]}),p.jsx("button",{type:"button",onClick:t,"aria-label":"Sluiten",className:"flex-shrink-0 p-1.5 rounded text-[var(--color-text-muted)] hover:bg-[var(--color-bg)] hover:text-[var(--color-text)] transition",children:p.jsx(Re,{size:18})})]}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-px bg-[var(--color-border)] border-b border-[var(--color-border)]",children:[p.jsxs("div",{className:"bg-[var(--color-bg)] p-4",children:[p.jsx("div",{className:"uppercase tracking-wider text-[var(--color-text-muted)] mb-1 font-semibold",style:{fontSize:"10px",letterSpacing:"0.08em"},children:"Huidig onderwerp"}),p.jsx("div",{className:"text-[var(--color-text)] break-words",style:{fontSize:"var(--text-sm)"},children:r.subject||p.jsx("span",{className:"italic text-[var(--color-text-muted)]",children:"(leeg)"})})]}),p.jsxs("div",{className:"bg-[var(--color-bg)] p-4 relative",children:[p.jsxs("div",{className:"uppercase tracking-wider mb-1 font-semibold flex items-center gap-1",style:{fontSize:"10px",letterSpacing:"0.08em",color:"rgb(99 102 241)"},children:[p.jsx(ae,{size:10}),"Voorgesteld onderwerp"]}),p.jsx("div",{className:"text-[var(--color-text)] break-words",style:{fontSize:"var(--text-sm)"},children:n.subject})]})]}),p.jsxs("div",{className:"flex-1 grid grid-cols-1 md:grid-cols-2 gap-px bg-[var(--color-border)] overflow-hidden",children:[p.jsxs("div",{className:"bg-[var(--color-bg)] flex flex-col min-h-0",children:[p.jsx("div",{className:"px-4 py-2 border-b border-[var(--color-border)] uppercase tracking-wider text-[var(--color-text-muted)] font-semibold",style:{fontSize:"10px",letterSpacing:"0.08em"},children:"Huidig"}),p.jsx("iframe",{title:"Huidig",srcDoc:c,sandbox:"",className:"flex-1 w-full bg-white",style:{minHeight:"300px",border:0}})]}),p.jsxs("div",{className:"bg-[var(--color-bg)] flex flex-col min-h-0",children:[p.jsxs("div",{className:"px-4 py-2 border-b border-[var(--color-border)] uppercase tracking-wider font-semibold flex items-center gap-1",style:{fontSize:"10px",letterSpacing:"0.08em",color:"rgb(99 102 241)"},children:[p.jsx(ae,{size:10}),"Voorgesteld"]}),p.jsx("iframe",{title:"Voorgesteld",srcDoc:u,sandbox:"",className:"flex-1 w-full bg-white",style:{minHeight:"300px",border:0}})]})]}),p.jsxs("div",{className:"p-4 flex items-center justify-between gap-2 border-t border-[var(--color-border)]",children:[p.jsx("p",{className:"text-[var(--color-text-muted)]",style:{fontSize:"var(--text-xs)"},children:"Toepassen overschrijft de editor â opslaan blijft een aparte stap."}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(V,{type:"button",variant:"ghost",onClick:t,children:"Annuleren"}),p.jsx(V,{type:"button",variant:"primary",icon:p.jsx(qe,{size:14}),onClick:()=>a(n),children:"Toepassen op editor"})]})]})]})}):null},li=["nl","en","de"],oi={nl:"Nederlands",en:"English",de:"Deutsch"},di=[{id:"invites",label:"Uitnodigingen",templateIds:["invite_exhibitor","
2invite_presenter","invite_supplier","invite_user"]},{id:"lifecycle",label:"Lifecycle",templateIds:["password_reset","email_change_verification","reminder_day7","reminder_day14","project_access_granted"]},{id:"submissions",label:"Submissions",templateIds:["booth_reservation_admin_notification","application_form_confirmation","application_form_quote","application_form_organizer_notification","contact_form_organizer_notification","contact_form_sender_confirmation","form_submission_organizer_notification","public_form_submission_organizer"]},{id:"operations",label:"Operations",templateIds:["shop_order_notification","order_changed_notification","fair_planning_visitor"]},{id:"invoicing",label:"Facturatie",templateIds:["invoice_sent","credit_note_sent","invoice_reminder_1","invoice_reminder_2","invoice_final_notice"]}],ci={firstName:"Jan",lastName:"Janssen",fullName:"Jan Janssen",salutation:"Beste Jan,",email:"[email protected]",projectName:"{{projectName}}",brandName:"Voorbeeld Brand",senderName:"Patrick van Brienen",appHost:"https://exhibitor-portal.nl",contactEmail:"[email protected]",contactPhone:"+31 (0)30 1234567",supplierName:"Voorbeeld Leverancier",passwordResetLink:"https://exhibitor-portal.nl/set-password/sample-token-abc123",resetLink:"https://exhibitor-portal.nl/reset/sample-token",verificationLink:"https://exhibitor-portal.nl/verify-email-change/sample-token",oldEmail:"[email protected]",newEmail:"[email protected]",validityHours:"24",subject:"[Voorbeeld onderwerp]",message:"Dit is een voorbeeld-berichtâ¦",senderEmail:"[email protected]",senderCompany:"Voorbeeld BV",senderPhone:"+31 (0)6 12345678",formTitle:"Voorbeeldformulier",submissionId:"abc123def456",applicationId:"app-789",boothNumber:"A-12",boothDimensions:"4x3",companyName:"Voorbeeld BV",contactName:"Jan Janssen",submissionDetailsHtml:'<div style="padding:16px;background:#f9fafb;border-radius:6px;color:#6b7280;">[ ingediende velden komen hier ]</div>',boothDataHtml:'<div style="padding:16px;background:#f9fafb;border-radius:6px;color:#6b7280;">[ booth-gegevens-tabel komt hier ]</div>',urgencyMessage:"",daysUntilExpiry:"7",orderNumber:"ORD-2026-0042",orderDate:"16-05-2026, 14:32",subtotal:"⬠1.250,00",vatAmount:"⬠262,50",total:"⬠1.512,50",customerNote:"Graag voor opening leveren, vrijdag tussen 8 en 10 uur.",currentDate:"donderdag 16 mei 2026",invoiceNumber:"INV-2026-0042",invoiceDate:"07 september 2026",dueDate:"07 oktober 2026",amountDue:"⬠1.512,50",daysPastDue:"14",sellerCompanyName:"The Exhibition Company B.V.",installmentLabel:"Aanbetaling 50%",paymentIban:"NL00 BANK 0123 4567 89",invoiceTrackingPixelHtml:"",orderItemsHtml:'<tr><td style="padding:10px 12px;border-bottom:1px solid #e5e7eb;color:#374151;">Stoel â chroom</td><td style="padding:10px 12px;border-bottom:1px solid #e5e7eb;color:#6b7280;text-align:center;">4</td><td style="padding:10px 12px;border-bottom:1px solid #e5e7eb;color:#6b7280;text-align:right;">⬠25,00</td><td style="padding:10px 12px;border-bottom:1px solid #e5e7eb;color:#374151;text-align:right;font-weight:600;">⬠100,00</td></tr>',programHtml:'<h2 style="color:#0d9488;margin-top:30px;margin-bottom:15px;font-size:18px;">Programma</h2><div style="padding:12px 15px;border-bottom:1px solid #e5e7eb;"><div style="color:#0d9488;font-weight:bold;font-size:14px;">10:00 ⢠Hal A</div><div style="font-weight:600;color:#1f2937;margin-top:4px;">[ programma-item ]</div></div>',exhibitorsHtml:'<h2 style="color:#0d9488;margin-top:30px;margin-bottom:15px;font-size:18px;">Te bezoeken exposanten</h2><table style="width:100%;border-collapse:collapse;"><tr style="background:#0d9488;color:white;"><th style="padding:10px 15px;text-align:left;">Bedrijf</th><th style="padding:10px 15px;text-align:right;">Stand</th></tr><tr style="background:#f9fafb;"><td style="padding:10px 15px;color:#1f2937;">Voorbeeld BV</td><td style="padding:10px 15px;text-align:right;color:#0d9488;font-weight:bold;">A-12</td></tr></table>'};function ui(e,t){return e?e.replace(/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g,((e,a)=>void 0!==t[a]?t[a]:e)):""}const mi=()=>{const{t:e}=T("projects"),{id:t}=g(),{currentUser:a}=K(),[s,r]=h.useState(null),[n,i]=h.useState({}),[l,o]=h.useState(null),[u,x]=h.useState([]),[b,v]=h.useState(""),[f,j]=h.useState("invite_exhibitor"),[y,N]=h.useState("nl"),[_,w]=h.useState("editor"),[k,C]=h.useState(!1),[S,z]=h.useState(!0),[I,P]=h.useState(!1),[D,B]=h.useState(!1),[L,$]=h.useState(!1),[U,H]=h.useState(null),[R,q]=h.useState(""),[G,J]=h.useState(""),[Y,Z]=h.useState(""),X=h.useRef(null),[Q,ee]=h.useState(""),[te,ae]=h.useState((()=>new Set(di.filter((e=>
2"invites"!==e.id)).map((e=>e.id))))),[se,re]=h.useState(null),[ne,ie]=h.useState(null),[le,oe]=h.useState(""),[ce,ue]=h.useState(!1);h.useEffect((()=>{if(!t||!a)return;let s=!1;return z(!0),Promise.all([Hn(),Rn(t),Ge(t,a).catch((()=>null))]).then((([e,t,a])=>{s||(r(e.defaults),x(e.variables),i((null==t?void 0:t.templates)||{}),o(t),v((null==a?void 0:a.name)||""))})).catch((t=>{A.error(e("setup.mail_templates.error_load",{defaultValue:"Kon templates niet laden."}))})).finally((()=>{s||z(!1)})),()=>{s=!0}}),[t,a,e]);const me=h.useMemo((()=>{var e,t,a,r,i,l;if(!s)return null;const o=null!=(t=null==(e=s[f])?void 0:e[y])?t:{headerImageUrl:null,subject:"",html:"",plainText:null},d=(null==(a=n[f])?void 0:a[y])||{};return{headerImageUrl:null!=(i=null!=(r=d.headerImageUrl)?r:o.headerImageUrl)?i:null,subject:"string"==typeof d.subject&&d.subject.trim().length>0?d.subject:o.subject,html:"string"==typeof d.html&&d.html.trim().length>0?d.html:o.html,plainText:void 0!==d.plainText&&null!==d.plainText?d.plainText:null!=(l=o.plainText)?l:""}}),[s,n,f,y]);h.useEffect((()=>{me&&(H(me.headerImageUrl||null),q(me.subject),J(me.html),Z(me.plainText||""),$(!1))}),[me,f,y]);const pe=h.useCallback((e=>{const t=n[e];return!!t&&Object.values(t).some((e=>!!e&&Object.values(e).some((e=>null!=e&&("string"!=typeof e||e.trim().length>0)))))}),[n]),xe=h.useCallback((e=>{var t;const a=((null==(t=n[f])?void 0:t[y])||{})[e];return null!=a&&("string"!=typeof a||a.trim().length>0)}),[n,f,y]),he=h.useCallback((()=>m(null,null,(function*(){if(t){P(!0);try{yield qn(t,f,y,{subject:R,html:G,plainText:Y.trim()?Y:null,headerImageUrl:U||null}),i((e=>c(d({},e),{[f]:c(d({},e[f]||{}),{[y]:{subject:R,html:G,plainText:Y.trim()?Y:null,headerImageUrl:U||null}})}))),$(!1),A.success(e("setup.mail_templates.saved",{defaultValue:"Template opgeslagen."}))}catch(a){A.error(e("setup.mail_templates.error_save",{defaultValue:"Opslaan mislukt."}))}finally{P(!1)}}}))),[t,f,y,R,G,Y,U,e]),ge=h.useCallback((a=>m(null,null,(function*(){var r;if(t&&s)try{yield Jn(t,f,y,a),i((e=>{const t=d({},e[f]||{}),s=d({},t[y]||{});return delete s[a],t[y]=s,c(d({},e),{[f]:t})}));const n=null==(r=s[f])?void 0:r[y];n&&("subject"===a&&q(n.subject),"html"===a&&J(n.html),"plainText"===a&&Z(n.plainText||""),"headerImageUrl"===a&&H(n.headerImageUrl||null)),$(!1),A.success(e("setup.mail_templates.field_reset",{defaultValue:"Veld teruggezet naar default."}))}catch(n){A.error(e("setup.mail_templates.error_reset",{defaultValue:"Reset mislukt."}))}}))),[t,s,f,y,e]),be=h.useCallback((a=>m(null,null,(function*(){if(!t)return;const s=a.converted||a.original;if(s){B(!0);try{const a=yield function(e,t,a,s){return m(this,null,(function*(){var r;const n=(null==(r=s.name.split(".").pop())?void 0:r.toLowerCase())||"png",i=It(Me,`projects/${e}/mail-headers/${t}__${a}.${n}`);return yield Pt(i,s,{contentType:s.type}),Dt(i)}))}(t,f,y,s);H(a),yield qn(t,f,y,{headerImageUrl:a}),i((e=>c(d({},e),{[f]:c(d({},e[f]||{}),{[y]:c(d({},(e[f]||{})[y]||{}),{headerImageUrl:a})})}))),A.success(e("setup.mail_templates.image_uploaded",{defaultValue:"Banner geüpload."}))}catch(r){A.error(e("setup.mail_templates.error_upload",{defaultValue:"Upload mislukt."}))}finally{B(!1)}}}))),[t,f,y,e]),ve=h.useCallback((()=>m(null,null,(function*(){if(t)try{yield function(e,t,a,s){return m(this,null,(function*(){if(s){try{const e=s.match(/\/o\/(.+?)\?/);if(!e)return;const t=decodeURIComponent(e[1]);yield At(It(Me,t))}catch(r){}yield Jn(e,t,a,"headerImageUrl")}}))}(t,f,y,U),H(null),i((e=>{const t=d({},e[f]||{}),a=d({},t[y]||{});return delete a.headerImageUrl,t[y]=a,c(d({},e),{[f]:t})}))}catch(e){}}))),[t,f,y,U]),fe=h.useCallback((e=>{X.current&&(X.current.insertContent(`{{${e}}}`),$(!0))}),[]),je=h.useMemo((()=>({subject:R,html:G,plainText:Y.trim()?Y:null,headerImageUrl:U})),[R,G,Y,U]),Ne=h.useCallback((()=>m(null,null,(function*(){var a,r,i,l,o;if(!t||se)return;if("nl"===y)return void A.error(e("setup.mail_templates.ai_translate_from_nl_only",{defaultValue:"Vertalen werkt vanuit NL. Selecteer een EN of DE tab."}));const d=(null==(a=null==s?void 0:s[f])?void 0:a.nl)||null,c=null==(r=n[f])?void 0:r.nl,u=d?{headerImageUrl:null!=(l=null!=(i=null==c?void 0:c.headerImageUrl)?i:d.headerImageUrl)?l:null,subject:"string"==typeof(null==c?void 0:c.subject)&&c.subject.trim().length>0?c.subject:d.subject,html:"string"==typeof(null==c?void 0:c.html)&&
2c.html.trim().length>0?c.html:d.html,plainText:void 0!==(null==c?void 0:c.plainText)&&null!==c.plainText?c.plainText:null!=(o=d.plainText)?o:null}:null;if(u){re("translate");try{const a=yield function(e){return m(this,null,(function*(){if(e.sourceLanguage===e.targetLanguage)throw new Error("Bron- en doel-taal zijn gelijk");const t=`You are a professional translator specializing in transactional email content for trade fair / event-organizer software.\n\nYour task: translate email content from ${Qn[e.sourceLanguage]} to ${Qn[e.targetLanguage]}.\n\nCRITICAL RULES:\n1. Preserve ALL HTML tags, attributes, inline styles, and structure EXACTLY. Only translate visible text content.\n2. NEVER translate variables in mustache syntax. These tokens must remain LITERAL: ${ei}.\n3. Preserve link URLs (href values) and image src attributes unchanged.\n4. Maintain the same tone and formality as the source.\n5. Currency, dates, units stay in their original format (admin can localize separately).\n6. Return ONLY a valid JSON object with this exact shape â no prose, no markdown fences:\n {\n "subject": "translated subject line",\n "html": "translated html body",\n "plainText": "translated plain-text body or null if source plainText was null"\n }`,a=`Translate this email template from ${Qn[e.sourceLanguage]} to ${Qn[e.targetLanguage]}.\n\nSource subject:\n${e.content.subject}\n\nSource HTML body:\n${e.content.html}\n\n${e.content.plainText?`Source plainText body:\n${e.content.plainText}`:"Source plainText: null"}\n\nReturn JSON only.`;return ai(yield ti({projectId:e.projectId,systemPrompt:t,userMessage:a,maxTokens:6e3,temperature:.2}))}))}({projectId:t,sourceLanguage:"nl",targetLanguage:y,content:u});ie(a),oe(e("setup.mail_templates.ai_translate_label",{defaultValue:"Vertaling vanuit NL â "+oi[y],target:oi[y]}))}catch(p){A.error((null==p?void 0:p.message)||"Vertalen mislukt")}finally{re(null)}}else A.error("Geen NL-bron beschikbaar")}))),[t,se,y,f,s,n,e]),we=h.useCallback((a=>m(null,null,(function*(){if(!t||se)return;const s=Yn[f];re("text"===a?"improve_text":"html"===a?"improve_html":"improve_both");try{const r=yield function(e){return m(this,null,(function*(){const t={text:"Verbeter ALLEEN de geschreven tekst (subject + headings + body-paragrafen + CTA-knop-labels). Behoud HTML-structuur, classes, inline styles, layout en kleuren EXACT. Maak de copy helderder, vriendelijker en actie-gerichter. Behoud dezelfde lengte (±20%) tenzij content overduidelijk onleesbaar is.",html:"Verbeter ALLEEN de HTML-indeling: betere visuele hiërarchie, modernere spacing, leesbare inline styles, mobile-friendly width-constraints, betere CTA-button-styling, consistente kleuren. Behoud de exacte tekst-inhoud â alleen presentatie aanpassen.",both:"Verbeter zowel de tekst als de HTML-indeling: helderdere copy, betere visuele hiërarchie, modernere styling, sterkere CTA. Behoud de bedoeling en functionaliteit van de mail."}[e.mode],a=`You are a senior email-design expert helping admins of a multi-tenant exhibition/event SaaS platform improve their per-project mail templates.\n\nTemplate-context:\n- Name: ${e.templateName}\n- Description: ${e.templateDescription}\n- Language: ${Qn[e.language]}\n\nImprovement focus for THIS request:\n${t}\n\nCRITICAL RULES:\n1. NEVER translate. Keep the same language as the source.\n2. NEVER change variables in mustache syntax. These tokens must stay LITERAL and unchanged: ${ei}.\n3. NEVER add scripts, external resources, tracking pixels, or content-type-different tags.\n4. Inline CSS only â emails don't support <style> blocks reliably. No external stylesheets.\n5. Use only common email-safe HTML: div, p, h1-h4, ul/li, table, tr, td, a, img, strong, em, br.\n6. Email max-width 600-680px; use 'max-width' inline style on the outer wrapper.\n7. Return ONLY a valid JSON object with this exact shape â no prose, no markdown fences:\n {\n "subject": "improved subject line",\n "html": "improved html body",\n "plainText": "improved plain-text body or null if source had no plainText"\n }`,s=`Improve this mail template. Apply the focus from your system prompt.\n\nCurrent subject:\n${e.content.subject}\n\nCurrent HTML body:\n${e.content.html}\n\n${e.content.plainText?`Current plainText body:\n${e.content.plainText}`:"Current plainText: null"}\n\nReturn JSON only.`;return ai(yield ti({projectId:e.projectId,systemPrompt:a,userMessage:s,maxTokens:6e3,temperature:"html"===e.mode?.4:.5}))}))}({projectId:t,language:y,content:je,mode:a,templateName:s.name,templateDescription:s.description});ie(r);const n="text"===a?e("setup.mail_templates.ai_improve_text",{defaultValue:"Tekst-verbetering"}):"html"===a?e("setup.mail_templates.ai_improve_html",{defaultValue:"Layout-verbetering"}):e("setup.mail_templates.ai_improve_both",{defaultValue:"Tekst + layout verbetering"});oe(n)}catch(r){A.error((null==r?void 0:r.message)||"AI-verbetering mislukt")}finally{re(null)}}))),[t,se,f,y,je,e]),ke=h.useCallback((e=>{q(e.subject),J(e.html),null!==e.plainText&&Z(e.plainText),$(!0),ie(null),oe(""),A.success('Voorstel toegepast op editor. Druk op "Opslaan" om te bewaren.')}),[]),Ce=h.useMemo((()=>{const e=c(d({},ci),{projectName:b||"[Project]"}),t=ui(G,e).replace(/\{\{headerImageHtml\}\}/g,(a=U)?`<div style="margin-bottom: 24px;"><img src="${a}" alt="" style="max-width: 100%; height: auto; display: block;" /></div>`:"");var a;const s=ui(R,e);return`<!DOCTYPE html><html><head>\n<meta charset="utf-8" />\n<title>Preview</title>\n<style>\nbody{margin:0;padding:24px;background:linear-gradient(180deg,#f8fafc 0%,#f1f5f9 100%);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;color:#0f172a;min-height:100vh;box-sizing:border-box;}\n.mail-frame{max-width:680px;margin:0 auto;}\n.subject-bar{background:#fff;border:1px solid #e2e8f0;border-radius:10px;padding:14px 18px;margin-bottom:16px;font-size:13px;color:#475569;box-shadow:0 1px 2px rgba(0,0,0,0.04);}\n.subject-bar .label{display:block;font-size:10px;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;font-weight:600;margin-bottom:4px;}\n.subject-bar .value{color:#0f172a;font-size:14px;font-weight:500;}\n.mail-body{background:#fff;border:1px solid #e2e8f0;border-radius:10px;padding:32px;box-shadow:0 4px 12px rgba(15,23,42,0.06);}\n</style>\n</head><body>\n<div class="mail-frame">\n <div class="subject-bar"><span class="label">Onderwerp</span><span class="value">${r=s||"â",r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}</span></div>\n <div class="mail-body">${t}</div>\n</div>\n</body></html>`;var r}),[G,R,U,b]),Se=h.useMemo((()=>{const e=Q.trim().toLowerCase();return di.map((t=>{const a=t.templateIds.filter((t=>{if(!e)return!0;const a=Yn[t];return a.name.toLowerCase().includes(e)||a.tagline.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||t.toLowerCase().includes(e)}));return c(d({},t),{matchingIds:a})})).filter((e=>e.matchingIds.length>0))}),[Q]),Ie=h.useCallback((e=>{ae((t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a}))}),[]);h.useEffect((()=>{Q.trim()&&ae((e=>{const t=new Set(e);let a=!1;return Se.forEach((e=>{t.has(e.id)&&(t.delete(e.id),a=!0)})),a?t:e}))}),[Q,Se]),h.useEffect((()=>{const e=di.find((e=>e.templateIds.includes(f)));e&&ae((t=>{if(!t.has(e.id))return t;const a=new Set(t);return a.delete(e.id),a}))}),[f]),E(p.jsxs("div",{className:"flex items-center gap-3",children:[L&&p.jsxs("span",{className:"hidden sm:flex items-center gap-1.5",style:{fontSize:"var(--text-xs)",color:"var(--color-text-muted)"}
2,children:[p.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-[var(--color-warning)] animate-pulse"}),e("setup.mail_templates.unsaved",{defaultValue:"Niet opgeslagen wijzigingen"})]}),p.jsx(V,{type:"button",variant:"primary",size:"md",loading:I,disabled:I||!L,onClick:he,children:e("setup.save_button",{defaultValue:"Opslaan"})})]}),[I,L,he,e]);const Pe=Yn[f],De=h.useMemo((()=>{var e;const t=new Set,a=e=>{if(!e)return;const a=e.matchAll(/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g);for(const s of a)t.add(s[1])};a(R),a(G),a(Y);const r=null==(e=null==s?void 0:s[f])?void 0:e[y];a(null==r?void 0:r.subject),a(null==r?void 0:r.html),a(null==r?void 0:r.plainText),Pe.keyVariables.forEach((e=>t.add(e)));const n=new Set(u);return u.filter((e=>t.has(e)&&n.has(e)))}),[R,G,Y,s,f,y,Pe,u]);return t?!S&&s&&me?p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[340px_1fr] gap-6",children:[p.jsxs("aside",{className:"lg:sticky lg:top-4 lg:max-h-[calc(100vh-6rem)] lg:overflow-y-auto",children:[p.jsxs("div",{className:"rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-elevated)] p-4",children:[p.jsxs("div",{className:"relative mb-4",children:[p.jsx(Je,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-muted)]"}),p.jsx("input",{type:"text",value:Q,onChange:e=>ee(e.target.value),placeholder:e("setup.mail_templates.search",{defaultValue:"Zoek templatesâ¦"}),className:"w-full pl-9 pr-8 py-2 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg)] focus:border-[var(--color-accent)] focus:outline-none transition",style:{fontSize:"var(--text-sm)"}}),Q&&p.jsx("button",{type:"button",onClick:()=>ee(""),"aria-label":"Wis zoekopdracht",className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded text-[var(--color-text-muted)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text)]",children:p.jsx(Re,{size:12})})]}),0===Se.length&&p.jsx("p",{className:"text-center py-6 text-[var(--color-text-muted)]",style:{fontSize:"var(--text-xs)"},children:e("setup.mail_templates.no_results",{defaultValue:'Geen templates gevonden voor "{{query}}"',query:Q})}),Se.map((e=>{const t=te.has(e.id);return p.jsxs("section",{className:"mb-3 last:mb-0",children:[p.jsxs("button",{type:"button",onClick:()=>Ie(e.id),className:"w-full flex items-center justify-between px-2 py-1.5 rounded hover:bg-[var(--color-bg)] transition",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[t?p.jsx(Ye,{size:12}):p.jsx(ze,{size:12}),p.jsx("span",{className:"font-semibold uppercase tracking-wider text-[var(--color-text-muted)]",style:{fontSize:"10.5px",letterSpacing:"0.08em"},children:e.label})]}),p.jsx("span",{className:"text-[var(--color-text-subtle)]",style:{fontSize:"10.5px"},children:e.matchingIds.length})]}),!t&&p.jsx("ul",{className:"mt-1 space-y-0.5",children:e.matchingIds.map((e=>{const t=Yn[e],a=t.icon,s=e===f,r=pe(e),n=Zn[t.tone];return p.jsx("li",{children:p.jsx("button",{type:"button",onClick:()=>j(e),className:"w-full text-left px-3 py-2.5 rounded-lg transition relative group "+(s?"bg-[var(--color-bg)]":"hover:bg-[var(--color-bg)]"),style:s?{boxShadow:`inset 2px 0 0 ${n.fg}`}:void 0,children:p.jsxs("div",{className:"flex items-start gap-2.5",children:[p.jsx("div",{className:"flex-shrink-0 mt-0.5 rounded-md p-1.5",style:{backgroundColor:s?n.bg:"transparent",color:s?n.fg:"var(--color-text-muted)"},children:p.jsx(a,{size:13})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"block truncate "+(s?"font-semibold text-[var(--color-text)]":"text-[var(--color-text)]"),style:{fontSize:"var(--text-sm)"},children:t.name}),r&&p.jsx("span",{"aria-label":"Project-override actief",title:"Project-override actief",className:"flex-shrink-0 h-1.5 w-1.5 rounded-full",style:{backgroundColor:n.fg}})]}),p.jsx("span",{className:"block truncate text-[var(--color-text-muted)]",style:{fontSize:"11px",marginTop:"1px"},children:t.tagline})]})]})})},e)}))})]},e.id)}))]}),p.jsx("p",{className:"mt-3 px-3 text-[var(--color-text-muted)]",style:{fontSize:"11px",lineHeight:"1.5"},children:p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--color-accent)]"}),"project-override actief"]})})]}),p.jsxs("main",{className:"space-y-5 min-w-0",children:[p.jsx(hi,{meta:Pe,hasOverride:pe(f)}),Wn(f)&&p.jsx("div",{className:"rounded-xl border border-[var(--color-border)] bg-[var(--color-bg)] px-4 py-3",children:p.jsx(M,{checked:Gn(l,f),disabled:ce,onChange:a=>m(null,null,(function*(){if(!t)return;const s=e=>o((t=>{var a;return c(d({},null!=t?t:{}),{templateSettings:c(d({},null!=(a=null==t?void 0:t.templateSettings)?a:{}),{[f]:{requireConfirmation:e}})})}));s(a),ue(!0);try{yield function(e,t,a){return m(this,null,(function*(){const s=ye.currentUser;if(!s)throw new Error("Niet ingelogd");const r=ft(W,"projectMailTemplates",e);yield yt(r,{templateSettings:{[t]:{requireConfirmation:a}},updatedAt:Bt(),updatedBy:s.uid},{merge:!0})}
2))}(t,f,a),A.success(e("setup.mail_templates.saved",{defaultValue:"Template opgeslagen."}))}catch(r){s(!a),A.error(e("setup.mail_templates.error_save",{defaultValue:"Opslaan mislukt."}))}finally{ue(!1)}})),label:e("setup.mail_templates.require_confirmation_label",{defaultValue:"Bevestiging vereist voor verzending"}),description:e("setup.mail_templates.require_confirmation_hint",{defaultValue:"Mails van deze template worden vastgehouden in de outbox en moeten handmatig worden goedgekeurd voordat ze verzonden worden."})})}),p.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--color-border)] pb-0",children:[p.jsx("div",{className:"flex gap-1",children:li.map((e=>{const t=e===y;return p.jsx("button",{type:"button",onClick:()=>N(e),className:"px-4 py-2 -mb-px border-b-2 transition font-medium "+(t?"border-[var(--color-accent)] text-[var(--color-accent)]":"border-transparent text-[var(--color-text-muted)] hover:text-[var(--color-text)]"),style:{fontSize:"var(--text-sm)"},children:oi[e]},e)}))}),p.jsxs("div",{className:"inline-flex items-center gap-0.5 p-0.5 rounded-lg bg-[var(--color-bg-elevated)] border border-[var(--color-border)]",children:[p.jsx(ji,{active:"editor"===_,onClick:()=>w("editor"),icon:p.jsx(Ze,{size:13}),label:e("setup.mail_templates.editor",{defaultValue:"Editor"})}),p.jsx(ji,{active:"preview"===_,onClick:()=>w("preview"),icon:p.jsx(Xe,{size:13}),label:e("setup.mail_templates.preview",{defaultValue:"Preview"})})]})]}),"editor"===_?p.jsxs("div",{className:"space-y-4",children:[p.jsx(pi,{language:y,busy:se,onTranslate:Ne,onImproveText:()=>we("text"),onImproveHtml:()=>we("html"),onImproveBoth:()=>we("both")}),p.jsx(bi,{children:p.jsx(vi,{icon:p.jsx(Qe,{size:14}),title:e("setup.mail_templates.header_label",{defaultValue:"Header-banner"}),hint:e("setup.mail_templates.header_hint",{defaultValue:"Verschijnt bovenaan de mail. Max 5MB."}),children:U?p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("img",{src:U,alt:"Banner",className:"max-w-[180px] max-h-[60px] rounded border border-[var(--color-border)]"}),p.jsx(V,{type:"button",variant:"ghost",size:"sm",icon:p.jsx(O,{size:13}),onClick:ve,children:e("setup.mail_templates.remove",{defaultValue:"Verwijderen"})})]}):p.jsxs("div",{className:"relative",children:[p.jsx(pa,{onChange:be,longestSide:600,validation:{maxSizeMB:5,minWidth:600,minHeight:50,allowedTypes:["image/jpeg","image/jpg","image/png","image/webp"]},qualityCheck:!0}),D&&p.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--color-bg)]/70 backdrop-blur-sm rounded-md pointer-events-none",children:[p.jsx(_e,{size:"sm"}),p.jsx("span",{className:"ml-2 text-[var(--color-text-muted)]",style:{fontSize:"var(--text-sm)"},children:e("setup.mail_templates.uploading",{defaultValue:"Uploadenâ¦"})})]})]})})}),p.jsxs(bi,{children:[p.jsx(fi,{title:e("setup.mail_templates.subject",{defaultValue:"Onderwerp"}),hint:"De eerste regel in de inbox van de ontvanger",resetVisible:xe("subject"),onReset:()=>ge("subject")}),p.jsx(F,{label:"",value:R,onChange:e=>{q(e.target.value),$(!0)},placeholder:"Bijv. {{projectName}}: Uitnodiging voor de exposantenomgeving"})]}),p.jsxs(bi,{children:[p.jsx(fi,{title:e("setup.mail_templates.html_body",{defaultValue:"HTML body"}),hint:"Volledige HTML inclusief styling. Variabelen {{var}} worden ingevuld bij verzending.",resetVisible:xe("html"),onReset:()=>ge("html")}),p.jsx("div",{className:"rounded-md overflow-hidden border border-[var(--color-border)]",children:p.jsx(et,{apiKey:"sij3ipupzgzefywmm4bi1ev7efxqakl7menqy7ur9zb8dteo",onInit:(e,t)=>{X.current=t},value:G,onEditorChange:e=>{J(e),$(!0)},init:{menubar:!1,height:480,plugins:"lists link table code image",toolbar:"undo redo | formatselect | bold italic underline | bullist numlist | link | code",content_style:"body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; font-size: 14px; max-width: 600px; margin: 0 auto; padding: 16px; color: #0f172a; line-height: 1.6; }",branding:!1,statusbar:!1}})}),p.jsxs("div",{className:"mt-3 p-3 rounded-md border border-[var(--color-border)] bg-[var(--color-bg-elevated)]",children:[p.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[p.jsx(Qt,{size:13,className:"text-[var(--color-text-muted)]"}),p.jsx("span",{className:"uppercase tracking-wider text-[var(--color-text-muted)] font-semibold",style:{fontSize:"10.5px",letterSpacing:"0.08em"},children:"Variabelen â klik om in te voegen"}),p.jsx("span",{className:"text-[var(--color-text-muted)]",style:{fontSize:"10.5px"},children:"· alleen relevant voor deze template"})]}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:De.map((e=>{const t=Pe.keyVariables.includes(e);return p.jsx("button",{type:"button",onClick:()=>fe(e),className:"px-2 py-1 rounded-full border transition "+(t?"border-[var(--color-accent-soft)] bg-[var(--color-accent-soft)] text-[var(--color-accent)] hover:border-[var(--color-accent)]":"border-[var(--color-border)] bg-[var(--color-bg)] hover:border-[var(--color-accent)] hover:text-[var(--color-accent)]"),style:{fontSize:"11.5px",fontFamily:"ui-monospace, monospace"},title:t?"Aanbevolen voor deze template":void 0,children:`{{${e}}}`},e)}))})]})]}),p.jsxs(bi,{children:[p.jsxs("button",{type:"button",onClick:()=>C((e=>!e)),className:"w-full flex items-center justify-between text-left",children:[p.jsxs("div",{children:[p.jsxs("h4",{className:"font-semibold",style:{fontSize:"var(--text-sm)"},children:[k?p.jsx(ze,{size:13,className:"inline mr-1"}):p.jsx(Ye,{size:13,className:"inline mr-1"}),e("setup.mail_templates.plain_text",{defaultValue:"Plain-text variant (optioneel)"})]}),p.jsx("p",{className:"mt-0.5 text-[var(--color-text-muted)] ml-5",style:{fontSize:"var(--text-xs)"},children:"Voor mail-clients zonder HTML-support. Leeg laten = automatisch uit HTML"})]}),xe("plainText")&&p.jsx("span",{className:"text-[var(--color-accent)]",style:{fontSize:"11px"},children:"aangepast"})]}),k&&p.jsxs("div",{className:"mt-3",children:[xe("plainText")&&p.jsxs("button",{type:"button",onClick:()=>ge("plainText"),className:"mb-2 inline-flex items-center gap-1 text-[var(--color-text-muted)] hover:text-[var(--color-accent)]",style:{fontSize:"var(--text-xs)"},children:[p.jsx(Ia,{size:11}),"Reset naar default"]}),p.jsx(de,{label:"",rows:6,value:Y,onChange:e=>{Z(e.target.value),$(!0)}})]})]})]}):p.jsxs(bi,{padding:"none",children:[p.jsxs("div",{className:"px-5 py-3 border-b border-[var(--color-border)] flex items-center gap-2 text-[var(--color-text-muted)]",children:[p.jsx(Xe,{size:13}),p.jsx("span",{style:{fontSize:"var(--text-xs)"},children:"Live preview met voorbeeld-data â variabelen worden bij verzending vervangen."})]}),p.jsx("iframe",{title:"Preview",srcDoc:Ce,sandbox:"",className:"w-full bg-white",style:{height:"80vh",display:"block",border:0}})]}),p.jsx(ii,{open:null!==ne,onClose:()=>{ie(null),oe("")},onAccept:ke,actionLabel:le,current:je,proposed:ne,language:y,projectName:b,headerImageUrl:U})]})]}):p.jsxs("div",{className:"py-24 flex items-center justify-center gap-2 text-[var(--color-text-muted)]",children:[p.jsx(_e,{size:"sm"}),e("setup.mail_templates.loading",{defaultValue:"Templates ladenâ¦"})]}):p.jsx("div",{className:"py-12 text-center text-[var(--color-text-muted)]",children:e("participants_missing_project_id")})},pi=({language:e,busy:t,onTranslate:a,onImproveText:s,onImproveHtml:r,onImproveBoth:n})=>{const i="nl"!==e;return p.jsxs("div",{className:"rounded-xl border p-3 flex flex-wrap items-center gap-2",style:{background:"linear-gradient(135deg, rgba(99,102,241,0.05) 0%, rgba(168,85,247,0.05) 100%)",borderColor:"rgba(99,102,241,0.18)"},children:[p.jsxs("div",{className:"flex items-center gap-1.5 mr-2",children:[p.jsx(ae,{size:14,style:{color:"rgb(99 102 241)"}}),p.jsx("span",{className:"font-semibold uppercase tracking-wider",style:{fontSize:"10.5px",letterSpacing:"0.08em",color:"rgb(67 56 202)"},children:"AI-hulp"})]}),p.jsx(xi,{icon:p.jsx(ra,{size:13}),label:i?"Vertaal vanuit NL":"Vertalen (kies EN/DE)",loading:"translate"===t,disabled:null!==t||!i,onClick:a,title:i?"Genereer een vertaling vanuit de NL-template":"Selecteer EN of DE tab om te vertalen"}),p.jsx("div",{className:"mx-1 h-5 w-px bg-[var(--color-border)]","aria-hidden":!0}),p.jsx(xi,{icon:p.jsx(Ze,{size:13}),label:"Verbeter tekst",loading:"improve_text"===t,disabled:null!==t,onClick:s,title:"Laat Claude alleen de copy verbeteren â HTML blijft gelijk"}),p.jsx(xi,{icon:p.jsx(Pa,{size:13}),label:"Verbeter layout",loading:"improve_html"===t,disabled:null!==t,onClick:r,title:"Laat Claude alleen de HTML-indeling moderniseren â tekst blijft"}),p.jsx(xi,{icon:p.jsx(ae,{size:13}),label:"Verbeter beide",loading:"improve_both"===t,disabled:null!==t,onClick:n,title:"Verbeter tekst én HTML-indeling in één keer",primary:!0})]})},xi=({icon:e,label:t,loading:a,disabled:s,onClick:r,title:n,primary:i})=>p.jsxs("button",{type:"button",onClick:r,disabled:s||a,title:n,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border transition font-medium "+(i?"border-indigo-500/30 text-indigo-700 hover:bg-indigo-50 disabled:opacity-50":"border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-bg)] hover:border-indigo-500/40 hover:text-indigo-700 disabled:opacity-50"),style:d({fontSize:"var(--text-xs)"},i?{background:"linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(168,85,247,0.08) 100%)"}:{}),children:[a?p.jsx(tt,{size:13,className:"animate-spin"}):e,t]}),hi=({meta:e,hasOverride:t})=>{const a=Zn[e.tone],s=e.icon;return p.jsxs("div",{className:"rounded-xl border overflow-hidden relative",style:{borderColor:"var(--color-border)"}
2,children:[p.jsx("div",{"aria-hidden":!0,className:"absolute inset-x-0 top-0 h-0.5",style:{backgroundColor:a.fg}}),p.jsxs("div",{className:"flex items-start gap-4 p-5",children:[p.jsx("div",{className:"flex-shrink-0 rounded-lg p-3",style:{backgroundColor:a.bg,color:a.fg},children:p.jsx(s,{size:22})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"uppercase font-semibold tracking-wider rounded px-1.5 py-0.5",style:{fontSize:"10px",letterSpacing:"0.08em",backgroundColor:a.bg,color:a.fg},children:Xn[e.tone]}),t&&p.jsx("span",{className:"uppercase font-semibold tracking-wider rounded px-1.5 py-0.5 bg-[var(--color-accent-soft)] text-[var(--color-accent)]",style:{fontSize:"10px",letterSpacing:"0.08em"},children:"Project-override"})]}),p.jsx("h2",{className:"font-semibold text-[var(--color-text)]",style:{fontSize:"var(--text-xl)",lineHeight:"1.3"},children:e.name}),p.jsx("p",{className:"text-[var(--color-text-muted)] mt-0.5",style:{fontSize:"var(--text-sm)"},children:e.tagline}),p.jsx("p",{className:"text-[var(--color-text)] mt-3",style:{fontSize:"var(--text-sm)",lineHeight:"1.6"},children:e.description})]})]}),p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-px bg-[var(--color-border)] border-t border-[var(--color-border)]",children:[p.jsx(gi,{label:"Ontvanger",value:e.recipient}),p.jsx(gi,{label:"Trigger",value:e.trigger}),p.jsx(gi,{label:"CF",value:e.cfName,mono:!0})]})]})},gi=({label:e,value:t,mono:a})=>p.jsxs("div",{className:"bg-[var(--color-bg-elevated)] px-4 py-3",children:[p.jsx("div",{className:"uppercase tracking-wider text-[var(--color-text-muted)] mb-0.5 font-semibold",style:{fontSize:"10px",letterSpacing:"0.08em"},children:e}),p.jsx("div",{className:"text-[var(--color-text)]",style:{fontSize:"var(--text-xs)",fontFamily:a?"ui-monospace, monospace":void 0,lineHeight:"1.4"},children:t})]}),bi=({children:e,padding:t="normal"})=>p.jsx("section",{className:"rounded-xl border border-[var(--color-border)] bg-[var(--color-bg)] "+("none"===t?"":"p-5"),children:e}),vi=({icon:e,title:t,hint:a,children:s})=>p.jsxs("div",{className:"flex items-start gap-4",children:[p.jsxs("div",{className:"flex-1",children:[p.jsxs("h4",{className:"font-semibold text-[var(--color-text)] flex items-center gap-1.5",style:{fontSize:"var(--text-sm)"},children:[e,t]}),a&&p.jsx("p",{className:"mt-0.5 text-[var(--color-text-muted)]",style:{fontSize:"var(--text-xs)"},children:a})]}),p.jsx("div",{className:"flex-shrink-0",children:s})]}),fi=({title:e,hint:t,resetVisible:a,onReset:s})=>p.jsxs("div",{className:"flex items-start justify-between mb-3",children:[p.jsxs("div",{children:[p.jsx("h4",{className:"font-semibold text-[var(--color-text)]",style:{fontSize:"var(--text-sm)"},children:e}),t&&p.jsxs("p",{className:"mt-0.5 text-[var(--color-text-muted)]",style:{fontSize:"var(--text-xs)"},children:[p.jsx(ve,{size:11,className:"inline mr-1"}),t]})]}),a&&p.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 text-[var(--color-text-muted)] hover:text-[var(--color-accent)] flex-shrink-0",style:{fontSize:"var(--text-xs)"},children:[p.jsx(Ia,{size:11}),"Reset"]})]}),ji=({active:e,onClick:t,icon:a,label:s})=>p.jsxs("button",{type:"button",onClick:t,className:"px-3 py-1.5 rounded-md inline-flex items-center gap-1.5 transition font-medium "+(e?"bg-[var(--color-bg)] text-[var(--color-text)] shadow-sm":"text-[var(--color-text-muted)] hover:text-[var(--color-text)]"),style:{fontSize:"var(--text-xs)"},children:[a,s]}),yi=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(!0),[r,n]=h.useState(!1);h.useEffect((()=>{if(!t)return;m(null,null,(function*(){try{const e=ft(W,`projects/${t}`),a=yield jt(e);if(a.exists()){const e=a.data();s(!1!==e.showOrdersCard)}}catch(a){A.error(e("setup.error_fetch"))}}))}),[t,e]);const i=h.useCallback((()=>m(null,null,(function*(){if(t){n(!0);try{const s=ft(W,`projects/${t}`);yield St(s,{showOrdersCard:a}),A.success(e("setup.success_save"))}catch(s){A.error(e("setup.error_save"))}finally{n(!1)}}}))),[t,a,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:r,disabled:r||!t,onClick:i,children:e("setup.save_button")}),[r,t,i,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-info-soft)] p-3",children:p.jsx(Ue,{size:20,strokeWidth:1.5,className:"text-[var(--color-info)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.ordersCard.title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.ordersCard.description")})]})]}),p.jsxs("div",{className:"flex items-start justify-between gap-4 roun
2ded-[var(--radius-md)] bg-[var(--color-bg)] p-4",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("p",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.ordersCard.show_label")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.ordersCard.show_description")})]}),p.jsx(M,{id:"showOrdersCard",name:"showOrdersCard",checked:a,onChange:s})]})]})},Ni="orderCrudDeadlineAt";const _i=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState(!1),[r,n]=h.useState(""),[i,l]=h.useState(!1);h.useEffect((()=>{if(!t)return;m(null,null,(function*(){try{const e=ft(W,`projects/${t}`),a=yield jt(e);if(a.exists()){const e=a.data();s(!0===e.shopEnabled),n(function(e){var t;if(!e)return"";if(e instanceof vt)return e.toDate().toISOString();if("object"==typeof e&&null!==e&&"toDate"in e){const a=null==(t=e.toDate)?void 0:t.call(e);if(a instanceof Date&&!Number.isNaN(a.getTime()))return a.toISOString()}const a=new Date(String(e));return Number.isNaN(a.getTime())?"":a.toISOString()}(e[Ni]))}}catch(a){A.error(e("setup.error_fetch"))}}))}),[t,e]);const o=h.useCallback((()=>m(null,null,(function*(){if(!t)return;const s=r?new Date(r):null;if(!r||s&&!Number.isNaN(s.getTime())){l(!0);try{const r=ft(W,`projects/${t}`);yield St(r,{shopEnabled:a,[Ni]:s?vt.fromDate(s):Tt()}),A.success(e("setup.success_save"))}catch(n){A.error(e("setup.error_save"))}finally{l(!1)}}else A.error(e("setup.shop.order_deadline.invalid"))}))),[t,a,r,e]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:i||!t,onClick:o,children:e("setup.save_button")}),[i,t,o,e]);const d=Boolean(r)&&new Date(r).getTime()<Date.now();return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx(at,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.shop.title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.shop.description")})]})]}),p.jsxs("div",{className:"flex items-start justify-between gap-4 rounded-[var(--radius-md)] bg-[var(--color-bg)] p-4",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("p",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:e("setup.shop.enable_label")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("setup.shop.enable_description")})]}),p.jsx(M,{id:"shopEnabled",name:"shopEnabled",checked:a,onChange:s})]})]}),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-warning-soft,var(--color-bg))] p-3",children:p.jsx(Da,{size:20,strokeWidth:1.5,className:"text-[var(--color-warning,var(--color-text))]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.shop.order_deadline.title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.shop.order_deadline.description")})]})]}),p.jsx(oe,{label:e("setup.shop.order_deadline.label"),value:r||void 0,onChange:n,description:e(r?d?"setup.shop.order_deadline.hint_passed":"setup.shop.order_deadline.hint_active":"setup.shop.order_deadline.hint_empty")}),r&&p.jsx("div",{className:"mt-3",children:p.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(""),children:e("setup.shop.order_deadline.clear")})})]})]})},wi=()=>{const{t:e}=T("invoicing"),{id:t}=g(),{settings:a}=Ba(t),[s,r]=h.useState("modern"),[n,i]=h.useState("#1a365d"),[l,o]=h.useState(!1),[d,c]=h.useState(!1),[u,x]=h.useState(null),[b,v]=h.useState(!1),f=h.useRef(null);h.useEffect((()=>{(null==a?void 0:a.pdfTemplate)&&r(a.pdfTemplate),(null==a?void 0:a.accentColor)&&i(a.accentColor),x((null==a?void 0:a.logoUrl)||null)}),[null==a?void 0:a.pdfTemplate,null==a?void 0:a.accentColor,null==a?void 0:a.logoUrl]);return E(p.jsxs("div",{className:"flex gap-2",children:[p.jsx(V,{variant:"secondary",size:"sm",icon:p.jsx(Xe,{size:14}),loading:d,onClick:()=>{m(null,null,(function*(){if(t){c(!0);try{const e=yield Aa(t,s,n),a=URL.createObjectURL(e);window.open(a,"_blank","noopener"),setTimeout((()=>URL.revokeObjectURL(a)),6e4)}catch(a){A.error(a instanceof Error?a.message:e("messages.error_generic"))}finally{c(!1)}}}))},children:e("actions.preview_pdf")}),p.jsx(V,{variant:"primary",size:"sm",icon:p.jsx(Va,{size:14}),loading:l,onClick:()=>{m(null,null,(function*(){if(t){o(!0);try{yield Ta(t,{pdfTemplate:s,accentColor:n}),A.success(e("pdf_setup.saved"))}catch(a){A.error(a instanceof Error?a.message:e("messages.error_generic"))}finally{o(!1)}}}))},children:e("actions.save")})]}),[s,n,l,d,t]),p.jsxs("div",{className:"mx-auto max-w-4xl space-y-6",children:[p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("pdf_setup.description")}),p.jsxs("section",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4",children:[p.jsx("h2",{className:"mb-1 [font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:e("pdf_setup.logo")}),p.jsx("p",{className:"mb-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("pdf_setup.logo_hint")}),p.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[p.jsx("div",{className:"flex h-20 w-48 items-center justify-center rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] bg-white p-2",children:u?p.jsx("img",{src:u,alt:"",className:"max-h-full max-w-full object-contain"}):p.jsx("span",{className:"text-center [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e("pdf_setup.logo_none")})}),p.jsx("input",{ref:f,type:"file",accept:"image/png,image/jpeg",className:"hidden",onChange:a=>{var s;const r=null==(s=a.target.files)?void 0:s[0];var n;r&&(n=r,m(null,null,(function*(){if(!t)return;const a="image/png"===n.type?"png":"image/jpeg"===n.type?"jpg":null;if(!a||n.size>
22097152)A.error(e("pdf_setup.logo_invalid"));else{v(!0);try{const s=`invoices/${t}/logo-${Date.now()}.${a}`,r=It(Me,s);yield Pt(r,n,{contentType:n.type});const i=yield Dt(r);yield Ta(t,{logoUrl:i,logoPath:s}),x(i),A.success(e("pdf_setup.logo_saved"))}catch(s){A.error(s instanceof Error?s.message:e("messages.error_generic"))}finally{v(!1),f.current&&(f.current.value="")}}})))}}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(V,{variant:"secondary",size:"sm",icon:p.jsx(st,{size:14}),loading:b,onClick:()=>{var e;return null==(e=f.current)?void 0:e.click()},children:e(u?"pdf_setup.logo_replace":"pdf_setup.logo_upload")}),u&&p.jsx(V,{variant:"ghost",size:"sm",icon:p.jsx(O,{size:14}),disabled:b,onClick:()=>{m(null,null,(function*(){if(t){v(!0);try{yield Ta(t,{logoUrl:"",logoPath:""}),x(null),A.success(e("pdf_setup.logo_removed"))}catch(a){A.error(a instanceof Error?a.message:e("messages.error_generic"))}finally{v(!1)}}}))},children:e("pdf_setup.logo_remove")})]})]})]}),p.jsxs("section",{children:[p.jsx("h2",{className:"mb-3 [font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:e("pdf_setup.template")}),p.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:Ea.map((t=>{const a=s===t;return p.jsxs("button",{type:"button",onClick:()=>r(t),"aria-pressed":a,className:"rounded-[var(--radius-lg)] border-2 bg-[var(--color-surface)] p-4 text-left transition-colors "+(a?"border-[var(--color-accent)] ring-2 ring-[var(--color-accent)]/20":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"),children:[p.jsx(ki,{template:t,accent:n}),p.jsx("div",{className:"mt-3 font-medium text-[var(--color-text)] [font-size:var(--text-sm)]",children:e(`pdf_setup.templates.${t}.name`)}),p.jsx("div",{className:"mt-0.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:e(`pdf_setup.templates.${t}.desc`)})]},t)}))})]}),p.jsxs("section",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4",children:[p.jsx("h2",{className:"mb-3 [font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:e("pdf_setup.accent")}),p.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[p.jsx("input",{type:"color",value:n,onChange:e=>i(e.target.value),"aria-label":e("pdf_setup.accent"),className:"h-10 w-14 cursor-pointer rounded-[var(--radius-md)] border border-[var(--color-border)] bg-transparent p-1"}),p.jsx(he,{value:n,onChange:e=>/^#[0-9a-fA-F]{0,6}$/.test(e.target.value)&&i(e.target.value),inputSize:"sm",className:"w-32 font-mono","aria-label":e("pdf_setup.accent")}),p.jsx("div",{className:"flex gap-1",children:["#1a365d","#0f766e","#7c3aed","#b91c1c","#c2410c","#111827"].map((e=>p.jsx("button",{type:"button","aria-label":e,onClick:()=>i(e),className:"h-7 w-7 rounded-full border border-black/10",style:{background:e}},e)))})]}),p.jsxs("p",{className:"mt-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[e("pdf_setup.accent_hint")," ",e("pdf_setup.preview_hint")]})]})]})},ki=({template:e,accent:t})=>{const a=`${t}22`,s=p.jsx("div",{className:"h-1 rounded bg-[var(--color-border)]"}),r=p.jsx("div",{className:"space-y-1",children:[0,1,2].map((e=>p.jsx("div",{className:"h-1 rounded bg-[var(--color-border)]",style:{width:90-12*e+"%"}},e)))});return p.jsxs("div",{className:"relative aspect-[1/1.35] w-full overflow-hidden rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white p-2","aria-hidden":!0,children:["modern"===e&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"mb-2 h-6 w-full rounded-sm",style:{background:t}}),p.jsxs("div",{className:"mb-2 flex justify-between gap-2",children:[p.jsxs("div",{className:"w-1/2 space-y-1",children:[s,s]}),p.jsx("div",{className:"h-8 w-2/5 rounded-sm",style:{background:a}})]}),p.jsx("div",{className:"mb-1 h-2 w-full rounded-sm",style:{background:t}}),r,p.jsx("div",{className:"ml-auto mt-2 h-6 w-1/2 rounded-sm",style:{background:a}})]}),"classic"===e&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"mb-3 flex justify-between",children:[p.jsx("div",{className:"h-4 w-1/3 rounded-sm",style:{background:t}}),p.jsx("div",{className:"h-3 w-1/4 rounded-sm bg-[var(--color-border)]"})]}),p.jsxs("div",{className:"mb-2 flex justify-between gap-2",children:[p.jsxs("div",{className:"w-1/2 space-y-1",children:[s,s]}),p.jsxs("div",{className:"w-2/5 space-y-1",children:[s,s]})]}),p.jsx("div",{className:"mb-1 h-2 w-full rounded-sm bg-[var(--color-bg)]"}),r,p.jsx("div",{className:"mt-2 h-px w-full",style:{background:t}})]}),"minimal"===e&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"mb-4 flex justify-between",children:[p.jsx("div",{className:"h-2 w-1/4 rounded-sm bg-[var(--color-text)]"}),p.jsx("div",{className:"h-1.5 w-1/5 rounded-sm bg-[var(--color-border)]"})]}),p.jsxs("div",{className:"mb-3 w-1/2 space-y-1",children:[s,s]}),p.jsx("div",{className:"mb-2 h-px w-full bg-[var(--color-text)]"}),r,p.jsx("div",{className:"ml-auto mt-3 h-1.5 w-1/3 rounded-sm",style:{background:t}})]}),"bold"===e&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"absolute inset-y-0 left-0 w-[32%] p-2",style:{background:t},children:[p.jsx("div",{className:"mt-2 h-2 w-3/4 rounded-sm bg-white/80"}),p.jsx("div",{className:"mt-1 h-1 w-full rounded-sm bg-white/50"}),p.jsx("div",{className:"mt-1 h-1 w-2/3 rounded-sm bg-white/50"})]}),p.jsxs("div",{className:"ml-[36%]",children:[p.jsx("div",{className:"mb-1 h-4 w-3/5 rounded-sm",style:{background:t}}),p.jsx("div",{className:"mb-3 h-1.5 w-2/5 rounded-sm bg-[var(--color-border)]"}),r,p.jsx("div",{className:"ml-auto mt-2 h-6 w-3/5 rounded-sm",style:{background:a}})]})]})]})}
2,Ci=["nl","en","de"],Si=new Map(Fa.map((e=>[e.path,e]))),zi=e=>"heading"===e.type?`heading:${e.id}`:`item:${e.path}`,Ii=e=>{var t,a,s;return[e.title,null==(t=e.titleI18n)?void 0:t.nl,null==(a=e.titleI18n)?void 0:a.en,null==(s=e.titleI18n)?void 0:s.de].filter((e=>"string"==typeof e&&e.trim().length>0)).join(" ").toLowerCase()},Pi=e=>Oa(e).map((e=>{var t,a;if("heading"===e.type)return c(d({},e),{isSectionHeading:e.id.startsWith("section-")});const s=Si.get(e.path);return c(d({},e),{section:null!=(t=null==s?void 0:s.section)?t:"daily",defaultLabel:null!=(a=null==s?void 0:s.defaultLabel)?a:e.title})})),Di=e=>Ci.filter((t=>e[t].trim().length>0)).length,Bi=()=>{const{t:e,i18n:t}=T("projects"),{id:a}=g(),s=U((e=>e.tenantId)),{isAdmin:r}=K(),{translateText:n}=La(),[i,l]=h.useState([]),[o,u]=h.useState(!1),[x,b]=h.useState(!0),[v,f]=h.useState(null),[j,y]=h.useState(!1),[N,_]=h.useState(null),[w,k]=h.useState({}),[C,S]=h.useState(new Set),[z,I]=h.useState(""),P=re(ne(le,{activationConstraint:{distance:5}}));h.useEffect((()=>{if(!a)return l(Pi(void 0)),void b(!1);m(null,null,(function*(){b(!0);try{const r=ft(W,`projects/${a}`),n=yield jt(r);if(!n.exists())return void l(Pi(void 0));const i=n.data();l(Pi(i.exhibitorSidebarMenuConfig));const o={orders:{visible:!1!==i.showOrdersCard,note:e("setup.exhibitor_sidebar_menu.conditional.depends_orders")},shop:{visible:!0===i.shopEnabled,note:e("setup.exhibitor_sidebar_menu.conditional.depends_shop")},forms:{visible:!0,autoHide:!0,note:e("setup.exhibitor_sidebar_menu.conditional.auto_empty_forms",{defaultValue:"Wordt automatisch verborgen voor exposanten zonder formulieren."})},fotos:{visible:!0,autoHide:!0,note:e("setup.exhibitor_sidebar_menu.conditional.auto_empty_photos",{defaultValue:"Wordt automatisch verborgen voor exposanten zonder foto's van de stand."})},berichten:{visible:!0,autoHide:!0,note:e("setup.exhibitor_sidebar_menu.conditional.auto_empty_messages",{defaultValue:"Wordt automatisch verborgen voor exposanten zonder berichten."})}};if(s&&a)try{const t=yield Ma(s,a),r=t.find((e=>"Badges_1745828215684"===e.formId)),n=t.find((e=>"Guestlist_01"===e.formId)),i=t.find((e=>e.isActive&&(e=>{const t=Ii(e);return"form_1755590050533"===e.formId||t.includes("presentatie")||t.includes("presentation")})(e))),l=t.find((e=>e.isActive&&(e=>{const t=Ii(e),a=String(e.subject||"").toLowerCase();return"FairOffers_01"===e.formId||"fairoffers"===a||t.includes("aanbied")||t.includes("offer")})(e)&&(e=>{const t=e.readableFor;if(!Array.isArray(t)||0===t.length)return!0;const a=t.map((e=>e.toLowerCase()));return a.includes("exhibitor")||a.includes("all")||a.includes("*")})(e)));o.badges={visible:!!(null==r?void 0:r.isActive),note:e("setup.exhibitor_sidebar_menu.conditional.depends_badges")},o.guestlist={visible:!!(null==n?void 0:n.isActive),note:e("setup.exhibitor_sidebar_menu.conditional.depends_guestlist")},o.presentaties={visible:!!i,note:e("setup.exhibitor_sidebar_menu.conditional.depends_presentations")},o.aanbiedingen={visible:!!l,note:e("setup.exhibitor_sidebar_menu.conditional.depends_fair_offers")}}catch(t){const a=e("setup.exhibitor_sidebar_menu.conditional.status_unknown");o.badges={visible:!1,note:a},o.guestlist={visible:!1,note:a},o.presentaties={visible:!1,note:a},o.aanbiedingen={visible:!1,note:a}}k(o)}catch(r){A.error(e("setup.error_fetch")),l(Pi(void 0))}finally{b(!1)}}))}),[a,s,e]);const D=h.useMemo((()=>i.map(zi)),[i]),B=h.useMemo((()=>{const e=i.filter((e=>"item"===e.type)),t=i.filter((e=>"heading"===e.type)),a=i.map((e=>Di(e.titleI18n))).filter((e=>3===e)).length,s=i.length,r=0===s?100:Math.round(a/s*100),n=e.filter((e=>{const t=w[e.path];return t&&!t.visible})).length;return{itemCount:e.length,headingCount:t.length,fullyTranslated:a,totalEntries:s,translationPct:r,hiddenConditional:n}}),[i,w]),M=h.useMemo((()=>{const e=z.trim().toLowerCase();if(!e)return null;const t=new Set;return i.forEach((a=>{[a.titleI18n.nl,a.titleI18n.en,a.titleI18n.de,"item"===a.type?a.path:""].join(" ").toLowerCase().includes(e)&&t.add(zi(a)
2)})),t}),[i,z]),L=(e,t,a)=>{l((s=>s.map((s=>{if(zi(s)!==e)return s;const r=c(d({},s.titleI18n),{[t]:a});return c(d({},s),{titleI18n:r,title:$a(r,"nl",s.title)})}))))},$=(e,t)=>m(null,null,(function*(){if(!a||"nl"===t)return;const s=i.find((t=>zi(t)===e));s&&(f(`${e}:${t}`),yield n(s.titleI18n,t,a,(a=>{L(e,t,a)}),(e=>{A.error(e)})),f(null))})),O=e=>m(null,null,(function*(){a&&(yield $(e,"en"),yield $(e,"de"))})),F=e=>{l((t=>t.filter((t=>!("heading"===t.type&&t.id===e&&!t.isSectionHeading))).map(((e,t)=>c(d({},e),{order:t})))))},H=e=>{l((t=>t.map((t=>zi(t)!==e||"item"!==t.type?t:c(d({},t),{hidden:!t.hidden})))))},R=h.useCallback((()=>m(null,null,(function*(){if(r)if(a){u(!0);try{const t=e("setup.exhibitor_sidebar_menu.new_heading_default"),s=i.map(((e,a)=>{if("item"===e.type){const t={nl:e.titleI18n.nl.trim().length>0?e.titleI18n.nl.trim():e.defaultLabel,en:e.titleI18n.en.trim(),de:e.titleI18n.de.trim()};return d({type:"item",path:e.path,title:$a(t,"nl",e.defaultLabel),titleI18n:t,order:a},e.hidden?{hidden:!0}:{})}const s={nl:e.titleI18n.nl.trim().length>0?e.titleI18n.nl.trim():t,en:e.titleI18n.en.trim(),de:e.titleI18n.de.trim()};return{type:"heading",id:e.id,title:$a(s,"nl",t),titleI18n:s,order:a}})),r=ft(W,`projects/${a}`);yield St(r,{exhibitorSidebarMenuConfig:s,updatedAt:new Date}),l(Pi(s)),A.success(e("setup.success_save"))}catch(t){A.error(e("setup.error_save"))}finally{u(!1)}}else A.error(e("setup.no_project_id"));else A.error(e("setup.unauthorized"))}))),[r,a,i,e]);E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:o,disabled:o||!r||x,onClick:R,children:e("setup.exhibitor_sidebar_menu.save_button")}),[o,r,x,R,e]);const q=(t.language||"nl").slice(0,2);return p.jsxs("div",{className:"space-y-6",children:[p.jsx(Ti,{title:e("setup.exhibitor_sidebar_menu.header"),description:e("setup.exhibitor_sidebar_menu_v2.intro_subtitle"),stats:B,labels:{items:e("setup.exhibitor_sidebar_menu_v2.stats.items"),headings:e("setup.exhibitor_sidebar_menu_v2.stats.headings"),translations:e("setup.exhibitor_sidebar_menu_v2.stats.translations"),translations_value:e("setup.exhibitor_sidebar_menu_v2.stats.translations_value",{filled:B.fullyTranslated,total:B.totalEntries}),warnings:e("setup.exhibitor_sidebar_menu_v2.stats.warnings"),warnings_value:B.hiddenConditional>0?e("setup.exhibitor_sidebar_menu_v2.stats.warnings_value",{count:B.hiddenConditional}):e("setup.exhibitor_sidebar_menu_v2.stats.warnings_none")}}),!r&&p.jsxs("div",{className:"flex items-start gap-2.5 rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] px-4 py-3 [font-size:var(--text-sm)] text-[var(--color-text)]",role:"note",children:[p.jsx(rt,{size:16,strokeWidth:2,className:"mt-0.5 shrink-0 text-[var(--color-warning)]"}),p.jsx("span",{children:e("setup.exhibitor_sidebar_menu.admin_only_notice")})]}),x?p.jsx("div",{className:"flex items-center justify-center rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] py-16",children:p.jsx(_e,{size:"md"})}):p.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[minmax(0,1fr)_360px]",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsx(Ei,{searchQuery:z,onSearchChange:I,onAddHeading:()=>{const t=e("setup.exhibitor_sidebar_menu.new_heading_default");l((e=>{const a={type:"heading",id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,8)}
2`,title:t,titleI18n:{nl:t,en:"",de:""},order:e.length,isSectionHeading:!1};return[...e,a].map(((e,t)=>c(d({},e),{order:t})))})),S((e=>{const t=new Set(e);return t.add(`heading:custom-${Date.now()}`),t}))},onTranslateAll:()=>m(null,null,(function*(){if(!a||null!==v||j)return;const t=i.filter((e=>e.titleI18n.nl.trim().length>0||e.titleI18n.en.trim().length>0||e.titleI18n.de.trim().length>0));if(0!==t.length){y(!0),_({done:0,total:t.length});try{let a=0;for(const e of t)yield O(zi(e)),a+=1,_({done:a,total:t.length});A.success(e("setup.exhibitor_sidebar_menu.batch_translation_done"))}finally{y(!1),_(null)}}else A.error(e("setup.exhibitor_sidebar_menu.no_source_text"))})),onReset:()=>{l(Pi(void 0)),S(new Set)},onExpandAll:()=>{S(new Set(i.map(zi)))},onCollapseAll:()=>{S(new Set)},expandedCount:C.size,translateBusyLabel:j&&N?e("setup.exhibitor_sidebar_menu.translating_progress",{done:N.done,total:N.total}):null!==v?e("setup.exhibitor_sidebar_menu.translating"):null,labels:{search_placeholder:e("setup.exhibitor_sidebar_menu_v2.search_placeholder"),add_heading:e("setup.exhibitor_sidebar_menu.add_heading_button"),translate_missing:e("setup.exhibitor_sidebar_menu.translate_all_button"),reset:e("setup.exhibitor_sidebar_menu.reset_button"),expand_all:e("setup.exhibitor_sidebar_menu_v2.toolbar.expand_all"),collapse_all:e("setup.exhibitor_sidebar_menu_v2.toolbar.collapse_all")},disabled:!r||o,translateDisabled:!r||o||!a||null!==v||j,isBatchTranslating:j}),M&&0===M.size&&p.jsx("div",{className:"rounded-[var(--radius-lg)] border border-dashed border-[var(--color-border)] bg-[var(--color-bg)] py-10 text-center",children:p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.exhibitor_sidebar_menu_v2.no_search_results",{query:z})})}),p.jsx(ce,{sensors:P,collisionDetection:ue,onDragEnd:e=>{const{active:t,over:a}=e;a&&t.id!==a.id&&l((e=>{const s=e.findIndex((e=>zi(e)===t.id)),r=e.findIndex((e=>zi(e)===a.id));return s<0||r<0?e:Kt(e,s,r).map(((e,t)=>c(d({},e),{order:t})))}))},children:p.jsx(Wt,{items:D,strategy:Ht,children:p.jsx("ol",{className:"space-y-1.5",children:i.map(((t,s)=>{const n=zi(t);return!M||M.has(n)?p.jsx(Vi,{entry:t,index:s,isExpanded:C.has(n),onToggleExpand:()=>(e=>{S((t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a}))})(n),disabled:!r||o,onTitleChange:L,onTranslateLanguage:$,onTranslateAll:O,translatingKey:v,isBatchTranslating:j,projectId:a||void 0,onRemoveHeading:F,onToggleHidden:H,conditionalStatusByPath:w,t:e},n):p.jsx("li",{"aria-hidden":!0,className:"hidden"},n)}))})})})]}),p.jsx(Fi,{entries:i,previewLocale:q,labels:{header:e("setup.exhibitor_sidebar_menu.preview.header"),desc:e("setup.exhibitor_sidebar_menu.preview.desc"),dashboard_title:e("setup.exhibitor_sidebar_menu.preview.dashboard_title"),dashboard_subtitle:e("setup.exhibitor_sidebar_menu.preview.dashboard_subtitle"),new_heading_default:e("setup.exhibitor_sidebar_menu.new_heading_default")}})]})]})};function Ti({title:e,description:t,stats:a,labels:s}){const r=a.hiddenConditional>0;return p.jsxs("section",{className:"relative overflow-hidden rounded-[var(--radius-lg)] border border-[var(--color-border)] shadow-[var(--shadow-sm)]",style:{background:"linear-gradient(135deg, var(--color-info-soft) 0%, var(--color-accent-soft) 100%)"},children:[p.jsx("div",{"aria-hidden":!0,className:"absolute inset-0",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 70%, transparent) 0%, color-mix(in srgb, var(--color-surface) 92%, transparent) 100%)"}}),p.jsxs("div",{className:"relative p-6 sm:p-7",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("span",{"aria-hidden":!0,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-surface)] text-[var(--color-accent)] shadow-[var(--shadow-xs)]",children:p.jsx(nt,{size:20,strokeWidth:2})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"[font-size:var(--text-xl)] font-semibold text-[var(--color-text)]",children:e}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:t})]})]}),p.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[p.jsx(Ai,{icon:p.jsx(nt,{size:16,strokeWidth:2}),label:s.items,value:String(a.itemCount),tone:"info"}),p.jsx(Ai,{icon:p.jsx(ea,{size:16,strokeWidth:2}),label:s.headings,value:String(a.headingCount),tone:"accent"}),p.jsx(Ai,{icon:p.jsx(ra,{size:16,strokeWidth:2}),label:s.translations,value:`${a.translationPct}%`,sublabel:s.translations_value,tone:100===a.translationPct?"success":"warning"}),p.jsx(Ai,{icon:r?p.jsx(Ua,{size:16,strokeWidth:2}):p.jsx(Xe,{size:16,strokeWidth:2}),label:s.warnings,value:String(a.hiddenConditional),sublabel:s.warnings_value,tone:r?"warning":"success"})]})]})]})}function Ai({icon:e,label:t,value:a,sublabel:s,tone:r}){const n={info:{color:"var(--color-info)",soft:"var(--color-info-soft)"},accent:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},success:{color:"var(--color-success)",soft:"var(--color-success-soft)"},warning:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"}}[r];return p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3 shadow-[var(--shadow-xs)]",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{"aria-hidden":!0,
2className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[var(--radius-sm)]",style:{background:n.soft,color:n.color},children:e}),p.jsx("span",{className:"[font-size:var(--text-xs)] font-medium uppercase tracking-wide text-[var(--color-text-muted)]",children:t})]}),p.jsx("p",{className:"mt-2 [font-size:var(--text-2xl)] font-bold text-[var(--color-text)] tabular-nums",children:a}),s&&p.jsx("p",{className:"mt-0.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:s})]})}function Ei({searchQuery:e,onSearchChange:t,onAddHeading:a,onTranslateAll:s,onReset:r,onExpandAll:n,onCollapseAll:i,expandedCount:l,translateBusyLabel:o,labels:d,disabled:c,translateDisabled:u,isBatchTranslating:m}){return p.jsxs("div",{className:"sticky top-2 z-10 flex flex-wrap items-center gap-2 rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)]/95 p-2 shadow-[var(--shadow-xs)] backdrop-blur",children:[p.jsx("div",{className:"min-w-[200px] flex-1",children:p.jsx(he,{type:"search",placeholder:d.search_placeholder,value:e,onChange:e=>t(e.target.value),inputSize:"sm","aria-label":d.search_placeholder})}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx(V,{variant:"secondary",size:"sm",type:"button",onClick:l>0?i:n,disabled:c,icon:p.jsx(ze,{size:14}),children:l>0?d.collapse_all:d.expand_all}),p.jsx("span",{"aria-hidden":!0,className:"hidden h-6 w-px bg-[var(--color-border)] sm:block"}),p.jsx(V,{variant:"secondary",size:"sm",type:"button",icon:p.jsx(ae,{size:14}),loading:m,onClick:s,disabled:u,children:null!=o?o:d.translate_missing}),p.jsx(V,{variant:"primary",size:"sm",type:"button",icon:p.jsx(Ve,{size:14}),onClick:a,disabled:c,children:d.add_heading}),p.jsx(V,{variant:"ghost",size:"sm",type:"button",icon:p.jsx(Ia,{size:14}),onClick:r,disabled:c,children:d.reset})]})]})}function Vi({entry:e,index:t,isExpanded:a,onToggleExpand:s,disabled:r,onTitleChange:n,onTranslateLanguage:i,onTranslateAll:l,translatingKey:o,isBatchTranslating:u,projectId:m,onRemoveHeading:x,onToggleHidden:h,conditionalStatusByPath:g,t:b}){const v=zi(e),{attributes:f,listeners:j,setNodeRef:y,transform:N,transition:_,isDragging:w}=Rt({id:v,disabled:r}),k={transform:me.Transform.toString(N),transition:_,opacity:w?.7:1},C=e.titleI18n.nl.trim().length>0||e.titleI18n.en.trim().length>0||e.titleI18n.de.trim().length>0,S=p.jsx("button",c(d(d({type:"button",className:"inline-flex h-9 w-9 shrink-0 cursor-grab items-center justify-center rounded-[var(--radius-md)] text-[var(--color-text-muted)] transition-colors hover:bg-[var(--color-bg)] disabled:cursor-not-allowed disabled:opacity-40 "+(w?"cursor-grabbing":""),"aria-label":b("setup.exhibitor_sidebar_menu.drag_aria"),disabled:r},f),j),{children:p.jsx(qt,{size:16,"aria-hidden":"true"})}));return"heading"===e.type?p.jsx("li",{ref:y,style:k,children:p.jsx(Mi,{entry:e,dragHandle:S,isExpanded:a,onToggleExpand:s,disabled:r,onTitleChange:n,onTranslateLanguage:i,onTranslateAll:l,translatingKey:o,isBatchTranslating:u,projectId:m,onRemoveHeading:x,sourceTextAvailable:C,t:b})}):p.jsx("li",{ref:y,style:k,children:p.jsx(Li,{entry:e,dragHandle:S,isExpanded:a,onToggleExpand:s,disabled:r,onTitleChange:n,onTranslateLanguage:i,onTranslateAll:l,translatingKey:o,isBatchTranslating:u,projectId:m,conditionalStatusByPath:g,onToggleHidden:h,sourceTextAvailable:C,t:b})})}function Mi({entry:e,dragHandle:t,isExpanded:a,onToggleExpand:s,disabled:r,onTitleChange:n,onTranslateLanguage:i,onTranslateAll:l,translatingKey:o,isBatchTranslating:d,projectId:c,onRemoveHeading:u,sourceTextAvailable:m,t:x}){const h=zi(e),g=Di(e.titleI18n);return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)]",children:[p.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[t,p.jsx("span",{"aria-hidden":!0,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[var(--radius-sm)] bg-[var(--color-warning)]/15 text-[var(--color-warning)]",children:p.jsx(ea,{size:14,strokeWidth:2.25})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] font-semibold uppercase tracking-wider text-[var(--color-warning)]",children:e.isSectionHeading?x("setup.exhibitor_sidebar_menu_v2.section_heading_label"):x("setup.exhibitor_sidebar_menu.heading_label")}),p.jsx("p",{className:"truncate [font-size:var(--text-base)] font-bold text-[var(--color-text)]",children:e.titleI18
2n.nl||e.title||x("setup.exhibitor_sidebar_menu.new_heading_default")})]}),p.jsx(Oi,{filledLangs:g}),p.jsx("button",{type:"button",onClick:s,"aria-expanded":a,"aria-controls":`row-body-${h}`,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[var(--radius-md)] text-[var(--color-text-muted)] transition-colors hover:bg-[var(--color-warning)]/15",children:p.jsx(ze,{size:16,strokeWidth:2.25,className:"transition-transform duration-[var(--duration-fast)] "+(a?"rotate-180":"")})})]}),a&&p.jsxs("div",{id:`row-body-${h}`,className:"border-t border-[var(--color-warning)]/30 bg-[var(--color-surface)]/60 px-3 pt-3 pb-3",children:[p.jsx($i,{entry:e,disabled:r,onTitleChange:n,onTranslateLanguage:i,translatingKey:o,isBatchTranslating:d,projectId:c,sourceTextAvailable:m,t:x}),p.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2",children:[p.jsx(V,{variant:"secondary",size:"sm",type:"button",icon:p.jsx(ae,{size:14}),onClick:()=>l(h),disabled:r||d||!c||!m||null!==o,children:x("setup.exhibitor_sidebar_menu.translate_all_entry")}),!e.isSectionHeading&&p.jsx(V,{variant:"danger",size:"sm",type:"button",icon:p.jsx(O,{size:14}),onClick:()=>u(e.id),disabled:r,children:x("setup.exhibitor_sidebar_menu.remove_heading_button")})]})]})]})}function Li({entry:e,dragHandle:t,isExpanded:a,onToggleExpand:s,disabled:r,onTitleChange:n,onTranslateLanguage:i,onTranslateAll:l,translatingKey:o,isBatchTranslating:d,projectId:c,conditionalStatusByPath:u,onToggleHidden:m,sourceTextAvailable:x,t:h}){const g=zi(e),b=Di(e.titleI18n),v=u[e.path],f=!!e.hidden;return p.jsxs("div",{className:"overflow-hidden rounded-[var(--radius-lg)] border bg-[var(--color-surface)] transition-colors hover:border-[var(--color-border-strong)] "+(f?"border-dashed border-[var(--color-border)] opacity-60":"border-[var(--color-border)]"),children:[p.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[t,p.jsx("div",{className:"min-w-0 flex-1",children:p.jsx(he,{id:`sidebar-entry-${g}-nl`,type:"text",value:e.titleI18n.nl,onChange:e=>n(g,"nl",e.target.value),disabled:r,inputSize:"sm","aria-label":"NL title",placeholder:e.defaultLabel,leadingIcon:p.jsx("span",{className:"[font-size:var(--text-xs)] font-bold tabular-nums",children:"NL"})})}),p.jsx(Oi,{filledLangs:b}),v&&p.jsx("span",{className:"hidden shrink-0 md:block",title:v.note,children:v.autoHide?p.jsx(R,{variant:"info",size:"sm",leadingIcon:p.jsx(ae,{size:10,strokeWidth:2.5}),children:h("setup.exhibitor_sidebar_menu_v2.conditional_short.auto_empty",{defaultValue:"Auto bij inhoud"})}):p.jsx(R,{variant:v.visible?"success":"warning",size:"sm",leadingIcon:v.visible?p.jsx(Xe,{size:10,strokeWidth:2.5}):p.jsx(Ua,{size:10,strokeWidth:2.5}),children:v.visible?h("setup.exhibitor_sidebar_menu_v2.conditional_short.visible"):h("setup.exhibitor_sidebar_menu_v2.conditional_short.hidden")})}),p.jsx("button",{type:"button",onClick:()=>m(g),disabled:r,"aria-pressed":f,title:h(f?"setup.exhibitor_sidebar_menu_v2.row.show_item":"setup.exhibitor_sidebar_menu_v2.row.hide_item"),"aria-label":h(f?"setup.exhibitor_sidebar_menu_v2.row.show_item":"setup.exhibitor_sidebar_menu_v2.row.hide_item"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[var(--radius-md)] transition-colors hover:bg-[var(--color-bg)] disabled:cursor-not-allowed disabled:opacity-40 "+(f?"text-[var(--color-warning)]":"text-[var(--color-text-muted)]"),children:f?p.jsx(Ua,{size:16,strokeWidth:2.25,"aria-hidden":"true"}):p.jsx(Xe,{size:16,strokeWidth:2.25,"aria-hidden":"true"})}),p.jsx("button",{type:"button",onClick:s,"aria-expanded":a,"aria-controls":`row-body-${g}`,"aria-label":h(a?"setup.exhibitor_sidebar_menu_v2.row.collapse_translations":"setup.exhibitor_sidebar_menu_v2.row.expand_translations"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[var(--radius-md)] text-[var(--color-text-muted)] transition-colors hover:bg-[var(--color-bg)]",children:p.jsx(ze,{size:16,strokeWidth:2.25,className:"transition-transform duration-[var(--duration-fast)] "+(a?"rotate-180":"")})})]}),a&&p.jsxs("div",{id:`row-body-${g}`,className:"border-t border-[var(--color-border)] bg-[var(--color-bg)] px-3 pt-3 pb-3",children:[p.jsx("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:["en","de"].map((t=>{const a=o===`${g}:${t}`;return p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(he,{id:`sidebar-entry-${g}-${t}
2`,type:"text",value:e.titleI18n[t],onChange:e=>n(g,t,e.target.value),disabled:r,inputSize:"sm","aria-label":`${t.toUpperCase()} title`,leadingIcon:p.jsx("span",{className:"[font-size:var(--text-xs)] font-bold tabular-nums",children:t.toUpperCase()})}),p.jsx(V,{variant:"secondary",size:"sm",type:"button",title:h("setup.exhibitor_sidebar_menu.translate_lang",{locale:t.toUpperCase()}),icon:p.jsx(ae,{size:12}),disabled:r||d||!c||!x||null!==o,loading:a,onClick:()=>i(g,t),children:"AI"})]},t)}))}),p.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2",children:[p.jsx(V,{variant:"secondary",size:"sm",type:"button",icon:p.jsx(ae,{size:14}),onClick:()=>l(g),disabled:r||d||!c||!x||null!==o,children:h("setup.exhibitor_sidebar_menu.translate_all_entry")}),v&&p.jsxs("p",{className:"flex items-center gap-1.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[v.visible?p.jsx(Xe,{size:12,strokeWidth:2,className:"text-[var(--color-success)]"}):p.jsx(Ua,{size:12,strokeWidth:2,className:"text-[var(--color-warning)]"}),p.jsx("span",{children:v.note})]})]})]})]})}function $i({entry:e,disabled:t,onTitleChange:a,onTranslateLanguage:s,translatingKey:r,isBatchTranslating:n,projectId:i,sourceTextAvailable:l,t:o}){const d=zi(e);return p.jsx("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-3",children:Ci.map((o=>{const c=r===`${d}:${o}`;return p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(he,{id:`sidebar-heading-${d}-${o}`,type:"text",value:e.titleI18n[o],onChange:e=>a(d,o,e.target.value),disabled:t,inputSize:"sm","aria-label":`${o.toUpperCase()} title`,leadingIcon:p.jsx("span",{className:"[font-size:var(--text-xs)] font-bold tabular-nums",children:o.toUpperCase()})}),"nl"!==o&&p.jsx(V,{variant:"secondary",size:"sm",type:"button",icon:p.jsx(ae,{size:12}),disabled:t||n||!i||!l||null!==r,loading:c,onClick:()=>s(d,o),children:"AI"})]},o)}))})}function Oi({filledLangs:e}){const t=3===e;return p.jsxs("span",{className:"hidden shrink-0 items-center gap-1 rounded-full px-2 py-0.5 [font-size:var(--text-xs)] font-medium tabular-nums sm:inline-flex "+(t?"bg-[var(--color-success-soft)] text-[var(--color-success)]":"bg-[var(--color-warning-soft)] text-[var(--color-warning)]"),"aria-label":t?"All languages translated":`${e} of 3 languages filled`,children:[t?p.jsx(se,{size:12,strokeWidth:2.5}):p.jsx("span",{className:"flex items-center gap-0.5",children:[0,1,2].map((t=>p.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full",style:{background:t<e?"var(--color-warning)":"var(--color-text-subtle)",opacity:t<e?1:.35}},t)))}),p.jsxs("span",{children:[e,"/3"]})]})}function Fi({entries:e,previewLocale:t,labels:a}){return p.jsx("aside",{className:"xl:sticky xl:top-2 xl:self-start",children:p.jsxs("div",{className:"overflow-hidden rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] shadow-[var(--shadow-xs)]",children:[p.jsx("header",{className:"border-b border-[var(--color-border)] px-4 py-3",children:p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:a.header}),p.jsx("p",{className:"mt-0.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:a.desc})]}),p.jsx("span",{className:"rounded-full bg-[var(--color-bg)] px-2 py-0.5 [font-size:var(--text-xs)] font-mono uppercase tracking-wider text-[var(--color-text-muted)]","aria-label":"Preview locale",children:t})]})}),p.jsxs("div",{className:"flex items-center gap-1.5 border-b border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2",children:[p.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-2.5 rounded-full bg-[var(--color-danger)]/70"}),p.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-2.5 rounded-full bg-[var(--color-warning)]/70"}),p.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-2.5 rounded-full bg-[var(--color-success)]/70"}),p.jsx("span",{className:"ml-2 [font-size:var(--text-xs)] font-mono text-[var(--color-text-subtle)]",children:"exhibitor.dashboard"})]}),p.jsxs("div",{className:"max-h-[70vh] overflow-y-auto bg-[var(--color-surface)] p-4 scrollbar-thin",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h5",{className:"[font-size:var(--text-base)] font-semibold text-[var(--color-text)]",children:a.dashboard_title}),p.jsx("p",{className:"mt-0.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:a.dashboard_subtitle})]}),p.jsx("div",{className:"space-y-0.5",children:e.map(((s,r)=>{if("heading"===s.type)return p.jsx("p",{className:"px-2 pt-3 pb-1 [font-size:var(--text-xs)] font-semibold uppercase tracking-wider text-[var(--color-text-muted)]",children:$a(s.titleI18
2n,t,a.new_heading_default)},`preview-${s.id}`);const n=r===e.findIndex((e=>"item"===e.type));return p.jsx("div",{className:"flex items-center rounded-[var(--radius-md)] border-l-2 px-3 py-2 [font-size:var(--text-sm)] transition-colors "+(n?"border-[var(--color-accent)] bg-[var(--color-accent-soft)] font-semibold text-[var(--color-accent)]":"border-transparent text-[var(--color-text)] hover:bg-[var(--color-bg)]"),children:$a(s.titleI18n,t,s.defaultLabel)},`preview-${s.path}`)}))})]})]})})}const Ui=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$/i;function Ki(e){return e.trim().toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"").split("/")[0].split(":")[0]}const Wi=()=>{const{t:e}=T("projects"),{id:t}=g(),[a,s]=h.useState({customDomain:"",website:""}),[r,n]=h.useState(!1),[i,l]=h.useState(!1);h.useEffect((()=>{if(!t)return;m(null,null,(function*(){n(!0);try{const e=ft(W,`projects/${t}`),a=ft(W,`public_projects/${t}`),[r,n]=yield Promise.all([jt(e),jt(a)]),i=r.exists()?r.data():{},l=n.exists()?n.data():{};s({customDomain:"string"==typeof l.customDomain?Ki(l.customDomain):"string"==typeof i.customDomain?Ki(i.customDomain):"",website:"string"==typeof l.website?String(l.website):"string"==typeof i.website?String(i.website):""})}catch(a){A.error(e("setup.domain.load_error"))}finally{n(!1)}}))}),[t,e]);const o=h.useMemo((()=>Ki(a.customDomain)),[a.customDomain]),u=o.length>0,x=!u||Ui.test(o),b=h.useCallback((()=>m(null,null,(function*(){if(t){l(!0);try{const r=ft(W,`projects/${t}`),n=ft(W,`public_projects/${t}`),i=o||null,l=a.website.trim()||null;if(i){const a=wt(Nt(W,"public_projects"),Ct("customDomain","==",i),kt(1)),s=yield _t(a);if(!s.empty&&s.docs[0].id!==t)return void A.error(e("setup.domain.duplicate_error",{domain:i}))}yield St(r,{customDomain:i,website:l,updatedAt:new Date}),yield yt(n,{projectId:t,customDomain:i,website:l,updatedAt:new Date},{merge:!0}),A.success(e("setup.domain.saved_success")),s((e=>c(d({},e),{customDomain:o})))}catch(r){A.error(e("setup.domain.save_error"))}finally{l(!1)}}else A.error(e("setup.domain.no_project_error"))}))),[t,o,a.website,e]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:i,disabled:r||i||!x,onClick:b,children:e("setup.domain.save_button")}),[r,i,x,b,e]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsxs("div",{className:"mb-5 flex items-start gap-3",children:[p.jsx("div",{className:"rounded-[var(--radius-lg)] bg-[var(--color-accent-soft)] p-3",children:p.jsx($e,{size:20,strokeWidth:1.5,className:"text-[var(--color-accent)]"})}),p.jsxs("div",{children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:e("setup.domain.header")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:p.jsx($s,{i18nKey:"setup.domain.intro",t:e,components:{strong:p.jsx("span",{className:"font-medium"})}})})]})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-info)]/20 bg-[var(--color-info-soft)] p-4 [font-size:var(--text-sm)] text-[var(--color-text)]",children:p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx(ve,{size:18,strokeWidth:1.5,className:"mt-0.5 flex-shrink-0 text-[var(--color-info)]"}),p.jsxs("div",{children:[p.jsx("p",{className:"font-semibold",children:e("setup.domain.info_title")}),p.jsx("p",{className:"mt-1",children:e("setup.domain.info_body")})]})]})}),p.jsx(F,{label:e("setup.domain.custom_domain_label"),value:a.customDomain,onChange:e=>s((t=>c(d({},t),{customDomain:e.target.value}))),placeholder:e("setup.domain.custom_domain_placeholder"),description:e("setup.domain.custom_domain_help"),error:x?void 0:e("setup.domain.custom_domain_invalid"),disabled:r||i}),p.jsx(F,{label:e("setup.domain.website_label"),value:a.website,onChange:e=>s((t=>c(d({},t),{website:e.target.value}))),placeholder:e("setup.domain.website_placeholder"),disabled:r||i}),u&&x&&p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-accent)]/20 bg-[var(--color-accent-soft)] p-4 [font-size:var(--text-sm)] text-[var(--color-text)]",children:[p.jsx("p",{className:"font-semibold",children:e("setup.domain.effect_title")}),p.jsxs("p",{className:"mt-1",children:[e("setup.domain.effect_body")," ",p.jsxs("span",{className:"font-mono",children:["https://",o,"/"]})]}),p.jsxs("p",{className:"mt-1",children:[e("setup.domain.effect_example_label")," ",p.jsxs("span",{className:"font-mono",children:["https://",o,"/my-program"]})]})]}),p.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] p-4 [font-size:var(--text-sm)] text-[var(--color-text)]",children:p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx(rt,{size:18,strokeWidth:1.5,className:"mt-0.5 flex-shrink-0 text-[var(--color-warning)]"}),p.jsxs("div",{children:[p.jsx("p",{className:"font-semibold",children:e("setup.domain.next_steps_title")}),p.jsxs("ol",{className:"mt-1 list-inside list-decimal space-y-1",children:[p.jsx("li",{children:p.jsx($s,{i18nKey:"setup.domain.next_step_vercel",t:e,components:{strong:p.jsx("span",{className:"font-medium"})}})}),p.jsx("li",{children:e("setup.domain.next_step_dns")}),p.jsx("li",{children:e("setup.domain.next_step_ssl")}),p.jsx("li",{children:e("setup.domain.next_step_check")})]})]})]})})]})]})},Hi=["nl","en","de"],Ri=(e,t,a)=>({nl:e,en:t,de:a}),qi=e=>Boolean(e&&"object"==typeof e&&!Array.isArray(e)),Gi=e=>"string"==typeof e?{nl:e,en:"",de:""}:qi(e)?{nl:"string"==typeof e.nl?e.nl:"",en:"string"==typeof e.en?e.en:"",de:"string"==typeof e.de?e.de:""}:{nl:"",en:"",de:""},Ji=e=>{if(void 0!==e)return"string"==typeof e?e:d({},e)},Yi=(e,t)=>Gi(e)[t]||"",Zi=(e,t,a)=>{const s=Gi(e);return c(d({},s),{[t]:a})},Xi=["4x2","5x2","6x2","7x2","8x2","9x2","10x2","3x3","4x3","5x3","6x3","4x4","5x4"],Qi="terms",el={"4x2":1680,"5x2":2070,"6x2":2440,"7x2":2800,"8x2":3130,"9x2":3500,"10x2":3780,"3x3":1860,"4x3":2440,"5x3":2990,"6x3":3500,"4x4":3130,"5x4":3780},tl=(al=el,sl=25,Object.entries(al).reduce(((e,[t,a])=>{const s=(e=>{const[t,a]=e.split("x"),s=Number(t),r=Number(a);if(!(!Number.isFinite(s)||!Number.isFinite(r)||s<=0||r<=0))return s*r})(t);return"number"==typeof s?(e[t]=a+s*sl,e):(e[t]=a,e)}),{}));var al,sl;const rl=[Ri("Wanden en frieslijst met bedrijfsnaam","Walls and fascia with company name","Wände und Blende mit Firmenname"),Ri("Vast tapijt (antracietkleurig) in de stand","Fixed carpet (anthracite) in the booth","Fester Teppich (anthrazit) im Stand"),Ri("1 spot per 4 m²","1 spotlight per 4 m²","1
2Spot pro 4 m²"),Ri("Stroomaansluiting (220V / 3KW)","Power connection (220V / 3KW)","Stromanschluss (220V / 3KW)"),Ri("1 statafel en 2 barkrukken","1 standing table and 2 bar stools","1 Stehtisch und 2 Barhocker"),Ri("Standschoonmaak vóór en tijdens de beurs","Booth cleaning before and during the fair","Standreinigung vor und während der Messe"),Ri("1 exposantenbadge per 6 m²","1 exhibitor badge per 6 m²","1 Ausstellerausweis pro 6 m²"),Ri("1 lunch per 6 m²","1 lunch per 6 m²","1 Mittagessen pro 6 m²")],nl=[Ri("Vast tapijt (antracietkleurig) in de stand","Fixed carpet (anthracite) in the booth","Fester Teppich (anthrazit) im Stand"),Ri("Standschoonmaak vóór en tijdens de beurs","Booth cleaning before and during the fair","Standreinigung vor und während der Messe"),Ri("Stroomaansluiting (220V / 3KW)","Power connection (220V / 3KW)","Stromanschluss (220V / 3KW)"),Ri("1 exposantenbadge per 6 m²","1 exhibitor badge per 6 m²","1 Ausstellerausweis pro 6 m²"),Ri("1 lunch per 6 m²","1 lunch per 6 m²","1 Mittagessen pro 6 m²")],il=[{templateId:Ja.templateId,templateName:Ja.templateName,pricingModel:"default_components",minimumSquareMeters:Ja.minimumSquareMeters||9,earlyBirdDiscountBase:Ja.earlyBirdDiscountBase||"sqm_base",earlyBirdDiscountSqmBaseRate:Ja.earlyBirdDiscountSqmBaseRate,earlyBirdDiscountTiers:Ja.earlyBirdDiscountTiers||[],supportEmail:Ja.supportEmail,termsUrl:Ja.termsUrl,boothOptions:Ja.boothOptions.map((e=>{var t;return{id:e.type,type:e.type,label:"open_space"===e.type?Ri("Standlocatie (open space) + stroompunt","Booth space (open space) + power point","Standfläche (Open Space) + Stromanschluss"):"with_construction"===e.type?Ri("Standlocatie met standbouw","Booth space with stand construction","Standfläche mit Standbau"):"full_package"===e.type?Ri("Standlocatie met standbouw, balie, tafel met 4 stoelen en opbergruimte","Booth space with stand construction, counter, table with 4 chairs and storage","Standfläche mit Standbau, Theke, Tisch mit 4 Stühlen und Lagerraum"):Gi(e.label),description:"open_space"===e.type?Ri("Lege standruimte met stroomaansluiting","Empty booth space with power connection","Leere Standfläche mit Stromanschluss"):"with_construction"===e.type?Ri("Standruimte inclusief basis standbouw","Booth space including basic stand construction","Standfläche inklusive Basis-Standbau"):"full_package"===e.type?Ri("Complete standoplossing inclusief meubilair en opbergruimte (1x1m)","Complete booth solution including furniture and storage (1x1m)","Komplette Standlösung inklusive Mobiliar und Lagerraum (1x1m)"):Gi(e.description),infoText:"open_space"===e.type?Ri("Lege standruimte met stroomaansluiting","Empty booth space with power connection","Leere Standfläche mit Stromanschluss"):"with_construction"===e.type?Ri("Standruimte inclusief basis standbouw","Booth space including basic stand construction","Standfläche inklusive Basis-Standbau"):"full_package"===e.type?Ri("Complete standoplossing inclusief meubilair en opbergruimte (1x1m)","Complete booth solution including furniture and storage (1x1m)","Komplette Standlösung inklusive Mobiliar und Lagerraum (1x1m)"):Gi(e.infoText||e.description),includedItems:"open_space"===e.type?[Ri("Stroompunt 220V/3KW","Power point 220V/3KW","Strompunkt 220V/3KW")]:"with_construction"===e.type?[Ri("Witte wanden","White walls","WeiÃe Wände"),Ri("Frieslijst met bedrijfsnaam","Fascia with company name","Blende mit Firmenname"),Ri("1 spot per 4m2","1 spotlight per 4m2","1 Spot pro 4m2"),Ri("Vloerbedekking kleur zwart","Black floor covering","Bodenbelag in Schwarz"),Ri("Stroompunt 220V/3KW","Power point 220V/3KW","Strompunkt 220V/3KW")]:"full_package"===e.type?[Ri("Witte wanden","White walls","WeiÃe Wände"),Ri("Frieslijst met bedrijfsnaam","Fascia with company name","Blende mit Firmenname"),Ri("1 spot per 4m2","1 spotlight per 4m2","1 Spot pro 4m2"),Ri("Vloerbedekking kleur zwart","Black floor covering","Bodenbelag in Schwarz"),Ri("Stroompunt 220V/3KW","Power point 220V/3KW","Strompunkt 220V/3KW"),Ri("tafel met 4 stoelen","table with 4 chairs","Tisch mit 4 Stühlen"),Ri("Balie","Counter","Theke"),Ri("afsluitbare opbergruimte 1Ã1 meter","lockable storage space 1Ã1 meter","abschlieÃbarer Lagerraum 1Ã1 Meter")]:null==(t=e.includedItems)?void 0:t.map((e=>Gi(e))),enableConditionalOptions:!!Array.isArray(e.conditionalOptions)&&e.conditionalOptions.length>0,conditionalOptions:Array.isArray(e.conditionalOptions)?e.conditionalOptions.map((e=>({id:e.id,type:e.type,label:e.label,infoText:e.infoText||""}))):[],pricePerM2:e.pricePerM2,pricing:e.pricing?d({},e.pricing):void 0}})),standPreferences:Ja.standPreferences.map((e=>c(d({},e),{label:"between_stand"===e.type?Ri("Tussenstand","Between stand","Reihenstand"):"corner_stand"===e.type?Ri("Hoekstand","Corner stand","Eckstand"):"head_stand"===e.type?Ri("Kopstand","Head stand","Kopfstand"):"island_stand"===e.type?Ri("Eilandstand (minimaal 25m²)","Island stand (minimum 25m²)","Inselstand (mindestens 25m²)"):Ri("Geen voorkeur","No preference","Keine Präferenz"),infoText:e.infoText?Gi(e.infoText):void 0})))},{templateId:"tech-expo-template",templateName:"Template Tech Expo",pricingModel:"default_components",minimumSquareMeters:9,earlyBirdDiscountBase:"sqm_base",earlyBirdDiscountTiers:[],supportEmail:"[email protected]",termsUrl:"",boothOptions:[{id:"shell-scheme",type:"shell-scheme",label:Ri("Shell scheme stand","Shell scheme stand","Shell-Scheme-Stand"),description:Ri("Inclusief achterwand, verlichting en basisstroom","Including back wall, lighting and basic power","Inklusive Rückwand, Beleuchtung und Basisstrom"),infoText:Ri("Een complete basisopstelling met vaste wanden, licht en standaard stroomvoorziening.","A complete basic setup with fixed walls, lighting and standard power supply.","Ein komplettes Basissetup mit festen Wänden, Beleuchtung und Standardstromversorgung."),enableConditionalOptions:!1,conditionalOptions:[],pricePerM2:210},{id:"premium-corner",type:"premium-corner",label:Ri("Premium hoekstand","Premium corner stand","Premium-Eckstand"),description:Ri("Hoeklocatie met extra zichtbaarheid en signing","Corner location with extra visibility and signage","Eckstandort mit zusätzlicher Sichtbarkeit und Beschilderung"),infoText:Ri("Strategische hoekpositie met betere zichtlijnen en meer loopverkeer.","Strategic corner position with better sight lines and more foot traffic.","Strategische Eckposition mit besseren Sichtlinien und mehr Laufkundschaft."),enableConditionalOptions:!1,conditionalOptions:[],pricePerM2:285}],standPreferences:Ja.standPreferences.map((e=>c(d({},e),{infoText:e.infoText||""})))},{templateId:"nederlandse-kerstpakkettenbeurs-template",templateName:"Template Nederlandse Kerstpakkettenbeurs",pricingModel:"default_components",minimumSquareMeters:9,earlyBirdDiscountBase:"sqm_base",earlyBirdDiscountTiers:[],supportEmail:"[email protected]",termsUrl:"",boothOptions:[{id:"open_space",type:"open_space",label:Ri("Standlocatie (open space) + stroompunt","Booth space (open space) + power point","Standfläche (Open Space) + Stromanschluss"),description:Ri("Lege standruimte met stroomaansluiting","Empty booth space with power connection","
2Leere Standfläche mit Stromanschluss"),infoText:Ri("Kies voor vrije standruimte met vaste stroomaansluiting.","Choose open booth space with fixed power connection.","Wählen Sie freie Standfläche mit festem Stromanschluss."),enableConditionalOptions:!1,conditionalOptions:[],pricePerM2:115,pricing:{electricityFee:160}},{id:"with_construction",type:"with_construction",label:Ri("Standlocatie met standbouw","Booth space with stand construction","Standfläche mit Standbau"),description:Ri("Standruimte inclusief basis standbouw","Booth space including basic stand construction","Standfläche inklusive Basis-Standbau"),infoText:Ri("Inclusief basis standbouw met wanden, frieslijst en verlichting.","Includes basic stand construction with walls, fascia and lighting.","Inklusive Basis-Standbau mit Wänden, Blende und Beleuchtung."),enableConditionalOptions:!1,conditionalOptions:[],pricePerM2:115,pricing:{electricityFee:160,wallPricePerMeter:44,friezePricePerMeter:31,companyNamePrice:77.5,spotPrice:50}},{id:"full_package",type:"full_package",label:Ri("Standlocatie met standbouw, balie, tafel met 4 stoelen en opbergruimte","Booth space with stand construction, counter, table with 4 chairs and storage","Standfläche mit Standbau, Theke, Tisch mit 4 Stühlen und Lagerraum"),description:Ri("Complete standoplossing inclusief meubilair en opbergruimte (1x1m)","Complete booth solution including furniture and storage (1x1m)","Komplette Standlösung inklusive Mobiliar und Lagerraum (1x1m)"),infoText:Ri("Complete stand inclusief standbouw en meubilair voor directe inzet op de beursvloer.","Complete booth including construction and furniture, ready for use on the show floor.","Kompletter Stand inklusive Standbau und Mobiliar, sofort einsatzbereit auf der Messefläche."),enableConditionalOptions:!1,conditionalOptions:[],pricePerM2:115,pricing:{electricityFee:160,wallPricePerMeter:44,friezePricePerMeter:31,companyNamePrice:77.5,spotPrice:50,fullPackageTablePrice:40,fullPackageChairCount:4,fullPackageChairPrice:18,fullPackageCounterPrice:82.5,fullPackageStoragePrice:149}}],standPreferences:Ja.standPreferences.map((e=>c(d({},e),{infoText:e.infoText||""})))},{templateId:"standbouw-matrix-template",templateName:"Template Beurs met standbouwmatrix",pricingModel:"dimension_matrix",minimumSquareMeters:8,earlyBirdDiscountBase:"participation_fee",earlyBirdDiscountSqmBaseRate:void 0,earlyBirdDiscountTiers:Ja.earlyBirdDiscountTiers||[{month:7,day:1,percentage:10},{month:9,day:1,percentage:5}],supportEmail:"[email protected]",termsUrl:"",boothOptions:[{id:"with_construction_white",type:"with_construction_white",label:Ri("Deelname met standbouw - Wit","Participation with stand construction - White","Teilnahme mit Standbau - WeiÃ"),description:Ri("Vaste prijzen per afmeting, grotere stands per m²","Fixed prices per dimension, larger booths priced per m²","Feste Preise pro Abmessung, gröÃere Stände pro m²"),infoText:Ri("Voor afmetingen groter dan 18 m² geldt â¬189 per m².","For dimensions larger than 18 m², â¬189 per m² applies.","Für Abmessungen gröÃer als 18 m² gilt â¬189 pro m²."),includedItems:[...rl],enableConditionalOptions:!1,conditionalOptions:[],dimensionPricing:{thresholdSquareMeters:18,pricePerM2AboveThreshold:189,pricesByDimension:d({},el)}},{id:"with_construction_black",type:"with_construction_black",label:Ri("Deelname met standbouw - Zwart","Participation with stand construction - Black","Teilnahme mit Standbau - Schwarz"),description:Ri("Prijs wit + â¬25 per m² toeslag","White price + â¬25 per m² surcharge","Preis Weià + â¬25 pro m² Aufschlag"),infoText:Ri("Voor afmetingen groter dan 18 m² geldt â¬214 per m².","For dimensions larger than 18 m², â¬214 per m² applies.","Für Abmessungen gröÃer als 18 m² gilt â¬214 pro m²."),includedItems:[...rl],enableConditionalOptions:!1,conditionalOptions:[],dimensionPricing:{thresholdSquareMeters:18,pricePerM2AboveThreshold:214,pricesByDimension:d({},tl)}},{id:"own_construction",type:"own_construction",label:Ri("Deelname met eigen standbouw","Participation with own stand construction","Teilnahme mit eigenem Standbau"),description:Ri("Eigen standbouw met vaste prijzen per afmeting","Own stand construction with fixed prices per dimension","Eigener Standbau mit festen Preisen pro Abmessung"),infoText:Ri("Voor afmetingen groter dan 18 m² geldt â¬169 per m².","For dimensions larger than 18 m², â¬
2169 per m² applies.","Für Abmessungen gröÃer als 18 m² gilt â¬169 pro m²."),includedItems:[...nl],enableConditionalOptions:!1,conditionalOptions:[],dimensionPricing:{thresholdSquareMeters:18,pricePerM2AboveThreshold:169,pricesByDimension:d({},{"4x2":1550,"5x2":1800,"6x2":2150,"7x2":2470,"8x2":2780,"9x2":3070,"10x2":3380,"3x3":1650,"4x3":2150,"5x3":2610,"6x3":3070,"4x4":2780,"5x4":3380})}}],standPreferences:Ja.standPreferences.map((e=>c(d({},e),{infoText:e.infoText||""})))}],ll=e=>e.map((e=>{var t;return c(d({},e),{label:Ji(e.label)||"",boothLabelSku:"string"==typeof e.boothLabelSku?e.boothLabelSku:"",description:Ji(e.description)||"",infoText:Ji(e.infoText),includedItems:e.includedItems?e.includedItems.map((e=>Ji(e)||"")):void 0,includedItemSkus:e.includedItemSkus?[...e.includedItemSkus]:void 0,conditionalOptions:(null==(t=e.conditionalOptions)?void 0:t.map((e=>c(d({},e),{label:Ji(e.label)||"",infoText:Ji(e.infoText)}))))||[],pricing:e.pricing?d({},e.pricing):void 0,dimensionPricing:e.dimensionPricing?c(d({},e.dimensionPricing),{pricesByDimension:e.dimensionPricing.pricesByDimension?d({},e.dimensionPricing.pricesByDimension):void 0}):void 0})})),ol=e=>e.map((e=>c(d({},e),{label:Ji(e.label)||"",infoText:Ji(e.infoText)}))),dl=e=>e.map((e=>d({},e))),cl=(e,t,a=!1)=>{if(!Array.isArray(e))return dl(t);const s=e.map((e=>{const t=e&&"object"==typeof e?e:{};return{month:"number"==typeof t.month?t.month:NaN,day:"number"==typeof t.day?t.day:NaN,percentage:"number"==typeof t.percentage?t.percentage:NaN}})).filter((e=>Number.isFinite(e.month)&&Number.isFinite(e.day)&&Number.isFinite(e.percentage)));return 0===s.length&&a?dl(t):s},ul=e=>il.find((t=>t.templateId===e))||il[0],ml=e=>({templateId:e.templateId,templateName:e.templateName,pricingModel:e.pricingModel||"default_components",minimumSquareMeters:"number"==typeof e.minimumSquareMeters&&e.minimumSquareMeters>=1?Math.round(e.minimumSquareMeters):9,earlyBirdDiscountBase:e.earlyBirdDiscountBase||("dimension_matrix"===(e.pricingModel||"default_components")?"participation_fee":"sqm_base"),earlyBirdDiscountSqmBaseRate:"number"==typeof e.earlyBirdDiscountSqmBaseRate?e.earlyBirdDiscountSqmBaseRate:void 0,earlyBirdDiscountTiers:dl(e.earlyBirdDiscountTiers||[]),supportEmail:e.supportEmail||"[email protected]",termsUrl:Qi,boothOptions:ll(e.boothOptions),standPreferences:ol(e.standPreferences)}),pl=e=>({templateId:e.templateId,templateName:e.templateName,pricingModel:e.pricingModel,minimumSquareMeters:e.minimumSquareMeters,earlyBirdDiscountBase:e.earlyBirdDiscountBase,earlyBirdDiscountSqmBaseRate:"number"==typeof e.earlyBirdDiscountSqmBaseRate?e.earlyBirdDiscountSqmBaseRate:void 0,earlyBirdDiscountTiers:dl(e.earlyBirdDiscountTiers),supportEmail:e.supportEmail,termsUrl:Qi,boothOptions:ll(e.boothOptions),standPreferences:ol(e.standPreferences)}),xl=()=>c(d({},ml(il[0])),{formVisible:!1,menuVisible:!1,templateConfigs:{[il[0].templateId]:ml(il[0])}}),hl=e=>{if(Array.isArray(e))return e.map((e=>hl(e)));if(e&&"object"==typeof e&&!(e instanceof Date)){return Object.entries(e).reduce(((e,[t,a])=>(void 0===a||(e[t]=hl(a)),e)),{})}return e},gl=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,bl=(e,t)=>{var a,s,r,n,i,l,o,d,c,u;const m=e&&"object"==typeof e?e:void 0,p={electricityFee:null!=(a=gl(null==m?void 0:m.electricityFee))?a:null==t?void 0:t.electricityFee,wallPricePerMeter:null!=(s=gl(null==m?void 0:m.wallPricePerMeter))?s:null==t?void 0:t.wallPricePerMeter,friezePricePerMeter:null!=(r=gl(null==m?void 0:m.friezePricePerMeter))?r:null==t?void 0:t.friezePricePerMeter,companyNamePrice:null!=(n=gl(null==m?void 0:m.companyNamePrice))?n:null==t?void 0:t.companyNamePrice,spotPrice:null!=(i=gl(null==m?void 0:m.spotPrice))?i:null==t?void 0:t.spotPrice,fullPackageTablePrice:null!=(l=gl(null==m?void 0:m.fullPackageTablePrice))?l:null==t?void 0:t.fullPackageTablePrice,fullPackageChairCount:null!=(o=gl(null==m?void 0:m.fullPackageChairCount))?o:null==t?void 0:t.fullPackageChairCount,fullPackageChairPrice:null!=(d=gl(null==m?void 0:m.fullPackageChairPrice))?d:null==t?void 0:t.fullPackageChairPrice,fullPackageCounterPrice:null!=(c=gl(null==m?void 0:m.fullPackageCounterPrice))?c:null==t?void 0:t.fullPackageCounterPrice,fullPackageStoragePrice:null!=(u=gl(null==m?void 0:m.fullPackageStoragePrice))?u:null==t?void 0:t.fullPackageStoragePrice};return Object.values(p).some((e=>void 0!==e))?p:void 0},vl=(e,t)=>
2{var a,s;const r=e&&"object"==typeof e?e:void 0,n=null==r?void 0:r.pricesByDimension,i=n&&"object"==typeof n?Object.entries(n).reduce(((e,[t,a])=>("number"==typeof a&&Number.isFinite(a)&&(e[t]=a),e)),{}):null==t?void 0:t.pricesByDimension,l={thresholdSquareMeters:null!=(a=gl(null==r?void 0:r.thresholdSquareMeters))?a:null==t?void 0:t.thresholdSquareMeters,pricePerM2AboveThreshold:null!=(s=gl(null==r?void 0:r.pricePerM2AboveThreshold))?s:null==t?void 0:t.pricePerM2AboveThreshold,pricesByDimension:i};return l.thresholdSquareMeters||l.pricePerM2AboveThreshold||l.pricesByDimension?l:void 0},fl=e=>{const t=e.trim().replace(",",".");if(!t)return;const a=Number(t);return Number.isFinite(a)?a:void 0},jl=(e,t)=>Array.isArray(e)?e.map(((e,a)=>{var s,r,n,i,l,o,d,c,u,m,p,x,h,g;const b=e&&"object"==typeof e?e:{},v=Array.isArray(b.includedItems)?b.includedItems:[],f=Array.isArray(b.includedItemSkus)?b.includedItemSkus:[],j=[],y=[];v.forEach(((e,t)=>{const a=qi(e)?Gi(e):"string"==typeof e?e:"";if(!("string"==typeof a?a.trim().length>0:Hi.some((e=>(a[e]||"").trim().length>0))))return;const s=f[t],r="string"==typeof s&&s.trim().length>0?s.trim():"";j.push(a),y.push(r)}));const N=null==(s=t[a])?void 0:s.includedItems,_=null==(r=t[a])?void 0:r.includedItemSkus,w="string"==typeof(null==(n=t[a])?void 0:n.boothLabelSku)?null==(i=t[a])?void 0:i.boothLabelSku:"";return{id:"string"==typeof b.id?b.id:(null==(l=t[a])?void 0:l.id)||`custom-${Date.now()}-${Math.random().toString(16).slice(2,8)}`,type:"string"==typeof b.type?b.type:(null==(o=t[a])?void 0:o.type)||"custom-option",label:qi(b.label)?Gi(b.label):"string"==typeof b.label?b.label:Ji(null==(d=t[a])?void 0:d.label)||"",boothLabelSku:"string"==typeof b.boothLabelSku?b.boothLabelSku.trim():w,description:qi(b.description)?Gi(b.description):"string"==typeof b.description?b.description:Ji(null==(c=t[a])?void 0:c.description)||"",infoText:qi(b.infoText)?Gi(b.infoText):"string"==typeof b.infoText?b.infoText:Ji(null==(u=t[a])?void 0:u.infoText)||(qi(b.description)?Gi(b.description):"string"==typeof b.description?b.description:""),includedItems:Array.isArray(b.includedItems)?j:N,includedItemSkus:Array.isArray(b.includedItems)?y:_,enableConditionalOptions:Array.isArray(b.conditionalOptions)?b.conditionalOptions.length>0:Boolean(null==(m=t[a])?void 0:m.enableConditionalOptions),conditionalOptions:Array.isArray(b.conditionalOptions)?b.conditionalOptions.map(((e,s)=>{var r;const n=e&&"object"==typeof e?e:{};return{id:"string"==typeof n.id?n.id:`${"string"==typeof b.id?b.id:(null==(r=t[a])?void 0:r.id)||"conditional"}-${s}`,type:"string"==typeof n.type&&n.type?n.type:(i="string"==typeof n.label?n.label:qi(n.label)&&(Gi(n.label).nl||Gi(n.label).en||Gi(n.label).de)||`optie-${s+1}`,i.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"custom-option"),label:qi(n.label)?Gi(n.label):"string"==typeof n.label?n.label:"",infoText:qi(n.infoText)?Gi(n.infoText):"string"==typeof n.infoText?n.infoText:""};var i})):(null==(p=t[a])?void 0:p.conditionalOptions)||[],pricePerM2:"number"==typeof b.pricePerM2?b.pricePerM2:null==(x=t[a])?void 0:x.pricePerM2,pricing:bl(b.pricing,null==(h=t[a])?void 0:h.pricing),dimensionPricing:vl(b.dimensionPricing,null==(g=t[a])?void 0:g.dimensionPricing)}})):ll(t),yl=(e,t)=>Array.isArray(e)?e.map(((e,a)=>{var s,r,n,i;const l=e&&"object"==typeof e?e:{};return{type:"string"==typeof l.type?l.type:(null==(s=t[a])?void 0:s.type)||"no_preference",label:qi(l.label)?Gi(l.label):"string"==typeof l.label?l.label:Ji(null==(r=t[a])?void 0:r.label)||"",infoText:qi(l.infoText)?Gi(l.infoText):"string"==typeof l.infoText?l.infoText:Ji(null==(n=t[a])?void 0:n.infoText)||"",minSquareMeters:"number"==typeof l.minSquareMeters?l.minSquareMeters:null==(i=t[a])?void 0:i.minSquareMeters}})):ol(t),Nl=({label:e,placeholder:t,hint:a,emptyMessage:s,removeLinkLabel:r,searchValue:n,onSearchChange:i,dropdownOpen:l,onDropdownOpenChange:o,products:d,onSelectProduct:c,selectedSku:u,onClearSelection:m,disabled:x})=>p.jsxs("div",{children:[p.jsx("span",{className:"mb-1 block [font-size:var(--text-xs)] font-medium text-[var(--color-text)]",children:e}),p.jsxs("div",{className:"relative",children:[p.jsx(he,{type:"text",inputSize:"sm",fullWidth:!0,placeholder:t,value:n,onChange:e=>{i(e.target.value),o(!0)},onFocus:()=>{n.trim()&&o(!0)},onBlur:()=>{setTimeout((()=>o(!1)),150)},disabled:x}),l&&n.trim()&&p.jsx("div",{className:"absolute left-0 right-0 z-10 mt-1 max-h-48 overflow-y-auto rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] shadow-[var(--shadow-md)]",children:d.length>0?d.map((e=>p.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left [font-size:var(--text-xs)] hover:bg-[var(--color-bg)]",onMouseDown:t=>{t.preventDefault(),c(e)},disabled:x,children:[p.jsxs("span",{className:"truncate text-[var(--color-text)]",children:[p.jsx("strong",{children:e._productSku})," â ",e._productName_nl]}),p.jsxs("span",{className:"whitespace-nowrap text-[var(--color-text-muted)]",children:["⬠",e.price.toFixed(2)]})]},e.productId))):p.jsx("div",{className:"px-3 py-2 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:s})})]}),p.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:a}),u&&p.jsx(V,{type:"button",variant:"link",size:"sm",onClick:m,disabled:x,children:r})]})]}),_l=({selectedSku:e,selectedProduct:t,foundLabel:a,notFoundLabel:s})=>t?p.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-success)]/30 bg-[var(--color-success-soft)] px-2 py-1 [font-size:var(--text-xs)] text-[var(--color-text)]",children:a}):e?p.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] px-2 py-1 [font-size:var(--text-xs)] text-[var(--color-text)]",children:s}):null,wl=()=>{var e;const{t:t}=T("projects"),{id:a}=g(),{isAdmin:s}=K(),[r,n]=h.useState(xl()),[i,l]=h.useState([]),[o,u]=h.useState({}),[x,b]=h.useState({}),[v,f]=h.useState({}),[j,y]=h.useState({}
2),[N,_]=h.useState({}),[w,k]=h.useState(!1),C=h.useMemo((()=>new Map(i.map((e=>[e._productSku,e])))),[i]);h.useEffect((()=>{if(!a)return;m(null,null,(function*(){try{const e=ft(W,`projects/${a}`),t=yield jt(e);if(!t.exists())return;const s=t.data();if(!(null==s?void 0:s.applicationFormConfig))return;n((e=>{var t;const a=xl();if(!e||"object"!=typeof e)return a;const s=e,r="string"==typeof s.templateId?s.templateId:a.templateId,n=ul(r),i=ml(n),l={templateId:r,templateName:"string"==typeof s.templateName?s.templateName:i.templateName,pricingModel:"dimension_matrix"===s.pricingModel||"default_components"===s.pricingModel?s.pricingModel:i.pricingModel,minimumSquareMeters:"number"==typeof s.minimumSquareMeters&&s.minimumSquareMeters>=1?Math.round(s.minimumSquareMeters):i.minimumSquareMeters,earlyBirdDiscountBase:"participation_fee"===s.earlyBirdDiscountBase||"sqm_base"===s.earlyBirdDiscountBase?s.earlyBirdDiscountBase:i.earlyBirdDiscountBase,earlyBirdDiscountSqmBaseRate:null!=(t=gl(s.earlyBirdDiscountSqmBaseRate))?t:i.earlyBirdDiscountSqmBaseRate,earlyBirdDiscountTiers:cl(s.earlyBirdDiscountTiers,i.earlyBirdDiscountTiers,"standbouw-matrix-template"===r),supportEmail:"string"==typeof s.supportEmail?s.supportEmail:i.supportEmail,termsUrl:Qi,boothOptions:jl(s.boothOptions,i.boothOptions),standPreferences:yl(s.standPreferences,i.standPreferences)},o=s.templateConfigs&&"object"==typeof s.templateConfigs?Object.entries(s.templateConfigs).reduce(((e,[t,a])=>{var s;const r=ul(t),n=ml(r),i=a&&"object"==typeof a?a:{};return e[t]={templateId:t,templateName:"string"==typeof i.templateName?i.templateName:n.templateName,pricingModel:"dimension_matrix"===i.pricingModel||"default_components"===i.pricingModel?i.pricingModel:n.pricingModel,minimumSquareMeters:"number"==typeof i.minimumSquareMeters&&i.minimumSquareMeters>=1?Math.round(i.minimumSquareMeters):n.minimumSquareMeters,earlyBirdDiscountBase:"participation_fee"===i.earlyBirdDiscountBase||"sqm_base"===i.earlyBirdDiscountBase?i.earlyBirdDiscountBase:n.earlyBirdDiscountBase,earlyBirdDiscountSqmBaseRate:null!=(s=gl(i.earlyBirdDiscountSqmBaseRate))?s:n.earlyBirdDiscountSqmBaseRate,earlyBirdDiscountTiers:cl(i.earlyBirdDiscountTiers,n.earlyBirdDiscountTiers,"standbouw-matrix-template"===t),supportEmail:"string"==typeof i.supportEmail?i.supportEmail:n.supportEmail,termsUrl:Qi,boothOptions:jl(i.boothOptions,n.boothOptions),standPreferences:yl(i.standPreferences,n.standPreferences)},e}),{}):{},u=c(d({},o),{[l.templateId]:l}),m=u[r]||i;return{formVisible:Boolean(s.formVisible),menuVisible:Boolean(s.menuVisible),templateId:r,templateName:m.templateName,pricingModel:m.pricingModel,minimumSquareMeters:m.minimumSquareMeters,earlyBirdDiscountBase:m.earlyBirdDiscountBase,earlyBirdDiscountSqmBaseRate:m.earlyBirdDiscountSqmBaseRate,earlyBirdDiscountTiers:m.earlyBirdDiscountTiers,supportEmail:m.supportEmail,termsUrl:m.termsUrl,boothOptions:m.boothOptions,standPreferences:m.standPreferences,templateConfigs:u}})(s.applicationFormConfig))}catch(e){}}))}),[a]),h.useEffect((()=>{if(!a)return;m(null,null,(function*(){try{const e=yield Ya(a);l(e)}catch(e){l([])}}))}),[a]),h.useEffect((()=>{u((e=>{var t;const a=null==(t=r.boothOptions[0])?void 0:t.type;return r.boothOptions.reduce(((t,s)=>{var r;return t[s.type]=null!=(r=e[s.type])?r:s.type===a,t}),{})}))}),[r.boothOptions]);const S=(e,t)=>{const a=t.trim();n((t=>c(d({},t),{boothOptions:t.boothOptions.map((t=>t.type===e?c(d({},t),{boothLabelSku:a.length>0?a:""}):t))})))},z=(e,t,a)=>{const s=a.trim();n((a=>c(d({},a),{boothOptions:a.boothOptions.map((a=>{if(a.type!==e)return a;const r=a.includedItemSkus?[...a.includedItemSkus]:[];return r[t]=s.length>0?s:"",c(d({},a),{includedItemSkus:r})}))})))},I=(e,t,a)=>{const s=fl(a);n((a=>c(d({},a),{earlyBirdDiscountTiers:a.earlyBirdDiscountTiers.map(((a,r)=>r!==e||"number"!=typeof s?a:c(d({},a),{[t]:"percentage"===t?s:Math.round(s)})))})))},P=(e,t,a)=>{const s=fl(a);n((a=>c(d({},a),{boothOptions:a.boothOptions.map((a=>a.type!==e?a:c(d({},a),{dimensionPricing:c(d({},a.dimensionPricing||{}),{[t]:s})})))})))},D=(e,t,a)=>{const s=fl(a);n((a=>c(d({},a),{boothOptions:a.boothOptions.map((a=>a.type!==e?a:c(d({},a),{pricing:c(d({},a.pricing||{}),{[t]:s})})))})))},B=(e,t,a,s)=>{n((r=>c(d({},r),{boothOptions:r.boothOptions.map((r=>r.type===e?c(d({},r),{[t]:Zi(r[t],a,s)}):r))})))},L=h.useCallback((()=>m(null,null,(function*(){if(!s)return void A.error(t("setup.application_form.save_unauthorized"));if(!a)return void A.error(t("setup.application_form.save_no_project"));k(!0);const e=Object.entries(c(d({},r.templateConfigs),{[r.templateId]:pl(r)})).reduce(((e,[t,a])=>(e[t]=c(d({},a),{termsUrl:Qi}),e)),{}),n=c(d({},r),{termsUrl:Qi,templateConfigs:e}),i={applicationFormConfig:hl(n),updatedAt:new Date};try{const e=ft(W,`projects/${a}`),s=ft(W,`public_projects/${a}`);yield St(e,i),yield St(s,i).catch((e=>m(null,null,(function*(){if("not-found"!==(e&&"object"==typeof e&&"code"in e?e.code:void 0))throw e;yield yt(s,c(d({},i),{projectId:a}),{merge:!0})}
2)))),A.success(t("setup.application_form.save_success"))}catch(l){A.error(t("setup.application_form.save_error"))}finally{k(!1)}}))),[s,a,r,t]);return E(p.jsx(V,{type:"button",variant:"primary",size:"md",loading:w,disabled:!s||w,onClick:L,children:t("setup.application_form.save_button")}),[w,s,L,t]),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-[var(--shadow-sm)]",children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:t("setup.application_form.title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:t("setup.application_form.description")}),!s&&p.jsx("div",{role:"status",className:"mt-4 rounded-[var(--radius-md)] border border-[var(--color-warning)]/30 bg-[var(--color-warning-soft)] p-3 [font-size:var(--text-sm)] text-[var(--color-text)]",children:t("setup.admin_only_notice")}),p.jsxs("div",{className:"mt-6 space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[p.jsx(Gt,{label:t("setup.application_form.template_label"),value:r.templateId,onChange:e=>{const t=ul(e);n((e=>d(d({},e),(()=>{const a=e.templateConfigs[t.templateId],s=a?c(d({},a),{boothOptions:ll(a.boothOptions),standPreferences:ol(a.standPreferences)}):ml(t);return{templateId:s.templateId,templateName:s.templateName,pricingModel:s.pricingModel,minimumSquareMeters:s.minimumSquareMeters,earlyBirdDiscountBase:s.earlyBirdDiscountBase,earlyBirdDiscountSqmBaseRate:s.earlyBirdDiscountSqmBaseRate,earlyBirdDiscountTiers:s.earlyBirdDiscountTiers,supportEmail:s.supportEmail,termsUrl:s.termsUrl,boothOptions:s.boothOptions,standPreferences:s.standPreferences,templateConfigs:c(d({},e.templateConfigs),{[e.templateId]:pl(e),[s.templateId]:s})}})())))},options:il.map((e=>({value:e.templateId,label:e.templateName}))),disabled:!s}),p.jsx(he,{label:t("setup.application_form.minimum_sqm_label"),type:"number",step:1,min:1,value:r.minimumSquareMeters,onChange:e=>(e=>{const t=fl(e);n((e=>c(d({},e),{minimumSquareMeters:"number"==typeof t&&t>=1?Math.round(t):e.minimumSquareMeters})))})(e.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.support_email_label"),type:"email",value:r.supportEmail,onChange:e=>n((t=>c(d({},t),{supportEmail:e.target.value}))),disabled:!s})]}),p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-success)]/30 bg-[var(--color-success-soft)] px-3 py-2 [font-size:var(--text-xs)] text-[var(--color-text)]",children:[p.jsx("span",{className:"font-semibold",children:t("setup.application_form.terms_url_label")})," ",p.jsxs("code",{className:"rounded bg-[var(--color-surface)]/70 px-1 py-0.5",children:["/",Qi]}),p.jsx("span",{className:"mt-1 block",children:t("setup.application_form.terms_url_help")})]}),p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-info)]/30 bg-[var(--color-info-soft)] px-3 py-2 [font-size:var(--text-xs)] text-[var(--color-text)]",children:[t("setup.application_form.active_pricing_type_label")," ",p.jsx("strong",{children:"dimension_matrix"===r.pricingModel?t("setup.application_form.pricing_dimension_matrix"):t("setup.application_form.pricing_default_components")})]}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 items-start",children:[p.jsx(Gt,{label:t("setup.application_form.discount_base_label"),value:r.earlyBirdDiscountBase,onChange:e=>(e=>{"sqm_base"!==e&&"participation_fee"!==e||n((t=>c(d({},t),{earlyBirdDiscountBase:e})))})(e),options:"dimension_matrix"===r.pricingModel?[{value:"participation_fee",label:t("setup.application_form.discount_base_option_participation_fee_matrix")},{value:"sqm_base",label:t("setup.application_form.discount_base_option_sqm_base")}]:[{value:"sqm_base",label:t("setup.application_form.discount_base_option_sqm_base")},{value:"participation_fee",label:t("setup.application_form.discount_base_option_participation_fee")}],hint:"participation_fee"===r.earlyBirdDiscountBase?t("setup.application_form.discount_base_help_participation_fee"):"dimension_matrix"===r.pricingModel?t("setup.application_form.discount_base_help_sqm_matrix"):t("setup.application_form.discount_base_help_sqm_default"),disabled:!s}
2),p.jsx(he,{label:t("setup.application_form.sqm_base_rate_label"),type:"number",step:.01,min:0,value:null!=(e=r.earlyBirdDiscountSqmBaseRate)?e:"",onChange:e=>(e=>{const t=fl(e);n((e=>c(d({},e),{earlyBirdDiscountSqmBaseRate:"number"==typeof t&&t>=0?t:void 0})))})(e.target.value),disabled:!s||"dimension_matrix"!==r.pricingModel,hint:t("setup.application_form.sqm_base_rate_help")})]}),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4 space-y-3",children:[p.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:t("setup.application_form.early_bird_section_title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t("setup.application_form.early_bird_section_description")})]}),p.jsx(V,{type:"button",variant:"secondary",size:"sm",onClick:()=>{n((e=>c(d({},e),{earlyBirdDiscountTiers:[...e.earlyBirdDiscountTiers,{month:12,day:31,percentage:0}]})))},disabled:!s,children:t("setup.application_form.early_bird_add_tier")})]}),p.jsx("div",{className:"space-y-2",children:r.earlyBirdDiscountTiers.map(((e,a)=>p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_1fr_1fr_auto] gap-2 items-end",children:[p.jsx(he,{label:t("setup.application_form.early_bird_month_label"),type:"number",min:1,max:12,step:1,inputSize:"sm",value:e.month,onChange:e=>I(a,"month",e.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.early_bird_day_label"),type:"number",min:1,max:31,step:1,inputSize:"sm",value:e.day,onChange:e=>I(a,"day",e.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.early_bird_percentage_label"),type:"number",min:0,max:100,step:.1,inputSize:"sm",value:e.percentage,onChange:e=>I(a,"percentage",e.target.value),disabled:!s}),p.jsx($,{"aria-label":t("setup.application_form.early_bird_remove_tier"),title:t("setup.application_form.early_bird_remove_tier"),variant:"ghost",size:"sm",icon:p.jsx(O,{size:16,className:"text-[var(--color-danger)]"}),onClick:()=>(e=>{n((t=>c(d({},t),{earlyBirdDiscountTiers:t.earlyBirdDiscountTiers.filter(((t,a)=>a!==e))})))})(a),disabled:!s})]},`discount-tier-${a}`)))})]}),p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4 space-y-4",children:[p.jsxs("div",{children:[p.jsx("h4",{className:"[font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:t("setup.application_form.step1_pricing_title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t("setup.application_form.step1_pricing_description")})]}),p.jsx("div",{className:"space-y-4",children:r.boothOptions.map((e=>{var a,l,m,h,g,w,k,I,T,A,E,M,L,$,O,F,U,K,W,H,R,q,G,J,Y;const Z="dimension_matrix"===r.pricingModel,X="with_construction"===e.type||"full_package"===e.type,Q="full_package"===e.type,ee=Yi(e.label,"nl")||e.type,te=(e.includedItems||[]).length,ae=(e.includedItemSkus||[]).filter((e=>e&&e.trim())).length,se=e.boothLabelSku||"",re=se?C.get(se):void 0,ne=Boolean(se.trim()),ie=Boolean(o[e.type]),le=x[e.type]||(re?`${re._productSku} â ${re._productName_nl}`:se),oe=i.filter((e=>{if(!le.trim())return!0;const t=le.toLowerCase();return e._productSku.toLowerCase().includes(t)||e._productName_nl.toLowerCase().includes(t)}));return p.jsxs("div",{className:["rounded-[var(--radius-md)] border p-4 transition-colors",ie?"border-[var(--color-accent)] bg-[var(--color-accent-soft)]/40":"border-[var(--color-border)] bg-[var(--color-surface)]"].join(" "),children:[p.jsx("button",{type:"button",className:"w-full text-left",onClick:()=>u((t=>c(d({},t),{[e.type]:!t[e.type]}))),children:p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"[font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:ee}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t("setup.application_form.option_type_label",{type:e.type})})]}),p.jsxs("div",{className:"flex items-center gap-2 [font-size:var(--text-xs)]",children:[p.jsx("span",{className:"rounded-full bg-[var(--color-bg)] px-2 py-1 text-[var(--color-text)]",children:t("setup.application_form.onderdelen_pill_label",{linked:ae,total:te})}),p.jsx("span",{className:["rounded-full px-2 py-1",ne?"bg-[var(--color-success-soft)] text-[var(--color-success)]":"bg-[var(--color-warning-soft)] text-[var(--color-warning)]"].join(" "),children:t(ne?"setup.application_form.naam_sku_pill_linked":"setup.application_form.naam_sku_pill_not_linked")}),p.jsx("span",{className:"[font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:ie?"-":"+"})]})]})}),ie&&p.jsxs("div",{className:"mt-4 border-t border-[var(--color-accent)]/30 pt-4 space-y-4",children:[p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 space-y-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"[font-size:var(--text-xs)] font-semibold text-[var(--color-text)]",children:t("setup.application_form.booth_texts_section_title")}),p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t("setup.application_form.booth_texts_section_description")})]}),Hi.map((a=>p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[p.jsx(he,{label:t("setup.application_form.booth_label_locale_label",{locale:a.toUpperCase()}),type:"text",inputSize:"sm",value:Yi(e.label,a),onChange:t=>B(e.type,"label",a,t.target.value),disabled:!s}
2),p.jsx(he,{label:t("setup.application_form.booth_description_locale_label",{locale:a.toUpperCase()}),type:"text",inputSize:"sm",value:Yi(e.description,a),onChange:t=>B(e.type,"description",a,t.target.value),disabled:!s}),p.jsx("div",{className:"md:col-span-2",children:p.jsx(de,{label:t("setup.application_form.booth_info_text_locale_label",{locale:a.toUpperCase()}),rows:2,value:Yi(e.infoText,a),onChange:t=>B(e.type,"infoText",a,t.target.value),disabled:!s})})]},`${e.type}-texts-${a}`))),p.jsx(Nl,{label:t("setup.application_form.booth_label_sku_label"),placeholder:t("setup.application_form.sku_search_placeholder"),hint:t("setup.application_form.sku_search_hint"),emptyMessage:t("setup.application_form.sku_no_products_found"),removeLinkLabel:t("setup.application_form.sku_remove_link_label"),searchValue:le,onSearchChange:t=>b((a=>c(d({},a),{[e.type]:t}))),dropdownOpen:Boolean(v[e.type]),onDropdownOpenChange:t=>f((a=>c(d({},a),{[e.type]:t}))),products:oe,onSelectProduct:t=>{S(e.type,t._productSku),b((a=>c(d({},a),{[e.type]:`${t._productSku} â ${t._productName_nl}`}))),f((t=>c(d({},t),{[e.type]:!1})))},selectedSku:se,onClearSelection:()=>{S(e.type,""),b((t=>c(d({},t),{[e.type]:""})))},disabled:!s}),p.jsx(_l,{selectedSku:se,selectedProduct:re,foundLabel:re?t("setup.application_form.sku_status_found",{sku:re._productSku,name:re._productName_nl,price:re.price.toFixed(2)}):"",notFoundLabel:t("setup.application_form.sku_status_not_found",{sku:se})})]}),Z&&p.jsxs("div",{className:"mb-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 space-y-3",children:[p.jsx("p",{className:"[font-size:var(--text-xs)] font-semibold text-[var(--color-text)]",children:t("setup.application_form.matrix_section_title")}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[p.jsx(he,{label:t("setup.application_form.matrix_threshold_label"),type:"number",step:1,min:0,inputSize:"sm",value:null!=(l=null==(a=e.dimensionPricing)?void 0:a.thresholdSquareMeters)?l:"",onChange:t=>P(e.type,"thresholdSquareMeters",t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.matrix_price_above_threshold_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(h=null==(m=e.dimensionPricing)?void 0:m.pricePerM2AboveThreshold)?h:"",onChange:t=>P(e.type,"pricePerM2AboveThreshold",t.target.value),disabled:!s})]}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:Xi.map((a=>{var r,i,l;return p.jsx(he,{label:t("setup.application_form.matrix_dimension_price_label",{dimension:a}),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(l=null==(i=null==(r=e.dimensionPricing)?void 0:r.pricesByDimension)?void 0:i[a])?l:"",onChange:t=>((e,t,a)=>{const s=fl(a);n((a=>c(d({},a),{boothOptions:a.boothOptions.map((a=>{var r;return a.type!==e?a:c(d({},a),{dimensionPricing:c(d({},a.dimensionPricing||{}),{pricesByDimension:c(d({},(null==(r=a.dimensionPricing)?void 0:r.pricesByDimension)||{}),{[t]:null!=s?s:0})})})}))})))})(e.type,a,t.target.value),disabled:!s},`${e.type}-${a}`)}))})]}),p.jsxs("div",{className:"mb-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 space-y-2",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] font-semibold text-[var(--color-text)]",children:t("setup.application_form.included_items_section_title")}),p.jsx(V,{type:"button",variant:"secondary",size:"sm",onClick:()=>{return t=e.type,void n((e=>c(d({},e),{boothOptions:e.boothOptions.map((e=>e.type!==t?e:c(d({},e),{includedItems:[...e.includedItems||[],Gi(void 0)],includedItemSkus:[...e.includedItemSkus||[],""]})))})));var t},disabled:!s,children:t("setup.application_form.included_items_add_button")})]}),p.jsx("div",{className:"space-y-2",children:(e.includedItems||[]).map(((a,r)=>{var l;const o=`${e.type}-${r}`,u=(null==(l=e.includedItemSkus)?void 0:l[r])||"",m=u?C.get(u):void 0,x=j[o]||"",h=i.filter((e=>{if(!x.trim())return!0;const t=x.toLowerCase();return e._productSku.toLowerCase().includes(t)||e._productName_nl.toLowerCase().includes(t)}));return p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] p-2 space-y-2",children:[Hi.map((i=>p.jsx(he,{type:"text",inputSize:"sm",value:Yi(a,i),onChange:t=>((e,t,a,s)=>{n((r=>c(d({},r),{boothOptions:r.boothOptions.map((r=>{if(r.type!==e)return r;const n=r.includedItems?[...r.includedItems]:[];return n[t]=Zi(n[t],a,s),c(d({},r),{includedItems:n})}))})))})(e.type,r,i,t.target.value),disabled:!s,placeholder:t("setup.application_form.included_item_locale_placeholder",{locale:i.toUpperCase()})},`${e.type}-included-${r}-${i}`))),p.jsx(Nl,{label:t("setup.application_form.included_item_linked_sku_label"),placeholder:t("setup.application_form.sku_search_placeholder"),hint:t("setup.application_form.sku_search_hint"),emptyMessage:t("setup.application_form.sku_no_products_found"),removeLinkLabel:t
2("setup.application_form.sku_remove_link_label"),searchValue:x,onSearchChange:e=>y((t=>c(d({},t),{[o]:e}))),dropdownOpen:Boolean(N[o]),onDropdownOpenChange:e=>_((t=>c(d({},t),{[o]:e}))),products:h,onSelectProduct:t=>{z(e.type,r,t._productSku),y((e=>c(d({},e),{[o]:`${t._productSku} â ${t._productName_nl}`}))),_((e=>c(d({},e),{[o]:!1})))},selectedSku:u,onClearSelection:()=>{z(e.type,r,""),y((e=>c(d({},e),{[o]:""})))},disabled:!s}),p.jsx(_l,{selectedSku:u,selectedProduct:m,foundLabel:m?t("setup.application_form.sku_status_found",{sku:m._productSku,name:m._productName_nl,price:m.price.toFixed(2)}):"",notFoundLabel:t("setup.application_form.sku_status_not_found",{sku:u})}),p.jsx(V,{type:"button",variant:"secondary",size:"sm",onClick:()=>((e,t)=>{n((a=>c(d({},a),{boothOptions:a.boothOptions.map((a=>a.type!==e?a:c(d({},a),{includedItems:(a.includedItems||[]).filter(((e,a)=>a!==t)),includedItemSkus:(a.includedItemSkus||[]).filter(((e,a)=>a!==t))})))})))})(e.type,r),disabled:!s,children:t("setup.application_form.included_item_remove_button")})]},`${e.type}-included-${r}`)}))})]}),!Z&&p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-3 space-y-3",children:[p.jsx("p",{className:"[font-size:var(--text-xs)] font-semibold text-[var(--color-text)]",children:t("setup.application_form.pricing_components_section_title")}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[p.jsx(he,{label:t("setup.application_form.pricing_per_m2_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(g=e.pricePerM2)?g:"",onChange:t=>((e,t)=>{const a=fl(t);n((t=>c(d({},t),{boothOptions:t.boothOptions.map((t=>t.type===e?c(d({},t),{pricePerM2:a}):t))})))})(e.type,t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.electricity_fee_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(k=null==(w=e.pricing)?void 0:w.electricityFee)?k:"",onChange:t=>D(e.type,"electricityFee",t.target.value),disabled:!s}),X&&p.jsxs(p.Fragment,{children:[p.jsx(he,{label:t("setup.application_form.wall_price_per_meter_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(T=null==(I=e.pricing)?void 0:I.wallPricePerMeter)?T:"",onChange:t=>D(e.type,"wallPricePerMeter",t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.frieze_price_per_meter_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(E=null==(A=e.pricing)?void 0:A.friezePricePerMeter)?E:"",onChange:t=>D(e.type,"friezePricePerMeter",t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.company_name_price_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(L=null==(M=e.pricing)?void 0:M.companyNamePrice)?L:"",onChange:t=>D(e.type,"companyNamePrice",t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.spot_price_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(O=null==($=e.pricing)?void 0:$.spotPrice)?O:"",onChange:t=>D(e.type,"spotPrice",t.target.value),disabled:!s})]}),Q&&p.jsxs(p.Fragment,{children:[p.jsx(he,{label:t("setup.application_form.full_package_table_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(U=null==(F=e.pricing)?void 0:F.fullPackageTablePrice)?U:"",onChange:t=>D(e.type,"fullPackageTablePrice",t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.full_package_chair_count_label"),type:"number",step:1,min:0,inputSize:"sm",value:null!=(W=null==(K=e.pricing)?void 0:K.fullPackageChairCount)?W:"",onChange:t=>D(e.type,"fullPackageChairCount",t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.full_package_chair_price_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(R=null==(H=e.pricing)?void 0:H.fullPackageChairPrice)?R:"",onChange:t=>D(e.type,"fullPackageChairPrice",t.target.value),disabled:!s}),p.jsx(he,{label:t("setup.application_form.full_package_counter_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(G=null==(q=e.pricing)?void 0:q.fullPackageCounterPrice)?G:"",onChange:t=>D(e.type,"fullPackageCounterPrice",t.target.value),disabled:!s}
2),p.jsx(he,{label:t("setup.application_form.full_package_storage_label"),type:"number",step:.01,min:0,inputSize:"sm",value:null!=(Y=null==(J=e.pricing)?void 0:J.fullPackageStoragePrice)?Y:"",onChange:t=>D(e.type,"fullPackageStoragePrice",t.target.value),disabled:!s})]})]})]})]})]},e.id||e.type)}))})]}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[p.jsxs("div",{className:"flex items-center justify-between rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] px-4 py-3",children:[p.jsx("span",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:t("setup.application_form.form_visible_label")}),p.jsx(M,{id:"application-form-visible",name:"application-form-visible",checked:r.formVisible,onChange:e=>n((t=>c(d({},t),{formVisible:e}))),disabled:!s})]}),p.jsx("div",{className:"flex items-center justify-between rounded-[var(--radius-lg)] border border-dashed border-[var(--color-border)] bg-[var(--color-bg)]/60 px-4 py-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t("setup.application_form.menu_visible_moved")})]})]})]})},kl=()=>{const{t:e}=T("projects"),{currentUser:t}=K(),a=U((e=>e.tenantId)),{id:s}=g(),[r,n]=h.useState([]),[i,l]=h.useState(!1),[o,d]=h.useState(""),[c,u]=h.useState(!1),[x,b]=h.useState(!1);h.useEffect((()=>{m(null,null,(function*(){const s=(null==t?void 0:t.isSuperAdmin)?null:a||(null==t?void 0:t.tenantId)||null;if(t)if(t.isSuperAdmin||s){l(!0);try{const e=yield Y(s);n(e)}catch(r){A.error(e("setup.duplicate.load_error"))}finally{l(!1)}}else A.error(e("setup.duplicate.tenant_missing"))}))}),[t,a,e]);const v=h.useMemo((()=>r.filter((e=>e.id!==s))),[r,s]);h.useEffect((()=>{v.length?d((e=>e&&v.some((t=>t.id===e))?e:v[0].id)):d("")}),[v]);const f=h.useMemo((()=>v.find((e=>e.id===o))||null),[v,o]),j=v.map((e=>({value:e.id,label:e.name})));return p.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("h3",{className:"[font-size:var(--text-base)] font-semibold text-[var(--color-text)]",children:e("setup.duplicate.header")}),p.jsx("p",{className:"mt-1 mb-4 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.duplicate.desc")}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx(Gt,{label:e("setup.duplicate.source_label"),placeholder:e("setup.duplicate.source_placeholder"),value:o||null,onChange:e=>d(e),options:j,disabled:x||i||0===v.length}),!i&&0===v.length&&p.jsx("p",{className:"mt-1 [font-size:var(--text-xs)] text-[var(--color-warning)]",children:e("setup.duplicate.no_other_projects")})]}),p.jsx(H,{checked:c,onChange:e=>u(e.target.checked),disabled:x,label:e("setup.duplicate.confirm_label")}),p.jsx("div",{className:"flex justify-end",children:p.jsx(V,{onClick:()=>m(null,null,(function*(){if(s)if(o.trim())if(o.trim()!==s.trim())if(c){b(!0);try{const t=yield function(e){return m(this,null,(function*(){const{sourceProjectId:t,targetProjectId:a}=e;if(!t.trim())throw new Error("sourceProjectId is verplicht.");if(!a.trim())throw new Error("targetProjectId is verplicht.");if(t.trim()===a.trim())throw new Error("Bron- en doelproject moeten verschillend zijn.");const s=ft(W,"projects",t),r=yield jt(s);if(!r.exists())throw new Error(`Bronproject ${t} bestaat niet.`);const n=r.data(),i={name:n.name||"",slug:n.slug||"",description:n.description||"",contactPerson:n.contactPerson||"",location:n.location||"",locationAddressStreet:n.locationAddressStreet||"",locationAddressPostalCode:n.locationAddressPostalCode||"",locationAddressCity:n.locationAddressCity||"",locationAddressCountry:n.locationAddressCountry||"",logoUrl:n.logoUrl||"",imageUrl:n.imageUrl||"",updatedAt:new Date},l=ft(W,"projects",a);yield St(l,i);const o=ft(W,"public_projects",a),d={name:i.name,slug:i.slug,description:i.description,contactPerson:i.contactPerson,location:i.location,logoUrl:i.logoUrl||null,imageUrl:i.imageUrl||null,projectId:a,updatedAt:new Date};return yield St(o,d).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;yield yt(o,d)})))),{sourceProjectId:t,targetProjectId:a,copiedFieldsCount:Object.keys(i).length}}))}({sourceProjectId:o.trim(),targetProjectId:s.trim()});A.success(e("setup.duplicate.success",{count:t.copiedFieldsCount,source:(null==f?void 0:f.name)||t.sourceProjectId})),u(!1)}catch(t){A.error(t instanceof Error?t.message:e("setup.duplicate.error"))}finally{b(!1)}}else A.error(e("setup.duplicate.must_confirm"));else A.error(e("setup.duplicate.same_project"));else A.error(e("setup.duplicate.select_source"));else A.error(e("setup.duplicate.no_target"))})),disabled:x||i||!o||!s||!c,loading:x,children:e("setup.duplicate.submit")})})]})]})},Cl=/^(\d{4})-(\d{2})-(\d{2})$/;function Sl(e){const t=Cl.exec(e.trim());return t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):null}function zl(e){const t=e=>String(e).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Il(e,t){var a;const s=Sl(e);if(!s)return[];const r=null!=(a=Sl(t))?a:s;if(r.getTime()<s.getTime())return[e.trim()];const n=[],i=new Date(s);for(;i.getTime()<=r.getTime()&&n.length<31;)n.push(zl(i)),i.setDate(i.getDate()+1);return n}
2const Pl=[{id:"identity",icon:Ee,tone:"info"},{id:"location",icon:Z,tone:"success"},{id:"branding",icon:it,tone:"accent"},{id:"advanced",icon:Q,tone:"neutral"}],Dl={info:{color:"var(--color-info)",soft:"var(--color-info-soft)"},success:{color:"var(--color-success)",soft:"var(--color-success-soft)"},accent:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},neutral:{color:"var(--color-text-muted)",soft:"var(--color-bg)"}},Bl=e=>{if(!e)return"";let t=null;if("object"==typeof e&&"toDate"in e&&"function"==typeof e.toDate)t=e.toDate();else if(e instanceof Date)t=e;else if("string"==typeof e){const a=/^(\d{4}-\d{2}-\d{2})/.exec(e.trim());if(a)return a[1];const s=new Date(e);t=Number.isNaN(s.getTime())?null:s}else if("number"==typeof e){const a=new Date(e);t=Number.isNaN(a.getTime())?null:a}if(!t||Number.isNaN(t.getTime()))return"";return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},Tl=()=>{const{t:e,i18n:t}=T("projects"),{id:a}=g(),[s,r]=h.useState({title:"",slug:"",logo:null,logoFile:null,image:null,imageFile:null,description:"",contactPerson:"",eventStartDate:"",eventEndDate:"",openingHours:{},location:"",locationAddressStreet:"",locationAddressPostalCode:"",locationAddressCity:"",locationAddressCountry:""}),[n,i]=h.useState(!1),[l,o]=h.useState("identity"),u=h.useRef({identity:null,location:null,branding:null,advanced:null});h.useEffect((()=>{if(!a)return;m(null,null,(function*(){try{const e=ft(W,`projects/${a}`),t=yield jt(e);if(t.exists()){const e=t.data(),a={title:e.name||"",slug:e.slug||lt(e.name||""),description:e.description||"",logo:e.logoUrl||null,image:e.imageUrl||null,contactPerson:e.contactPerson||"",eventStartDate:"string"==typeof e.eventStartDate&&e.eventStartDate.trim()||Bl(e.startDate),eventEndDate:"string"==typeof e.eventEndDate&&e.eventEndDate.trim()||Bl(e.endDate),openingHours:Object.fromEntries((Array.isArray(e.openingHours)?e.openingHours:[]).filter((e=>e&&"string"==typeof e.date)).map((e=>[e.date,{open:String(e.open||""),close:String(e.close||"")}]))),location:e.location||"",locationAddressStreet:e.locationAddressStreet||"",locationAddressPostalCode:e.locationAddressPostalCode||"",locationAddressCity:e.locationAddressCity||"",locationAddressCountry:e.locationAddressCountry||"",logoFile:null,imageFile:null};r((e=>d(d({},e),a)))}}catch(t){A.error(e("setup.error_fetch"))}}))}),[a,e]),h.useEffect((()=>{const e=new IntersectionObserver((e=>{const t=e.filter((e=>e.isIntersecting)).sort(((e,t)=>t.intersectionRatio-e.intersectionRatio));if(t[0]){const e=t[0].target.getAttribute("data-section");e&&o(e)}}),{rootMargin:"-20% 0px -60% 0px",threshold:[0,.25,.5,.75,1]});return Pl.forEach((({id:t})=>{const a=u.current[t];a&&e.observe(a)})),()=>e.disconnect()}),[]);const x=(e,t)=>m(null,null,(function*(){const a=It(Me,t);return yield Pt(a,e),Dt(a)})),b=h.useContext(Gs),f=h.useMemo((()=>Il(s.eventStartDate,s.eventEndDate)),[s.eventStartDate,s.eventEndDate]),j=h.useMemo((()=>new Intl.DateTimeFormat(t.language||"nl",{weekday:"long",day:"numeric",month:"long"})),[t.language]),y=h.useMemo((()=>{const e=e=>"string"==typeof e?e.trim().length>0:Boolean(e),t=[s.title,s.slug,s.description,s.contactPerson,s.eventStartDate,s.eventEndDate],a=[s.location,s.locationAddressStreet,s.locationAddressPostalCode,s.locationAddressCity,s.locationAddressCountry],r=[s.logo||s.logoFile,s.image||s.imageFile];return{identity:{filled:t.filter(e).length,total:t.length},location:{filled:a.filter(e).length,total:a.length},branding:{filled:r.filter(e).length,total:r.length},advanced:{filled:0,total:0}}}),[s]),N=h.useMemo((()=>["identity","location","branding"].reduce(((e,t)=>(e.filled+=y[t].filled,e.total+=y[t].total,e)),{filled:0,total:0})),[y]),_=N.filled>0,w=s.title.trim()||e("setup.details_v2.preview.no_title"),k=[s.location.trim(),[s.locationAddressCity.trim(),s.locationAddressCountry.trim()].filter(Boolean).join(", ")].filter(Boolean),C=k.length>0?k.join(" ⢠"):e("setup.details_v2.preview.no_location"),S=`boothly.web.app/${s.slug.trim()||e("setup.slug_placeholder")}/floorplan`;return p.jsxs(p.Fragment,{children:[b&&v.createPortal(p.jsxs("div",{className:"flex items-center gap-3",children:[_&&p.jsxs("span",{className:"hidden items-center gap-1.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)] sm:flex tabular-nums",children:[p.jsx("span",{"aria-hidden":!0,
2className:"h-1.5 w-1.5 rounded-full bg-[var(--color-warning)]"}),e("setup.details_v2.unsaved_indicator")]}),p.jsx(V,{type:"button",variant:"primary",size:"sm",onClick:()=>m(null,null,(function*(){if(a){i(!0);try{const t=ft(W,`projects/${a}`),r=ft(W,`public_projects/${a}`),n=s.eventStartDate.trim(),i=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n),l=i?n:null,o=i?new Date(Number(i[1]),Number(i[2])-1,Number(i[3])):null,u=s.eventEndDate.trim();let p=Sl(u);p&&o&&p.getTime()<o.getTime()&&(p=null);const h=p?u:l;!p&&o&&(p=o);const g=Il(null!=l?l:"",null!=h?h:"").map((e=>{var t,a,r,n,i,l;return{date:e,open:null!=(r=null==(a=null==(t=s.openingHours[e])?void 0:t.open)?void 0:a.trim())?r:"",close:null!=(l=null==(i=null==(n=s.openingHours[e])?void 0:n.close)?void 0:i.trim())?l:""}})).filter((e=>/^\d{2}:\d{2}$/.test(e.open)&&/^\d{2}:\d{2}$/.test(e.close))),b={name:s.title,slug:s.slug,description:s.description,contactPerson:s.contactPerson,location:s.location,locationAddressStreet:s.locationAddressStreet,locationAddressPostalCode:s.locationAddressPostalCode,locationAddressCity:s.locationAddressCity,locationAddressCountry:s.locationAddressCountry,updatedAt:new Date};if(l&&o&&(b.eventStartDate=l,b.startDate=o,b.eventEndDate=h,b.endDate=p,b.openingHours=g),s.logoFile){const e=`projects/${a}/logo_${Date.now()}`;b.logoUrl=yield x(s.logoFile,e)}if(s.imageFile){const e=`projects/${a}/image_${Date.now()}`;b.imageUrl=yield x(s.imageFile,e)}yield St(t,b);const v=d(d(c(d(d({name:s.title,slug:s.slug,description:s.description,contactPerson:s.contactPerson,eventStartDate:l},o?{startDate:o}:{}),o?{eventEndDate:h,endDate:null!=p?p:o,openingHours:g}:{}),{location:s.location,locationAddressStreet:s.locationAddressStreet,locationAddressPostalCode:s.locationAddressPostalCode,locationAddressCity:s.locationAddressCity,locationAddressCountry:s.locationAddressCountry,projectId:a,updatedAt:new Date}),b.logoUrl?{logoUrl:b.logoUrl}:{}),b.imageUrl?{imageUrl:b.imageUrl}:{});yield St(r,v).catch((e=>m(null,null,(function*(){if("not-found"!==e.code)throw e;(yield jt(t)).exists()&&(yield yt(r,v))})))),A.success(e("setup.success_save"))}catch(t){A.error(e("setup.error_save"))}finally{i(!1)}}else A.error(e("setup.project_not_found"))})),loading:n,disabled:n,children:e("setup.save_button")})]}),b),p.jsxs("div",{className:"space-y-6",children:[p.jsx(Al,{title:w,titleIsPlaceholder:!s.title.trim(),location:C,locationIsPlaceholder:0===k.length,url:S,logo:s.logo,image:s.image,completion:N,completionLabel:e("setup.details_v2.preview.completion_label",{filled:N.filled,total:N.total}),subtitleLabel:e("setup.details_v2.preview.subtitle"),previewLabel:e("setup.details_v2.preview.label")}),p.jsx(Vl,{sections:Pl,activeSection:l,onJump:e=>{const t=u.current[e];t&&t.scrollIntoView({behavior:"smooth",block:"start"})},getLabel:t=>e(`setup.details_v2.sections.${t}.title`),getCompletion:e=>y[e]}),p.jsxs(Ml,{id:"identity",icon:Ee,tone:"info",title:e("setup.details_v2.sections.identity.title"),subtitle:e("setup.details_v2.sections.identity.subtitle"),completion:y.identity,completionLabel:e("setup.details_v2.section_completion",{filled:y.identity.filled,total:y.identity.total}),sectionRef:e=>u.current.identity=e,children:[p.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-5",children:[p.jsx("div",{className:"lg:col-span-3",children:p.jsx(F,{label:e("setup.title_label"),description:e("setup.title_desc"),value:s.title,onChange:e=>{const t=e.target.value;r((e=>c(d({},e),{title:t,slug:e.slug===lt(e.title)||""===e.slug?lt(t):e.slug})))},placeholder:e("setup.title_placeholder"),required:!0,isValid:s.title.trim().length>0})}),p.jsx("div",{className:"lg:col-span-2",children:p.jsx(F,{label:e("setup.slug_label"),description:e("setup.details_v2.slug_helper"),value:s.slug,onChange:e=>{const t=e.target.value.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"");r((e=>c(d({},e),{slug:t})))},placeholder:e("setup.slug_placeholder"),inputMode:"url",isValid:s.slug.trim().length>0})})]}),s.slug&&p.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] bg-[var(--color-bg)] px-3 py-2.5",children:[p.jsx("span",{"aria-hidden":!0,
2className:"flex h-7 w-7 items-center justify-center rounded-[var(--radius-sm)] bg-[var(--color-info-soft)] text-[var(--color-info)]",children:p.jsx(ot,{size:14,strokeWidth:2.25})}),p.jsx("span",{className:"[font-size:var(--text-xs)] font-medium uppercase tracking-wide text-[var(--color-text-muted)]",children:e("setup.details_v2.preview.url_label")}),p.jsxs("span",{className:"font-mono [font-size:var(--text-sm)] text-[var(--color-text)]",children:[p.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"https://"}),"boothly.web.app/",p.jsx("span",{className:"font-semibold text-[var(--color-info)]",children:s.slug}),p.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"/floorplan"})]})]}),p.jsx(de,{label:e("setup.desc_label"),description:e("setup.desc_desc"),value:s.description,onChange:e=>r((t=>c(d({},t),{description:e.target.value}))),placeholder:e("setup.desc_placeholder"),rows:4}),p.jsx(F,{label:e("setup.contact_label"),description:e("setup.contact_desc"),value:s.contactPerson,onChange:e=>r((t=>c(d({},t),{contactPerson:e.target.value}))),placeholder:e("setup.contact_placeholder")}),p.jsx(F,{type:"date",label:e("setup.event_start_date_label"),description:e("setup.event_start_date_desc"),value:s.eventStartDate,onChange:e=>r((t=>c(d({},t),{eventStartDate:e.target.value}))),isValid:s.eventStartDate.trim().length>0}),p.jsx(F,{type:"date",label:e("setup.event_end_date_label"),description:e("setup.event_end_date_desc"),value:s.eventEndDate,min:s.eventStartDate||void 0,onChange:e=>r((t=>c(d({},t),{eventEndDate:e.target.value}))),isValid:s.eventEndDate.trim().length>0}),p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[p.jsx($t,{size:14,strokeWidth:2.25,className:"text-[var(--color-text-muted)]"}),p.jsx("p",{className:"[font-size:var(--text-xs)] font-medium uppercase tracking-wide text-[var(--color-text-muted)]",children:e("setup.opening_hours_title")})]}),p.jsx("p",{className:"mb-3 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:e("setup.opening_hours_desc")}),0===f.length?p.jsx("p",{className:"[font-size:var(--text-sm)] text-[var(--color-text-subtle)]",children:e("setup.opening_hours_empty")}):p.jsx("div",{className:"space-y-3",children:f.map((t=>{var a,n;const i=null!=(a=s.openingHours[t])?a:{open:"",close:""},l=e=>r((a=>{var s;return c(d({},a),{openingHours:c(d({},a.openingHours),{[t]:d(d({},null!=(s=a.openingHours[t])?s:{open:"",close:""}),e)})})}));return p.jsxs("div",{className:"grid grid-cols-1 items-end gap-3 sm:grid-cols-[minmax(0,1fr)_140px_140px]",children:[p.jsx("div",{className:"[font-size:var(--text-sm)] font-medium text-[var(--color-text)]",children:j.format(null!=(n=Sl(t))?n:new Date)}),p.jsx(F,{type:"time",label:e("setup.opening_hours_open"),value:i.open,onChange:e=>l({open:e.target.value})}),p.jsx(F,{type:"time",label:e("setup.opening_hours_close"),value:i.close,onChange:e=>l({close:e.target.value})})]},t)}))})]})]}),p.jsxs(Ml,{id:"location",icon:Z,tone:"success",title:e("setup.details_v2.sections.location.title"),subtitle:e("setup.details_v2.sections.location.subtitle"),completion:y.location,completionLabel:e("setup.details_v2.section_completion",{filled:y.location.filled,total:y.location.total}),sectionRef:e=>u.current.location=e,children:[p.jsx(F,{label:e("setup.location_label"),description:e("setup.location_desc"),value:s.location,onChange:e=>r((t=>c(d({},t),{location:e.target.value}))),placeholder:e("setup.location_placeholder"),leadingIcon:p.jsx(_a,{size:18,strokeWidth:2})}),p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsx("p",{className:"mb-3 [font-size:var(--text-xs)] font-medium uppercase tracking-wide text-[var(--color-text-muted)]",children:e("setup.details_v2.address_card_title")}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(F,{label:e("setup.details.address_street_label"),value:s.locationAddressStreet,onChange:e=>r((t=>c(d({},t),{locationAddressStreet:e.target.value}))),placeholder:e("setup.details.address_street_placeholder")}),p.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[p.jsx(F,{label:e("setup.details.address_postal_label"),value:s.locationAddressPostalCode,onChange:e=>r((t=>c(d({},t),{locationAddressPostalCode:e.target.value}))),placeholder:e("setup.details.address_postal_placeholder")}),p.jsx(F,{label:e("setup.details.address_city_label"),value:s.locationAddressCity,onChange:e=>r((t=>c(d({},t),{locationAddressCity:e.target.value}))),placeholder:e("setup.details.address_city_placeholder"),containerClassName:"sm:col-span-2"})]}),p.jsx(F,{label:e("setup.details.address_country_label"),value:s.locationAddressCountry,onChange:e=>r((t=>c(d({},t),{locationAddressCountry:e.target.value}))),placeholder:e("setup.details.address_country_placeholder"),leadingIcon:p.jsx(Lt,{size:18,strokeWidth:2})})]})]})]}),p.jsx(Ml,{id:"branding",icon:it,tone:"accent",title:e("setup.details_v2.sections.branding.title"),subtitle:e("setup.details_v2.sections.branding.subtitle"),completion:y.branding,completionLabel:e("setup.details_v2.section_completion",{filled:y.branding.filled,total:y.branding.total}),sectionRef:e=>u.current.branding=e,children:p.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[p.jsxs(Ll,{label:e("setup.logo_label"),description:e("setup.logo_desc"),hint:e("setup.details_v2.upload.logo_hint"),hasValue:Boolean(s.logo),children:[p.jsx(pa,{onChange:e=>{if(e.converted){const t=new FileReader;t.onload=t=>{r((a=>{var s;return c(d({},a),{logo:null==(s=t.target)?void 0:s.result,logoFile:e.converted})}))}
2,t.readAsDataURL(e.converted)}else r((e=>c(d({},e),{logo:null,logoFile:null})))},name:"logo",ratio:"1:1",width:300,height:300,validation:{minWidth:100,minHeight:100,maxSizeMB:5,allowedTypes:["image/jpeg","image/png","image/webp"]}}),"string"==typeof s.logo&&!s.logoFile&&p.jsx($l,{src:s.logo,alt:e("setup.logo_preview_alt"),label:e("setup.details_v2.upload.current_logo"),size:"sm"})]}),p.jsxs(Ll,{label:e("setup.image_label"),description:e("setup.image_desc"),hint:e("setup.details_v2.upload.image_hint"),hasValue:Boolean(s.image),children:[p.jsx(pa,{onChange:e=>{if(e.converted){const t=new FileReader;t.onload=t=>{r((a=>{var s;return c(d({},a),{image:null==(s=t.target)?void 0:s.result,imageFile:e.converted})}))},t.readAsDataURL(e.converted)}else r((e=>c(d({},e),{image:null,imageFile:null})))},name:"eventImage",ratio:"4:3",width:800,height:600,validation:{minWidth:400,minHeight:300,maxSizeMB:8,allowedTypes:["image/jpeg","image/png","image/webp"]}}),"string"==typeof s.image&&!s.imageFile&&p.jsx($l,{src:s.image,alt:e("setup.image_preview_alt"),label:e("setup.details_v2.upload.current_image"),size:"md"})]})]})}),p.jsx(Ml,{id:"advanced",icon:Q,tone:"neutral",title:e("setup.details_v2.sections.advanced.title"),subtitle:e("setup.details_v2.sections.advanced.subtitle"),completion:y.advanced,completionLabel:"",sectionRef:e=>u.current.advanced=e,children:p.jsx(kl,{})})]})]})};function Al({title:e,titleIsPlaceholder:t,location:a,locationIsPlaceholder:s,url:r,logo:n,image:i,completion:l,completionLabel:o,subtitleLabel:d,previewLabel:c}){const u=0===l.total?0:l.filled/l.total,m=Math.round(100*u);return p.jsxs("section",{className:"relative overflow-hidden rounded-[var(--radius-lg)] border border-[var(--color-border)] shadow-[var(--shadow-sm)]",style:{background:"linear-gradient(135deg, var(--color-accent-soft) 0%, var(--color-info-soft) 100%)"},children:[i&&p.jsx("div",{"aria-hidden":!0,className:"absolute inset-0 opacity-15",style:{backgroundImage:`url(${i})`,backgroundSize:"cover",backgroundPosition:"center",filter:"saturate(1.1)"}}),p.jsx("div",{"aria-hidden":!0,className:"absolute inset-0",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 60%, transparent) 0%, color-mix(in srgb, var(--color-surface) 85%, transparent) 100%)"}}),p.jsxs("div",{className:"relative grid grid-cols-1 items-center gap-6 p-6 sm:p-8 md:grid-cols-[auto_1fr_auto]",children:[p.jsx("div",{className:"flex h-24 w-24 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] shadow-[var(--shadow-sm)] sm:h-28 sm:w-28","aria-hidden":!n,children:n?p.jsx("img",{src:n,alt:"",className:"h-full w-full object-contain p-2"}):p.jsx(Qe,{size:28,strokeWidth:1.5,className:"text-[var(--color-text-subtle)]"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"mb-1.5 flex items-center gap-2 [font-size:var(--text-xs)] font-medium uppercase tracking-wider text-[var(--color-text-muted)]",children:[p.jsx(ae,{size:12,strokeWidth:2.5}),c]}),p.jsx("h2",{className:"truncate [font-size:var(--text-2xl)] font-bold "+(t?"text-[var(--color-text-subtle)]":"text-[var(--color-text)]"),children:e}),p.jsxs("p",{className:"mt-1 flex items-center gap-1.5 truncate [font-size:var(--text-sm)] "+(s?"text-[var(--color-text-subtle)]":"text-[var(--color-text-muted)]"),children:[p.jsx(Z,{size:14,strokeWidth:2}),p.jsx("span",{className:"truncate",children:a})]}),p.jsxs("p",{className:"mt-2 flex items-center gap-1.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:[p.jsx(Lt,{size:12,strokeWidth:2}),p.jsxs("span",{className:"truncate font-mono",children:[p.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"https://"}),r]})]}),p.jsx("p",{className:"mt-3 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:d})]}),p.jsx("div",{className:"flex shrink-0 items-center justify-center md:justify-end",children:p.jsx(El,{ratio:u,label:o,percent:m})})]})]})}function El({ratio:e,label:t,percent:a}){const s=92,r=2*Math.PI*42,n=r*(1-e);return p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("div",{className:"relative",style:{width:s,height:s},children:[p.jsxs("svg",{width:s,height:s,className:"-rotate-90",children:[p.jsx("circle",{cx:46,cy:46,r:42,fill:"none",strokeWidth:8,stroke:"var(--color-border)"}),p.jsx("circle",{cx:46,cy:46,r:42,fill:"none",strokeWidth:8,stroke:"var(--color-accent)",strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:n,style:{transition:"stroke-dashoffset var(--duration-base) var(--ease-out)"}})]}),p.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:p.jsxs("span",{className:"[font-size:var(--text-lg)] font-bold text-[var(--color-text)] tabular-nums",children:[a,"%"]})})]}),p.jsxs("div",{className:"hidden flex-col text-left md:flex",children:[p.jsx("span",{className:"[font-size:var(--text-xs)] font-semibold uppercase tracking-wider text-[var(--color-text-muted)]",children:t.split("â¢")[0]}),p.jsx("span",{className:"[font-size:var(--text-xs)] text-[var(--color-text-subtle)] tabular-nums",children:t.includes("â¢")?t.split("â¢")[1].trim():""})]})]})}function Vl({sections:e,activeSection:t,onJump:a,getLabel:s,getCompletion:r}){return p.jsx("nav",{"aria-label":"Setup-secties",className:"sticky top-2 z-10 -mx-1 flex gap-2 overflow-x-auto rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)]/95 p-1.5 shadow-[var(--shadow-xs)] backdrop-blur scrollbar-thin",children:e.map((({id:e,icon:n,tone:i})=>{const l=t===e,o=r(e),d=o.total>0&&o.filled===o.total,c=o.total>0,u=Dl[i];return p.jsxs("button",{type:"button",onClick:()=>a(e),"aria-current":l?"true":void 0,className:["group flex shrink-0 items-center gap-2 rounded-[var(--radius-md)] px-3 py-2 transition-colors duration-[var(--duration-fast)]",l?"bg-[var(--color-text)] text-[var(--color-surface)]":"bg-transparent text-[var(--color-text)] hover:bg-[var(--color-bg)]"].join(" "),children:[p.jsx("span",{"aria-hidden":!0,
2className:"flex h-6 w-6 items-center justify-center rounded-[var(--radius-sm)]",style:{background:l?"color-mix(in srgb, var(--color-surface) 18%, transparent)":u.soft,color:l?"var(--color-surface)":u.color},children:p.jsx(n,{size:14,strokeWidth:2.25})}),p.jsx("span",{className:"[font-size:var(--text-sm)] font-medium whitespace-nowrap",children:s(e)}),c&&(d?p.jsx(se,{size:14,strokeWidth:2.25,className:l?"text-[var(--color-surface)]":"text-[var(--color-success)]"}):p.jsxs("span",{className:"tabular-nums [font-size:var(--text-xs)] font-medium "+(l?"text-[var(--color-surface)]/80":"text-[var(--color-text-muted)]"),children:[o.filled,"/",o.total]}))]},e)}))})}function Ml({id:e,icon:t,tone:a,title:s,subtitle:r,completion:n,completionLabel:i,children:l,sectionRef:o}){const d=Dl[a],c=n.total>0,u=c&&n.filled===n.total;return p.jsxs("section",{ref:o,"data-section":e,id:`section-${e}`,className:"relative overflow-hidden rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface)] shadow-[var(--shadow-xs)]",style:{scrollMarginTop:"5rem"},children:[p.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-1",style:{background:d.color}}),p.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-[var(--color-border)] px-6 py-5 pl-7",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("span",{"aria-hidden":!0,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[var(--radius-md)]",style:{background:d.soft,color:d.color},children:p.jsx(t,{size:20,strokeWidth:2})}),p.jsxs("div",{children:[p.jsx("h3",{className:"[font-size:var(--text-lg)] font-semibold text-[var(--color-text)]",children:s}),p.jsx("p",{className:"mt-0.5 [font-size:var(--text-sm)] text-[var(--color-text-muted)]",children:r})]})]}),c&&p.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 rounded-full border px-2.5 py-1 [font-size:var(--text-xs)] font-medium tabular-nums",style:{background:u?"var(--color-success-soft)":d.soft,color:u?"var(--color-success)":d.color,borderColor:"transparent"},children:[u?p.jsx(se,{size:12,strokeWidth:2.5}):p.jsx(Ft,{size:12,strokeWidth:2.5}),p.jsx("span",{children:i})]})]}),p.jsx("div",{className:"space-y-5 px-6 py-6 pl-7",children:l})]})}function Ll({label:e,description:t,hint:a,hasValue:s,children:r}){return p.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg)] p-4",children:[p.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[p.jsxs("div",{children:[p.jsx("p",{className:"[font-size:var(--text-sm)] font-semibold text-[var(--color-text)]",children:e}),p.jsx("p",{className:"mt-0.5 [font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:t})]}),s&&p.jsx(se,{size:18,strokeWidth:2.25,className:"shrink-0 text-[var(--color-success)]","aria-hidden":!0})]}),r,p.jsx("p",{className:"mt-3 [font-size:var(--text-xs)] text-[var(--color-text-subtle)]",children:a})]})}function $l({src:e,alt:t,label:a,size:s}){const r="sm"===s?"h-16 w-16":"h-20 w-28";return p.jsxs("div",{className:"mt-3 flex items-center gap-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-2",children:[p.jsx("div",{className:`${r} flex shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)] bg-[var(--color-bg)]`,children:p.jsx("img",{src:e,alt:t,className:"max-h-full max-w-full object-contain"})}),p.jsx("p",{className:"[font-size:var(--text-xs)] text-[var(--color-text-muted)]",children:a})]})}const Ol=[{value:"300x250",labelKey:"dimensions.300x250",ratio:"4:3"},{value:"2400x300",labelKey:"dimensions.2400x300",ratio:"8:1"},{value:"728x90",labelKey:"dimensions.728x90",ratio:"8:1"},{value:"160x600",labelKey:"dimensions.160x600",ratio:"4:15"},{value:"320x100",labelKey:"dimensions.320x100",ratio:"16:5"},{value:"300x600",labelKey:"dimensions.300x600",ratio:"1:2"},{value:"970x250",labelKey:"dimensions.970x250",ratio:"97:25"},{value:"600x200",labelKey:"dimensions.600x200",ratio:"3:1"},{value:"600x600",labelKey:"dimensions.600x600",ratio:"1:1"}],Fl=[{value:"all",labelKey:"audience.all",icon:$e},{value:"guest",labelKey:"audience.guest",icon:dt},{value:"exhibitor",labelKey:"audience.exhibitor",icon:Et},{value:"presenter",labelKey:"audience.presenter",icon:ta},{value:"supplier",labelKey:"audience.supplier",icon:He},{value:"viewer",labelKey:"audience.viewer",icon:ta},{value:"project_manager",labelKey:"audience.project_manager",icon:Sa},{value:"admin",labelKey:"audience.admin",icon:Za}],Ul=[{id:"news-banner",labelKey:"placementGroups.news-banner",hintKey:"placementGroups.news-bannerHint"},{id:"news-leaderboard",labelKey:"placementGroups.news-leaderboard",hintKey:"placementGroups.news-leaderboardHint"},{id:"sidebar",labelKey:"placementGroups.sidebar",hintKey:"placementGroups.sidebarHint"},{id:"news",labelKey:"placementGroups.news"},{id:"overig",labelKey:"placementGroups.overig"}],Kl=[{value:"news-banner-top",labelKey:"placement.news-banner-top",group:"news-banner",recommendedDimension:"2400x300"},{value:"news-banner-inline",labelKey:"placement.news-banner-inline",group:"news-banner",recommendedDimension:"2400x300"},{value:"news-title-leaderboard",labelKey:"placement.news-title-leaderboard",group:"news-leaderboard",recommendedDimension:"728x90"},{value:"sidebar-block-1",labelKey:"placement.sidebar-block-1",group:"sidebar",recommendedDimension:"300x250"},{value:"sidebar-block-2",labelKey:"placement.sidebar-block-2",group:"sidebar",recommendedDimension:"300x250"},{value:"news-detail",labelKey:"placement.news-detail",group:"news"},{value:"news-list",labelKey:"placement.news-list",group:"news"},{value:"home",labelKey:"placement.home",group:"overig"},{value:"footer",labelKey:"placement.footer",group:"overig"},{value:"header",labelKey:"placement.header",group:"overig"}];function Wl(e){return m(this,null,(function*(){const t=yield jt(ft(W,`public_projects/${e}`));if(!t.exists())return[];const a=t.data().ads||[],s=yield jt(ft(W,`projects/${e}/analytics/ads_alltime`)),r=s.exists()?s.data():{},n=r.impressionsById||{},i=r.clicksById||{};return a.map((e=>{var t,a,s,r;const l=e.id.replace(/[./]/g,"_");return c(d({},e),{impressions:null!=(t=n[l])?t:0,clicks:null!=(a=i[l])?a:0,createdAt:(null==(s=e.createdAt)?void 0:s.toDate)?e.createdAt.toDate():new Date,updatedAt:(null==(r=e.updatedAt)?void 0:r.toDate)?e.updatedAt.toDate():new Date})}))}))}function Hl(e){return m(this,null,(function*(){const t=ye.currentUser;if(!t)throw new Error("Niet ingelogd");const a=yield t.getIdToken(),s=yield fetch(Oe("saveAdvertisements"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(e)});if(!s.ok){const e=yield s.text().catch((()=>""));throw new Error(e||`saveAdvertisements faalde (HTTP ${s.status})`)}}))}const Rl=["2400x300","728x90","970x250","320x100"],ql=({formData:e,setFormData:t,previewImage:a,setPreviewImage:s,uploadingImage:r,handleImageUpload:n,handleDimensionChange:i,toggleAudience:l,togglePlacement:o,editingId:u,saving:m,resetForm:x,handleSaveAdvertisement:h})=>{var g;const{t:b}=T("advertisement"),v=e.placement||[],f=Kl.some((e=>"news-banner"===e.group&&v.includes(e.value))),j=Rl.includes(e.dimensions||""),y=f&&!j,N=Xa(e.aspectRatio)||Xa("4:3");return p.jsxs("div",{className:"p-6 border-b border-gray-200 bg-gray-50",children:[p.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-6",children:b(u?"form.editTitle":"form.addTitle")}),p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[b("form.name")," ",p.jsx("span",{className:"text-red-500",children:"*"})]}),p.jsx("input",{type:"text",value:e.name||"",onChange:e=>t((t=>c(d({},t),{name:e.target.value}))),placeholder:b("form.namePlaceholder"),className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:b("form.description")}),p.jsx("textarea",{value:e.description||"",onChange:e=>t((t=>c(d({},t),{description:e.target.value}))),placeholder:b("form.descriptionPlaceholder"),rows:3,className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"})]}),p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[b("form.dimensions")," ",p.jsx("span",{className:"text-red-500",children:"*"})]}),p.jsx("select",{value:e.dimensions||"300x250",onChange:e=>i(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:Ol.map((e=>p.jsx("option",{value:e.value,children:b(e.labelKey)},e.value)))}),p.jsx("p",{className:"mt-2 text-xs text-gray-500",children:b("form.as
2pectRatio",{ratio:e.aspectRatio||"4:3"})}),y&&p.jsx("div",{className:"mt-2 flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 p-3",children:p.jsxs("p",{className:"text-xs text-amber-800",children:[b("form.bannerHint")," ",p.jsx("button",{type:"button",onClick:()=>i("2400x300"),className:"font-semibold underline hover:text-amber-900",children:b("form.bannerHintAction")})]})})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:b("form.linkUrl")}),p.jsx("input",{type:"url",value:e.linkUrl||"",onChange:e=>t((t=>c(d({},t),{linkUrl:e.target.value}))),placeholder:b("form.linkUrlPlaceholder"),className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),p.jsx("p",{className:"mt-2 text-xs text-gray-500",children:b("form.linkUrlHint")})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:b("form.priority")}),p.jsx("input",{type:"number",min:"1",max:"10",value:e.priority||1,onChange:e=>{const a=parseInt(e.target.value,10)||1,s=Math.min(10,Math.max(1,a));t((e=>c(d({},e),{priority:s})))},className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),p.jsx("p",{className:"mt-2 text-xs text-gray-500",children:b("form.priorityHint")})]})]}),p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[b("form.image")," ",p.jsx("span",{className:"text-red-500",children:"*"})]}),a?p.jsxs("div",{className:"relative",children:[p.jsx("img",{src:a,alt:b("form.previewAlt"),className:"w-full rounded-xl border border-gray-300 object-cover",style:{aspectRatio:N}}),p.jsx("button",{onClick:()=>{s(null),t((e=>c(d({},e),{imageUrl:""})))},className:"absolute top-2 right-2 p-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors shadow-lg",type:"button",children:p.jsx(O,{className:"w-4 h-4"})})]}):p.jsxs("label",{className:"block w-full cursor-pointer",children:[p.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-xl p-8 text-center hover:border-blue-500 transition-colors flex flex-col items-center justify-center",style:{aspectRatio:N},children:[p.jsx(ct,{className:"w-12 h-12 text-gray-400 mb-3"}),p.jsx("p",{className:"text-sm font-medium text-gray-700",children:b(r?"form.imageUploading":"form.imageCta")}),p.jsx("p",{className:"text-xs text-gray-500 mt-1",children:b("form.imageFormats")})]}),p.jsx("input",{type:"file",accept:"image/*",onChange:n,className:"hidden",disabled:r})]})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[b("form.startDate")," ",p.jsx("span",{className:"text-red-500",children:"*"})]}),p.jsx("input",{type:"date",value:e.startDate||"",onChange:e=>t((t=>c(d({},t),{startDate:e.target.value}))),className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:b("form.endDate")}),p.jsx("input",{type:"date",value:e.endDate||"",onChange:e=>t((t=>c(d({},t),{endDate:e.target.value}))),className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:[b("form.audience")," ",p.jsx("span",{className:"text-red-500",children:"*"})]}),p.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:Fl.map((t=>{var a;const s=t.icon;return p.jsxs("label",{className:"flex items-center gap-3 p-3 border border-gray-200 rounded-xl hover:bg-gray-50 cursor-pointer transition-colors",children:[p.jsx("input",{type:"checkbox",checked:(null==(a=e.targetAudience)?void 0:a.includes(t.value))||!1,onChange:()=>l(t.value),className:"w-4 h-4 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"}),p.jsx(s,{className:"w-4 h-4 text-gray-500"}),p.jsx("span",{className:"text-sm font-medium text-gray-700",children:b(t.labelKey)})]},t.value)}))})]}),p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:[b("form.placement")," ",p.jsx("span",{className:"text-red-500",children:"*"})]}),p.jsx("div",{className:"space-y-4",children:Ul.map((t=>{const a=Kl.filter((e=>e.group===t.id));return 0===a.length?null:p.jsxs("div",{children:[p.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 mb-1",children:b(t.labelKey)}),t.hintKey&&p.jsx("p",{className:"text-xs text-gray-500 mb-2",children:b(t.hintKey)}),p.jsx("div",{className:"space-y-2",children:a.map((t=>{var a;return p.jsxs("label",{className:"flex items-center gap-3 p-3 border border-gray-200 rounded-xl hover:bg-gray-50 cursor-pointer transition-colors",children:[p.jsx("input",{type:"checkbox",checked:(null==(a=e.placement)?void 0:a.includes(t.value))||!1,onChange:()=>o(t.value),className:"w-4 h-4 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"}),p.jsx("span",{className:"text-sm font-medium text-gray-700",children:b(t.labelKey)})]},t.value)}))})]},t.id)}))})]}),p.jsx("div",{children:p.jsxs("label",{className:"flex items-center gap-3 p-4 border border-gray-200 rounded-xl hover:bg-gray-50 cursor-pointer transition-colors",children:[p.jsx("input",{type:"checkbox",checked:null==(g=e.isActive)||g,onChange:e=>t((t=>c(d({},t),{isActive:e.target.checked}))),className:"w-5 h-5 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"}),p.jsxs("div",{children:[p.jsx("span",{className:"text-sm font-medium text-gray-700 block",children:b("form.activeLabel")}),p.jsx("span",{className:"text-xs text-gray-500",children:b("form.activeHint")})]})]})})]})]}),p.jsxs("div",{className:"flex items-center justify-end gap-3 mt-6 pt-6 border-t border-gray-200",children:[p.jsx("button",{onClick:x,className:"px-6 py-2 border border-gray-300 text-gray-700 rounded-xl hover:bg-gray-50 transition-colors font-medium",disabled:m,type:"button",children:b("form.cancel")}),p.jsxs("button",{onClick:h,disabled:m||r,className:"inline-flex items-center gap-2 px-6 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:[p.jsx(Va,{className:"w-4 h-4"}),b(m?"form.saving":u?"form.update":"form.add")]})]})]})},Gl=({advertisement:e})=>{const{t:t}=T("advertisement"),a=e.impressions>0?(e.clicks/e.impressions*100).toFixed(2):"0.00",s=()=>{const t=new Date(e.startDate),a=e.endDate?new Date(e.endDate):new Date,s=Math.abs(a.getTime()-t.getTime());return Math.ceil(s/864e5)};return p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 p-4 bg-gray-50 rounded-lg",children:[p.jsxs("div",{className:"flex items-start space-x-3",children:[p.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:p.jsx(Xe,{className:"w-5 h-5 text-blue-600"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-gray-600",children:t("analytics.impressions")}),p.jsx("p",{className:"text-2xl font-bold text-gray-900",children:e.impressions.toLocaleStr
2ing()}),p.jsx("p",{className:"text-xs text-gray-500",children:t("analytics.perDay",{value:(()=>{const t=s();return t>0?(e.impressions/t).toFixed(1):"0"})()})})]})]}),p.jsxs("div",{className:"flex items-start space-x-3",children:[p.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:p.jsx(aa,{className:"w-5 h-5 text-green-600"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-gray-600",children:t("analytics.clicks")}),p.jsx("p",{className:"text-2xl font-bold text-gray-900",children:e.clicks.toLocaleString()})]})]}),p.jsxs("div",{className:"flex items-start space-x-3",children:[p.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:p.jsx(ss,{className:"w-5 h-5 text-purple-600"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-gray-600",children:t("analytics.ctr")}),p.jsxs("p",{className:"text-2xl font-bold text-gray-900",children:[a,"%"]}),p.jsx("p",{className:"text-xs text-gray-500",children:t("analytics.ctrSub")})]})]}),p.jsxs("div",{className:"flex items-start space-x-3",children:[p.jsx("div",{className:"p-2 bg-orange-100 rounded-lg",children:p.jsx(ut,{className:"w-5 h-5 text-orange-600"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-gray-600",children:t("analytics.active")}),p.jsx("p",{className:"text-2xl font-bold text-gray-900",children:s()}),p.jsx("p",{className:"text-xs text-gray-500",children:t("analytics.days")})]})]})]})},Jl=({ad:e,onEdit:t,onDelete:a,onToggleActive:s,saving:r})=>{const{t:n}=T("advertisement"),[i,l]=h.useState(!1),o=Qa(e),d=o.icon,c=(e.targetAudience||[]).map((e=>n(`audience.${es(e)}`,{defaultValue:e}))).join(", ");return p.jsxs("div",{className:"border border-gray-200 rounded-xl overflow-hidden hover:shadow-lg transition-shadow",children:[p.jsxs("div",{className:"relative bg-gray-100",style:{aspectRatio:Xa(e.aspectRatio)},children:[p.jsx("img",{src:e.imageUrl,alt:e.name,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute top-2 right-2 flex gap-2",children:p.jsxs("span",{className:"px-3 py-1 rounded-lg text-xs font-semibold flex items-center gap-1 "+("green"===o.color?"bg-green-100 text-green-800":"blue"===o.color?"bg-blue-100 text-blue-800":"red"===o.color?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"),children:[p.jsx(d,{className:"w-3 h-3"}),n(o.labelKey)]})})]}),p.jsxs("div",{className:"p-4",children:[p.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:e.name}),e.description&&p.jsx("p",{className:"text-sm text-gray-600 mb-3 line-clamp-2",children:e.description}),p.jsxs("div",{className:"space-y-2 text-xs text-gray-600 mb-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(rs,{className:"w-4 h-4 flex-shrink-0"}),p.jsxs("span",{children:[e.dimensions," ⢠",e.aspectRatio]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(ut,{className:"w-4 h-4 flex-shrink-0"}),p.jsxs("span",{className:"truncate",children:[e.startDate," ",e.endDate&&`- ${e.endDate}`]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(dt,{className:"w-4 h-4 flex-shrink-0"}),p.jsx("span",{className:"truncate",children:c})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(mt,{className:"w-4 h-4 flex-shrink-0"}),p.jsx("span",{children:n("card.stats",{priority:e.priority,impressions:e.impressions,clicks:e.clicks})})]})]}),p.jsx("div",{className:"flex flex-wrap gap-1 mb-4",children:e.placement.map((e=>p.jsx("span",{className:"px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-lg",children:n(`placement.${e}`,{defaultValue:e})},e)))}),p.jsxs("button",{onClick:()=>l(!i),className:"w-full mb-3 px-3 py-2 bg-purple-50 text-purple-700 rounded-lg hover:bg-purple-100 transition-colors flex items-center justify-center gap-2 text-sm font-medium",children:[p.jsx(mt,{className:"w-4 h-4"}),p.jsx("span",{children:n("card.analytics")}),i?p.jsx(pt,{className:"w-4 h-4"}):p.jsx(ze,{className:"w-4 h-4"})]}),i&&p.jsx("div",{className:"mb-4",children:p.jsx(Gl,{advertisement:e})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>s(e.id),className:"flex-1 px-3 py-2 rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-1 "+(e.isActive?"bg-gray-100 text-gray-700 hover:bg-gray-200":"bg-green-100 text-green-700 hover:bg-green-200"),disabled:r,children:e.isActive?p.jsxs(p.Fragment,{children:[p.jsx(Ua,{className:"w-4 h-4"}),p.jsx("span",{className:"hidden sm:inline",children:n("card.pause")})]}):p.jsxs(p.Fragment,{children:[p.jsx(Xe,{className:"w-4 h-4"}),p.jsx("span",{className:"hidden sm:inline",children:n("card.activate")})]})}),p.jsx("button",{onClick:()=>t(e),className:"px-3 py-2 bg-blue-100 text-blue-700 rounded-lg hover:bg-blue-200 transition-colors",disabled:r,title:n("card.edit"),children:p.jsx(ns,{className:"w-4 h-4"})}),p.jsx("button",{onClick:()=>a(e.id),className:"px-3 py-2 bg-red-100 text-red-700 rounded-lg hover:bg-red-200 transition-colors",disabled:r,title:n("card.delete"),children:p.jsx(O,{className:"w-4 h-4"})})]})]})]})},Yl={name:"",description:"",imageUrl:"",linkUrl:"",dimensions:"300x250",aspectRatio:"4:3",targetAudience:[],startDate:(new Date).toISOString().split("T")[0],endDate:"",isActive:!0,priority:1,placement:["sidebar"],impressions:0,clicks:0}
2,Zl=()=>{const{t:e}=T("advertisement"),[t,a]=h.useState([]),[s,r]=h.useState(!0),[n,i]=h.useState(!1),[l,o]=h.useState(null),[u,x]=h.useState(!1),[g,b]=h.useState(null),[v,f]=h.useState(!1),[j,y]=h.useState(null),N=U((e=>e.tenantId)),_=U((e=>e.projectId)),[w,k]=h.useState(Yl);h.useEffect((()=>{let t=!0;return N&&_?(r(!0),Wl(_).then((e=>{t&&a(e)})).catch((a=>{t&&o({text:e("messages.loadError"),type:"error"})})).finally((()=>{t&&r(!1)})),()=>{t=!1}):(r(!1),()=>{t=!1})}),[N,_,e]),h.useEffect((()=>{if(l){const e=setTimeout((()=>o(null)),5e3);return()=>clearTimeout(e)}}),[l]);const C=()=>m(null,null,(function*(){if(!_)return;const e=yield Wl(_);a(e)})),S=t=>m(null,null,(function*(){if(_&&confirm(e("messages.deleteConfirm")))try{i(!0),yield function(e,t){return Hl({projectId:e,op:"delete",adId:t})}(_,t),yield C(),o({text:e("messages.deleted"),type:"success"})}catch(a){o({text:e("messages.deleteError"),type:"error"})}finally{i(!1)}})),z=t=>m(null,null,(function*(){if(_)try{i(!0),yield function(e,t){return Hl({projectId:e,op:"toggle",adId:t})}(_,t),yield C(),o({text:e("messages.statusUpdated"),type:"success"})}catch(a){o({text:e("messages.statusError"),type:"error"})}finally{i(!1)}})),I=e=>{k({name:e.name,description:e.description,imageUrl:e.imageUrl,linkUrl:e.linkUrl,dimensions:e.dimensions,aspectRatio:e.aspectRatio,targetAudience:e.targetAudience,startDate:e.startDate,endDate:e.endDate,isActive:e.isActive,priority:e.priority,placement:e.placement}),y(e.imageUrl),b(e.id),x(!0)},P=()=>{k(Yl),y(null),b(null),x(!1)};return s?p.jsx("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-200 p-8",children:p.jsxs("div",{className:"flex items-center justify-center",children:[p.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),p.jsx("span",{className:"ml-3 text-gray-600",children:e("page.loading")})]})}):p.jsxs("div",{id:"advertisements-section",className:"bg-white rounded-2xl shadow-sm border border-gray-200",children:[p.jsx("div",{className:"border-b border-gray-200 p-6",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"p-2 bg-blue-100 rounded-xl",children:p.jsx(Qe,{className:"w-6 h-6 text-blue-600"})}),p.jsxs("div",{children:[p.jsx("h2",{className:"text-xl font-bold text-gray-900",children:e("page.title")}),p.jsx("p",{className:"text-sm text-gray-600 mt-1",children:e("page.subtitle")})]})]}),p.jsx("button",{onClick:()=>x(!u),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors font-medium",disabled:n,children:u?p.jsxs(p.Fragment,{children:[p.jsx(Re,{className:"w-4 h-4"}),e("page.cancelButton")]}):p.jsxs(p.Fragment,{children:[p.jsx(Ve,{className:"w-4 h-4"}),e("page.newButton")]})})]})}),l&&p.jsx("div",{className:"mx-6 mt-6 p-4 rounded-xl border "+("success"===l.type?"bg-green-50 border-green-200 text-green-800":"error"===l.type?"bg-red-50 border-red-200 text-red-800":"bg-blue-50 border-blue-200 text-blue-800"),children:p.jsxs("div",{className:"flex items-center gap-2",children:["success"===l.type&&p.jsx(is,{className:"w-5 h-5"}),"error"===l.type&&p.jsx(xt,{className:"w-5 h-5"}),"info"===l.type&&p.jsx(xt,{className:"w-5 h-5"}),p.jsx("span",{className:"font-medium",children:l.text})]})}),u&&p.jsx(ql,{formData:w,setFormData:k,previewImage:j,setPreviewImage:y,uploadingImage:v,handleImageUpload:t=>m(null,null,(function*(){var a;const s=null==(a=t.target.files)?void 0:a[0];if(s&&_)if(s.type.startsWith("image/"))if(s.size>5242880)o({text:e("messages.imageTooLarge"),type:"error"});else try{f(!0);const t=Date.now(),a=`advertisements/${_}/${t}_${s.name}`,r=It(Me,a);yield Pt(r,s);const n=yield Dt(r);k((e=>c(d({},e),{imageUrl:n}))),y(n),o({text:e("messages.imageUploaded"),type:"success"})}catch(r){o({text:e("messages.imageUploadError"),type:"error"})}finally{f(!1)}else o({text:e("messages.imageOnly"),type:"error"})})),handleDimensionChange:e=>{const t=Ol.find((t=>t.value===e));k((a=>c(d({},a),{dimensions:e,aspectRatio:(null==t?void 0:t.ratio)||"4:3"})))},toggleAudience:e=>{k((t=>{const a=t.targetAudience||[],s=a.includes(e)?a.filter((t=>t!==e)):[...a,e];return c(d({},t),{targetAudience:s})}))},togglePlacement:e=>{k((t=>{const a=t.placement||[],s=a.includes(e)?a.filter((t=>t!==e)):[...a,e];return c(d({},t),{placement:s})}))},editingId:g,saving:n,resetForm:P,handleSaveAdvertisement:()=>m(null,null,(function*(){if(!N||!_)return void o({text:e("messages.noProject"),type:"error"});const a=ts(w);if(a)return void o({text:e(a),type:"error"});const s=!!g;try{let a;if(i(!0),s){const e=t.find((e=>e.id===g));a=c(d(d({},e),w),{id:g})}else a=as(w);yield function(e,t){return Hl({projectId:e,op:"upsert",ad:t})}(_,a),yield C(),o({text:e(s?"messages.updated":"messages.created"),type:"success"}),P()}catch(r){o({text:e("messages.saveError"),type:"error"})}finally{i(!1)}}))}),p.jsx("div",{className:"p-6",children:0===t.length?p.jsxs("div",{className:"text-center py-12",children:[p.jsx(Qe,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),p.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:e("page.emptyTitle")}),p.jsx("p",{className:"text-gray-600 mb-6",children:e("page.emptySubtitle")}),p.jsxs("button",{onClick:()=>x(!0),className:"inline-flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors font-medium",children:[p.jsx(Ve,{className:"w-5 h-5"}),e("page.emptyCta")]})]}):p.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:t.map((e=>p.jsx(Jl,{ad:e,onEdit:I,onDelete:S,onToggleActive:z,saving:n},e.id)))})})]})},Xl=({templates:e,projectId:t,onTemplateUpdated:a})=>{const s=f(),{currentUser:r}=K(),[n,i]=h.useState(null),l=e=>{if(!e)return"-";const t=e.toDate?e.toDate():new Date(e);return new Intl.DateTimeFormat("nl-NL",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)};return 0===e.length?null:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Templates (",e.length,")"]}),p.jsx("div",{className:"space-y-3",children:e.map((e=>p.jsx("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-200 p-6 hover:shadow-md transition-shadow",children:p.jsxs("div",{className:"flex items-start gap-4",children:[p.jsx("div",{className:"flex-shrink-0",children:e.imageUrl?p.jsx("img",{src:e.imageUrl,alt:e.name,className:"w-32 h-32 object-contain rounded-xl border border-gray-200 bg-gray-50"}):p.jsx("div",{className:"w-32 h-32 bg-gray-100 rounded-xl flex items-center justify-center",children:p.jsx(Qe,{className:"w-12 h-12 text-gray-400"})})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-start justify-between mb-2",children:p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:e.name}),e.isActive?p.jsx("span",{className:"px-3 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full",children:"Actief"}):p.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-600 text-xs font-medium rounded-full",children:"Inactief"})]}),e.description&&p.jsx("p",{className:"text-sm text-gray-600 mt-1",children:e.description})]})}),p.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-gray-600 mb-4",children:[p.jsxs("span",{children:["Aangemaakt: ",l(e.createdAt)]}),p.jsx("span",{children:"â¢"}),p.jsxs("span",{children:["Versie: v",e.currentVersion]}),p.jsx("span",{children:"â¢"}),p.jsxs("span",{children:["Downloads: ",e.downloadCount||0]}),p.jsx("span",{children:"â¢"}),p.jsxs("span",{children:[e.imageWidth," à ",e.imageHeight," px"]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsxs("button",{onClick:()=>{return a=e.id,void s(`/projects/${t}/setup/personal-banners/${a}/edit`);var a},className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors min-h-[44px]",disabled:n===e.id,children:[p.jsx(ys,{className:"w-4 h-4"}),p.jsx("span",{children:"Bewerken"})]}),p.jsxs("button",{onClick:()=>(e=>m(null,null,(function*(){if(!r)return;
2const s=prompt("Naam voor de gedupliceerde template:",`${e.name} (kopie)`);if(s)try{i(e.id),yield ls(t,e.id,r.uid,s),a()}catch(n){alert("Fout bij dupliceren van template")}finally{i(null)}})))(e),className:"flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-xl hover:bg-gray-200 transition-colors min-h-[44px]",disabled:n===e.id,children:[p.jsx(Ae,{className:"w-4 h-4"}),p.jsx("span",{children:"Dupliceren"})]}),p.jsxs("button",{onClick:()=>{return a=e.id,void s(`/projects/${t}/setup/personal-banners/${a}/history`);var a},className:"flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-xl hover:bg-gray-200 transition-colors min-h-[44px]",disabled:n===e.id,children:[p.jsx(ht,{className:"w-4 h-4"}),p.jsx("span",{children:"Geschiedenis"})]}),p.jsx("button",{onClick:()=>(e=>m(null,null,(function*(){if(r)try{i(e.id),yield os(t,e.id,r.uid,{isActive:!e.isActive,changeDescription:e.isActive?"Template gedeactiveerd":"Template geactiveerd"}),a()}catch(s){alert("Fout bij wijzigen van template status")}finally{i(null)}})))(e),className:"flex items-center gap-2 px-4 py-2 rounded-xl transition-colors min-h-[44px] "+(e.isActive?"bg-red-100 text-red-700 hover:bg-red-200":"bg-green-100 text-green-700 hover:bg-green-200"),disabled:n===e.id,children:e.isActive?p.jsxs(p.Fragment,{children:[p.jsx(Ns,{className:"w-4 h-4"}),p.jsx("span",{children:"Deactiveren"})]}):p.jsxs(p.Fragment,{children:[p.jsx(_s,{className:"w-4 h-4"}),p.jsx("span",{children:"Activeren"})]})})]})]})]})},e.id)))})]})},Ql=({projectId:e,onSuccess:t,onCancel:a})=>{const{currentUser:s}=K(),r=h.useRef(null),[n,i]=h.useState(""),[l,o]=h.useState(""),[d,c]=h.useState(null),[u,x]=h.useState(null),[g,b]=h.useState(!1),[v,f]=h.useState(null),[j,y]=h.useState(null);h.useEffect((()=>{m(null,null,(function*(){try{const t=yield jt(ft(W,`projects/${e}`));t.exists()&&y(t.data().tenantId)}catch(t){}}))}),[e]);return p.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-200 p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6",children:[p.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Nieuwe Banner Template"}),p.jsx("button",{onClick:a,className:"p-2 hover:bg-gray-100 rounded-xl transition-colors",disabled:g,children:p.jsx(Re,{className:"w-5 h-5 text-gray-600"})})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Template Naam *"}),p.jsx("input",{type:"text",value:n,onChange:e=>i(e.target.value),placeholder:"bijv. Duikvaker Aankondiging",className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent",disabled:g})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Beschrijving (optioneel)"}),p.jsx("textarea",{value:l,onChange:e=>o(e.target.value),placeholder:"Korte beschrijving van deze template...",rows:3,className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",disabled:g})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Banner Afbeelding *"}),d?p.jsx("div",{className:"border border-gray-300 rounded-2xl p-4",children:p.jsxs("div",{className:"flex items-start gap-4",children:[u&&p.jsx("div",{className:"flex-shrink-0",children:p.jsx("img",{src:u,alt:"Preview",className:"w-32 h-32 object-contain rounded-xl border border-gray-200"})}),p.jsx("div",{className:"flex-1 min-w-0",children:p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:d.name}),p.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:[(d.size/1024/1024).toFixed(2)," MB"]})]}),p.jsx("button",{onClick:()=>{c(null),x(null),r.current&&(r.current.value="")},className:"p-1 hover:bg-gray-100 rounded-lg transition-colors",disabled:g,children:p.jsx(Re,{className:"w-4 h-4 text-gray-600"})})]})})]})}):p.jsxs("div",{onClick:()=>{var e;return null==(e=r.current)?void 0:e.click()},className:"border-2 border-dashed border-gray-300 rounded-2xl p-8 text-center cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-colors",children:[p.jsxs("div",{className:"flex flex-col items-center gap-3",children:[p.jsx("div",{className:"w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center",children:p.jsx(ct,{className:"w-6 h-6 text-blue-600"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm font-medium text-gray-900",children:"Klik om een afbeelding te selecteren"}),p.jsx("p",{className:"text-xs text-gray-600 mt-1",children:"PNG, JPG of JPEG (max 4MB)"})]})]}),p.jsx("input",{ref:r,type:"file",accept:"image/*",onChange:e=>{var t;const a=null==(t=e.target.files)?void 0:t[0];if(!a)return;if(!a.type.startsWith("image/"))return void f("Selecteer een geldig afbeeldingsbestand");if(a.size>4194304)return void f("Bestand is te groot. Maximum 4MB toegestaan.");c(a),f(null);const s=new FileReader;s.onload=e=>{var t;x(null==(t=e.target)?void 0:t.result)},s.readAsDataURL(a)},className:"hidden",disabled:g})]})]}),v&&p.jsx("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4",children:p.jsx("p",{className:"text-sm text-red-800",children:v})}),p.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:p.jsxs("p",{className:"text-sm text-blue-800",children:[p.jsx("strong",{children:"Let op:"})," Na het uploaden kun je placeholders toevoegen voor bedrijfsnaam en standnummer."]})}),p.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-gray-200",children:[p.jsx("button",{onClick:a,className:"px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-xl transition-colors min-h-[44px]",disabled:g,children:"Annuleren"}),p.jsx("button",{onClick:()=>m(null,null,(function*(){if(d&&s&&j)if(n.trim())try{b(!0),f(null),yield ds(e,j,s.uid,{name:n.trim(),description:l.trim(),imageFile:d}),t()}catch(a){f("Fout bij uploaden van template. Probeer opnieuw.")}finally{b(!1)}else f("Voer een naam in voor de template");else f("Ontbrekende gegevens")})),disabled:!d||!n.trim()||g,className:"px-6 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed min-h-[44px]",children:g?"Uploaden...":"Template Aanmaken"})]})]})]})},eo=()=>{const{id:e}=g(),[t]=j(),a=null!=e?e:t.get("projectId"),s=f(),[r,n]=h.useState([]),[i,l]=h.useState(!0),[o,d]=h.useState(!1);h.useEffect((()=>{c()}
2),[a]);const c=()=>m(null,null,(function*(){if(a)try{l(!0);const e=yield cs(a,!1);n(e)}catch(e){}finally{l(!1)}}));return a?p.jsxs("div",{className:"min-h-screen bg-gray-50",children:[p.jsx("div",{className:"bg-white border-b border-gray-200",children:p.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("button",{onClick:()=>s(-1),className:"p-2 hover:bg-gray-100 rounded-xl transition-colors",children:p.jsx(ws,{className:"w-5 h-5 text-gray-600"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Persoonlijke Banners"}),p.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Beheer banner templates voor exposanten"})]})]}),p.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors min-h-[44px]",children:[p.jsx(Ve,{className:"w-5 h-5"}),p.jsx("span",{className:"hidden sm:inline",children:"Nieuwe Template"})]})]})})}),p.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:i?p.jsx("div",{className:"flex items-center justify-center py-12",children:p.jsx("div",{className:"text-gray-600",children:"Templates laden..."})}):0!==r.length||o?p.jsxs(p.Fragment,{children:[o&&p.jsx("div",{className:"mb-6",children:p.jsx(Ql,{projectId:a,onSuccess:()=>{d(!1),c()},onCancel:()=>d(!1)})}),p.jsx(Xl,{templates:r,projectId:a,onTemplateUpdated:c})]}):p.jsx("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-200 p-12 text-center",children:p.jsxs("div",{className:"max-w-md mx-auto",children:[p.jsx("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4",children:p.jsx(Ve,{className:"w-8 h-8 text-blue-600"})}),p.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Geen templates gevonden"}),p.jsx("p",{className:"text-gray-600 mb-6",children:"Maak je eerste banner template aan om exposanten gepersonaliseerde banners te laten downloaden."}),p.jsx("button",{onClick:()=>d(!0),className:"px-6 py-3 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:"Maak Eerste Template"})]})})})]}):p.jsx("div",{className:"p-6",children:p.jsx("div",{className:"text-red-600",children:"Project ID not found"})})}
2,to=({config:e,onChange:t})=>p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Font Familie"}),p.jsx("select",{value:e.fontFamily,onChange:e=>t({fontFamily:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:us.map((e=>p.jsx("option",{value:e,style:{fontFamily:e},children:e},e)))})]}),p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Font Grootte: ",e.fontSize,"px"]}),p.jsx("input",{type:"range",min:"8",max:"240",step:"1",value:e.fontSize,onChange:e=>t({fontSize:parseInt(e.target.value)}),className:"w-full"}),p.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mt-1",children:[p.jsx("span",{children:"8px"}),p.jsx("span",{children:"240px"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Font Gewicht"}),p.jsx("select",{value:e.fontWeight,onChange:e=>t({fontWeight:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:ms.map((e=>p.jsxs("option",{value:e.value,children:[e.label," (",e.value,")"]},e.value)))})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Kleur"}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("input",{type:"color",value:e.fontColor,onChange:e=>t({fontColor:e.target.value}),className:"h-10 w-20 rounded-xl border border-gray-300 cursor-pointer"}),p.jsx("input",{type:"text",value:e.fontColor,onChange:e=>t({fontColor:e.target.value}),placeholder:"#FFFFFF",className:"flex-1 px-3 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent font-mono text-sm"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Uitlijning"}),p.jsx("div",{className:"flex gap-2",children:["left","center","right"].map((a=>p.jsx("button",{onClick:()=>t({textAlign:a}),className:"flex-1 px-4 py-2 rounded-xl border-2 transition-colors "+(e.textAlign===a?"border-blue-600 bg-blue-50 text-blue-700":"border-gray-300 hover:border-gray-400"),children:p.jsxs("div",{className:"flex items-center justify-center gap-2",children:["left"===a&&p.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:p.jsx("path",{d:"M2 4h16v2H2V4zm0 4h10v2H2V8zm0 4h16v2H2v-2zm0 4h10v2H2v-2z"})}),"center"===a&&p.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:p.jsx("path",{d:"M2 4h16v2H2V4zm3 4h10v2H5V8zm-3 4h16v2H2v-2zm3 4h10v2H5v-2z"})}),"right"===a&&p.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:p.jsx("path",{d:"M2 4h16v2H2V4zm6 4h10v2H8V8zm-6 4h16v2H2v-2zm6 4h10v2H8v-2z"})}),p.jsx("span",{className:"capitalize text-sm",children:a})]})},a)))})]}),p.jsxs("details",{className:"border border-gray-200 rounded-xl p-4",children:[p.jsx("summary",{className:"cursor-pointer font-medium text-gray-700 mb-4",children:"Geavanceerde Opties"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 mb-2",children:[p.jsx("input",{type:"checkbox",checked:void 0!==e.maxWidth,onChange:a=>{if(a.target.checked)t({maxWidth:500});else{const a=e,{maxWidth:s}=a,r=u(a,["maxWidth"]);t(r)}},className:"rounded"}),"Max Breedte (text wrapping)"]}),void 0!==e.maxWidth&&p.jsx("input",{type:"number",value:e.maxWidth,onChange:e=>t({maxWidth:parseInt(e.target.value)}),min:"50",max:"2000",step:"10",className:"w-full px-3 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Letter Spacing: ",e.letterSpacing||0,"px"]}),p.jsx("input",{type:"range",min:"-5",max:"20",step:"0.5",value:e.letterSpacing||0,onChange:e=>t({letterSpacing:parseFloat(e.target.value)}),className:"w-full"})]}),p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Regelhoogte: ",e.lineHeight||1.2]}),p.jsx("input",{type:"range",min:"0.8",max:"2.5",step:"0.1",value:e.lineHeight||1.2,onChange:e=>t({lineHeight:parseFloat(e.target.value)}),className:"w-full"})]})]})]}),p.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[p.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:"Preview:"}),p.jsx("div",{style:{fontFamily:e.fontFamily,fontSize:`${Math.min(e.fontSize,32)}px`,fontWeight:e.fontWeight,color:e.fontColor,textAlign:e.textAlign,letterSpacing:e.letterSpacing?`${e.letterSpacing}px`:void 0,lineHeight:e.lineHeight},children:"Voorbeeld Tekst"})]})]}),ao=({templateImageUrl:e,templateWidth:t,templateHeight:a,companyNameConfig:s,standNumberConfig:r,logoConfig:n,onCompanyNameChange:i,onStandNumberChange:l,onLogoChange:o})=>{const u=h.useRef(null),[m,x]=h.useState(1),[g,b]=h.useState(null),[v,f]=h.useState(null),[j,y]=h.useState(!1);h.useEffect((()=>{const e=()=>{if(u.current){const e=u.current.offsetWidth/t;x(Math.min(e,1))}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[t]);const N="companyName"===v?s:"standNumber"===v?r:"logo"===v?n:void 0,_=N?{x:N.x,y:N.y}:null,w=(e,t)=>{t.preventDefault(),b(e),f(e)},k=()=>{b(null)},C=e=>{if("logo"===e){const e=c(d({}
2,gs),{x:Math.round(t/2),y:Math.round(a/2),enabled:!0});o(e)}else{const s=c(d({},hs),{x:Math.round(t/2),y:Math.round(a/2)});"companyName"===e?i(s):l(s)}f(e)},S=e=>{"companyName"===e?i(void 0):"standNumber"===e?l(void 0):"logo"===e&&o(void 0),v===e&&f(null)},z=(e,t,a)=>{const s=v===e,r=g===e;return p.jsxs("div",{onMouseDown:t=>w(e,t),onClick:()=>f(e),style:{position:"absolute",left:t.x*m+"px",top:t.y*m+"px",transform:"translate(-50%, -50%)",cursor:r?"grabbing":"grab",zIndex:s?20:10},className:"group "+(r?"opacity-70":""),children:[p.jsx("div",{className:"absolute inset-0 border-2 rounded pointer-events-none "+(s?"border-blue-600 bg-blue-100/20":"border-gray-400 bg-gray-100/20 group-hover:border-blue-400"),style:{padding:"8px",minWidth:"100px",minHeight:"40px"}}),p.jsx("div",{style:{fontFamily:t.fontFamily,fontSize:t.fontSize*m+"px",fontWeight:t.fontWeight,color:t.fontColor,textAlign:t.textAlign,letterSpacing:t.letterSpacing?`${t.letterSpacing}px`:void 0,padding:"8px",whiteSpace:"nowrap",userSelect:"none"},children:a}),s&&p.jsxs("div",{className:"absolute -top-8 left-1/2 transform -translate-x-1/2 flex items-center gap-2 bg-blue-600 text-white px-3 py-1 rounded-lg shadow-lg text-xs font-medium",children:[p.jsx(sa,{className:"w-3 h-3"}),p.jsx("span",{children:"companyName"===e?"Bedrijfsnaam":"Standnummer"}),p.jsx("button",{onClick:t=>{t.stopPropagation(),S(e)},className:"ml-2 hover:bg-blue-700 rounded p-0.5",children:p.jsx(Re,{className:"w-3 h-3"})})]})]},e)};return p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[p.jsx("div",{className:"lg:col-span-2",children:p.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Canvas Editor"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700",children:[p.jsx("input",{type:"checkbox",checked:j,onChange:e=>y(e.target.checked),className:"rounded"}),"Grid"]}),p.jsxs("span",{className:"text-sm text-gray-600",children:["Schaal: ",Math.round(100*m),"%"]})]})]}),p.jsxs("div",{ref:u,onMouseMove:e=>{if(!g||!u.current)return;const p=u.current.getBoundingClientRect(),x=Math.round((e.clientX-p.left)/m),h=Math.round((e.clientY-p.top)/m),b=Math.max(0,Math.min(x,t)),v=Math.max(0,Math.min(h,a));"companyName"===g?i(c(d({},s||hs),{x:b,y:v})):"standNumber"===g?l(c(d({},r||hs),{x:b,y:v})):"logo"===g&&n&&o(c(d({},n),{x:b,y:v}))},onMouseUp:k,onMouseLeave:k,className:"relative bg-gray-100 rounded-xl overflow-hidden",style:{width:"100%",height:a*m+"px",backgroundImage:j?"linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px)":void 0,backgroundSize:j?`${20*m}px ${20*m}px`:void 0},children:[p.jsx("img",{src:e,alt:"Template",style:{width:t*m+"px",height:a*m+"px",pointerEvents:"none",userSelect:"none"},draggable:!1}),s&&z("companyName",s,"Voorbeeld Bedrijf BV"),r&&z("standNumber",r,"A123"),(null==n?void 0:n.enabled)&&(e=>{const t="logo"===v,a="logo"===g;return p.jsxs("div",{onMouseDown:e=>w("logo",e),onClick:()=>
2f("logo"),style:{position:"absolute",left:e.x*m+"px",top:e.y*m+"px",transform:"translate(-50%, -50%)",cursor:a?"grabbing":"grab",zIndex:t?20:10},className:"group "+(a?"opacity-70":""),children:[p.jsx("div",{className:"border-2 rounded-xl overflow-hidden "+(t?"border-purple-600 bg-gradient-to-br from-purple-100 to-purple-200":"border-purple-400 bg-gradient-to-br from-purple-50 to-purple-100 group-hover:border-purple-500"),style:{width:e.size*m+"px",height:e.size*m+"px"},children:p.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",style:{pointerEvents:"none",userSelect:"none"},children:[p.jsx("rect",{width:"100",height:"100",fill:"#6366f1",opacity:"0.1"}),p.jsx("circle",{cx:"50",cy:"40",r:"15",fill:"#6366f1",opacity:"0.3"}),p.jsx("rect",{x:"35",y:"60",width:"30",height:"8",rx:"2",fill:"#6366f1",opacity:"0.3"}),p.jsx("text",{x:"50",y:"85",textAnchor:"middle",fill:"#6366f1",fontSize:"12",fontWeight:"bold",fontFamily:"system-ui, -apple-system, sans-serif",children:"LOGO"})]})}),p.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-purple-600/80 text-white text-center py-0.5",style:{fontSize:10*m+"px"},children:[e.size,"Ã",e.size,"px"]}),t&&p.jsxs("div",{className:"absolute -top-8 left-1/2 transform -translate-x-1/2 flex items-center gap-2 bg-purple-600 text-white px-3 py-1 rounded-lg shadow-lg text-xs font-medium whitespace-nowrap",children:[p.jsx(sa,{className:"w-3 h-3"}),p.jsx("span",{children:"Logo"}),p.jsx("button",{onClick:e=>{e.stopPropagation(),S("logo")},className:"ml-2 hover:bg-purple-700 rounded p-0.5",children:p.jsx(Re,{className:"w-3 h-3"})})]})]},"logo")})(n),_&&p.jsxs("div",{className:"absolute top-2 left-2 z-30 pointer-events-none bg-gray-800/90 text-white px-2 py-1 rounded text-xs font-mono",children:["x: ",_.x,", y: ",_.y]})]}),p.jsxs("div",{className:"flex flex-wrap gap-3 mt-4",children:[!s&&p.jsx("button",{onClick:()=>C("companyName"),className:"flex-1 min-w-[150px] px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:"+ Bedrijfsnaam"}),!r&&p.jsx("button",{onClick:()=>C("standNumber"),className:"flex-1 min-w-[150px] px-4 py-2 bg-green-600 text-white rounded-xl hover:bg-green-700 transition-colors",children:"+ Standnummer"}),!(null==n?void 0:n.enabled)&&p.jsx("button",{onClick:()=>C("logo"),className:"flex-1 min-w-[150px] px-4 py-2 bg-purple-600 text-white rounded-xl hover:bg-purple-700 transition-colors",children:"+ Logo"})]}),p.jsx("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-xl",children:p.jsxs("p",{className:"text-sm text-blue-800",children:[p.jsx("strong",{children:"Instructies:"})," Klik en sleep de placeholders om ze te positioneren. Gebruik de pijltjestoetsen voor fijne aanpassingen. Klik op een placeholder om de font instellingen te wijzigen."]})})]})}),p.jsx("div",{className:"lg:col-span-1",children:p.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 p-6 sticky top-6",children:[p.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Configuratie"}),v?"logo"===v?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"mb-4 p-3 bg-purple-50 rounded-xl",children:p.jsx("p",{className:"text-sm font-medium text-purple-900",children:"Logo Placeholder"})}),n&&p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Positie X"}),p.jsx("input",{type:"number",value:n.x,onChange:e=>o(c(d({},n),{x:parseInt(e.target.value)||0})),className:"w-full px-3 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-purple-500 focus:border-transparent"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Positie Y"}),p.jsx("input",{type:"number",value:n.y,onChange:e=>o(c(d({},n),{y:parseInt(e.target.value)||0})),className:"w-full px-3 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-purple-500 focus:border-transparent"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Logo Grootte"}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("input",{type:"range",value:n.size,onChange:e=>o(c(d({},n),{size:parseInt(e.target.value)})),min:xs,max:ps,step:10,className:"flex-1"}),p.jsx("input",{type:"number",value:n.size,onChange:e=>o(c(d({},n),{size:parseInt(e.target.value)||xs})),min:xs,max:ps,className:"w-16 px-2 py-1 border border-gray-300 rounded-lg text-sm"})]}),p.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[n.size," Ã ",n.size," px"]})]}),p.jsx("div",{className:"p-3 bg-purple-50 rounded-xl border border-purple-200",children:p.jsx("p",{className:"text-xs text-purple-800",children:"Logo wordt opgehaald uit het bedrijfsprofiel van de exposant"})})]})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"mb-4 p-3 bg-blue-50 rounded-xl",children:p.jsx("p",{className:"text-sm font-medium text-blue-900",children:"companyName"===v?"Bedrijfsnaam":"Standnummer"})}),p.jsx(to,{config:"companyName"===v?s||hs:r||hs,onChange:e=>((e,t)=>{const a="companyName"===e?s:r;if(!a)return;const n=d(d({},a),t);"companyName"===e?i(n):l(n)})(v,e)})]}):p.jsx("div",{className:"text-center py-8 text-gray-500",children:p.jsx("p",{className:"text-sm",children:"Selecteer een placeholder om de instellingen te wijzigen"})})]})})]})},so=()=>{const{id:e,templateId:t}=g(),[a]=j(),s=null!=e?e:a.get("projectId"),r=f(),{currentUser:n}
2=K(),[i,l]=h.useState(null),[o,u]=h.useState(!0),[x,b]=h.useState(!1),[v,y]=h.useState(null),[N,_]=h.useState(!1),[w,k]=h.useState(),[C,S]=h.useState(),[z,I]=h.useState(),[P,D]=h.useState(""),[B,T]=h.useState(""),[A,E]=h.useState(!1),[V,M]=h.useState("");h.useEffect((()=>{L()}),[s,t]);const L=()=>m(null,null,(function*(){if(s&&t)try{u(!0);const e=yield bs(s,t);if(!e)return void y("Template niet gevonden");l(e),k(e.placeholders.companyName),S(e.placeholders.standNumber),I(e.placeholders.logo),D(e.name),T(e.description||""),E(e.isActive)}catch(e){y("Fout bij laden van template")}finally{u(!1)}}));return o?p.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:p.jsx("div",{className:"text-gray-600",children:"Template laden..."})}):v||!i?p.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:p.jsxs("div",{className:"text-center",children:[p.jsx("p",{className:"text-red-600 mb-4",children:v||"Template niet gevonden"}),p.jsx("button",{onClick:()=>r(-1),className:"px-4 py-2 bg-gray-600 text-white rounded-xl hover:bg-gray-700",children:"Terug"})]})}):p.jsxs("div",{className:"min-h-screen bg-gray-50",children:[p.jsx("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-30",children:p.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("button",{onClick:()=>r(-1),className:"p-2 hover:bg-gray-100 rounded-xl transition-colors",children:p.jsx(ws,{className:"w-5 h-5 text-gray-600"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Template Bewerken"}),p.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["Versie ",i.currentVersion]})]})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("button",{onClick:()=>_(!N),className:"flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-xl hover:bg-gray-200 transition-colors min-h-[44px]",children:[p.jsx(Xe,{className:"w-5 h-5"}),p.jsx("span",{className:"hidden sm:inline",children:N?"Verberg Preview":"Toon Preview"})]}),p.jsxs("button",{onClick:()=>m(null,null,(function*(){if(s&&t&&n)try{b(!0),y(null),yield os(s,t,n.uid,{name:P,description:B,placeholders:{companyName:w,standNumber:C,logo:z},isActive:A,changeDescription:V||"Template bijgewerkt"}),yield L(),M(""),alert("Template succesvol opgeslagen!")}catch(e){y("Fout bij opslaan van template")}finally{b(!1)}})),disabled:x,className:"flex items-center gap-2 px-6 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed min-h-[44px]",children:[p.jsx(Va,{className:"w-5 h-5"}),p.jsx("span",{children:x?"Opslaan...":"Opslaan"})]})]})]})})}),p.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[p.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 p-6 mb-6",children:[p.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Basis Informatie"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Template Naam"}),p.jsx("input",{type:"text",value:P,onChange:e=>D(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Status"}),p.jsxs("label",{className:"flex items-center gap-3 px-4 py-2 border border-gray-300 rounded-xl cursor-pointer hover:bg-gray-50",children:[p.jsx("input",{type:"checkbox",checked:A,onChange:e=>E(e.target.checked),className:"rounded"}),p.jsx("span",{className:"text-sm text-gray-700",children:A?"Actief (zichtbaar voor exposanten)":"Inactief"})]})]}),p.jsxs("div",{className:"md:col-span-2",children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Beschrijving (optioneel)"}),p.jsx("textarea",{value:B,onChange:e=>T(e.target.value),rows:2,className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"})]}),p.jsxs("div",{className:"md:col-span-2",children:[p.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Wijzigingsbeschrijving (voor version history)"}),p.jsx("input",{type:"text",value:V,onChange:e=>M(e.target.value),placeholder:"bijv. Font grootte aangepast",className:"w-full px-4 py-2 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]})]}),p.jsx(ao,{templateImageUrl:i.imageUrl,templateWidth:i.imageWidth,templateHeight:i.imageHeight,companyNameConfig:w,standNumberConfig:C,logoConfig:z,onCompanyNameChange:k,onStandNumberChange:S,onLogoChange:I}),N&&p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-2xl max-w-4xl w-full max-h-[90vh] overflow-auto",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 p-4 flex items-center justify-between",children:[p.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Preview met Voorbeeld Data"}),p.jsx("button",{onClick:()=>_(!1),className:"p-2 hover:bg-gray-100 rounded-xl transition-colors",children:p.jsx(ws,{className:"w-5 h-5 text-gray-600"})})]}),p.jsx("div",{className:"p-6",children:p.jsx("div",{className:"bg-gray-100 rounded-xl p-6 flex items-center justify-center",children:p.jsx(vs,{template:c(d({},i),{placeholders:{companyName:w,standNumber:C,logo:z}}),companyName:"Voorbeeld Bedrijf BV",standNumber:"A123",logoUrl:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Crect width='300' height='300' fill='%236366f1'/%3E%3Ctext x='150' y='160' text-anchor='middle' fill='white' font-size='48' font-weight='bold' font-family='Arial'%3ELOGO%3C/text%3E%3C/svg%3E",scale:.5})})})]})})]})]})},ro=()=>{const{id:e,templateId:t}=g(),[a]=j(),s=null!=e?e:a.get("projectId"),r=f(),{currentUser:n}
2=K(),[i,l]=h.useState(null),[o,u]=h.useState([]),[x,b]=h.useState(!0),[v,y]=h.useState(null),[N,_]=h.useState(null);h.useEffect((()=>{w()}),[s,t]);const w=()=>m(null,null,(function*(){if(s&&t)try{b(!0);const[e,a]=yield Promise.all([bs(s,t),fs(s,t)]);l(e),u(a)}catch(e){}finally{b(!1)}})),k=e=>{if(!e)return"-";const t=e.toDate?e.toDate():new Date(e);return new Intl.DateTimeFormat("nl-NL",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)};return x?p.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:p.jsx("div",{className:"text-gray-600",children:"Geschiedenis laden..."})}):i?p.jsxs("div",{className:"min-h-screen bg-gray-50",children:[p.jsx("div",{className:"bg-white border-b border-gray-200",children:p.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("button",{onClick:()=>r(-1),className:"p-2 hover:bg-gray-100 rounded-xl transition-colors",children:p.jsx(ws,{className:"w-5 h-5 text-gray-600"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Version History"}),p.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[i.name," - Huidige versie: v",i.currentVersion]})]})]})})}),p.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[0===o.length?p.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 p-12 text-center",children:p.jsx("p",{className:"text-gray-600",children:"Geen version history beschikbaar"})}):p.jsx("div",{className:"space-y-4",children:o.map((e=>{const a=e.versionNumber===i.currentVersion;return p.jsx("div",{className:"bg-white rounded-2xl border-2 p-6 transition-all "+(a?"border-blue-600 shadow-lg":"border-gray-200 hover:border-gray-300"),children:p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[p.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:["Versie ",e.versionNumber]}),a&&p.jsx("span",{className:"px-3 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full",children:"Huidige Versie"})]}),p.jsxs("div",{className:"space-y-1 text-sm text-gray-600",children:[p.jsxs("p",{children:[p.jsx("strong",{children:"Datum:"})," ",k(e.createdAt)]}),e.changeDescription&&p.jsxs("p",{children:[p.jsx("strong",{children:"Wijziging:"})," ",e.changeDescription]}),p.jsxs("p",{children:[p.jsx("strong",{children:"Afmetingen:"})," ",e.imageWidth," Ã ",e.imageHeight," px"]}),p.jsxs("p",{children:[p.jsx("strong",{children:"Placeholders:"})," ",[e.placeholders.companyName&&"Bedrijfsnaam",e.placeholders.standNumber&&"Standnummer"].filter(Boolean).join(", ")||"Geen"]})]})]}),p.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[p.jsxs("button",{onClick:()=>_(e),className:"flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-xl hover:bg-gray-200 transition-colors min-h-[44px]",children:[p.jsx(Xe,{className:"w-4 h-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Preview"})]}),!a&&p.jsxs("button",{onClick:()=>{return a=e.id,r=e.versionNumber,m(null,null,(function*(){if(s&&t&&n&&window.confirm(`Weet je zeker dat je versie ${r} wilt herstellen? Dit maakt een nieuwe versie aan met deze configuratie.`))try{y(a),yield js(s,t,a,n.uid),yield w(),alert(`Versie ${r} succesvol hersteld!`)}catch(e){alert("Fout bij herstellen van versie")}finally{y(null)}}));var a,r},disabled:v===e.id,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed min-h-[44px]",children:[p.jsx(Ia,{className:"w-4 h-4"}),p.jsx("span",{className:"hidden sm:inline",children:v===e.id?"Herstellen...":"Herstel"})]})]})]})},e.id)}))}),p.jsx("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-xl",children:p.jsxs("p",{className:"text-sm text-blue-800",children:[p.jsx("strong",{children:"Let op:"})," Het herstellen van een oude versie maakt een nieuwe versie aan met de configuratie van de geselecteerde versie. De version history blijft behouden."]})})]}),N&&p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-2xl max-w-4xl w-full max-h-[90vh] overflow-auto",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 p-4 flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:["Preview Versie ",N.versionNumber]}),p.jsx("p",{className:"text-sm text-gray-600",children:k(N.createdAt)})]}),p.jsx("button",{onClick:()=>_(null),className:"p-2 hover:bg-gray-100 rounded-xl transition-colors",children:p.jsx(ws,{className:"w-5 h-5 text-gray-600"})})]}),p.jsxs("div",{className:"p-6",children:[p.jsx("div",{className:"bg-gray-100 rounded-xl p-6 flex items-center justify-center",children:p.jsx(vs,{template:c(d({},i),{imageUrl:N.imageUrl,imageWidth:N.imageWidth,imageHeight:N.imageHeight,placeholders:N.placeholders}),companyName:"Voorbeeld Bedrijf BV",standNumber:"A123",scale:.5})}),N.changeDescription&&p.jsx("div",{className:"mt-4 p-4 bg-gray-50 rounded-xl",children:p.jsxs("p",{className:"text-sm text-gray-700",children:[p.jsx("strong",{children:"Wijziging:"})," ",N.changeDescription]})})]})]})})]}):p.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:p.jsxs("div",{className:"text-center",children:[p.jsx("p",{className:"text-red-600 mb-4",children:"Template niet gevonden"}),p.jsx("button",{onClick:()=>r(-1),className:"px-4 py-2 bg-gray-600 text-white rounded-xl hover:bg-gray-700",children:"Terug"})]})})},no=new Set(["mail-templates","exhibitor-sidebar-menu"]),io=({path:e,children:t})=>{const{t:a}=T("projects"),s=gt(e),r=null==s?void 0:s.labelKey,n=a(r||"setup.page_title"),i=no.has(e);return p.jsx(oo,{title:n,fullWidth:i,children:t})},lo=({projectId:e})=>{var t,a,s,r;return p.jsxs(N,{children:[p.jsx(_,{index:!0,element:p.jsx(w,{to:`/projects/${e}/setup/${null!=(a=null==(t=bt)?void 0:t.path)?a:"details"}`,replace:!0})}),p.jsx(_,{path:"details",element:p.jsx(io,{path:"details",children:p.jsx(Tl,{})})}),p.jsx(_,{path:"forms",element:p.jsx(io,{path:"forms",children:p.jsx(Ys,{})})}),p.jsx(_,{path:"contact-info",element:p.jsx(io,{path:"contact-info",children:p.jsx(dr,{})})}),p.jsx(_,{path:"menu",element:p.jsx(io,{path:"menu",children:p.jsx(wr,{})})}),p.jsx(_,{path:"application-form",element:p.jsx(io,{path:"application-form",children:p.jsx(wl,{})})}),p.jsx(_,{path:"visuals",element:p.jsx(io,{path:"visuals",children:p.jsx(br,{})})}),p.jsx(_,{path:"domain",element:p.jsx(io,{path:"domain",children:p.jsx(Wi,{})})}),p.jsx(_,{path:"dashboard-info",element:p.jsx(io,{path:"dashboard-info",children:p.jsx(Pn,{})})}),p.jsx(_,{path:"start-pages",element:p.jsx(io,{path:"start-pages",children:p.jsx(Dn,{})})}),p.jsx(_,{path:"mail-branding",element:p.jsx(io,{path:"mail-branding",children:p.jsx(Fn,{})})}),p.jsx(_,{path:"mail-templates",element:p.jsx(io,{path:"mail-templates",children:p.jsx(mi,{})})}),p.jsx(_,{path:"ai-model",element:p.jsx(io,{path:"ai-model",children:p.jsx(In,{})})}),p.jsx(_,{path:"floorplan-builder",element:p.jsx(io,{path:"floorplan-builder",children:p.jsx(hn,{})})}),p.jsx(_,{path:"floorplan-viewer",element:p.jsx(io,{path:"floorplan-viewer",children:p.jsx(fn,{})})}),p.jsx(_,{path:"floorplan-duplicate",element:p.jsx(io,{path:"floorplan-duplicate",children:p.jsx(jn,{})})}),p.jsx(_,{path:"claude",element:p.jsx(io,{path:"claude",children:p.jsx(Br,{})})}),p.jsx(_,{path:"filemaker",element:p.jsx(io,{path:"filemaker",children:p.jsx(Mr,{})})}),p.jsx(_,{path:"mailchimp",element:p.jsx(io,{path:"mailchimp",children:p.jsx(Ur,{})})}),p.jsx(_,{path:"googleplaces",element:p.jsx(io,{path:"googleplaces",children:p.jsx(Hr,{})})}),p.jsx(_,{path:"zernio",element:p.jsx(io,{path:"zernio",children:p.jsx(qr,{})})}),p.jsx(_,{path:"ticketscan",element:p.jsx(io,{path:"ticketscan",children:p.jsx(Jr,{})})}),p.jsx(_,{path:"badges",element:p.jsx(io,{path:"badges",children:p.jsx(Yr,{})})}),p.jsx(_,{path:"deadlines",element:p.jsx(io,{path:"deadlines",children:p.jsx(en,{})})}),p.jsx(_,{path:"participation-info",element:p.jsx(io,{path:"participation-info",children:p.jsx(ln,{})})}),p.jsx(_,{path:"terms-conditions",element:p.jsx(io,{path:"terms-conditions",children:p.jsx(mn,{})})}),p.jsx(_,{path:"categories",element:p.jsx(io,{path:"categories",children:p.jsx(Cn,{})})}),p.jsx(_,{path:"orders",element:p.jsx(io,{path:"orders",children:p.jsx(yi,{})})}),p.jsx(_,{path:"orders-card",element:p.jsx(io,{path:"orders-card",children:p.jsx(yi,{})})}),p.jsx(_,{path:"shop",element:p.jsx(io,{path:"shop",children:p.jsx(_i,{})})}),p.jsx(_,{path:"invoice-pdf",element:p.jsx(io,{path:"invoice-pdf",children:p.jsx(wi,{})})}),p.jsx(_,{path:"exhibitor-sidebar-menu",element:p.jsx(io,{path:"exhibitor-sidebar-menu",children:p.jsx(Bi,{})})}),p.jsx(_,{path:"meeting-planner",element:p.jsx(io,{path:"meeting-planner",children:p.jsx(Rs,{})})}),p.jsx(_,{path:"advertisements",element:p.jsx(io,{path:"advertisements",children:p.jsx(Zl,{})})}),p.jsx(_,{path:"personal-banners",element:p.jsx(io,{path:"personal-banners",children:p.jsx(eo,{})})}),p.jsx(_,{path:"personal-banners/:templateId/edit",element:p.jsx(io,{path:"personal-banners",children:p.jsx(so,{})})}),p.jsx(_,{path:"personal-banners/:templateId/history",element:p.jsx(io,{path:"personal-banners",children:p.jsx(ro,{})})}),p.jsx(_,{path:"*",element:p.jsx(w,{to:`/projects/${e}/setup/${null!=(r=null==(s=bt)?void 0:s.path)?r:"details"}`,replace:!0})})]})};function oo({title:e,children:t,fullWidth:a=!1}){return p.jsxs("div",{className:a?"space-y-6":"mx-auto max-w-4xl space-y-6",children:[p.jsx("div",{className:"border-b border-[var(--color-border)] pb-3",children:p.jsx("h2",{className:"[font-size:var(--text-xl)] font-semibold text-[var(--color-text)]",children:e})}),t]})}const co=()=>{var e,t;const{id:a}=g(),{t:s}=T("projects"),r=null!=(t=null==(e=y().pathname.split("/setup/")[1])?void 0:e.split("/")[0])?t:"",n=gt(r),i=s(n?n.labelKey:"setup.page_title"),l=no.has(r)?"full":"wrapped",[o,d]=h.useState(null),c=h.useCallback((e=>{d(e)}),[]),u=h.useMemo((()=>p.jsx("div",{ref:c,className:"contents"})),[c]);return p.jsx(k,{projectId:a,title:i,mode:"setup",allowedRoles:["admin"],actions:u,defaultContentWidth:l,children:a?p.jsx(Gs.Provider,{value:o,children:p.jsx(lo,{projectId:a})}):p.jsx("div",{className:"py-12 text-center text-[var(--color-text-muted)]",children:p.jsx("p",{children:s("participants_missing_project_id")})})})};
2export{co as ProjectSetupShellPage,co as default}; 3//# sourceMappingURL=ProjectSetupShellPage-BNPEeXL1.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.