1import{j as e}from"./query-C9rthSUJ.js";import{f as ta}from"./format-I42qvieW.js";import{u as bn,b as vn,A as fn,B as D}from"./navigation-Dsw3USph.js";import{P as ca}from"./page-header-D1ZeX5sx.js";import{c as yn,e as la,g as da,b as p,d as C,C as Te}from"./index-1qHllCzV.js";import{a as x,L as sa}from"./vendor-D5-NEHb5.js";import{X as He,I as B,c as Ie}from"./dropdown-menu-BYmjAYFV.js";import{C as hs}from"./checkbox-CNk-BRPe.js";import{L as M}from"./label-DOHzhs-N.js";import{D as Et,g as jn,a as Rt,b as Ot,c as Xt,d as xs,L as aa,e as _s,f as Nn,E as wn}from"./dialog-DDYUSWYc.js";import{A as kn,a as $n,b as Sn,c as Cn,d as zn,e as Mn,f as An,g as Dn}from"./alert-dialog-CFuNEyXY.js";import{T as _t,a as gt,b as mt,c as pt}from"./tooltip-DtbEMDrr.js";import{S as ut,a as bt,b as vt,c as ft,d as yt}from"./select-Bf9mqZaD.js";import{e as Tn}from"./events-DR3teHDn.js";import{T as In,a as Pn,b as gs,c as ms}from"./tabs-BV605ubX.js";import{c as q}from"./useConfirm-C9JaqIVg.js";import ps from"./map-pin-COGEP8He.js";import na from"./book-open-C_Jch2R_.js";import Bn from"./palette-Cdj3gvzY.js";import ia from"./layout-template-D1D5dGAe.js";import Ln from"./mouse-pointer-click-MdpXxrza.js";import En from"./circle-check-Z90ymQDI.js";import Rn from"./circle-x-B0ygDn0k.js";import Ce from"./plus-BPqzkS0V.js";import On from"./circle-alert-DmTb0b_k.js";import Fe from"./trash-2-BxCcsnSK.js";import Xn from"./upload-DELyXtDI.js";import jt from"./info-D8ttYUxU.js";import Je from"./clock-D_aQwV6T.js";import ra from"./tag-BUnmjjfK.js";import Nt from"./triangle-alert-DOM9v9BM.js";import Wn from"./lock-open-DPgbYutX.js";import oa from"./grid-3x3-BkRjGgIa.js";import Yn from"./dollar-sign-B3d8QDuS.js";import"./format-D4YE7dny.js";import"./zh-TW-CjSIZPpn.js";import"./ui-B72G9_re.js";import"./charts-3WZcVZCN.js";import"./index-CLV1MOmb.js";import"./index-CAvYfBqI.js";import"./circle-help-BdpO14f2.js";function Ve(Q,Ze=!1){if(!Q)return"";const Pe=Ze?"T23:59:59+08:00":"T00:00:00+08:00";return new Date(Q+Pe).toISOString()}function Un(){var qs,Qs,ea;const Q=bn(),Ze=vn(),{user:Pe,isAuthenticated:pe,isLoading:Ge}=yn(),j=Ze.get("event_id"),{language:Z}=la(),s=x.useCallback((t,n)=>da(Z,t,n),[Z]),ee=x.useRef(null),je=x.useRef(null),[z,ha]=x.useState(null),[oe,Wt]=x.useState([]),[xa,us]=x.useState(!0),[Yt,wt]=x.useState(!1),[Be,te]=x.useState(null),[kt,$t]=x.useState(!1),[Fn,Jn]=x.useState(!1),[G,Le]=x.useState(null),[ue,Ee]=x.useState(null),[Y,ze]=x.useState(null),[L,Ut]=x.useState(1),[bs,vs]=x.useState(!1),[b,R]=x.useState([]),[Ke,qe]=x.useState(null),[se,Ne]=x.useState(new Set),[Qe,Vn]=x.useState("select"),[P,we]=x.useState(null),[be,et]=x.useState([]),[Ht,fs]=x.useState([]),[_a,St]=x.useState(!1),[tt,Ft]=x.useState(""),[ce,st]=x.useState(""),[E,ys]=x.useState(""),[at,Me]=x.useState(1),[js,ga]=x.useState(0),[Jt,Ns]=x.useState("fixed"),[F,ma]=x.useState(!0),[v,U]=x.useState([]),[nt,ws]=x.useState(!1),ve=x.useRef(null),[le,ks]=x.useState([]),$s=20,[pa,it]=x.useState(!1),[Ct,rt]=x.useState(null),de=x.useCallback(()=>{ks(t=>{const n={boothDrafts:JSON.parse(JSON.stringify(b)),customAreas:JSON.parse(JSON.stringify(v)),timestamp:Date.now()},a=[...t,n];return a.length>$s?a.slice(-$s):a})},[b,v]),ua=x.useCallback(()=>{if(le.length===0){p.info(s("events_create_booth_settings.text10"));return}const t=le[le.length-1];R(t.boothDrafts),U(t.customAreas),ks(n=>n.slice(0,-1)),p.success(s("events_create_booth_settings.text11"))},[le,s]);x.useEffect(()=>{const t=n=>{if(n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement)return;const a=n.shiftKey?10:1;let r=0,o=0;switch(n.key){case"ArrowUp":o=-a;break;case"ArrowDown":o=a;break;case"ArrowLeft":r=-a;break;case"ArrowRight":r=a;break;default:return}n.preventDefault(),Ke?R(i=>i.map(l=>l.id===Ke?{...l,x:Math.max(0,l.x+r),y:Math.max(0,l.y+o)}:l)):se.size>0&&R(i=>i.map(l=>se.has(l.id)?{...l,x:Math.max(0,l.x+r),y:Math.max(0,l.y+o)}:l))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[Ke,se]);const ae=x.useMemo(()=>{if(Y&&Y.width>0)return Math.round(Y.width*L);const t=v.length>0?Math.max(...v.map(a=>(a.x||0)+(a.width||0))):0,n=b.length>0?Math.max(...b.map(a=>a.x+a.width)):0;return Math.max(800,t+100,n+100)},[Y,L,v,b]),ne=x.useMemo(()=>
1{if(Y&&Y.height>0)return Math.round(Y.height*L);const t=v.length>0?Math.max(...v.map(a=>(a.y||0)+(a.height||0))):0,n=b.length>0?Math.max(...b.map(a=>a.y+a.height)):0;return Math.max(600,t+200,n+200)},[Y,L,v,b]),[ba,ot]=x.useState(!1),[A,ie]=x.useState(null),[Vt,va]=x.useState(!1),[fa,ke]=x.useState(!1),[Ss,ya]=x.useState(10),[Re,ja]=x.useState(""),[fe,Na]=x.useState(null),[Zt,wa]=x.useState(!0),[$e,ct]=x.useState("area-number"),[he,lt]=x.useState(!1),[Cs,ka]=x.useState(""),zs=t=>{const n=b.filter(i=>i.area===t&&i.name);if(n.length===0)return null;let a=0,r=0,o=0;for(const i of n){const l=i.name||"";if(l.includes("-")){const c=l.split("-")[0];if(c.toLowerCase()===t.toLowerCase()||c.toLowerCase()===t.charAt(0).toLowerCase()){a++;continue}}if(/^[A-Za-z]\d+$/.test(l)){r++;continue}o++}return a>=r&&a>=o&&a>0?"area-number":r>=o&&r>0?"type-global":o>0?"custom":null},$a=t=>{ys(t);const n=zs(t);n?(ct(n),lt(!0)):lt(!1)},[Sa,Ms]=x.useState(!1),[N,Gt]=x.useState([]),[J,Ca]=x.useState([]),[Kt,za]=x.useState([]),[Ma,qt]=x.useState(!1),[As,Aa]=x.useState([]),[Da,Qt]=x.useState(!1),[Zn,Gn]=x.useState(!1),[zt,Ds]=x.useState(!1),[Oe,Ts]=x.useState(!0),[Mt,Is]=x.useState(!0),[At,Ps]=x.useState(!0),[Dt,Bs]=x.useState(""),[Ae,es]=x.useState(new Set),[Tt,Ls]=x.useState(!0),ts=Oe&&Mt&&At&&nt&&Tt&&zt,Ta=()=>{const t=!ts;Ts(t),Is(t),Ps(t),ws(t),Ls(t),Ds(t)},[Ia,Xe]=x.useState(!1),[w,xe]=x.useState(null),[Pa,It]=x.useState(!1),[dt,ss]=x.useState(null),[Ba,as]=x.useState(null),[La,K]=x.useState(!1),[S,X]=x.useState(null),Es=x.useMemo(()=>{if(!(w!=null&&w.start_date)||!(w!=null&&w.end_date))return[];const t=[];for(const n of J){if(w.id&&w.id===n.id)continue;const a=n.start_date,r=n.end_date;w.start_date<=r&&a<=w.end_date&&t.push(`${n.name} (${a} ~ ${r})`)}return t},[w==null?void 0:w.start_date,w==null?void 0:w.end_date,w==null?void 0:w.id,J]),Ea=x.useMemo(()=>{const t={};for(let n=0;n<J.length;n++)for(let a=n+1;a<J.length;a++){const r=J[n],o=J[a];if(r.start_date>o.end_date||r.end_date<o.start_date)continue;const i=r.target_areas||[],l=o.target_areas||[];if(i.length>0&&l.length>0&&!i.some(_=>l.includes(_)))continue;const c=r.id||`idx-${n}`,d=o.id||`idx-${a}`;t[c]||(t[c]=[]),t[d]||(t[d]=[]),t[c].push(o.name||`${s("events_create_booth_settings.text214")} ${a+1}`),t[d].push(r.name||`${s("events_create_booth_settings.text214")} ${n+1}`)}return t},[J,s]),ns=()=>z!=null&&z.registration_start_time?z.registration_start_time.split("T")[0]:"",Ra=()=>{const t=ns();if(J.length===0)return t;const n=J.reduce((o,i)=>i.end_date&&i.end_date>o?i.end_date:o,"");if(!n)return t;const a=new Date(n);a.setDate(a.getDate()+1);const r=a.toISOString().split("T")[0];return t&&r<t?t:r},Oa=()=>{const t=String.fromCharCode(65+v.length),n=v[v.length-1];let a=n?n.y+n.height+20:100;const r=120,o=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f43f5e"],i=ne-r;a>i&&(a=Math.min(100,i),p.warning(`${s("events_create_booth_settings.text12")}ï¼${s("events_create_booth_settings.text13")}`));const l={name:`${t}${s("events_create_booth_settings.text14")}`,color:o[v.length%o.length],x:20,y:Math.max(0,a),width:Math.min(760,ae-40),height:r};U([...v,l])},Xa=t=>{const n=[...v];n.splice(t,1),U(n)},[_e,Rs]=x.useState({isDragging:!1,startMouseX:0,startMouseY:0,initialPositions:{}}),[re,We]=x.useState({isDragging:!1,areaIndex:null,mode:null,startMouseX:0,startMouseY:0,initialArea:null}),[Pt,is]=x.useState({horizontal:[],vertical:[]}),Os=5,[Ye,Xs]=x.useState(!1),[ge,Ws]=x.useState(null),[Ue,rs]=x.useState(null),[V,ht]=x.useState(null);x.useEffect(()=>{if(!Ge&&!pe){p.error(s("events_create_booth_settings.text15")),Q.push("/events/policy");return}if(!j){p.error(s("events_create_booth_settings.text16")),Q.push("/events/create/organizer");return}Wa(),Js()},[Ge,pe,j]);const Wa=async()=>{if(j)try{const t=await Tn.getEventById(j);ha(t)}catch{}},Ys=t=>{let n=[],a=1,r=null,o=null;if(!t)return{parsedAreas:n,loadedZoomLevel:a,loadedMapSize:r,originalMapUrl:o};try{const i=JSON.parse(t);if(i.zoomLevel&&typeof i.zoomLevel=="number"&&(a=i.zoomLevel),i.mapImageSize&&i.mapImageSize.width&&i.mapImageSize.height&&(r=i.mapImageSize),i.originalMapUrl&&(o=i.originalMapUrl),i.areas&&Array.isArray(i.areas)){const l=r?Math.round(r.width*a):2e3,c=r?Math.round(r.height*a):2e3;n=i.areas.map(d=>{const _=Math.min(d.width||100,l-20),m=Math.min(d.height||100,c-20),g=Math.max(0,Math.min(d.x||0,l-_)),y=Math.max(0,Math.min(d.y||0,c-m));return{...d,x:g,y,width:_,height:m,unlocked_booth_ids:Array.isArray(d.unlocked_booth_ids)?d.unlocked_booth_ids:[]}})}}catch{}return{parsedAreas:n,loadedZoomLevel:a,loadedMapSize:r,originalMapUrl:o}},Ya=(t,n,a,r,o)=>{const i=t+a/2,l=n+r/2;for(const c of o)if(c.width&&c.height&&i>=c.x&&i<=c.x+c.width&&l>=c.y&&l<=c.y+c.height)return c.name;return null},Us=(t,n,a,r=1)=>(n?t.filter(i=>i.map_id===n):t).map((i,l)=>{var f;let c=50+l%8*70,d=50+Math.floor(l/8)*70;if(i.coordinate){const k=i.coordinate.split(",");if(k.length===2){const T=k[0].trim().match(/x:(\d+)/),O=k[1].trim().match(/y:(\d+)/);T&&T[1]&&(c=Math.round(parseInt(T[1])*r)),O&&O[1]&&(d=Math.round(parseInt(O[1])*r))}}const _=i.override_booth_price&&Number(i.override_booth_price)>0?Number(i.override_booth_price):0,m=N.find(k=>
1k.id===i.event_booth_type_id),g=i.display_width||(m==null?void 0:m.display_width)||60,y=i.display_height||(m==null?void 0:m.display_height)||60,$=Math.round(g*r),h=Math.round(y*r),I=Ya(c,d,$,h,a)||i.area||((f=a[0])==null?void 0:f.name)||`A${s("events_create_booth_settings.text14")}`;return{id:i.id,name:i.name,x:c,y:d,width:$,height:h,area:I,override_booth_price:_,pass_code:i.pass_code??null,has_pass_code:i.has_pass_code||!1,event_booth_type_id:i.event_booth_type_id||void 0,display_width:i.display_width||void 0,display_height:i.display_height||void 0,opacity:i.opacity??void 0}}),Bt=(t,n)=>{const{parsedAreas:a,loadedZoomLevel:r,loadedMapSize:o,originalMapUrl:i}=Ys(t.config);U(a),Ut(r),o&&ze(o);const l=i||t.map_url||null;if(l){if(Ee(i||t.map_url||null),Le(l),!o){const d=new Image;d.crossOrigin="anonymous",d.onload=()=>{ze(_=>_||{width:d.naturalWidth,height:d.naturalHeight})},d.src=l}}else Ee(null),Le(null),o||ze(null);const c=Us(n,t.id,a,r);R(c),Me(c.length+1),we(t.id),st(t.name||"")},xt=t=>{const n=L;if(n===t||n===0)return;const a=t/n;R(r=>r.map(o=>({...o,x:Math.round(o.x*a),y:Math.round(o.y*a),width:Math.round(o.width*a),height:Math.round(o.height*a)}))),U(r=>r.map(o=>({...o,x:Math.round(o.x*a),y:Math.round(o.y*a),width:Math.round(o.width*a),height:Math.round(o.height*a)}))),Ut(t)},Ua=t=>{const n=be.find(a=>a.id===t);n&&(qe(null),Ne(new Set),Bt(n,Ht))},Hs=async()=>{if(!(!j||!tt.trim()))try{const t=await C.post("/maps",{event_id:j,name:tt.trim(),status:"active"});et(n=>[...n,t]),Bt(t,Ht),St(!1),Ft(""),p.success(s("events_create_booth_settings.map_created"))}catch(t){const n=t;p.error(s("events_create_booth_settings.create_map_failed")+": "+(n.message||s("events_create_booth_settings.unknown_error")))}},Ha=async()=>{if(!P)return;const t=be.find(a=>a.id===P);if(await q({title:s("events_create_booth_settings.confirm_delete_map"),description:`${s("events_create_booth_settings.confirm_delete_map_description",{name:(t==null?void 0:t.name)||s("events_create_booth_settings.this_map")})}`,confirmText:s("events_create_booth_settings.delete"),cancelText:s("events_create_booth_settings.cancel"),variant:"danger"}))try{await C.delete(`/maps/${P}`);const a=be.filter(o=>o.id!==P);et(a);const r=Ht.filter(o=>o.map_id!==P);fs(r),Wt(r),a.length>
10?Bt(a[0],r):(we(null),st(""),R([]),U([]),Ee(null),Le(null)),p.success(s("events_create_booth_settings.map_deleted"))}catch(a){const r=a;p.error(s("events_create_booth_settings.delete_map_failed")+": "+(r.message||s("events_create_booth_settings.unknown_error")))}},Fs=async()=>{var n,a;if(!P||!ce.trim())return;const t=be.find(r=>r.id===P);if((t==null?void 0:t.name)!==ce.trim())try{await C.patch(`/maps/${P}`,{name:ce.trim()}),et(r=>r.map(o=>o.id===P?{...o,name:ce.trim()}:o)),p.success(s("events_create_booth_settings.map_name_updated"))}catch(r){const i=((a=(n=r.response)==null?void 0:n.data)==null?void 0:a.detail)||s("events_create_booth_settings.update_map_name_failed");p.error(i),t&&st(t.name)}},Js=async()=>{if(j)try{us(!0);const t=await C.get(`/booths/map/${j}`),n=t.booths||[];Wt(n),fs(n);let a=[];try{a=((await C.get(`/maps/?event_id=${j}&limit=100`)).data||[]).filter(o=>!o.deleted_at),et(a)}catch{}if(a.length>0)Bt(a[0],n);else{const{parsedAreas:r,loadedZoomLevel:o,loadedMapSize:i,originalMapUrl:l}=Ys(t.config);U(r),Ut(o),i&&ze(i);const c=l||t.map_url;if(c){Ee(l||t.map_url||null),Le(c);const _=new Image;_.crossOrigin="anonymous",_.onload=()=>{ze(m=>m||{width:_.naturalWidth,height:_.naturalHeight})},_.src=c}const d=Us(n,null,r,o);R(d),Me(d.length+1)}}catch{}finally{us(!1)}},De=async()=>{if(j)try{const n=(await C.get(`/event-booth-types/?event_id=${j}${P?`&map_id=${P}`:""}`)).data||[],a=await Promise.all(n.map(async i=>{try{const l=await C.get(`/event-booth-types/${i.id}/pricings`);return{...i,pricings:l.data||[]}}catch{return{...i,pricings:[]}}}));Gt(a);const r=new Map;a.forEach(i=>{var l;(l=i.pricings)==null||l.forEach(c=>{const d=`${c.price_type}-${c.start_date}-${c.end_date}-${c.target_areas||""}`;r.has(d)?r.get(d).prices[i.type_code]=c.price:r.set(d,{id:c.id,name:c.price_name,start_date:c.start_date.split("T")[0],end_date:c.end_date.split("T")[0],prices:{[i.type_code]:c.price},target_areas:c.target_areas?Array.isArray(c.target_areas)?c.target_areas:JSON.parse(c.target_areas):void 0,is_active:c.is_active,updated_by:c.updated_by,updated_at:c.updated_at})})}
1),Ca(Array.from(r.values()));const o=new Map;await Promise.all(a.map(async i=>{try{((await C.get(`/event-booth-types/${i.id}/pricings/deleted`)).data||[]).forEach(d=>{const _=`${d.price_type}-${d.start_date}-${d.end_date}-${d.target_areas||""}`;o.has(_)?o.get(_).prices[i.type_code]=d.price:o.set(_,{id:d.id,name:d.price_name,start_date:d.start_date.split("T")[0],end_date:d.end_date.split("T")[0],prices:{[i.type_code]:d.price},target_areas:d.target_areas?Array.isArray(d.target_areas)?d.target_areas:JSON.parse(d.target_areas):void 0,is_active:d.is_active,updated_by:d.updated_by,updated_at:d.updated_at,deleted_at:d.deleted_at})})}catch{}})),za(Array.from(o.values()));try{const i=await C.get(`/event-booth-types/deleted?event_id=${j}${P?`&map_id=${P}`:""}`);Aa(i.data||[])}catch{}}catch{}};x.useEffect(()=>{j&&De()},[j]),x.useEffect(()=>{j&&P&&De()},[P]),x.useEffect(()=>{if(N.length===0)return;const t=L||1;R(n=>{let a=!1;const r=n.map(o=>{const i=N.find(m=>m.id===o.event_booth_type_id),l=o.display_width||(i==null?void 0:i.display_width)||60,c=o.display_height||(i==null?void 0:i.display_height)||60,d=Math.round(l*t),_=Math.round(c*t);return o.width===d&&o.height===_?o:(a=!0,{...o,width:d,height:_})});return a?r:n})},[N,L]);const Vs=(t,n)=>{const a=new Date(t+"T00:00:00");return a.setDate(a.getDate()+n),a.toISOString().split("T")[0]},Fa=(t,n)=>{const a=[];return n.forEach(r=>{var o;(o=r.pricings)==null||o.forEach(i=>{i.price_name===t.name&&i.start_date.split("T")[0]===t.start_date&&i.end_date.split("T")[0]===t.end_date&&a.push(i.id)})}),a},Ja=(t,n,a)=>{const r=t.start_date,o=t.end_date,i=n.filter(d=>{if(d.start_date>o||d.end_date<r)return!1;const _=t.target_areas||[],m=d.target_areas||[];return!(_.length>0&&m.length>0&&!_.some(y=>m.includes(y)))});if(i.length===0)return null;const l=[],c=[];for(const d of i){const _=Fa(d,a);c.push(..._),d.start_date<r&&l.push({start_date:d.start_date,end_date:Vs(r,-1),prices:{...d.prices},name:d.name,source:"existing",target_areas:d.target_areas}),d.end_date>o&&l.push({start_date:Vs(o,1),end_date:d.end_date,prices:{...d.prices},name:d.name,source:"existing",target_areas:d.target_areas})}return l.push({start_date:r,end_date:o,prices:{...t.prices},name:t.name,source:"new",target_areas:t.target_areas}),l.sort((d,_)=>d.start_date.localeCompare(_.start_date)),{segments:l,pricingIdsToInvalidate:c}},Va=async()=>{var t,n;if(!(!dt||!Ba))try{for(const a of dt.pricingIdsToInvalidate)await C.delete(`/event-booth-types/pricings/${a}`);for(const a of dt.segments){const o=`${a.name.toLowerCase().replace(/\s/g,"_")}_${a.start_date}_${a.end_date}`;for(const i of N){const l=a.prices[i.type_code];!l||l<=0||await C.post(`/event-booth-types/${i.id}/pricings`,{event_booth_type_id:i.id,price_type:o,price_name:a.name,price:l,currency:"TWD",start_date:Ve(a.start_date,!1),end_date:Ve(a.end_date,!0),is_active:!0,target_areas:a.target_areas&&a.target_areas.length>0?a.target_areas:null})}}p.success(s("events_create_booth_settings.date_split_completed")),await De(),It(!1),ss(null),as(null),Xe(!1),xe(null)}catch(a){const r=a,o=((n=(t=r.response)==null?void 0:t.data)==null?void 0:n.detail)||r.message||s("events_create_booth_settings.unknown_error");p.error(`${s("events_create_booth_settings.split_failed")}: ${o}`)}},Za=async t=>{var i;const n=ns();if(n&&t.start_date<n){p.error(s("events_create_booth_settings.pricing_date_before_registration"));return}const a=N.filter(l=>!t.prices[l.type_code]||t.prices[l.type_code]<=0);let r=!1;if(a.length>0){const l=a.map(d=>d.type_name||d.type_code).join("ã");if(a.length===N.length){p.error(`${s("events_create_booth_settings.text470")}: ${l}`);return}if(!await q({title:s("events_create_booth_settings.missing_price_title")||"é¨åæ¤ä½é¡åæªè¨å®å¹æ ¼",description:(s("events_create_booth_settings.missing_price_description")||"以䏿¤ä½é¡åæªè¨å®å¹æ ¼ï¼å°ä¸æå»ºç«å®å¹ï¼")+` 2 3${l} 4 5`+(s("events_create_booth_settings.missing_price_confirm_hint")||"確å®åªå²å
5已填坫广 ¼çæ¤ä½é¡åï¼"),confirmText:s("events_create_booth_settings.missing_price_confirm")||"確å®ï¼è·³éæªè¨å®ç",cancelText:s("events_create_booth_settings.missing_price_cancel")||"è¿åè¨å®å¹æ ¼",variant:"warning"}))return;r=!0}if(!(t.id&&t.id.length>0)){const l=Ja(t,J,N);if(l){as(t),ss(l),It(!0);return}}try{const l=t.name.toLowerCase().replace(/\s/g,"_"),c=(g,y)=>{const $=g&&g.length>0?g:null,h=y&&y.length>0?y:null;return!$&&!h||!$||!h?!0:$.some(u=>h.includes(u))},d=[],_=[],m=t.target_areas&&t.target_areas.length>0?t.target_areas:null;for(const g of N){const y=t.prices[g.type_code]||0;if(r&&(!t.prices[g.type_code]||t.prices[g.type_code]<=0))continue;const $=(i=g.pricings)==null?void 0:i.find(h=>h.price_type===l||h.price_name===t.name);if($){const h=$.start_date.split("T")[0],u=$.end_date.split("T")[0];h===t.start_date&&u===t.end_date?d.push({type:"patch",url:`/event-booth-types/pricings/${$.id}`,data:{price_name:t.name,price:y,target_areas:m}}):(_.push({typeName:g.type_name||g.type_code,pricingName:`${$.price_name} (${h} ~ ${u})`}),d.push({type:"delete",url:`/event-booth-types/pricings/${$.id}`}),d.push({type:"post",url:`/event-booth-types/${g.id}/pricings`,data:{event_booth_type_id:g.id,price_type:l,price_name:t.name,price:y,currency:"TWD",start_date:Ve(t.start_date,!1),end_date:Ve(t.end_date,!0),is_active:!0,target_areas:m}}))}else{if(g.pricings)for(const h of g.pricings){const u=h.start_date.split("T")[0],I=h.end_date.split("T")[0],f=t.start_date<=I&&u<=t.end_date,k=h.target_areas?Array.isArray(h.target_areas)?h.target_areas:JSON.parse(h.target_areas):null;f&&c(m,k)&&_.push({typeName:g.type_name||g.type_code,pricingName:`${h.price_name} (${u} ~ ${I})`})}d.push({type:"post",url:`/event-booth-types/${g.id}/pricings`,data:{event_booth_type_id:g.id,price_type:l,price_name:t.name,price:y,currency:"TWD",start_date:Ve(t.start_date,!1),end_date:Ve(t.end_date,!0),is_active:!0,target_areas:m}})}}if(_.length>0&&!await q({title:s("events_create_booth_settings.confirm_overlap_overwrite"),description:`${s("events_create_booth_settings.overlap_conflict_description",{name:t.name,start:t.start_date,end:t.end_date})} 6 7`+_.map(y=>`⢠${y.typeName}ï¼${y.pricingName}`).join(` 8`)+` 9 10${s("events_create_booth_settings.overlap_conflict_deactivate_note")}`,confirmText:s("events_create_booth_settings.confirm_overwrite"),cancelText:s("events_create_booth_settings.cancel"),variant:"warning"}))return;for(const g of d)g.type==="delete"?await C.delete(g.url):g.type==="patch"?await C.patch(g.url,g.data):await C.post(g.url,g.data);p.success(s("events_create_booth_settings.text21")),await De(),Xe(!1),xe(null)}catch(l){const c=l,d=c.detail||c.message||"";p.error(`${s("events_create_booth_settings.save_pricing_failed")}ï¼${d}`)}},Ga=async t=>{var n;try{const a=t.name.toLowerCase().replace(/\s/g,"_");for(const r of N){const o=(n=r.pricings)==null?void 0:n.find(i=>(i.price_type===a||i.price_name===t.name)&&i.start_date.split("T")[0]===t.start_date&&i.end_date.split("T")[0]===t.end_date);o&&await C.delete(`/event-booth-types/pricings/${o.id}`)}p.success(s("events_create_booth_settings.text24")),await De()}catch(a){const r=a,o=r.detail||r.message||"";p.error(`${s("events_create_booth_settings.deactivate_pricing_failed")}ï¼${o}`)}},Ka=async t=>{if(K(!1),!await q({title:s("events_create_booth_settings.confirm_save_title")||"確èªå²å",description:s("events_create_booth_settings.confirm_save_description")||"æ¨ç¢ºå®è¦å²åæ¤æ¤ä½é¡ååï¼",confirmText:s("events_create_booth_settings.create")||"確å®",cancelText:s("events_create_booth_settings.cancel")||"åæ¶",variant:"warning"})){K(!0);return}try{if(t.id)await C.patch(`/event-booth-types/${t.id}`,{type_name:t.type_name,description:t.description||null,width:t.width||null,depth:t.depth||null,height:t.height||null,base_wattage:t.base_wattage||0,default_price:t.default_price||0,display_width:t.display_width||60,display_height:t.display_height||60}),p.success(s("events_create_booth_settings.text26"));else{if(!t.type_code){p.error(`${s("events_create_booth_settings.text27")}(${s("events_create_booth_settings.text28")})`),K(!0);return}await C.post("/event-booth-types",{event_id:j,map_id:P,type_code:t.type_code,type_name:t.type_name||t.type_code,description:t.description||null,width:t.width||null,depth:t.depth||null,height:t.height||null,base_wattage:t.base_wattage||0,default_price:t.default_price||0,display_width:t.display_width||60,display_height:t.display_height||60}),p.success(s("events_create_booth_settings.text29"))}await De(),X(null)}catch(a){const r=a,o=t.id?s("events_create_booth_settings.text30"):s("events_create_booth_settings.text31");p.error(`${o}${s("events_create_booth_settings.text32")}: `+(r.message||s("events_create_booth_settings.text22")))}};x.useEffect(()=>{const t=ee.current;if(!t)return;const n=t.getContext("2d");
10n&&(n.clearRect(0,0,t.width,t.height),qa(n))},[G,b,Ke,se,Ye,Ue,v,F]);const Zs=t=>{if(t.override_booth_price&&t.override_booth_price>0)return t.override_booth_price;const n=new Date,r=new Date(n.toLocaleString("en-US",{timeZone:"Asia/Taipei"})).toISOString().split("T")[0],o=J.filter(c=>r>=c.start_date&&r<=c.end_date?c.target_areas&&c.target_areas.length>0?t.area?c.target_areas.includes(t.area):!1:!0:!1);o.sort((c,d)=>{const _=c.target_areas&&c.target_areas.length>0?1:0;return(d.target_areas&&d.target_areas.length>0?1:0)-_});const i=o[0],l=N.find(c=>c.id===t.event_booth_type_id);if(i){const c=(l==null?void 0:l.type_code)||"small",d=i.prices[c];if(d&&d>0)return d}return(l==null?void 0:l.default_price)||0},qa=t=>{v.forEach((a,r)=>{a.width&&a.height&&(t.save(),t.fillStyle=`${a.color}0D`,t.fillRect(a.x,a.y,a.width,a.height),t.strokeStyle=F?a.color:`${a.color}40`,t.lineWidth=F?2:1,F?(t.setLineDash([5,5]),t.strokeRect(a.x,a.y,a.width,a.height),t.setLineDash([]),t.fillStyle=a.color,t.beginPath(),t.moveTo(a.x+a.width,a.y+a.height),t.lineTo(a.x+a.width-16,a.y+a.height),t.lineTo(a.x+a.width,a.y+a.height-16),t.closePath(),t.fill(),t.fillStyle=`${a.color}30`,t.beginPath(),t.arc(a.x+a.width/2,a.y+a.height/2,20,0,Math.PI*2),t.fill(),t.fillStyle=a.color,t.font="14px Inter, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("â¥",a.x+a.width/2,a.y+a.height/2)):t.strokeRect(a.x,a.y,a.width,a.height),t.setLineDash([]),t.fillStyle=a.color,t.font="bold 16px Inter, sans-serif",t.textAlign="left",t.textBaseline="bottom",t.fillText(a.name,a.x+8,a.y-8),t.restore())});const n={};if(v.forEach(a=>{n[a.name]=a.color}),b.forEach(a=>{const r=Ke===a.id,o=se.has(a.id),i=n[a.area]||"#6b7280",l=r||o;t.shadowColor="rgba(0, 0, 0, 0.1)",t.shadowBlur=l?15:5,t.shadowOffsetX=2,t.shadowOffsetY=2;const c=a.opacity??1,d=Math.round((l?.6:.3)*c*255).toString(16).padStart(2,"0");t.fillStyle=`${i}${d}`,t.roundRect?(t.beginPath(),t.roundRect(a.x,a.y,a.width,a.height,8),t.fill()):t.fillRect(a.x,a.y,a.width,a.height),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0,l?(t.strokeStyle="#fff",t.lineWidth=3,t.beginPath(),t.roundRect?t.roundRect(a.x,a.y,a.width,a.height,8):t.rect(a.x,a.y,a.width,a.height),t.stroke(),t.strokeStyle="#000",t.lineWidth=1,t.beginPath(),t.roundRect?t.roundRect(a.x-1,a.y-1,a.width+2,a.height+2,9):t.rect(a.x,a.y,a.width,a.height),t.stroke()):(t.strokeStyle="rgba(255,255,255,0.5)",t.lineWidth=1,t.beginPath(),t.roundRect?t.roundRect(a.x,a.y,a.width,a.height,8):t.rect(a.x,a.y,a.width,a.height),t.stroke()),t.fillStyle="#fff",t.textAlign="center",t.textBaseline="middle",t.shadowColor="rgba(0,0,0,0.5)",t.shadowBlur=2,t.font=l?"bold 14px Inter, sans-serif":"bold 12px Inter, sans-serif";const _=a.y+a.height/2-8;t.fillText(a.name,a.x+a.width/2,_),t.font=l?"600 11px Inter, sans-serif":"600 10px Inter, sans-serif";const m=a.y+a.height/2+10,g=Zs(a),y=g>0?`$${g.toLocaleString()}`:"-";t.fillText(y,a.x+a.width/2,m),t.shadowColor="transparent"}),Ye&&ge&&Ue){const a=Math.min(ge.x,Ue.x),r=Math.min(ge.y,Ue.y),o=Math.abs(Ue.x-ge.x),i=Math.abs(Ue.y-ge.y);t.save(),t.fillStyle="rgba(59, 130, 246, 0.1)",t.strokeStyle="rgba(59, 130, 246, 0.5)",t.lineWidth=1,t.setLineDash([4,2]),t.fillRect(a,r,o,i),t.strokeRect(a,r,o,i),t.restore()}},Gs=x.useCallback((t,n)=>{for(let a=b.length-1;a>=0;a--){const r=b[a];if(t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height)return r}},[b]),Qa=t=>{const n=ee.current;if(!n)return;const a=n.getBoundingClientRect(),r=t.clientX-a.left,o=t.clientY-a.top,i=Gs(r,o);i&&(ie({...i}),ot(!0))},en=t=>{t.preventDefault();const n=ee.current;if(!n)return;const a=n.getBoundingClientRect(),r=t.clientX-a.left,o=t.clientY-a.top,i=Gs(r,o);ht(i?{x:t.clientX,y:t.clientY,booth:i}:null)};x.useEffect(()=>{const t=()=>ht(null);return document.addEventListener("click",t),()=>document.removeEventListener("click",t)},[]);const tn=t=>{const n=ee.current;if(!n)return;const a=n.getBoundingClientRect(),r=t.clientX-a.left,o=t.clientY-a.top,i=[...b].reverse().find(l=>r>=l.x&&r<=l.x+l.width&&o>=l.y&&o<=l.y+l.height);if(!(i&&!F)){if(i&&F){for(let l=v.length-1;l>=0;l--){const c=v[l],d=c.x+c.width-20,_=c.y+c.height-20;if(r>=d&&r<=c.x+c.width&&o>=_&&o<=c.y+c.height){de(),We({isDragging:!0,areaIndex:l,mode:"resize",startMouseX:r,startMouseY:o,initialArea:{x:c.x,y:c.y,width:c.width,height:c.height}});return}}for(let l=v.length-1;l>=0;l--){const c=v[l],d=c.x+c.width/2,_=c.y+c.height/2,m=20;if(r>=d-m&&r<=d+m&&o>=_-m&&o<=_+m){de(),We({isDragging:!0,areaIndex:l,mode:"move",startMouseX:r,startMouseY:o,initialArea:{x:c.x,y:c.y,width:c.width,height:c.height}});return}}}}if(F&&!i){for(let l=v.length-1;l>=0;l--){const c=v[l],d=c.x+c.width-20,_=c.y+c.height-20;if(r>=d&&r<=c.x+c.width&&o>=_&&o<=c.y+c.height){de(),We({isDragging:!0,areaIndex:l,mode:"resize",startMouseX:r,startMouseY:o,initialArea:{x:c.x,y:c.y,width:c.width,height:c.height}});return}}for(let l=v.length-1;l>=0;l--){const c=v[l],d=c.x,_=c.x+Math.min(c.width,200),m=c.y-28,g=c.y;if(r>=d&&r<=_&&o>=m&&o<=g){de(),We({isDragging:!0,areaIndex:l,mode:"move",startMouseX:r,startMouseY:o,initialArea:{x:c.x,y:c.y,width:c.width,height:c.height}});return}}for(let l=v.length-1;l>=0;l--){const c=v[l],d=c.x+c.width/2,_=c.y+c.height/2,m=20;if(r>=d-m&&r<=d+m&&o>=_-m&&o<=_+m){de(),We({isDragging:!0,areaIndex:l,mode:"move",startMouseX:r,startMouseY:o,initialArea:{x:c.x,y:c.y,width:c.width,height:c.height}});return}}}if(Qe==="select"||Qe==="multi-select")if(i){const l=t.shiftKey,c=se.has(i.id);let d=new Set(se);
10l?c?d.delete(i.id):d.add(i.id):c||(d=new Set([i.id])),Ne(d),d.size===1?qe(Array.from(d)[0]):qe(null);const _={};d.forEach(m=>{const g=b.find(y=>y.id===m);g&&(_[m]={x:g.x,y:g.y})}),de(),Rs({isDragging:!0,startMouseX:r,startMouseY:o,initialPositions:_})}else t.shiftKey||(Ne(new Set),qe(null)),Xs(!0),Ws({x:r,y:o}),rs({x:r,y:o});else{const l=N[0],c=(l==null?void 0:l.display_width)||60,d=(l==null?void 0:l.display_height)||60,_=Math.round(r/20)*20,m=Math.round(o/20)*20,g=Math.max(0,Math.min(_,ae-c)),y=Math.max(0,Math.min(m,ne-d));if(b.some(u=>!(g+c<=u.x||g>=u.x+u.width||y+d<=u.y||y>=u.y+u.height))){p.error(s("events_create_booth_settings.text42"));return}const h={id:`draft-${Date.now()}`,name:`${E.charAt(0)}${String(at).padStart(2,"0")}`,x:g,y,width:c,height:d,area:E,override_booth_price:js,event_booth_type_id:l==null?void 0:l.id};R([...b,h]),Me(at+1)}},sn=t=>{const n=ee.current;if(!n)return;const a=n.getBoundingClientRect(),r=t.clientX-a.left,o=t.clientY-a.top;if(F&&!re.isDragging&&!_e.isDragging&&!Ye){let i=!1;for(let l=v.length-1;l>=0;l--){const c=v[l],d=c.x+c.width-20,_=c.y+c.height-20;if(r>=d&&r<=c.x+c.width&&o>=_&&o<=c.y+c.height){n.style.cursor="nwse-resize",i=!0;break}const m=c.x,g=c.x+Math.min(c.width,200),y=c.y-28,$=c.y;if(r>=m&&r<=g&&o>=y&&o<=$){n.style.cursor="move",i=!0;break}if(r>=c.x&&r<=c.x+c.width&&o>=c.y&&o<=c.y+c.height){n.style.cursor="move",i=!0;break}}i||(n.style.cursor="default")}else!F&&!_e.isDragging&&!Ye&&(n.style.cursor=Qe==="draw"?"crosshair":"default");if(re.isDragging&&re.areaIndex!==null&&re.initialArea){const i=r-re.startMouseX,l=o-re.startMouseY;U(c=>{const d=[...c],_=d[re.areaIndex],m=re.initialArea;if(re.mode==="move"){const g=m.x+i,y=m.y+l,$=_.width||100,h=_.height||50;_.x=Math.max(0,Math.min(g,ae-$)),_.y=Math.max(0,Math.min(y,ne-h))}else if(re.mode==="resize"){const g=m.width+i,y=m.height+l;_.width=Math.max(60,Math.min(g,ae-_.x)),_.height=Math.max(40,Math.min(y,ne-_.y))}return d});return}if(Ye&&ge){rs({x:r,y:o});const i=Math.min(ge.x,r),l=Math.min(ge.y,o),c=Math.max(ge.x,r),d=Math.max(ge.y,o),_=new Set;b.forEach(m=>{!(m.x>c||m.x+m.width<i||m.y>d||m.y+m.height<l)&&_.add(m.id)}),Ne(_);return}if(_e.isDragging){const i=r-_e.startMouseX,l=o-_e.startMouseY,c=new Set(Object.keys(_e.initialPositions));R(d=>{const _=d.map(f=>{const k=_e.initialPositions[f.id];if(k){let T=k.x+i,O=k.y+l;T=Math.round(T/10)*10,O=Math.round(O/10)*10;let W=Math.max(ae-f.width,f.width),me=Math.max(ne-f.height,f.height);if(!F&&f.area){const H=v.find(Se=>Se.name===f.area);H&&H.width&&H.height&&(H.x,H.y,W=H.x+H.width-f.width,me=H.y+H.height-f.height)}return T=Math.max(-f.width/2,Math.min(T,W)),O=Math.max(-f.height/2,Math.min(O,me)),{...f,x:T,y:O,isMoving:!0}}return{...f,isMoving:!1}}),m=_.filter(f=>!c.has(f.id)),g=_.filter(f=>c.has(f.id)),y=nn(g,m);is(y.guides);const $=_.map(f=>c.has(f.id)?{...f,x:f.x+y.snapX,y:f.y+y.snapY}:f),h=$.filter(f=>c.has(f.id)),u=$.filter(f=>!c.has(f.id));let I=!1;for(const f of h){for(const k of u)if(!(f.x+f.width<=k.x||f.x>=k.x+k.width||f.y+f.height<=k.y||f.y>=k.y+k.height)){I=!0;break}if(I)break}return I?(is({horizontal:[],vertical:[]}),d):$.map(({isMoving:f,...k})=>k)})}},an=t=>{const n=t.x+t.width/2,a=t.y+t.height/2;for(const r of v)if(r.width&&r.height&&n>=r.x&&n<=r.x+r.width&&a>=r.y&&a<=r.y+r.height)return r.name;return null},nn=(t,n)=>{let a=0,r=0;const o=[],i=[];if(t.length===0||n.length===0)return{snapX:0,snapY:0,guides:{horizontal:[],vertical:[]}};const l={left:Math.min(...t.map(c=>c.x)),right:Math.max(...t.map(c=>c.x+c.width)),top:Math.min(...t.map(c=>c.y)),bottom:Math.max(...t.map(c=>c.y+c.height)),centerX:0,centerY:0};l.centerX=(l.left+l.right)/2,l.centerY=(l.top+l.bottom)/2;for(const c of n){const d={left:c.x,right:c.x+c.width,top:c.y,bottom:c.y+c.height,centerX:c.x+c.width/2,centerY:c.y+c.height/2},_=[{moving:l.left,static:d.left},{moving:l.left,static:d.right},{moving:l.right,static:d.left},{moving:l.right,static:d.right},{moving:l.centerX,static:d.centerX}];for(const g of _){const y=g.static-g.moving;Math.abs(y)<=Os&&((a===0||Math.abs(y)<Math.abs(a))&&(a=y),i.includes(g.static)||i.push(g.static))}const m=[{moving:l.top,static:d.top},{moving:l.top,static:d.bottom}
10,{moving:l.bottom,static:d.top},{moving:l.bottom,static:d.bottom},{moving:l.centerY,static:d.centerY}];for(const g of m){const y=g.static-g.moving;Math.abs(y)<=Os&&((r===0||Math.abs(y)<Math.abs(r))&&(r=y),o.includes(g.static)||o.push(g.static))}}return{snapX:a,snapY:r,guides:{horizontal:o,vertical:i}}},Ks=()=>{if(re.isDragging&&We({isDragging:!1,areaIndex:null,mode:null,startMouseX:0,startMouseY:0,initialArea:null}),_e.isDragging){is({horizontal:[],vertical:[]});const t=Object.keys(_e.initialPositions);t.length>0&&R(n=>n.map(a=>{if(t.includes(a.id)){const r=an(a);if(r&&r!==a.area)return{...a,area:r}}return a})),Rs({isDragging:!1,startMouseX:0,startMouseY:0,initialPositions:{}})}Ye&&(Xs(!1),Ws(null),rs(null))},rn=()=>{Ks()},on=()=>{const t=Ss;if(t<=0){p.error(s("events_create_booth_settings.text47"));return}const n=100;if(t>n){p.error(`${s("events_create_booth_settings.text48")} ${n} ${s("events_create_booth_settings.text49")}ï¼${s("events_create_booth_settings.text50")}`);return}if(!E||E.trim()===""){p.error(`${s("events_create_booth_settings.text51")}ï¼${s("events_create_booth_settings.text52")}ã`);return}de();const a=[];let r,o,i;fe?(r=fe.display_width||60,o=fe.display_height||60,i=fe.id):(r=60,o=60,i=void 0);const l=d=>{switch($e){case"area-number":{const m=b.filter(g=>g.area===E).length+1;return`${E}-${String(m+d).padStart(2,"0")}`}case"type-global":{const _=((fe==null?void 0:fe.type_code)||"B").charAt(0).toUpperCase(),g=b.filter(y=>y.event_booth_type_id===i).length+1;return`${_}${String(g+d).padStart(2,"0")}`}case"custom":return`${Cs||s("events_create_booth_settings.text53")}-${String(at+d).padStart(2,"0")}`;default:return`${E.charAt(0)}${String(at+d).padStart(2,"0")}`}};for(let d=0;d<t;d++)a.push({id:`draft-${Date.now()}-${d}`,name:l(d),x:0,y:0,width:r,height:o,area:E,override_booth_price:js,event_booth_type_id:i});let c=[...b,...a];if(Zt){const d=v.find(_=>_.name===E);if(d){const m=(d.x||0)+20,g=(d.y||0)+40,y=d.width||700,$=d.height||500,h=r+40,u=o+60;if((d.width||0)<h||(d.height||0)<u){p.error(`${s("events_create_booth_settings.text54")}ã${E}ã${s("events_create_booth_settings.text55")}ï¼ 11${s("events_create_booth_settings.text56")} ${h}Ã${u} px 12${s("events_create_booth_settings.text57")} ${d.width||0}Ã${d.height||0} px`),ke(!1);return}const I=Math.floor((y-40)/(r+10)),f=Math.floor(($-60)/(o+10)),k=Math.max(1,I*f),T=b.filter(W=>W.area===E),O=k-T.length;if(O<=0){p.error(`${s("events_create_booth_settings.text54")}ã${E}ã${s("events_create_booth_settings.text58")}ï¼ 13${s("events_create_booth_settings.text59")} ${T.length} ${s("events_create_booth_settings.text61")}ï¼${s("events_create_booth_settings.text60")} ${k} ${s("events_create_booth_settings.text61")} 14${s("events_create_booth_settings.text62")}`),ke(!1);return}t>O&&(p.warning(`${s("events_create_booth_settings.text63")}ï¼${s("events_create_booth_settings.text64")} ${O} ${s("events_create_booth_settings.text49")}ï¼${s("events_create_booth_settings.text65")} ${t} ${s("events_create_booth_settings.text61")}ï¼`),a.splice(O)),a.forEach(W=>{let me=!1,H=0,Se=0;const un=m+y-W.width-20;for(;!me;){if(H>50){W.x=m,W.y=g+H*(W.height+10),me=!0;break}const Lt=m+Se*(W.width+10),ds=g+H*(W.height+10);if(Lt>un){Se=0,H++;continue}[...T,...a.filter(ye=>ye.id!==W.id&&ye.x!==0)].some(ye=>!(Lt+W.width<=ye.x||Lt>=ye.x+ye.width||ds+W.height<=ye.y||ds>=ye.y+ye.height))?Se++:(W.x=Lt,W.y=ds,me=!0)}}),c=[...b,...a]}else{p.error(`${s("events_create_booth_settings.text66")}ã${E}ãï¼${s("events_create_booth_settings.text67")}`);return}}else{const m=(h,u,I,f,k)=>k.some(T=>!(h+I<=T.x||h>=T.x+T.width||u+f<=T.y||u>=T.y+T.height)),g=Math.max(...b.map(h=>h.y+h.height),50)+20,y=50,$=[...b];a.forEach((h,u)=>{let I=!1,f=0;const k=100,T=Math.max(h.width,h.height);let O=u%8,W=Math.floor(u/8),me=y+O*(T+10),H=g+W*(T+10);for(;!I&&f<k;)m(me,H,h.width,h.height,$)?(O++,O>=8&&(O=0,W++),me=y+O*(T+10),H=g+W*(T+10)):(h.x=me,h.y=H,$.push(h),I=!0),f++;I||(h.x=y,h.y=Math.max(...$.map(Se=>Se.y+Se.height),g)+10,$.push(h))}),c=$}R(c),Me(at+a.length),p.success(`${s("events_create_booth_settings.text68")} ${a.length} ${s("events_create_booth_settings.text49")}ï¼${s("events_create_booth_settings.text69")} ${c.length} ${s("events_create_booth_settings.text61")}ï¼`),ke(!1)},os=async(t,n=!1)=>{n&&(R([]),Me(1),p.info(s("events_create_booth_settings.text70")));const a=await new Promise(o=>{const i=new FileReader;i.onload=l=>{var c;return o((c=l.target)==null?void 0:c.result)},i.readAsDataURL(t)}),r=new window.Image;r.onload=()=>
14{const o=r.naturalWidth||r.width,i=r.naturalHeight||r.height;ze({width:o,height:i}),Le(a),xt(1),p.success(`${s("events_create_booth_settings.text71")}: ${o}Ã${i}px`)},r.src=a,vs(!0);try{const o=new FormData;o.append("file",t);const i=localStorage.getItem("access_token"),l={};i&&(l.Authorization=`Bearer ${i}`);const c=await fetch("https://apigo.futuresignreg.com/api/v1/images/upload-image/",{method:"POST",headers:l,body:o});if(!c.ok)throw new Error("Upload failed");const d=await c.json();Ee(d.url),p.success(s("events_create_booth_settings.text72"))}catch{p.error(s("events_create_booth_settings.text73"))}finally{vs(!1)}},cn=async t=>{var a;const n=(a=t.target.files)==null?void 0:a[0];if(n){if(t.target.value="",b.length>0){rt(n),it(!0);return}await os(n,!1)}},ln=async()=>{Ct&&await os(Ct,!1),it(!1),rt(null)},dn=async()=>{Ct&&await os(Ct,!0),it(!1),rt(null)},hn=async()=>{if(!A)return;if(!A.area||A.area.trim()===""){p.error(s("events_create_booth_settings.area_required")||"è«å
è¨å®æ¤ä½åå");return}const t=b.find(o=>o.id===A.id),n=t&&t.area!==A.area,a={...A};if(n){const o=v.find(i=>i.name===A.area);o&&o.width&&o.height&&(a.x=o.x+20,a.y=o.y+20,a.x+a.width>o.x+o.width&&(a.x=o.x+o.width-a.width-10),a.y+a.height>o.y+o.height&&(a.y=o.y+o.height-a.height-10))}if(!a.id.startsWith("temp-")&&!a.id.startsWith("draft-"))try{const o={name:a.name,area:a.area,override_booth_price:a.override_booth_price,coordinate:`x:${Math.round(a.x/L)},y:${Math.round(a.y/L)}`,event_booth_type_id:a.event_booth_type_id||null,map_id:P||null,display_width:a.display_width||null,display_height:a.display_height||null,opacity:a.opacity??1};a.pass_code!==null&&(o.pass_code=a.pass_code===void 0?"":a.pass_code),await C.patch(`/booths/${a.id}`,o)}catch(o){const i=o;console.error("å²åæ¤ä½å¤±æ:",{status:i==null?void 0:i.status,detail:i==null?void 0:i.detail,message:i==null?void 0:i.message,boothId:a.id}),p.error((i==null?void 0:i.message)||s("events_create_booth_settings.text23"));return}R(o=>o.map(i=>i.id===a.id?a:i)),ot(!1),ie(null),p.success(s(n?"events_create_booth_settings.text74":"events_create_booth_settings.text75"))},xn=()=>{A&&(de(),R(t=>t.filter(n=>n.id!==A.id)),Ne(t=>{const n=new Set(t);return n.delete(A.id),n}),ot(!1),ie(null),qe(null),p.success(s("events_create_booth_settings.deleted_booth")))},_n=async()=>!G||!Y?null:new Promise(t=>{const n=new window.Image;n.crossOrigin="anonymous",n.onload=()=>{const a=document.createElement("canvas");a.width=Y.width,a.height=Y.height;const r=a.getContext("2d");if(!r){t(null);return}r.drawImage(n,0,0,Y.width,Y.height);const o={};v.forEach(i=>{i.width&&i.height&&(o[i.name]=i.color,r.save(),r.fillStyle=`${i.color}15`,r.fillRect(i.x,i.y,i.width,i.height),r.strokeStyle=`${i.color}60`,r.lineWidth=2,r.strokeRect(i.x,i.y,i.width,i.height),r.fillStyle=i.color,r.font="bold 16px Inter, sans-serif",r.textAlign="left",r.textBaseline="bottom",r.fillText(i.name,i.x+8,i.y-8),r.restore())}),b.forEach(i=>{const l=o[i.area]||"#6b7280";r.save(),r.fillStyle=`${l}60`,r.roundRect?(r.beginPath(),r.roundRect(i.x,i.y,i.width,i.height,6),r.fill(),r.strokeStyle=l,r.lineWidth=2,r.stroke()):(r.fillRect(i.x,i.y,i.width,i.height),r.strokeStyle=l,r.lineWidth=2,r.strokeRect(i.x,i.y,i.width,i.height)),r.fillStyle="#ffffff",r.font="bold 11px Inter, sans-serif",r.textAlign="center",r.textBaseline="middle",r.shadowColor="rgba(0, 0, 0, 0.5)",r.shadowBlur=2,r.fillText(i.name,i.x+i.width/2,i.y+i.height/2),r.restore()}),a.toBlob(i=>{t(i)},"image/png",1)},n.onerror=()=>{t(null)},n.src=G}),gn=async()=>{var t;if(!j||!G){p.error(s("events_create_booth_settings.no_map_to_save")||"è«å
ä¸å³åºå");return}if(!ue){p.error(s("events_create_booth_settings.map_uploading")||"åºåæ£å¨ä¸å³ä¸ï¼è«ç¨å");return}ve.current&&(clearTimeout(ve.current),ve.current=null),$t(!0);try{let n=ue;const a=await _n();if(a)try{const i=new FormData;i.append("file",a,`booth-map-${j}.png`);const l=localStorage.getItem("access_token"),c={};l&&(c.Authorization=`Bearer ${l}`);const d=await fetch("https://apigo.futuresignreg.com/api/v1/images/upload-image/",{method:"POST",headers:c,body:i});d.ok&&(n=(await d.json()).url)}catch{}const r={areas:v,zoomLevel:L,mapImageSize:Y,originalMapUrl:ue},o=P||((t=be.find(i=>!i.deleted_at))==null?void 0:t.id);if(o){const i={event_id:j,map_url:n,config:JSON.stringify(r),booth_count:b.length};ce.trim()&&(i.name=ce.trim()),await C.patch(`/maps/${o}`,i),P||we(o),ce.trim()&&et(l=>l.map(c=>c.id===o?{...c,name:ce.trim()}:c))}else{const i=ce.trim()||(z==null?void 0:z.name)||"Map",l=await C.post("/maps",{event_id:j,name:i,map_url:n,config:JSON.stringify(r),status:"active",booth_count:b.length});l!=null&&l.id&&(we(l.id),st(i))}p.success(s("events_create_booth_settings.map_saved_success")||"åºåå·²å²å")}catch{p.error(s("events_create_booth_settings.map_save_failed")||"åºåå²å失æ")}finally{$t(!1)}},cs=async()=>{var r;if(!j)return;const t=new Set,n=new Set,a=v.map(o=>o.name&&t.has(o.name)?(n.add(o.name),{...o,name:""}):(o.name&&t.add(o.name),o));if(n.size>0){U(a),p.error(`${s("events_create_booth_settings.duplicate_area_names")}ï¼${[...n].join("ã")}`);return}$t(!0);try{const o={areas:v,zoomLevel:L,mapImageSize:Y,originalMapUrl:ue},i=P||((r=be.find(l=>!l.deleted_at))==null?void 0:r.id);if(i)await C.patch(`/maps/${i}`,{event_id:j,map_url:ue||null,config:JSON.stringify(o),booth_count:b.length}),P||we(i);else{const l=(z==null?void 0:z.name)||"Map",c=await C.post("/maps",{event_id:j,name:l,map_url:ue||null,config:JSON.stringify(o),status:"active",booth_count:b.length});c!=null&&c.id&&we(c.id)}p.success(s("events_create_booth_settings.area_settings_saved")||"ååè¨å®å·²å²å")}catch(o){console.error("Failed to save area settings:",o),p.error((o==null?void 0:o.detail)||s("events_create_booth_settings.text305")||"å²å失æ")}finally{$t(!1)}},ls=x.useCallback(()=>{ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{cs()},2e3)},[cs]),mn=async()=>{var t;if(j){ve.current&&(clearTimeout(ve.current),ve.current=null),wt(!0),te(null);try{let n=P||((t=be.find(h=>!h.deleted_at))==null?void 0:t.id);const a=async h=>{const u={areas:h,zoomLevel:L,mapImageSize:Y,originalMapUrl:ue};if(n){await C.patch(`/maps/${n}`,{event_id:j,map_url:ue||null,config:JSON.stringify(u),booth_count:b.length}),P||we(n);return}const I=(z==null?void 0:z.name)||"Map",f=await C.post("/maps",{event_id:j,name:I,map_url:ue||null,config:JSON.stringify(u),status:"active",booth_count:b.length});f!=null&&f.id&&(n=f.id,we(f.id))};await a(v);const r=new Set(oe.map(h=>h.id)),o=new Set(b.map(h=>h.id)),i=(h,u)=>{const I=`x:${Math.round(h.x/L)},y:${Math.round(h.y/L)}`,f=u.coordinate||"";return h.name!==u.name||h.area!==u.area||h.override_booth_price!==u.override_booth_price||I!==f||(h.event_booth_type_id||null)!==(u.event_booth_type_id||null)||(h.display_width||null)!==(u.display_width||null)||(h.display_height||null)!==(u.display_height||null)},l=new Map(oe.map(h=>[h.id,h])),c=b.filter(h=>r.has(h.id)).filter(h=>{const u=l.get(h.id);return u&&i(h,u)}),d=b.filter(h=>!r.has(h.id)),_=oe.filter(h=>!o.has(h.id)),m=20;let g=0;const y=c.length+d.length+_.length;if(c.length>0){te({current:g,total:y,phase:`æ´æ°æ¤ä½ (${c.length} å)`});const h={booths:c.map(u=>({id:u.id,name:u.name,area:u.area,override_booth_price:u.override_booth_price,coordinate:`x:${Math.round(u.x/L)},y:${Math.round(u.y/L)}`,event_booth_type_id:u.event_booth_type_id||null,map_id:n||null,display_width:u.display_width||null,display_height:u.display_height||null}))};try{const u=await C.patch("/booths/bulk",h);u.failed_count>0&&console.warn(`é¨åæ¤ä½æ´æ°å¤±æï¼${u.failed_count} å`,u.failed_booth_ids)}catch(u){console.error("æ¹éæ´æ°æ¤ä½å¤±æ:",u)}g+=c.length}const $=new Map;if(d.length>0){for(let h=0;h<d.length;h+=m){const u=d.slice(h,h+m);te({current:g+h,total:y,phase:`å»ºç«æ¤ä½ (${h+1}-${Math.min(h+m,d.length)}/${d.length})`});const I=u.map(k=>{const T={event_id:j,name:k.name,area:k.area,override_booth_price:k.override_booth_price,currency:"TWD",base_wattage:0,coordinate:`x:${Math.round(k.x/L)},y:${Math.round(k.y/L)}`,status:!0,booking_status:"available",pass_code:k.pass_code||null,event_booth_type_id:k.event_booth_type_id||null,map_id:n||null,display_width:k.display_width||null,display_height:k.display_height||null};return C.post("/booths",T).catch(O=>{throw O})});
14(await Promise.all(I)).forEach((k,T)=>{k!=null&&k.id&&$.set(u[T].id,k.id)})}g+=d.length}if($.size>0){const h=v.map(u=>({...u,unlocked_booth_ids:(u.unlocked_booth_ids||[]).map(I=>$.get(I)||I)}));U(h),await a(h)}if(_.length>0)for(let h=0;h<_.length;h+=m){const u=_.slice(h,h+m);te({current:g+h,total:y,phase:`åªé¤æ¤ä½ (${h+1}-${Math.min(h+m,_.length)}/${_.length})`});const I=u.map(f=>C.delete(`/booths/${f.id}`).catch(()=>null));await Promise.all(I)}te({current:1,total:1,phase:s("events_create_booth_settings.text82")}),p.success(s("events_create_booth_settings.booths_saved_success")),setTimeout(()=>{Js(),te(null)},1e3)}catch(n){p.error(s("events_create_booth_settings.text23"),{description:(n==null?void 0:n.detail)||s("events_create_booth_settings.text89")}),te(null)}finally{wt(!1)}}},pn=()=>{if(E){const t=zs(E);t?(ct(t),lt(!0)):lt(!1)}else lt(!1);ke(!0)};return Ge||xa?e.jsxs("div",{className:"min-h-screen flex flex-col bg-white",children:[e.jsx(ca,{title:s("events_create_booth_settings.text90"),backTo:"/my-events"}),e.jsx("main",{className:"flex-1 flex items-center justify-center",children:e.jsxs("p",{className:"text-gray-500",children:[s("events_create_booth_settings.text91"),"..."]})})]}):!pe||!Pe||!j?null:e.jsxs("div",{className:"flex h-screen bg-zinc-50 overflow-hidden font-sans",children:[e.jsxs("aside",{className:"w-100 bg-white border-r border-zinc-200 flex flex-col z-10 flex-shrink-0",children:[e.jsxs("div",{className:"h-16 flex items-center justify-between px-5 border-b border-zinc-100 bg-white",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(sa,{to:"/my-events",className:"flex items-center justify-center w-8 h-8 rounded-md bg-gray-100 hover:bg-gray-200 text-gray-600 transition-colors",title:s("events_create_booth_settings.text92"),children:e.jsx(fn,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2 text-[#1c1c1a]",children:[e.jsx(ps,{className:"h-6 w-6 fill-current"}),e.jsx("span",{className:"font-bold text-lg text-gray-800 tracking-tight",children:s("events_create_booth_settings.text93")})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(Et,{children:[e.jsx(jn,{asChild:!0,children:e.jsx("button",{className:"p-2 text-gray-400 hover:text-[#1c1c1a] hover:bg-amber-50 rounded-md transition-colors",title:s("events_create_booth_settings.text94"),children:e.jsx(na,{className:"h-5 w-5"})})}),e.jsxs(Rt,{className:"max-w-4xl max-h-[90vh] overflow-y-auto bg-zinc-950 text-zinc-100 border-zinc-800 p-0 gap-0",children:[e.jsx("div",{className:"p-6 border-b border-zinc-800 bg-zinc-900/50",children:e.jsxs(Ot,{children:[e.jsxs(Xt,{className:"text-xl text-[#1c1c1a] flex items-center gap-2",children:[e.jsx(na,{className:"h-5 w-5"}),s("events_create_booth_settings.text95")]}),e.jsx(xs,{className:"text-zinc-400",children:"Booth Layout & Specifications Guide"})]})}),e.jsx("div",{className:"p-6",children:e.jsxs(In,{defaultValue:"design",className:"w-full",children:[e.jsxs(Pn,{className:"grid w-full grid-cols-3 bg-zinc-900 border border-zinc-800 mb-6",children:[e.jsxs(gs,{value:"design",className:"data-[state=active]:bg-[#1c1c1a] data-[state=active]:text-black text-zinc-400",children:[e.jsx(Bn,{className:"h-4 w-4 mr-2"}),s("events_create_booth_settings.text96")]}),e.jsxs(gs,{value:"specs",className:"data-[state=active]:bg-[#1c1c1a] data-[state=active]:text-black text-zinc-400",children:[e.jsx(ia,{className:"h-4 w-4 mr-2"}),s("events_create_booth_settings.text97")]}),e.jsxs(gs,{value:"usage",className:"data-[state=active]:bg-[#1c1c1a] data-[state=active]:text-black text-zinc-400",children:[e.jsx(Ln,{className:"h-4 w-4 mr-2"}),s("events_create_booth_settings.text98")]})]}),e.jsx(ms,{value:"design",className:"space-y-6 animate-in fade-in slide-in-from-bottom-2",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md overflow-hidden border border-zinc-700 bg-black/50 cursor-zoom-in",onClick:()=>Ms(!0),children:e.jsx("img",{src:"/map-guide-example.png",alt:"Map Example",className:"w-full h-auto object-contain transition-transform duration-500"})}),e.jsxs("p",{className:"text-xs text-center text-zinc-500",children:[s("events_create_booth_settings.text99")," (",s("events_create_booth_settings.text100"),")"]}),Sa&&e.jsxs("div",{className:"fixed inset-0 z-[9999] bg-black/95 backdrop-blur-sm flex items-center justify-center p-4 cursor-zoom-out animate-in fade-in duration-200",onClick:()=>Ms(!1),children:[e.jsx("img",{src:"/map-guide-example.png",alt:"Map Example Full",className:"w-full h-full object-contain rounded-sm"}),e.jsx("button",{className:"absolute top-5 right-5 text-white/70 hover:text-white bg-white p-2 rounded-full",children:e.jsx(He,{className:"h-6 w-6"})}),e.jsx("div",{className:"absolute bottom-5 left-0 right-0 text-center text-white/50 text-sm",children:s("events_create_booth_settings.text101")})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-zinc-900/50 p-4 rounded-md border border-zinc-800",children:[e.jsxs("h3",{className:"text-[#1c1c1a] font-medium mb-3 flex items-center",children:[e.jsx(En,{className:"h-4 w-4 mr-2"})," ",s("events_create_booth_settings.text102")," (Dos)"]}),e.jsxs("ul",{className:"space-y-2 text-sm text-zinc-300",children:[e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-green-500",children:"â¢"}),e.jsxs("span",{children:[e.jsxs("b",{children:[s("events_create_booth_settings.text103"),":"]})," ",s("events_create_booth_settings.text104"),"ã"]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-green-500",children:"â¢"}),e.jsxs("span",{children:[e.jsxs("b",{children:[s("events_create_booth_settings.text105"),":"]})," ",s("events_create_booth_settings.text106")," 2000pxï¼",s("events_create_booth_settings.text107"),"ã"]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-green-500",children:"â¢"}),e.jsxs("span",{children:[e.jsxs("b",{children:[s("events_create_booth_settings.text108"),":"]})," ",s("events_create_booth_settings.text109"),"ï¼",s("events_create_booth_settings.text110"),"ã"]})]})]})]}),e.jsxs("div",{className:"bg-zinc-900/50 p-4 rounded-md border border-zinc-800",children:[e.jsxs("h3",{className:"text-red-400 font-medium mb-3 flex items-center",children:[e.jsx(Rn,{className:"h-4 w-4 mr-2"})," ",s("events_create_booth_settings.text111")," (Don'ts)"]}
14),e.jsx("ul",{className:"space-y-2 text-sm text-zinc-300",children:e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-red-500",children:"â¢"}),e.jsxs("span",{children:[e.jsxs("b",{children:[s("events_create_booth_settings.text112"),":"]})," ",s("events_create_booth_settings.text113"),"ã"]})]})})]})]})]})}),e.jsxs(ms,{value:"specs",className:"space-y-6 animate-in fade-in slide-in-from-bottom-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-sm font-medium text-zinc-400 ",children:s("events_create_booth_settings.text114")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-zinc-500",children:s("events_create_booth_settings.text115")}),e.jsxs(D,{variant:"ghost",size:"sm",className:"h-6 text-xs text-[#1c1c1a] hover:text-[#1c1c1a] hover:bg-[#1c1c1a]/10 px-2",onClick:()=>{X({id:"",event_id:j||"",type_code:"",type_name:"",description:null,width:null,depth:null,height:null,display_width:60,display_height:60,base_wattage:0,pricings:[]}),K(!0)},children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"})," ",s("events_create_booth_settings.text116")]})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:N.length===0?e.jsxs("div",{className:"col-span-2 text-center text-zinc-500 py-8",children:[e.jsx("p",{className:"mb-3",children:s("events_create_booth_settings.text117")}),e.jsxs(D,{variant:"outline",size:"sm",className:"border-zinc-700 text-zinc-400 hover:text-white hover:border-[#1c1c1a]",onClick:()=>{X({id:"",event_id:j||"",type_code:"",type_name:"",description:null,width:null,depth:null,height:null,display_width:60,display_height:60,base_wattage:0,pricings:[]}),K(!0)},children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"})," ",s("events_create_booth_settings.text118")]})]}):N.map(t=>e.jsxs("div",{className:"bg-zinc-900 p-4 rounded-md border border-zinc-800 relative overflow-hidden group cursor-pointer hover:border-[#1c1c1a]/50 transition-colors",onClick:()=>{X(t),K(!0)},children:[e.jsx("div",{className:"absolute top-0 right-0 p-2 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx("div",{className:"text-6xl font-black text-white",children:t.type_code==="large"?"L":"S"})}),e.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:t.type_name||t.type_code}),e.jsx("p",{className:"text-[#1c1c1a] text-sm mb-3",children:t.description||(t.type_code==="large"?s("events_create_booth_settings.text20"):s("events_create_booth_settings.text18"))}),e.jsxs("div",{className:"text-2xl font-mono text-zinc-300",children:[t.width||"â","Ã",t.depth||"â","Ã",t.height||"â"]}),e.jsxs("div",{className:"text-xs text-zinc-500 mt-1",children:[s("events_create_booth_settings.text119"),"Ã",s("events_create_booth_settings.text120"),"Ã",s("events_create_booth_settings.text121")," (cm)"]}),e.jsxs("div",{className:"mt-3 pt-3 border-t border-zinc-800 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-zinc-400",children:s("events_create_booth_settings.text122")}),e.jsxs("span",{className:"text-sm font-mono text-zinc-300",children:[t.base_wattage||0," W"]})]}),e.jsx("div",{className:"absolute bottom-2 right-2 text-xs text-zinc-600 opacity-0 group-hover:opacity-100 transition-opacity",children:s("events_create_booth_settings.text123")})]},t.id))}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-sm font-medium text-zinc-400 ",children:[s("events_create_booth_settings.text124")," (Capacity)"]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:v.length===0?e.jsx("div",{className:"col-span-full text-center text-zinc-500 py-4",children:s("events_create_booth_settings.text125")}):v.map(t=>{const n=b.filter(o=>o.area===t.name),a=N.map(o=>({name:o.type_name||o.type_code,count:n.filter(i=>i.event_booth_type_id===o.id).length})).filter(o=>o.count>0),r=n.filter(o=>!o.event_booth_type_id).length;return e.jsxs("div",{className:"bg-zinc-900 p-3 rounded-md border border-zinc-800 flex flex-col justify-between",children:[e.jsxs("span",{className:"text-xs text-zinc-400 mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:t.color}}),t.name]}),e.jsxs("span",{className:"text-sm font-semibold text-zinc-200",children:[a.map((o,i)=>e.jsxs("span",{children:[i>0&&" / ",o.name,": ",o.count]},i)),r>0&&e.jsxs("span",{children:[a.length>0&&" / ",s("events_create_booth_settings.text460"),": ",r]}),a.length===0&&r===0&&"â"]}
14)]},t.name)})})]})]}),e.jsxs(ms,{value:"usage",className:"space-y-4 animate-in fade-in slide-in-from-bottom-2",children:[e.jsx("div",{className:"space-y-3",children:[{step:1,title:`${s("events_create_booth_settings.text126")}ï¼${s("events_create_booth_settings.text127")}ï¼`,desc:`${s("events_create_booth_settings.text128")}ï¼JPG/PNGï¼ï¼${s("events_create_booth_settings.text129")}ã${s("events_create_booth_settings.text130")} 2000px ${s("events_create_booth_settings.text131")}ã`},{step:2,title:s("events_create_booth_settings.text132"),desc:`${s("events_create_booth_settings.text133")}ã${s("events_create_booth_settings.text134")}ã${s("events_create_booth_settings.text135")}ï¼å¦ Asia ZoneãVIPåï¼ï¼${s("events_create_booth_settings.text136")}ã${s("events_create_booth_settings.text137")}ï¼${s("events_create_booth_settings.text138")}ã`},{step:3,title:s("events_create_booth_settings.text139"),desc:`${s("events_create_booth_settings.text140")}ï¼${s("events_create_booth_settings.text141")}ã${s("events_create_booth_settings.text142")}ï¼ã`},{step:4,title:s("events_create_booth_settings.text143"),desc:`${s("events_create_booth_settings.text133")}ã${s("events_create_booth_settings.text97")}ã${s("events_create_booth_settings.text144")}ï¼${s("events_create_booth_settings.text145")}ï¼small/largeï¼ï¼${s("events_create_booth_settings.text146")}ï¼${s("events_create_booth_settings.text119")}Ã${s("events_create_booth_settings.text120")}Ã${s("events_create_booth_settings.text121")}ï¼${s("events_create_booth_settings.text147")}ã`},{step:5,title:s("events_create_booth_settings.text148"),desc:`${s("events_create_booth_settings.text133")}ã${s("events_create_booth_settings.text149")}ã${s("events_create_booth_settings.text150")}ã${s("events_create_booth_settings.text151")}ï¼â ${s("events_create_booth_settings.text152")}ï¼A-1, A-2...ï¼â¡ ${s("events_create_booth_settings.text153")}ï¼A-A, A-B...ï¼â¢ ${s("events_create_booth_settings.text154")}+${s("events_create_booth_settings.text152")}ï¼VIP-001, VIP-002...ï¼`},{step:6,title:s("events_create_booth_settings.text156"),desc:`${s("events_create_booth_settings.text157")} 1pxãShift+${s("events_create_booth_settings.text158")} 10pxã${s("events_create_booth_settings.text159")}ãShift+${s("events_create_booth_settings.text160")}ã${s("events_create_booth_settings.text161")}ã${s("events_create_booth_settings.text162")}ã`},{step:7,title:s("events_create_booth_settings.text163"),desc:`${s("events_create_booth_settings.text164")}ã${s("events_create_booth_settings.text165")}ã`},{step:8,title:s("events_create_booth_settings.text166"),desc:`${s("events_create_booth_settings.text167")}ï¼${s("events_create_booth_settings.text168")}ã${s("events_create_booth_settings.text97")}ãâ ${s("events_create_booth_settings.text169")} â ${s("events_create_booth_settings.text133")}ã${s("events_create_booth_settings.text170")}ãã${s("events_create_booth_settings.text171")}ï¼${s("events_create_booth_settings.text172")} â ${s("events_create_booth_settings.text173")} â ${s("events_create_booth_settings.text174")}ã`},{step:9,title:s("events_create_booth_settings.text175"),desc:`${s("events_create_booth_settings.text176")}ã${s("events_create_booth_settings.text177")}ã${s("events_create_booth_settings.text178")}ã${s("events_create_booth_settings.text179")}ã${s("events_create_booth_settings.text180")}ï¼${s("events_create_booth_settings.text181")}ã${s("events_create_booth_settings.text182")}ã${s("events_create_booth_settings.text150")}ã`}].map((t,n)=>e.jsxs("div",{className:"flex gap-3 items-start p-2.5 hover:bg-zinc-900 rounded-md transition-colors",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-[#1c1c1a] text-zinc-900 font-bold text-xs",children:t.step}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"font-medium text-zinc-200 text-sm mb-0.5",children:t.title}),e.jsx("p",{className:"text-xs text-zinc-400 leading-relaxed",children:t.desc})]})]},n))}),e.jsxs("div",{className:"mt-4 p-4 bg-purple-500/10 border border-purple-500/20 rounded-md",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(aa,{className:"h-4 w-4 text-purple-400"}),e.jsx("span",{className:"font-medium text-purple-300 text-sm",children:s("events_create_booth_settings.text183")}
14)]}),e.jsxs("p",{className:"text-xs text-zinc-400",children:[s("events_create_booth_settings.text184"),"ï¼",s("events_create_booth_settings.text185"),"ã",s("events_create_booth_settings.text186"),"ã"]})]}),e.jsxs("div",{className:"mt-3 p-4 bg-[#1c1c1a]/10 border border-[#1c1c1a]/20 rounded-md flex gap-3 text-[#1c1c1a] text-xs",children:[e.jsx(On,{className:"h-5 w-5 shrink-0"}),e.jsxs("p",{children:[s("events_create_booth_settings.text187"),"ï¼",s("events_create_booth_settings.text188"),"ã",s("events_create_booth_settings.text189")," ID ",s("events_create_booth_settings.text190"),"ï¼",s("events_create_booth_settings.text191"),"ã"]})]})]})]})})]})]}),e.jsx(sa,{to:"/my-events",className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",title:s("events_create_booth_settings.text192"),children:e.jsx(He,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-8 custom-scrollbar",children:[z&&e.jsxs("div",{children:[e.jsx(M,{className:"text-sm font-bold text-gray-400 mb-2 block",children:s("events_create_booth_settings.text193")}),e.jsx("div",{className:"text-base font-medium text-gray-900 bg-zinc-50 p-3 rounded-md border border-zinc-100",children:z.name})]}),e.jsxs("div",{children:[e.jsxs(M,{className:"text-sm font-bold text-gray-400 mb-2 block",children:[e.jsx(ps,{className:"h-3.5 w-3.5 inline mr-1"}),s("events_create_booth_settings.map_selection")," (",be.length,")"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ut,{value:P||"",onValueChange:Ua,children:[e.jsx(bt,{className:"flex-1 bg-white border-zinc-200",children:e.jsx(vt,{placeholder:s("events_create_booth_settings.select_map_placeholder")})}),e.jsx(ft,{children:be.map(t=>e.jsxs(yt,{value:t.id,children:[t.name,t.booth_count!=null&&e.jsxs("span",{className:"text-zinc-400 ml-2",children:["(",t.booth_count," ",s("events_create_booth_settings.booths_count_label"),")"]})]},t.id))})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>St(!0),className:"shrink-0",children:[e.jsx(Ce,{className:"h-4 w-4 mr-1"}),s("events_create_booth_settings.add_map")]}),P&&e.jsxs(D,{variant:"outline",size:"sm",onClick:Ha,className:"shrink-0 text-red-500 hover:text-red-700 hover:bg-red-50 border-red-200",children:[e.jsx(Fe,{className:"h-4 w-4 mr-1"}),s("events_create_booth_settings.delete_map")]})]}),P&&e.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-2",children:[e.jsx("span",{className:"text-xs text-gray-500 flex items-center",children:s("events_create_booth_settings.change_map_name")}),e.jsx(B,{value:ce,onChange:t=>st(t.target.value),onBlur:Fs,onKeyDown:t=>{t.key==="Enter"&&Fs()},placeholder:s("events_create_booth_settings.map_name"),className:"h-8 text-sm"}),e.jsx("span",{className:"text-sm text-gray-400 flex items-center",children:s("events_create_booth_settings.auto_save_on_blur")})]})]}),e.jsx(Et,{open:_a,onOpenChange:St,children:e.jsxs(Rt,{className:"sm:max-w-md",children:[e.jsxs(Ot,{children:[e.jsx(Xt,{children:s("events_create_booth_settings.add_map")}),e.jsx(xs,{children:s("events_create_booth_settings.add_map_dialog_description")})]}),e.jsxs("div",{className:"py-4",children:[e.jsx(M,{htmlFor:"new-map-name",className:"mb-2 block",children:s("events_create_booth_settings.map_name")}),e.jsx(B,{id:"new-map-name",value:tt,onChange:t=>Ft(t.target.value),placeholder:s("events_create_booth_settings.map_name_placeholder"),onKeyDown:t=>{t.key==="Enter"&&tt.trim()&&Hs()}})]}),e.jsxs(_s,{children:[e.jsx(D,{variant:"outline",onClick:()=>{St(!1),Ft("")},children:s("events_create_booth_settings.cancel")}),e.jsx(D,{onClick:Hs,disabled:!tt.trim(),children:s("events_create_booth_settings.create")})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(M,{className:"text-lg font-bold text-gray-400 ",children:s("events_create_booth_settings.text194")}),e.jsx("button",{onClick:Ta,className:"flex items-center gap-1.5 text-xs text-zinc-500 hover:text-zinc-700 transition-colors px-2 py-1 rounded hover:bg-zinc-100",title:s(ts?"events_create_booth_settings.text195":"events_create_booth_settings.text196"),children:ts?e.jsxs(e.Fragment,{children:[e.jsx(Te,{className:"h-4 w-4"}),e.jsx("span",{children:s("events_create_booth_settings.text195")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"h-4 w-4"}),e.jsx("span",{children:s("events_create_booth_settings.text196")})]})})]}),e.jsxs("div",{className:"border border-zinc-200 rounded-md bg-white overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-zinc-100 bg-zinc-50/30",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("button",{onClick:()=>Ts(!Oe),className:"text-md font-bold text-gray-700 flex items-center gap-2 hover:text-gray-900 transition-colors",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[#1c1c1a] text-white text-xs font-bold",children:"1"}),s("events_create_booth_settings.text391"),Oe?e.jsx(Te,{className:"h-4 w-4 text-gray-400"}):e.jsx(Ie,{className:"h-4 w-4 text-gray-400"})]}),G&&Oe&&e.jsx("button",{onClick:()=>{Le(null),Ee(null),ze(null),xt(1)},className:"text-[12px] text-red-400 hover:text-red-600 transition-colors",children:s("events_create_booth_settings.text197")})]}),Oe&&(G?e.jsxs("div",{className:"relative group rounded-md overflow-hidden border border-zinc-200 bg-zinc-100",children:[e.jsx("img",{src:G,alt:"Map Preview",className:"w-full h-auto object-contain max-h-[160px]"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors flex items-center justify-center opacity-0 group-hover:opacity-100",children:e.jsx(D,{size:"sm",variant:"secondary",className:"h-7 text-xs",onClick:()=>{var t;return(t=je.current)==null?void 0:t.click()},children:s("events_create_booth_settings.text198")})})]}):e.jsxs(D,{variant:"outline",size:"sm",className:"w-full h-20 border-2 border-dashed border-zinc-200 hover:border-zinc-300 hover:bg-white text-zinc-400 flex flex-col gap-1 items-center justify-center",onClick:()=>{var t;return(t=je.current)==null?void 0:t.click()},children:[e.jsx(Xn,{className:"h-5 w-5 mb-1"}),e.jsx("span",{className:"text-xs",children:s("events_create_booth_settings.text392")})]})),e.jsx("input",{ref:je,type:"file",accept:"image/*",className:"hidden",onChange:cn}),G&&Oe&&e.jsx(D,{size:"sm",className:"w-full mt-2 h-8 text-xs bg-[#1c1c1a] text-white hover:bg-brand-dark",disabled:kt||bs,onClick:gn,children:kt?s("events_create_booth_settings.saving_map")||"å²åä¸...":bs?s("events_create_booth_settings.map_uploading")||"ä¸å³ä¸...":s("events_create_booth_settings.save_map")||"å²ååºå"})]}),e.jsxs("div",{className:"p-4 border-b border-zinc-100",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Is(!Mt),className:"text-md font-bold text-gray-700 flex items-center gap-2 hover:text-gray-900 transition-colors",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[#1c1c1a] text-white text-xs font-bold",children:"2"}),s("events_create_booth_settings.text114"),Mt?e.jsx(Te,{className:"h-4 w-4 text-gray-400"}):e.jsx(Ie,{className:"h-4 w-4 text-gray-400"})]}),e.jsx(_t,{delayDuration:200,children:e.jsxs(gt,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(jt,{className:"h-4 w-4 text-zinc-400 hover:text-zinc-600 cursor-help shrink-0"})}),e.jsx(pt,{side:"right",className:"max-w-[240px] text-xs",children:s("events_create_booth_settings.booth_type_hint")})]})})]}),N.length>0&&e.jsxs("button",{onClick:()=>Qt(!0),className:"text-xs text-zinc-400 hover:text-zinc-600 flex items-center gap-1 transition-colors",children:[e.jsx(Je,{className:"h-3 w-3"}),s("events_create_booth_settings.booth_type_history")||"æ·å²ç´é"]})]}),Mt&&e.jsx("div",{className:"space-y-3",children:N.length===0?e.jsxs("div",{className:"text-center py-4 bg-zinc-50 rounded border border-dashed border-zinc-200",children:[e.jsx("p",{className:"text-xs text-zinc-400 mb-2",children:s("events_create_booth_settings.text11
147")}),e.jsxs(D,{variant:"outline",size:"sm",className:"text-xs h-7",onClick:()=>{X({id:"",event_id:j||"",type_code:"",type_name:"",description:null,width:null,depth:null,height:null,display_width:60,display_height:60,base_wattage:0,pricings:[]}),K(!0)},children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"})," ",s("events_create_booth_settings.text118")]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:N.map(t=>e.jsxs("div",{className:"bg-zinc-50 p-3 rounded-md border border-zinc-100 relative overflow-hidden group cursor-pointer hover:border-blue-200 hover:bg-blue-50/30 transition-colors",onClick:()=>{X(t),K(!0)},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-6 h-6 rounded flex items-center justify-center text-xs font-bold ${t.type_code==="large"?"bg-blue-100 text-blue-600":"bg-amber-100 text-amber-600"}`,children:t.type_code==="large"?"L":"S"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-700",children:t.type_name||t.type_code}),e.jsxs("div",{className:"text-xs text-zinc-400 font-mono",children:[t.width||"â","Ã",t.depth||"â","Ã",t.height||"â"," cm"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs text-zinc-400",children:s("events_create_booth_settings.text122")}),e.jsxs("div",{className:"text-xs font-mono text-zinc-600",children:[t.base_wattage||0," W"]})]}),e.jsx("button",{onClick:async n=>{if(n.stopPropagation(),!!await q({title:s("events_create_booth_settings.confirm_delete_bt_title")||"確èªåªé¤",description:`${t.type_name||t.type_code} 15 16${s("events_create_booth_settings.confirm_delete_bt_description")||"åªé¤å¾æ¤æ¤ä½é¡åå°ç§»è³æ·å²ç´éã確å®è¦åªé¤åï¼"}`,confirmText:s("events_create_booth_settings.delete")||"åªé¤",cancelText:s("events_create_booth_settings.cancel")||"åæ¶",variant:"danger"}))try{await C.delete(`/event-booth-types/${t.id}`),p.success(s("events_create_booth_settings.booth_type_deleted")||"æ¤ä½é¡åå·²åªé¤"),await De()}catch{p.error(s("events_create_booth_settings.booth_type_delete_failed")||"åªé¤æ¤ä½é¡å失æ")}},className:"p-1 rounded text-zinc-300 hover:text-red-500 hover:bg-red-50 opacity-0 group-hover:opacity-100 transition-colors",children:e.jsx(Fe,{className:"h-3.5 w-3.5"})})]})]}),e.jsxs("div",{className:"mt-2 pt-2 border-t border-zinc-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("span",{className:"text-zinc-400",children:[s("events_create_booth_settings.default_price_label"),":"]}),e.jsx("span",{className:"font-mono font-medium text-zinc-600",children:t.default_price?`NT$${t.default_price.toLocaleString()}`:"â"})]}),t.pricings&&t.pricings.filter(n=>n.is_active&&!n.deleted_at).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:t.pricings.filter(n=>n.is_active&&!n.deleted_at).sort((n,a)=>new Date(n.start_date).getTime()-new Date(a.start_date).getTime()).map(n=>{const a=new Date,r=new Date(n.start_date),o=new Date(n.end_date),i=r<=a&&a<=o,l=r>a;return e.jsxs("div",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] ${i?"bg-green-50 border border-green-200 text-green-700":l?"bg-amber-50 border border-amber-200 text-amber-700":"bg-zinc-100 border border-zinc-200 text-zinc-400"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${i?"bg-green-500":l?"bg-amber-400":"bg-zinc-300"}`}),e.jsx("span",{className:"font-medium",children:n.price_name}),e.jsxs("span",{className:"font-mono",children:["$",n.price.toLocaleString()]}),e.jsxs("span",{className:"text-[8px] opacity-70",children:[n.start_date.toString().slice(5,10),"~",n.end_date.toString().slice(5,10)]})]},n.id)})})]}),e.jsx("div",{className:"absolute bottom-1 right-2 text-[12px] text-zinc-400 opacity-0 group-hover:opacity-100 transition-opacity",children:s("events_create_booth_settings.text123")})]},t.id))}),e.jsxs(D,{variant:"outline",size:"sm",className:"w-full text-xs border-dashed text-zinc-500 hover:text-blue-600 hover:border-blue-300",onClick:()=>{X({id:"",event_id:j||"",type_code:"",type_name:"",description:null,width:null,depth:null,height:null,display_width:60,display_height:60,base_wattage:0,pricings:[]}),K(!0)},children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"})," ",s("events_create_booth_settings.text116")]})]})})]}),e.jsxs("div",{className:"p-4 border-b border-zinc-100 bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("button",{onClick:()=>Ps(!At),className:"text-md font-bold text-gray-700 flex items-center gap-2 hover:text-gray-900 transition-colors",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[#1c1c1a] text-white text-xs font-bold",children:"3"}),s("events_create_booth_settings.text199"),At?e.jsx(Te,{className:"h-4 w-4 text-gray-400"}):e.jsx(Ie,{className:"h-4 w-4 text-gray-400"})]}),e.jsx(_t,{delayDuration:200,children:e.jsxs(gt,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(jt,{className:"h-4 w-4 text-zinc-400 hover:text-zinc-600 cursor-help shrink-0"})}),e.jsx(pt,{side:"right",className:"max-w-[260px] text-xs",children:s("events_create_booth_settings.pricing_caution_hint")})]})})]}),At&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 p-1 bg-pink-50 rounded-md gap-1",children:[e.jsx("button",{onClick:()=>{Ns("fixed")},className:`py-1.5 text-sm font-semibold rounded-md transition-colors ${Jt==="fixed"?"bg-pink-100 text-pink-900 border border-pink-200":"text-gray-600 hover:text-pink-800 hover:bg-pink-100/70"}`,children:s("events_create_booth_settings.text393")}),e.jsx("button",{onClick:()=>{Ns("tiered"),ga(0)},className:`py-1.5 text-sm font-semibold rounded-md transition-colors ${Jt==="tiered"?"bg-pink-100 text-pink-900 border border-pink-200":"text-gray-600 hover:text-pink-800 hover:bg-pink-100/70"}`,children:s("events_create_booth_settings.text394")})]}),Jt==="fixed"?e.jsxs("div",{className:"space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[N.length===0?e.jsx("div",{className:"text-center py-4 bg-zinc-50 rounded border border-dashed border-zinc-200",children:e.jsx("span",{className:"text-xs text-zinc-400",children:s("events_create_booth_settings.no_booth_types")})}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 p-2 bg-zinc-50 rounded-md border border-zinc-200",children:[e.jsx("span",{className:"text-xs text-gray-400 shrink-0",children:(z==null?void 0:z.currency_code)||"TWD"}
16),e.jsx(B,{type:"text",inputMode:"numeric",value:Dt,onKeyDown:t=>{(t.key==="."||t.key==="e")&&t.preventDefault()},onChange:t=>{const n=parseInt(t.target.value,10);t.target.value===""?Bs(""):isNaN(n)||Bs(String(n))},className:"h-8 font-mono text-right text-sm flex-1 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:s("events_create_booth_settings.group_update_price")||"çµ±ä¸è¨å®å¹æ ¼"}),e.jsx(D,{size:"sm",className:"shrink-0 text-xs bg-zinc-900 text-white hover:bg-zinc-800",disabled:!Dt||Number(Dt)<=0||Ae.size===0,onClick:async()=>{const t=Number(Dt),n=N.filter(i=>Ae.has(i.id)).map(i=>i.type_name||i.type_code).join("ã");if(!(!await q({title:s("events_create_booth_settings.confirm_update")||"ç¢ºèªæ´æ°",description:s("events_create_booth_settings.group_update_confirm_1",{price:String(t),types:n}),confirmText:s("events_create_booth_settings.confirm")||"確å®",cancelText:s("events_create_booth_settings.cancel")||"åæ¶"})||!await q({title:s("events_create_booth_settings.confirm_update")||"ç¢ºèªæ´æ°",description:s("events_create_booth_settings.group_update_confirm_2"),confirmText:s("events_create_booth_settings.confirm")||"確å®",cancelText:s("events_create_booth_settings.cancel")||"åæ¶"})||!await q({title:s("events_create_booth_settings.confirm_update")||"ç¢ºèªæ´æ°",description:s("events_create_booth_settings.group_update_confirm_3"),confirmText:s("events_create_booth_settings.confirm")||"確å®",cancelText:s("events_create_booth_settings.cancel")||"åæ¶"})))try{await C.patch("/event-booth-types/batch-update-price",{booth_type_ids:Array.from(Ae),default_price:t}),Gt(i=>i.map(l=>Ae.has(l.id)?{...l,default_price:t}:l)),p.success(s("events_create_booth_settings.group_update_success"))}catch{p.error(s("events_create_booth_settings.group_update_failed"))}},children:s("events_create_booth_settings.group_update_apply")})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(hs,{id:"select-all-booth-types",checked:N.length>0&&Ae.size===N.length,onCheckedChange:t=>{es(t?new Set(N.map(n=>n.id)):new Set)}}),e.jsx("label",{htmlFor:"select-all-booth-types",className:"text-xs text-zinc-500 cursor-pointer select-none",children:s("events_create_booth_settings.select_all")})]}),e.jsx("p",{className:"text-xs text-zinc-500 mb-2",children:s("events_create_booth_settings.set_default_price_per_type")}),N.map(t=>e.jsx("div",{className:`bg-white border rounded-md p-3 hover:border-zinc-300 transition-colors ${Ae.has(t.id)?"border-zinc-400 bg-zinc-50":"border-zinc-200"}`,children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(hs,{checked:Ae.has(t.id),onCheckedChange:n=>{es(a=>{const r=new Set(a);return n?r.add(t.id):r.delete(t.id),r})}}),e.jsx(ra,{className:"h-4 w-4 text-zinc-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-zinc-700 truncate",children:t.type_name||t.type_code})]}),e.jsxs("div",{className:"relative flex-shrink-0 w-32",children:[e.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-gray-400 text-xs",children:(z==null?void 0:z.currency_code)||"TWD"}),e.jsx(B,{type:"text",inputMode:"numeric",value:t.default_price||"",onKeyDown:n=>{(n.key==="."||n.key==="e")&&n.preventDefault()},onChange:n=>{const a=parseInt(n.target.value,10),r=isNaN(a)?0:a;Gt(o=>o.map(i=>i.id===t.id?{...i,default_price:r}:i))},className:"pl-10 h-8 font-mono text-right text-sm [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:s("events_create_booth_settings.enter_price")||"輸å
¥å¹æ ¼"})]})]})},t.id)),e.jsx(D,{onClick:async()=>{try{await Promise.all(N.map(t=>C.patch(`/event-booth-types/${t.id}`,{default_price:t.default_price||0}))),p.success(s("events_create_booth_settings.default_price_saved"))}catch{p.error(s("events_create_booth_settings.default_price_save_failed"))}},className:"w-full text-xs bg-zinc-900 text-white hover:bg-zinc-800",size:"sm",children:s("events_create_booth_settings.save_default_prices")})]}),e.jsx("p",{className:"text-xs text-center text-zinc-500",children:s("events_create_booth_settings.default_price_hint")})]}):null,e.jsxs("div",{className:"space-y-3 pt-3 border-t border-zinc-100",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(M,{className:"text-xs font-bold text-gray-400 ",children:s("events_create_booth_settings.text212")}),Kt.length>0&&e.jsxs("button",{onClick:()=>qt(!0),className:"text-xs text-zinc-400 hover:text-amber-600 flex items-center gap-1 transition-colors",children:[e.jsx(Je,{className:"h-3 w-3"}),s("events_create_booth_settings.show_history")||"æ·å²ç´é"]})]}),e.jsx("div",{className:"space-y-2",children:J.length===0?e.jsxs("div",{className:"text-center py-6 bg-zinc-50 rounded border border-dashed border-zinc-200",children:[e.jsx(Je,{className:"h-6 w-6 text-zinc-300 mx-auto mb-2"}),e.jsx("span",{className:"text-xs text-zinc-400",children:s("events_create_booth_settings.text213")})]}):J.map((t,n)=>{const a=t.id||`idx-${n}`,r=Ea[a],o=r&&r.length>0;return e.jsxs("div",{className:`group relative border rounded-md p-3 transition-colors text-left cursor-pointer ${o?"bg-red-50 border-red-300 hover:border-red-400":"bg-white border-zinc-200 hover:border-amber-300"}`,onClick:()=>{xe(t),Xe(!0)},children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-semibold text-base flex items-center gap-2 mb-1 text-gray-900",children:[o&&e.jsx(Nt,{className:"h-4 w-4 text-red-500 shrink-0"}),e.jsx("span",{className:"truncate",title:t.name||`${s("events_create_booth_settings.text214")} ${n+1}`,children:t.name||`${s("events_create_booth_settings.text214")} ${n+1}`}),e.jsx("span",{className:"text-xs text-amber-600 opacity-0 group-hover:opacity-100 shrink-0",children:s("events_create_booth_settings.text123")})]}),e.jsxs("div",{className:"text-sm font-mono px-2 py-0.5 rounded whitespace-nowrap text-gray-500 bg-zinc-50",children:[t.start_date," ~ ",t.end_date]})]}),e.jsx("button",{onClick:async i=>{i.stopPropagation(),await q({title:s("events_create_booth_settings.text215"),variant:"danger",confirmText:s("events_create_booth_settings.delete")})&&Ga(t)},className:"text-zinc-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity p-1",title:s("events_create_booth_settings.text216"),children:e.jsx(Fe,{className:"h-4 w-4"})})]}),o&&e.jsxs("div",{className:"flex items-start gap-1.5 mb-2 px-2 py-1.5 rounded bg-red-100/60 text-red-700 text-xs",children:[e.jsx(Nt,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),e.jsxs("span",{children:[s("events_create_booth_settings.tier_conflict_warning")||"æ¥æåééç","ï¼",r.join("ã")]})]}),t.target_areas&&t.target_areas.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:t.target_areas.map(i=>e.jsx("span",{className:"px-1.5 py-0.5 rounded-md text-xs border bg-blue-50 text-blue-600 border-blue-100",children:i},i))}),e.jsx("div",{className:`grid gap-2 pt-2 border-t border-dashed border-gray-100 ${N.length<=2?"grid-cols-2":N.length===3?"grid-cols-3":"grid-cols-2 md:grid-cols-4"}`,children:N.map(i=>e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-sm text-zinc-400 truncate",title:i.type_name||i.type_code,children:i.type_name||i.type_code}),e.jsxs("span",{className:"text-base font-semibold text-zinc-700",children:["$",new Intl.NumberFormat("en-US").format(t.prices[i.type_code]||0)]})]},i.type_code))})]},t.id||n)})}),e.jsxs(D,{variant:"outline",size:"sm",className:"w-full text-xs border-dashed text-zinc-500 hover:text-blue-600 hover:border-blue-300",onClick:()=>{const t={};
16N.forEach(a=>{t[a.type_code]=0});const n=Ra();xe({id:"",name:"",start_date:n,end_date:"",prices:t,is_active:!0}),Xe(!0)},children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"})," ",s("events_create_booth_settings.text217")]})]})]})]}),e.jsxs("div",{className:"p-4 border-b border-zinc-100",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("button",{onClick:()=>ws(!nt),className:"text-md font-bold text-gray-700 flex items-center gap-2 hover:text-gray-900 transition-colors",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[#1c1c1a] text-white text-xs font-bold",children:"4"}),s("events_create_booth_settings.text219"),nt?e.jsx(Te,{className:"h-4 w-4 text-gray-400"}):e.jsx(Ie,{className:"h-4 w-4 text-gray-400"})]}),nt&&e.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none group",children:[e.jsx("div",{className:`w-3 h-3 rounded border flex items-center justify-center transition-colors ${F?"bg-blue-600 border-blue-600":"border-zinc-300 bg-white"}`,children:F&&e.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})}),e.jsx("input",{type:"checkbox",checked:F,onChange:t=>ma(t.target.checked),className:"hidden"}),e.jsx("span",{className:`text-[12px] transition-colors ${F?"text-blue-600 font-medium":"text-zinc-500 group-hover:text-zinc-700"}`,children:s("events_create_booth_settings.text220")})]})]}),nt&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"bg-zinc-50 rounded-md p-2 border border-zinc-100",children:e.jsxs("span",{className:"text-xs text-zinc-500 pl-1",children:[v.length," ",s("events_create_booth_settings.text221")]})}),e.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-1",children:[v.map((t,n)=>e.jsxs("div",{className:"rounded-md border border-zinc-200 bg-white p-2.5 space-y-2 hover:border-zinc-300 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:t.color,onChange:a=>{const r=[...v];r[n].color=a.target.value,U(r)},className:"w-5 h-5 rounded cursor-pointer border-0 p-0"}),e.jsx(B,{value:t.name,onChange:a=>{const r=v[n].name,o=a.target.value,i=[...v];i[n].name=o,U(i),R(l=>l.map(c=>c.area===r?{...c,area:o}:c)),E===r&&ys(o)},className:"h-7 text-xs flex-1"}),F&&e.jsx("button",{onClick:()=>Xa(n),className:"text-zinc-300 hover:text-red-500 transition-colors p-1",title:s("events_create_booth_settings.text225"),children:e.jsx(Fe,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{onClick:()=>{const a=[...v];a[n].isLocked=!a[n].isLocked,U(a),ls()},className:`cursor-pointer flex items-center justify-center gap-1.5 px-2 py-1.5 rounded text-xs border transition-colors ${t.isLocked?"bg-red-50 text-red-600 border-red-200":"bg-white text-zinc-500 border-zinc-200 hover:bg-zinc-50"}`,children:[t.isLocked?e.jsx(aa,{className:"h-3.5 w-3.5"}):e.jsx(Wn,{className:"h-3.5 w-3.5"}),t.isLocked?s("events_create_booth_settings.text226"):s("events_create_booth_settings.text227")]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("select",{className:"text-xs h-7 rounded border border-zinc-200 bg-white px-2 text-zinc-600 outline-none flex-1 focus:ring-0",value:t.regionRule||"all",onChange:a=>{const r=[...v],o=a.target.value;r[n].regionRule=o,U(r),ls()},title:t.regionRule==="tw_only"?s("events_create_booth_settings.text231"):t.regionRule==="foreign_only"?s("events_create_booth_settings.text232"):s("events_create_booth_settings.text233"),children:[e.jsx("option",{value:"all",children:s("events_create_booth_settings.text228")}),e.jsx("option",{value:"tw_only",children:s("events_create_booth_settings.text229")}),e.jsx("option",{value:"foreign_only",children:s("events_create_booth_settings.text230")})]}),e.jsx("div",{className:"text-zinc-400 hover:text-zinc-600 cursor-help",title:t.regionRule==="tw_only"?`${s("events_create_booth_settings.text229")}ï¼${s("events_create_booth_settings.text231")}`:t.regionRule==="foreign_only"?`${s("events_create_booth_settings.text230")}ï¼${s("events_create_booth_settings.text232")}`:`${s("events_create_booth_settings.text228")}ï¼${s("events_create_booth_settings.text233")}`,children:e.jsx(jt,{className:"h-3.5 w-3.5"})})]})]}),t.isLocked&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs text-zinc-400 font-semibold px-0.5",children:s("events_create_booth_settings.unlock_specific_booths")}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[b.filter(a=>a.area===t.name).map(a=>{const o=(t.unlocked_booth_ids||[]).includes(a.id);return e.jsx("button",{type:"button",onClick:()=>{const i=[...v],l=i[n].unlocked_booth_ids||[];i[n].unlocked_booth_ids=o?l.filter(c=>c!==a.id):[...l,a.id],U(i),ls()},className:`px-1.5 py-0.5 rounded text-xs border transition-colors ${o?"bg-green-50 text-green-700 border-green-200":"bg-red-50 text-red-700 border-red-200"}`,title:s(o?"events_create_booth_settings.booth_unlocked_click_to_lock":"events_create_booth_settings.booth_locked_click_to_unlock"),
16children:a.name},a.id)}),b.filter(a=>a.area===t.name).length===0&&e.jsx("span",{className:"text-xs text-zinc-400 px-0.5",children:"No booths in this area"})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs text-zinc-400 font-semibold px-0.5",children:s("events_create_booth_settings.text234")}),e.jsx("span",{className:"text-xs text-zinc-300",children:s("events_create_booth_settings.text235")})]}),e.jsx(B,{type:"text",autoComplete:"one-time-code","data-lpignore":"true","data-1p-ignore":"true",placeholder:s("events_create_booth_settings.text235"),value:t.pass_code||"",onChange:a=>{const r=[...v];r[n].pass_code=a.target.value||void 0,U(r)},className:"h-7 text-xs flex-1"}),t.pass_code&&e.jsx(D,{variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-7 text-xs text-purple-600 hover:bg-purple-50",onClick:async()=>{if(await q({title:s("events_create_booth_settings.confirm_save_title")||"確èªå²å",description:`${s("events_create_booth_settings.text236")||"å¥ç¨å¯ç¢¼"} "${t.pass_code}" ${s("events_create_booth_settings.text237")||"è³æ¤ååæææ¤ä½"}ï¼`,confirmText:s("events_create_booth_settings.create")||"確å®",cancelText:s("events_create_booth_settings.cancel")||"åæ¶",variant:"warning"}))try{const r=b.map(i=>i.area===t.name?{...i,pass_code:t.pass_code||""}:i);R(r);const o=r.filter(i=>i.area===t.name&&i.id);if(o.length>0){const i=o.map(l=>C.patch(`/booths/${l.id}`,{pass_code:t.pass_code}));await Promise.all(i),p.success(`${s("events_create_booth_settings.text236")} "${t.pass_code}" ${s("events_create_booth_settings.text237")} ${o.length} ${s("events_create_booth_settings.text53")}`)}else p.success(`${s("events_create_booth_settings.text240")} ${t.name} ${s("events_create_booth_settings.text241")} (${s("events_create_booth_settings.text242")})`)}catch{p.error(`${s("events_create_booth_settings.text238")}ï¼${s("events_create_booth_settings.text239")}`)}},disabled:!t.pass_code,title:s("events_create_booth_settings.text243"),children:s("events_create_booth_settings.text170")}),t.pass_code&&e.jsx(D,{variant:"ghost",size:"sm",className:"absolute right-10 top-0 h-7 text-xs text-red-500 hover:bg-red-50",onClick:async()=>{if(!await q({title:s("events_create_booth_settings.confirm_delete_bt_title")||"ç¢ºèªæ¸
é¤",description:s("events_create_booth_settings.text244")||"確å®è¦æ¸
餿¤ååæææ¤ä½çå¯ç¢¼åï¼",confirmText:s("events_create_booth_settings.create")||"確å®",cancelText:s("events_create_booth_settings.cancel")||"åæ¶",variant:"danger"}))return;const r=t.name;U(i=>i.map(l=>l.name===r?{...l,pass_code:void 0}:l)),R(i=>i.map(l=>l.area===r?{...l,pass_code:void 0}:l));const o=b.filter(i=>i.area===r&&oe.some(l=>l.id===i.id));try{if(o.length>0){const i=o.map(l=>C.patch(`/booths/${l.id}`,{pass_code:""}));await Promise.all(i),p.success(`${s("events_create_booth_settings.text244")} ${o.length} ${s("events_create_booth_settings.text245")}`)}else p.success(`${s("events_create_booth_settings.text244")} (${s("events_create_booth_settings.text242")})`)}catch{p.error(s("events_create_booth_settings.text246"))}},disabled:!t.pass_code,title:s("events_create_booth_settings.text247"),children:s("events_create_booth_settings.text244")})]}),F&&e.jsx("div",{className:"grid grid-cols-4 gap-1 p-1.5 bg-zinc-50 rounded border border-zinc-100",children:["x","y","width","height"].map(a=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-xs text-zinc-400 mb-0.5",children:a.charAt(0)}),e.jsx(B,{type:"number",className:"h-6 text-xs px-1 text-center bg-white",value:t[a],onChange:r=>{const o=[...v],i={...o[n],[a]:Number(r.target.value)};o[n]=i,U(o)}})]},a))})]},n)),F&&e.jsxs(D,{variant:"outline",size:"sm",className:"w-full text-xs border-dashed text-zinc-500 hover:text-blue-600 hover:border-blue-300",onClick:Oa,children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"})," ",s("events_create_booth_settings.text134")]})]})]}),v.length>0&&P&&e.jsx(D,{size:"sm",className:"w-full mt-3 h-8 text-xs bg-blue-600 text-white hover:bg-blue-700",disabled:kt,onClick:cs,children:s(kt?"events_create_booth_settings.saving_map":"events_create_booth_settings.save_area_settings")})]}),e.jsxs("div",{className:"p-4 border-b border-zinc-100",children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsxs("button",{onClick:()=>Ls(!Tt),className:"text-md font-bold text-gray-700 flex items-center gap-2 hover:text-gray-900 transition-colors",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[#1c1c1a] text-white text-xs font-bold",children:"5"}),s("events_create_booth_settings.batch_create_booths"),Tt?e.jsx(Te,{className:"h-4 w-4 text-gray-400"}):e.jsx(Ie,{className:"h-4 w-4 text-gray-400"})]})}),Tt&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:pn,className:"flex-1 flex items-center justify-center gap-3 p-3 rounded-md border transition-colors border-green-500 bg-green-50 text-green-600 hover:bg-green-100 hover:border-green-600",children:[e.jsx(oa,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-semibold",children:s("events_create_booth_settings.text450")})]}),e.jsx(_t,{children:e.jsxs(gt,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(jt,{className:"h-5 w-5 text-gray-400 hover:text-gray-600 cursor-help flex-shrink-0"})}),e.jsx(pt,{side:"left",className:"max-w-[200px]",children:e.jsx("p",{children:s("events_create_booth_settings.batch_create_hint")})})]})})]}),e.jsx("p",{className:"text-xs text-gray-400 text-center",children:s("events_create_booth_settings.text451")})]})]}),e.jsxs("div",{className:"p-4 border-b border-zinc-100",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Ds(!zt),className:"text-md font-bold text-gray-700 flex items-center gap-2 hover:text-gray-900 transition-colors",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-zinc-400 text-white text-xs font-bold",children:"6"}),s("events_create_booth_settings.text452"),zt?e.jsx(Te,{className:"h-4 w-4 text-gray-400"}):e.jsx(Ie,{className:"h-4 w-4 text-gray-400"})]}),e.jsx(_t,{children:e.jsxs(gt,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(jt,{className:"h-4 w-4 text-gray-400 hover:text-gray-600 cursor-help"})}),e.jsx(pt,{side:"right",className:"max-w-[200px]",children:e.jsx("p",{children:s("events_create_booth_settings.booth_stats_hint")})})]})})]}),oe.length!==b.length&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-amber-100 text-amber-700 rounded font-medium",children:s("events_create_booth_settings.text453")})]}),zt&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"bg-zinc-50 rounded p-2 text-center",children:[e.jsx("div",{className:"text-zinc-400 text-xs mb-0.5",children:s("events_create_booth_settings.text454")}),e.jsx("div",{className:"font-bold text-zinc-700",children:oe.length})]}),e.jsxs("div",{className:"bg-zinc-50 rounded p-2 text-center",children:[e.jsx("div",{className:"text-zinc-400 text-xs mb-0.5",children:s("events_create_booth_settings.text455")}),e.jsx("div",{className:"font-bold text-zinc-700",children:b.length})]})]}),oe.length!==b.length&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-xs text-amber-700",children:["â ï¸ ",s("events_create_booth_settings.text454")," ",oe.length," ",s("events_create_booth_settings.text49"),", ",s("events_create_booth_settings.text455")," ",b.length," ",s("events_create_booth_settings.text49"),".",oe.length>b.length&&e.jsxs("span",{children:[" ",s("events_create_booth_settings.text456")," ",oe.length-b.length," ",s("events_create_booth_settings.text457"),"."]}
16)]}),(()=>{N.length+2;const t={gridTemplateColumns:`1fr repeat(${N.length}, 1fr) 1fr`};return e.jsxs("div",{className:"bg-zinc-50 rounded border border-zinc-100 overflow-hidden",children:[e.jsxs("div",{className:"grid gap-0 text-xs bg-zinc-100 px-2 py-1 font-medium text-zinc-500",style:t,children:[e.jsx("div",{children:s("events_create_booth_settings.text458")}),N.map(n=>e.jsx("div",{className:"text-center truncate",title:n.type_name||n.type_code,children:n.type_name||n.type_code},n.id)),e.jsx("div",{className:"text-center",children:s("events_create_booth_settings.text459")})]}),v.map(n=>{const a=b.filter(r=>r.area===n.name);return e.jsxs("div",{className:"grid gap-0 text-xs px-2 py-1.5 border-t border-zinc-100 hover:bg-white",style:t,children:[e.jsxs("div",{className:"flex items-center gap-1 truncate",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm",style:{backgroundColor:n.color}}),e.jsx("span",{className:"truncate",title:n.name,children:n.name})]}),N.map(r=>e.jsx("div",{className:"text-center text-zinc-600",children:a.filter(o=>o.event_booth_type_id===r.id).length},r.id)),e.jsx("div",{className:"text-center font-medium",children:a.length})]},n.name)}),(()=>{const n=b.filter(a=>!a.area||!v.some(r=>r.name===a.area));return n.length===0?null:e.jsxs("div",{className:"grid gap-0 text-xs px-2 py-1.5 border-t border-zinc-100 bg-red-50 text-red-700",style:t,children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm bg-red-400"}),e.jsx("span",{children:s("events_create_booth_settings.text460")})]}),N.map(a=>e.jsx("div",{className:"text-center",children:n.filter(r=>r.event_booth_type_id===a.id).length},a.id)),e.jsx("div",{className:"text-center font-medium",children:n.length})]})})(),e.jsxs("div",{className:"grid gap-0 text-xs px-2 py-1.5 border-t border-zinc-200 bg-zinc-100 font-medium",style:t,children:[e.jsx("div",{children:s("events_create_booth_settings.text461")}),N.map(n=>e.jsx("div",{className:"text-center",children:b.filter(a=>a.event_booth_type_id===n.id).length},n.id)),e.jsx("div",{className:"text-center",children:b.length})]})]})})()]})]})]})]}),e.jsx("div",{children:e.jsxs("div",{className:"space-y-2",children:[se.size>0&&e.jsxs(D,{variant:"destructive",className:"w-full justify-start bg-red-50 text-red-600 hover:bg-red-100 border border-red-100",onClick:()=>{const t=se.size;de(),R(n=>n.filter(a=>!se.has(a.id))),Ne(new Set),p.success(s("events_create_booth_settings.deleted_booths_count",{count:t}))},children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),s("events_create_booth_settings.delete_selected_booths")," (",se.size,")"]}),b.length>0&&e.jsxs(D,{variant:"destructive",className:"w-full justify-start bg-red-50 text-red-600 hover:bg-red-100 border border-red-100",disabled:Yt,onClick:async()=>{const t=b.filter(a=>!a.id.startsWith("draft-")),n=b.filter(a=>a.id.startsWith("draft-"));if(t.length>0){if(await q({title:`${s("events_create_booth_settings.text277")}`,description:`${s("events_create_booth_settings.text278")} ${t.length} ${s("events_create_booth_settings.text279")}! 17 18${s("events_create_booth_settings.text280")}: ${t.length} ${s("events_create_booth_settings.text49")} 19${s("events_create_booth_settings.text281")}: ${n.length} ${s("events_create_booth_settings.text49")} 20 21${s("events_create_booth_settings.text282")} ${b.length} ${s("events_create_booth_settings.text79")}? 22${s("events_create_booth_settings.text283")}`,variant:"danger"})){wt(!0),te({current:0,total:t.length,phase:s("events_create_booth_settings.text284")});try{for(let o=0;o<t.length;o+=3){te({current:o+1,total:t.length,phase:`${s("events_create_booth_settings.text285")} (${o+1}-${Math.min(o+3,t.length)}/${t.length})`});const i=t.slice(o,o+3);await Promise.all(i.map(l=>C.delete(`/booths/${l.id}`).catch(c=>null))),o+3<t.length&&await new Promise(l=>setTimeout(l,100))}R([]),Wt([]),Ne(new Set),Me(1),te(null),p.success(`${s("events_create_booth_settings.text273")} ${t.length} ${s("events_create_booth_settings.text49")}`)}catch(r){p.error(s("events_create_booth_settings.text25"),{description:(r==null?void 0:r.detail)||s("events_create_booth_settings.text89")}),te(null)}finally{wt(!1)}}}else await q({title:`${s("events_create_booth_settings.text282")} ${b.length} ${s("events_create_booth_settings.text49")}?`,variant:"warning"})&&(R([]),Ne(new Set),Me(1),p.success(s("events_create_booth_settings.text286")))},children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),s("events_create_booth_settings.text275")," (",b.length,")"]})]})})]}),e.jsx("div",{className:"p-5 border-t border-zinc-200 bg-white",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(D,{variant:"outline",onClick:()=>Q.push("/my-events"),children:s("events_create_booth_settings.text276")}),e.jsx(_t,{delayDuration:200,children:e.jsxs(gt,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(D,{className:"bg-[#1c1c1a] text-white hover:bg-brand-dark",disabled:Yt,onClick:mn,children:s(Yt?"events_create_booth_settings.text277":"events_create_booth_settings.text278")})}),e.jsx(pt,{side:"top",className:"max-w-[260px] text-xs",children:s("events_create_booth_settings.save_booths_hint")})]})})]})})]}),e.jsxs("main",{className:"flex-1 relative flex flex-col h-full overflow-auto bg-slate-100",children:[e.jsxs("div",{className:"absolute top-6 left-6 z-20 flex gap-3 pointer-events-none",children:[e.jsxs("div",{className:"bg-white px-4 py-2 rounded-md text-sm font-semibold text-gray-600 border border-gray-200 pointer-events-auto flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),s("events_create_booth_settings.text279"),": ",b.length]}),e.jsxs("button",{onClick:ua,disabled:le.length===0,className:`bg-white px-4 py-2 rounded-md text-sm font-medium border border-gray-200 pointer-events-auto flex items-center gap-2 transition-colors ${le.length===0?"text-gray-300 cursor-not-allowed":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"}`,title:le.length>0?`${s("events_create_booth_settings.text280")} (${le.length} ${s("events_create_booth_settings.text281")})`:s("events_create_booth_settings.text282"),children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 7v6h6"}),e.jsx("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})]}),s("events_create_booth_settings.text280"),le.length>0&&e.jsxs("span",{className:"text-xs text-gray-400",children:["(",le.length,")"]})]})]}),Be&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center",children:e.jsx("div",{className:"bg-white border border-gray-200 rounded-md p-8 max-w-md w-full mx-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-[#1c1c1a]/10 rounded-full mb-4",children:e.jsxs("svg",{className:"animate-spin h-8 w-8 text-[#1c1c1a]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:s("events_create_booth_settings.text283")}),e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:Be.phase}),e.jsx("div",{className:"w-full bg-gray-200 rounded-md h-3 mb-2 overflow-hidden",children:e.jsx("div",{className:"bg-[#1c1c1a] h-3 rounded-md transition-colors ease-out",style:{width:`${Be.current/Be.total*100}%`}})}),e.jsxs("p",{className:"text-xs text-gray-500",children:[Be.current," / ",Be.total," ",s("events_create_booth_settings.text284")]})]})})}),e.jsxs("div",{className:"flex-1 overflow-auto p-12 min-h-0",style:{backgroundImage:"radial-gradient(#cbd5e1 1px, transparent 1px)",backgroundSize:"20px 20px"},children:[e.jsxs("div",{className:"inline-flex flex-col items-start gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[G&&e.jsxs("div",{className:"flex items-center gap-2 bg-white px-4 py-2 rounded-md border",children:[e.jsx("button",{onClick:()=>xt(Math.max(.5,L-.5)),className:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-600 font-bold disabled:opacity-30",disabled:L<=.5,children:"â"}),e.jsxs("span",{className:"text-sm font-medium w-14 text-center",children:[Math.round(L*100),"%"]}),e.jsx("button",{onClick:()=>xt(Math.min(5,L+.5)),className:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-600 font-bold disabled:opacity-30",disabled:L>=5,children:"+"}),e.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),[1,2,3].map(t=>e.jsxs("button",{onClick:()=>xt(t),className:`text-xs px-2 py-1 rounded ${L===t?"bg-gray-800 text-white":"text-gray-500 hover:bg-gray-100"}`,children:[t*100,"%"]},t)),Y&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),e.jsxs("span",{className:"text-xs text-gray-400",children:[s("events_create_booth_settings.text421"),": ",Y.width,"Ã",Y.height]})]})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("div",{className:"w-10 h-10 bg-amber-100 hover:bg-amber-200 border border-amber-300 rounded-full flex items-center justify-center cursor-pointer transition-colors",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-amber-600",children:[e.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}),e.jsx("path",{d:"M9 18h6"}),e.jsx("path",{d:"M10 22h4"})]})}),e.jsx("div",{className:"absolute left-0 top-full mt-2 w-80 bg-white border border-amber-200 rounded-md opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-colors z-50",children:e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 pb-2 border-b border-amber-100",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-amber-500",children:[e.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}),e.jsx("path",{d:"M9 18h6"}),e.jsx("path",{d:"M10 22h4"})]}),e.jsx("span",{className:"font-semibold text-amber-800",children:s("events_create_booth_settings.text344")})]}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-600",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-500 mt-0.5",children:"â¢"}),e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-100 border rounded text-xs font-mono",children:"â"})," ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-100 border rounded text-xs font-mono",children:"â"})," ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-100 border rounded text-xs font-mono",children:"â"})," ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-100 border rounded text-xs font-mono",children:"â"})," ",s("events_create_booth_settings.text463")]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-500 mt-0.5",children:"â¢"}),e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-100 border rounded text-xs font-mono",children:"Shift"})," + ",s("events_create_booth_settings.text420")," ",s("events_create_booth_settings.text464")]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-500 mt-0.5",children:"â¢"}),e.jsx("span",{children:s("events_create_booth_settings.text465")})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-500 mt-0.5",children:"â¢"}),e.jsxs("span",{children:[s("events_create_booth_settings.text422")," ",e.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded text-xs",children:"â¥"})," ",s("events_create_booth_settings.text423")]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-500 mt-0.5",children:"â¢"}),e.jsx("span",{children:s("events_create_booth_settings.text466")})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-500 mt-0.5",children:"â¢"}),e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-100 border rounded text-xs font-mono",children:"Shift"})," + ",s("events_create_booth_settings.text350")]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-500 mt-0.5",children:"â¢"}),e.jsx("span",{children:s("events_create_booth_settings.text351")})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-pink-500 mt-0.5",children:"â¢"}),e.jsxs("span",{children:[s("events_create_booth_settings.text424"),e.jsx("span",{className:"text-pink-500 font-medium",children:s("events_create_booth_settings.text352")}),s("events_create_booth_settings.text425")]})]})]}),e.jsxs("div",{className:"mt-3 pt-3 border-t border-amber-100",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-purple-500",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),e.jsx("span",{className:"font-medium text-purple-700 text-xs",children:s("events_create_booth_settings.text298")})]}),e.jsxs("ul",{className:"text-xs text-gray-500 space-y-1.5",children:[e.jsxs("li",{className:"flex items-start gap-1.5",children:[e.jsx("span",{className:"text-purple-400 mt-0.5",children:"â¢"}),e.jsxs("span",{children:[e.jsx("strong",{children:s("events_create_booth_settings.text426")}),s("events_create_booth_settings.text427")]})]}),e.jsxs("li",{className:"flex items-start gap-1.5",children:[e.jsx("span",{className:"text-purple-400 mt-0.5",children:"â¢"}),e.jsxs("span",{children:[e.jsx("strong",{children:s("events_create_booth_settings.text428")}),s("events_create_booth_settings.text429")]})]})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:s("events_create_booth_settings.text359")})]})]})})]})]}),e.jsx("div",{className:"relative flex items-start gap-3",children:e.jsxs("div",{className:`relative rounded-md border-[4px] border-gray-800 transition-colors overflow-hidden ${Qe!=="select"?"border-[#1c1c1a]":""}`,style:{width:ae,height:ne},children:[G&&e.jsx("img",{src:G,alt:s("events_create_booth_settings.text303"),className:"absolute inset-0 pointer-events-none select-none",style:{zIndex:0,width:ae,height:ne}}),!G&&e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{zIndex:0,backgroundImage:"linear-gradient(#ddd 1px, transparent 1px), linear-gradient(90deg, #ddd 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:"#f5f5f5"}}),e.jsx("canvas",{ref:ee,width:ae,height:ne,onMouseDown:tn,onMouseMove:sn,onMouseUp:Ks,onMouseLeave:rn,onDoubleClick:Qa,onContextMenu:en,className:`absolute inset-0 block rounded-md ${Qe==="select"?_e.isDragging?"curs
22or-grabbing":"cursor-grab":"cursor-crosshair"}`,style:{zIndex:10,backgroundColor:"transparent"}}),!G&&b.length===0&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",style:{zIndex:20},children:e.jsxs("div",{className:"text-center opacity-30",children:[e.jsx(oa,{className:"h-16 w-16 mx-auto mb-2"}),e.jsx("p",{className:"font-bold",children:s("events_create_booth_settings.text360")}),e.jsx("p",{className:"text-sm",children:s("events_create_booth_settings.text361")})]})}),(Pt.horizontal.length>0||Pt.vertical.length>0)&&e.jsxs("svg",{className:"absolute inset-0 pointer-events-none",style:{zIndex:100},width:ae,height:ne,children:[Pt.horizontal.map((t,n)=>e.jsx("line",{x1:0,y1:t,x2:ae,y2:t,stroke:"#f472b6",strokeWidth:1,strokeDasharray:"4 4"},`h-${n}`)),Pt.vertical.map((t,n)=>e.jsx("line",{x1:t,y1:0,x2:t,y2:ne,stroke:"#f472b6",strokeWidth:1,strokeDasharray:"4 4"},`v-${n}`))]})]})})]}),e.jsxs("div",{className:"absolute bottom-6 right-6 text-xs text-gray-400 pointer-events-none select-none",children:["Zoom: ",Math.round(L*100),"% | Canvas: ",ae,"Ã",ne,"px"]})]})]}),e.jsx(Et,{open:fa,onOpenChange:ke,modal:!1,children:e.jsxs(Rt,{className:"max-w-md",children:[e.jsx(Ot,{className:"pb-2",children:e.jsx(Xt,{className:"text-base",children:s("events_create_booth_settings.text330")})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(M,{className:"text-xs",children:[s("events_create_booth_settings.text362")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(ut,{value:E,onValueChange:$a,disabled:v.length===0,children:[e.jsx(bt,{className:`h-9 ${!E&&v.length>0?"border-amber-400":""}`,children:e.jsx(vt,{placeholder:v.length===0?s("events_create_booth_settings.text364"):s("events_create_booth_settings.text363")})}),e.jsx(ft,{children:v.map(t=>{const n=b.filter(a=>a.area===t.name).length;return e.jsx(yt,{value:t.name,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:t.color}}),t.name,n>0&&e.jsxs("span",{className:"text-xs text-gray-400",children:["(",n,")"]})]})},t.name)})})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(M,{className:"text-xs",children:s("events_create_booth_settings.batch_create_count")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:Ss,onChange:t=>{const n=t.target.value.replace(/[^0-9]/g,""),a=parseInt(n,10);ya(isNaN(a)?0:Math.max(1,a))},className:"h-9 w-20"}),e.jsx("span",{className:"text-xs text-gray-400",children:s("events_create_booth_settings.text53")})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(M,{className:"text-xs",children:[s("events_create_booth_settings.text313")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("button",{type:"button",className:"text-xs text-blue-600 hover:text-blue-700 flex items-center gap-0.5",onClick:()=>{ke(!1),X({id:"",event_id:j||"",type_code:"",type_name:"",description:null,width:null,depth:null,height:null,display_width:60,display_height:60,base_wattage:0,pricings:[]}),K(!0)},children:[e.jsx(Ce,{className:"h-3 w-3"})," ",s("events_create_booth_settings.text377")]})]}),e.jsxs(ut,{value:Re,onValueChange:t=>{ja(t);const n=N.find(a=>a.id===t);Na(n||null)},children:[e.jsx(bt,{className:`h-9 ${Re?"":"border-amber-400"}`,children:e.jsx(vt,{placeholder:s("events_create_booth_settings.text314")})}),e.jsx(ft,{children:N.map(t=>e.jsx(yt,{value:t.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-3 h-3 rounded ${t.type_code==="large"?"bg-amber-100 border border-amber-300":"bg-blue-100 border border-blue-300"}`}),e.jsx("span",{className:"text-sm",children:t.type_name||t.type_code}),e.jsxs("span",{className:"text-xs text-gray-400",children:["(",s("events_create_booth_settings.width_abbr"),t.width||"?"," Ã ",s("events_create_booth_settings.depth_abbr"),t.depth||"?"," Ã ",s("events_create_booth_settings.height_abbr"),t.height||"?"," cm)"]})]})},t.id))})]}),Re&&(()=>{const t=N.find(n=>n.id===Re);return t?e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 px-1 bg-gray-50 rounded p-1.5 mt-1",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("span",{children:[s("events_create_booth_settings.width_label"),": ",e.jsx("strong",{children:t.width||"?"})," cm"]}),e.jsxs("span",{children:[s("events_create_booth_settings.depth_label"),": ",e.jsx("strong",{children:t.depth||"?"})," cm"]}),e.jsxs("span",{children:[s("events_create_booth_settings.height_label"),": ",e.jsx("strong",{children:t.height||"?"})," cm"]})]}),e.jsxs("div",{className:"text-gray-400",children:[s("events_create_booth_settings.base_wattage_label"),": ",t.base_wattage||0,"W"]}),e.jsxs("div",{className:"text-gray-400",children:[s("events_create_booth_settings.display_size_label"),": ",e.jsxs("strong",{children:[t.display_width||60,"Ã",t.display_height||60]})," px"]})]}),e.jsx("button",{type:"button",className:"text-blue-500 hover:text-blue-600",onClick:()=>{ke(!1),X(t),K(!0)},children:s("events_create_booth_settings.edit_btn")})]}):null})()]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(M,{className:"text-xs",children:s("events_create_booth_settings.naming_mode_label")}),he&&e.jsxs("span",{className:"text-xs text-amber-600",children:["ð ",s("events_create_booth_settings.naming_mode_locked")]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>!he&&ct("area-number"),disabled:he&&$e!=="area-number",className:`p-2 rounded border text-center transition-colors ${$e==="area-number"?"border-[#1c1c1a] bg-[#1c1c1a]/10":he?"border-gray-100 bg-gray-50 opacity-50 cursor-not-allowed":"border-gray-200 hover:border-gray-300"}`,title:`${s("events_create_booth_settings.naming_mode_area_number_example")}: ${E||"VIP"}-01, ${E||"VIP"}-02...`,children:[e.jsx("div",{className:"font-medium text-xs",children:s("events_create_booth_settings.naming_mode_area_number")}),e.jsxs("div",{className:"text-xs text-gray-400 mt-0.5",children:[E||"A","-01"]})]}),e.jsxs("button",{type:"button",onClick:()=>!he&&ct("type-global"),disabled:he&&$e!=="type-global",className:`p-2 rounded border text-center transition-colors ${$e==="type-global"?"border-[#1c1c1a] bg-[#1c1c1a]/10":he?"border-gray-100 bg-gray-50 opacity-50 cursor-not-allowed":"border-gray-200 hover:border-gray-300"}`,title:s("events_create_booth_settings.naming_mode_type_global_desc"),children:[e.jsx("div",{className:"font-medium text-xs",children:s("events_create_booth_settings.naming_mode_type_global")}),e.jsx("div",{className:"text-xs text-gray-400 mt-0.5",children:fe?`${fe.type_code.charAt(0).toUpperCase()}01`:"S01"})]}),e.jsxs("button",{type:"button",onClick:()=>!he&&ct("custom"),disabled:he&&$e!=="custom",className:`p-2 rounded border text-center transition-colors ${$e==="custom"?"border-[#1c1c1a] bg-[#1c1c1a]/10":he?"border-gray-100 bg-gray-50 opacity-50 cursor-not-allowed":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("div",{className:"font-medium text-xs",children:s("events_create_booth_settings.naming_mode_custom")}),e.jsx("div",{className:"text-xs text-gray-400 mt-0.5",children:"XXX-01"})]})]}),$e==="custom"&&e.jsx(B,{placeholder:s("events_create_booth_settings.naming_mode_custom_placeholder"),value:Cs,onChange:t=>ka(t.target.value),className:"text-xs h-8 mt-1"})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"autoArrange",checked:Zt,onChange:t=>
22wa(t.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[#1c1c1a] focus:ring-[#1c1c1a]"}),e.jsx(M,{htmlFor:"autoArrange",className:"text-sm font-medium leading-none cursor-pointer",children:s("events_create_booth_settings.auto_arrange_label")})]}),e.jsx("span",{className:"text-xs text-gray-400 cursor-help",title:s(Zt?"events_create_booth_settings.auto_arrange_on_hint":"events_create_booth_settings.auto_arrange_off_hint"),children:"â"})]}),e.jsxs("div",{className:"p-2 bg-pink-50 text-pink-600 rounded-md text-xs flex items-center gap-1.5",children:[e.jsx("span",{children:"â¤ï¸"})," ",s("events_create_booth_settings.naming_mode_area_hint")]})]}),e.jsxs(_s,{className:"flex-col sm:flex-row gap-2",children:[v.length===0?e.jsxs("div",{className:"flex-1 text-left text-xs text-amber-600 bg-amber-50 px-2 py-1.5 rounded",children:["â ï¸ ",s("events_create_booth_settings.no_areas_warning")]}):E?Re?null:e.jsxs("div",{className:"flex-1 text-left text-xs text-amber-600 bg-amber-50 px-2 py-1.5 rounded",children:["â ï¸ ",s("events_create_booth_settings.select_type_warning")]}):e.jsxs("div",{className:"flex-1 text-left text-xs text-amber-600 bg-amber-50 px-2 py-1.5 rounded",children:["â ï¸ ",s("events_create_booth_settings.select_area_warning")]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{variant:"outline",size:"sm",onClick:()=>ke(!1),children:s("events_create_booth_settings.cancel")}),e.jsx(D,{size:"sm",className:"bg-[#1c1c1a] text-white hover:bg-brand-dark disabled:opacity-50 disabled:cursor-not-allowed",onClick:on,disabled:!E||v.length===0||!Re,children:s("events_create_booth_settings.confirm_create")})]})]})]})}),e.jsx(Et,{open:pa,onOpenChange:t=>{t||rt(null),it(t)},children:e.jsxs(Rt,{className:"max-w-md",children:[e.jsxs(Ot,{children:[e.jsxs(Xt,{className:"flex items-center gap-2",children:[e.jsx(ps,{className:"h-5 w-5 text-amber-500"}),s("events_create_booth_settings.replace_map_image")]}),e.jsxs(xs,{children:[s("events_create_booth_settings.replace_map_description_prefix")," ",e.jsx("span",{className:"font-bold text-amber-600",children:b.length})," ",s("events_create_booth_settings.replace_map_description_suffix")]})]}),e.jsxs("div",{className:"space-y-3 py-4",children:[e.jsx("button",{onClick:ln,className:"w-full p-4 border-2 border-gray-200 rounded-md hover:border-blue-400 hover:bg-blue-50 transition-colors text-left group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-blue-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-gray-900 group-hover:text-blue-700",children:s("events_create_booth_settings.text345")}),e.jsxs("div",{className:"text-sm text-gray-500 mt-1",children:[s("events_create_booth_settings.text346"),", ",s("events_create_booth_settings.text347")]})]})]})}),e.jsx("button",{onClick:dn,className:"w-full p-4 border-2 border-gray-200 rounded-md hover:border-red-400 hover:bg-red-50 transition-colors text-left group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 flex items-center justify-center flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-red-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-gray-900 group-hover:text-red-700",children:s("events_create_booth_settings.text348")}),e.jsxs("div",{className:"text-sm text-gray-500 mt-1",children:[s("events_create_booth_settings.text349"),", ",s("events_create_booth_settings.text350")]})]})]})})]}),e.jsx(_s,{children:e.jsx(D,{variant:"outline",onClick:()=>{it(!1),rt(null)},children:s("events_create_booth_settings.cancel")})})]})}),V&&e.jsxs("div",{className:"fixed bg-white rounded-md border border-gray-200 py-2 z-[100] min-w-[240px]",style:{left:`${V.x}px`,top:`${V.y}px`},onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-4 py-2 border-b border-gray-100",children:[e.jsx("div",{className:"font-bold text-sm text-gray-900",children:V.booth.name}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[V.booth.area," ⢠",(()=>{const t=N.find(n=>
22n.id===V.booth.event_booth_type_id);return t?`${t.type_name} (${t.display_width||60}Ã${t.display_height||60}px)`:`${V.booth.width}Ã${V.booth.height}px`})()]})]}),e.jsxs("div",{className:"px-4 py-2 space-y-1 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-gray-500",children:[s("events_create_booth_settings.text351"),":"]}),e.jsxs("span",{className:"font-semibold text-gray-900",children:["$",V.booth.override_booth_price.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-gray-500",children:[s("events_create_booth_settings.text352"),":"]}),e.jsxs("span",{className:"font-mono text-gray-700",children:["(",V.booth.x,", ",V.booth.y,")"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-gray-500",children:[s("events_create_booth_settings.text318"),":"]}),e.jsxs("span",{className:"font-mono text-gray-700",children:[V.booth.width," à ",V.booth.height]})]})]}),e.jsxs("div",{className:"border-t border-gray-100 mt-2",children:[e.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-50 transition-colors flex items-center gap-2",onClick:()=>{ie({...V.booth}),ot(!0),ht(null)},children:[e.jsx("span",{children:"âï¸"}),e.jsx("span",{children:s("events_create_booth_settings.context_menu_edit")})]}),e.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-red-50 text-red-600 transition-colors flex items-center gap-2",onClick:()=>{de(),R(t=>t.filter(n=>n.id!==V.booth.id)),ht(null),p.success(s("events_create_booth_settings.deleted_booth"))},children:[e.jsx("span",{children:"ðï¸"}),e.jsx("span",{children:s("events_create_booth_settings.context_menu_delete")})]})]})]}),ba&&A&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 animate-in fade-in",onClick:()=>ot(!1),children:e.jsxs("div",{className:"bg-white rounded-md w-full max-w-sm mx-4 overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 flex justify-between items-center",children:[e.jsx("h3",{className:"font-bold text-lg",children:s("events_create_booth_settings.text285")}),e.jsxs("div",{className:"flex gap-2 text-xs text-gray-400",children:["ID: ",A.name]})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.text445")}),e.jsx(B,{value:A.name,onChange:t=>ie({...A,name:t.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.text406")}),e.jsxs(ut,{value:A.area,onValueChange:t=>ie({...A,area:t}),children:[e.jsx(bt,{children:e.jsx(vt,{})}),e.jsx(ft,{children:v.map(t=>e.jsx(yt,{value:t.name,children:t.name},t.name))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.text413")}),e.jsx(B,{type:"number",value:A.override_booth_price||"",onChange:t=>ie({...A,override_booth_price:Number(t.target.value)}),placeholder:`0 ${s("events_create_booth_settings.text356")}`}),(!A.override_booth_price||A.override_booth_price===0)&&e.jsxs("div",{className:"text-xs text-amber-600 mt-1 flex items-center gap-1",children:[e.jsx(Je,{className:"h-3 w-3"}),s("events_create_booth_settings.text357"),": $",Zs(A).toLocaleString()]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.text440")}),e.jsxs(ut,{value:A.event_booth_type_id||"",onValueChange:t=>{const n=N.find(a=>a.id===t);n&&ie({...A,event_booth_type_id:n.id,width:n.display_width||60,height:n.display_height||60,display_width:void 0,display_height:void 0})},children:[e.jsx(bt,{className:"h-9",children:e.jsx(vt,{placeholder:s("events_create_booth_settings.text314")})}),e.jsx(ft,{children:N.map(t=>
22e.jsxs(yt,{value:t.id,children:[t.type_name," (",t.display_width||60,"Ã",t.display_height||60,"px)"]},t.id))})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.opacity")}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:0,max:1,step:.05,value:A.opacity??1,onChange:t=>ie({...A,opacity:Number(t.target.value)}),className:"flex-1"}),e.jsxs("span",{className:"text-sm w-10 text-right",children:[((A.opacity??1)*100).toFixed(0),"%"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hs,{id:"enable-pass-code",checked:A.pass_code!=null,onCheckedChange:t=>{ie({...A,pass_code:t?"":void 0})}}),e.jsx(M,{htmlFor:"enable-pass-code",className:"text-xs text-gray-500 cursor-pointer",children:s("events_create_booth_settings.text358")})]}),A.pass_code!=null&&e.jsxs("div",{className:"relative",children:[e.jsx(B,{type:Vt?"text":"password",value:A.pass_code,onChange:t=>ie({...A,pass_code:t.target.value}),placeholder:s("events_create_booth_settings.text235"),className:"font-mono pr-10",autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>va(!Vt),className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:Vt?e.jsx(Nn,{className:"h-4 w-4"}):e.jsx(wn,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"p-4 bg-gray-50 border-t border-gray-100 grid grid-cols-2 gap-3",children:[e.jsx(D,{variant:"outline",className:"text-red-500 hover:text-red-700 hover:bg-red-50 border-transparent bg-white",onClick:xn,children:s("events_create_booth_settings.delete_booth_btn")}),e.jsx(D,{className:"bg-[#1c1c1a] text-white hover:bg-brand-dark",onClick:hn,children:s("events_create_booth_settings.text19")})]})]})}),Ia&&w&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/30 z-40",onClick:()=>{}}),e.jsxs("aside",{className:"fixed top-0 right-0 h-full w-full max-w-[660px] bg-white z-50 flex flex-col animate-in slide-in-from-right duration-200",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 flex justify-between items-center bg-amber-50 flex-shrink-0",children:[e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",children:[e.jsx(Yn,{className:"h-5 w-5 text-amber-600"}),w.id?s("events_create_booth_settings.text364"):s("events_create_booth_settings.text365")]}),e.jsx("button",{onClick:()=>Xe(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx(He,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.text366")}),e.jsx(B,{value:w.name,onChange:t=>xe({...w,name:t.target.value}),placeholder:s("events_create_booth_settings.text367")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.text368")}),e.jsx(B,{type:"date",value:w.start_date,onChange:t=>xe({...w,start_date:t.target.value}),onKeyDown:t=>t.preventDefault(),min:ns()||void 0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-xs text-gray-500 ",children:s("events_create_booth_settings.text369")}),e.jsx(B,{type:"date",value:w.end_date,onChange:t=>xe({...w,end_date:t.target.value}),onKeyDown:t=>t.preventDefault(),min:w.start_date||void 0})]})]}),Es.length>0&&e.jsxs("div",{className:"bg-yellow-50 border border-yellow-300 rounded-md px-3 py-2 flex items-start gap-2",children:[e.jsx(Nt,{className:"h-4 w-4 text-yellow-600 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs text-yellow-700",children:[e.jsx("p",{className:"font-medium",children:s("events_create_booth_settings.date_overlap_warning")||"æ¤æéç¯åè以ä¸å®å¹éçï¼å²åæå°é²è¡åå²ï¼"}),e.jsx("ul",{className:"list-disc list-inside mt-1",children:Es.map((t,n)=>e.jsx("li",{children:t},n))})]})]}),J.length>0&&e.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium mb-2",children:s("events_create_booth_settings.text471")}),e.jsx("div",{className:"space-y-1",children:J.map((t,n)=>e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-700",children:t.name}),e.jsxs("span",{className:"font-mono text-gray-500",children:[t.start_date," ~ ",t.end_date]})]},t.id||n))})]}),e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-2",children:[e.jsx(Nt,{className:"h-4 w-4 text-amber-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs text-amber-700",children:[e.jsx("p",{className:"font-medium mb-1",children:s("events_create_booth_settings.text472")}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-amber-600",children:[e.jsx("li",{children:s("events_create_booth_settings.text473")}),e.jsx("li",{children:s("events_create_booth_settings.text474")}),e.jsx("li",{children:s("events_create_booth_settings.text475")})]}),z&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-amber-200 text-amber-600",children:[e.jsxs("p",{children:[s("events_create_booth_settings.text468"),": ",((qs=z.registration_start_time)==null?void 0:qs.split("T")[0])||"-"," ~ ",((Qs=z.registration_end_time)==null?void 0:Qs.split("T")[0])||"-"]}),e.jsxs("p",{children:[s("events_create_booth_settings.text469"),": ",((ea=z.start_at)==null?void 0:ea.split("T")[0])||"-"]})]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{className:"text-xs text-gray-500 ",children:[s("events_create_booth_settings.text370")," (",s("events_create_booth_settings.text371"),", ",s("events_create_booth_settings.text372"),")"]}),e.jsx("div",{className:"grid grid-cols-3 gap-2 bg-gray-50 p-3 rounded-md border border-gray-100 max-h-[100px] overflow-y-auto",children:v.map(t=>{var n;return e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-white p-1 rounded transition-colors",children:[e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-[#1c1c1a] focus:ring-[#1c1c1a]",checked:((n=w.target_areas)==null?void 0:n.includes(t.name))??!1,onChange:a=>{const r=w.target_areas||[];a.target.checked?xe({...w,target_areas:[...r,t.name]}):xe({...w,target_areas:r.filter(o=>o!==t.name)})}}),e.jsx("span",{className:"text-xs text-gray-700",children:t.name})]},t.name)}
22)})]}),N.length===0?e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-4 text-center",children:[e.jsx("p",{className:"text-amber-700 text-sm",children:s("events_create_booth_settings.text117")}),e.jsx("p",{className:"text-amber-600 text-xs mt-1",children:s("events_create_booth_settings.text118")})]}):e.jsx("div",{className:`grid gap-4 ${N.length===1?"grid-cols-1":N.length===2?"grid-cols-2":"grid-cols-2 md:grid-cols-3"}`,children:N.map(t=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(ra,{className:"h-3 w-3 text-amber-500"}),t.type_name||t.type_code," (TWD)"]}),e.jsx(B,{type:"text",inputMode:"numeric",className:"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",value:w.prices[t.type_code]||"",onChange:n=>{const a=n.target.value.replace(/[^0-9]/g,"");xe({...w,prices:{...w.prices,[t.type_code]:a?Number(a):0}})},placeholder:s("events_create_booth_settings.enter_price")||"輸å
¥å¹æ ¼"})]},t.type_code))}),w.name&&w.start_date&&w.end_date&&e.jsxs("div",{className:"bg-gray-50 rounded-md p-4 mt-4",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:s("events_create_booth_settings.text375")}),e.jsxs("div",{className:"bg-amber-50 rounded-md p-3 border border-amber-200",children:[e.jsx("div",{className:"font-medium text-sm text-amber-800 mb-1",children:w.name}),e.jsxs("div",{className:"text-xs text-gray-500 mb-2",children:[w.start_date," ~ ",w.end_date]}),e.jsx("div",{className:`grid gap-2 text-xs ${N.length<=2?"grid-cols-2":"grid-cols-3"}`,children:N.map(t=>e.jsxs("div",{className:"bg-white rounded px-2 py-1",children:[e.jsxs("span",{className:"text-gray-500",children:[t.type_name||t.type_code,":"]}),e.jsxs("span",{className:"font-medium text-gray-700 ml-1",children:["$",(w.prices[t.type_code]||0).toLocaleString()]})]},t.type_code))})]})]})]}),e.jsxs("div",{className:"p-4 bg-gray-50 border-t border-gray-100 flex justify-end gap-3 flex-shrink-0",children:[e.jsx(D,{variant:"outline",onClick:()=>Xe(!1),children:s("events_create_booth_settings.cancel")}),e.jsx(D,{className:"bg-[#1c1c1a] text-white hover:bg-brand-dark",disabled:!w.name||!w.start_date||!w.end_date,onClick:()=>Za(w),children:s("events_create_booth_settings.text376")})]})]})]}),La&&S&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/30 z-40",onClick:()=>{}}),e.jsxs("aside",{className:"fixed top-0 right-0 h-full w-full max-w-[660px] bg-white z-50 flex flex-col animate-in slide-in-from-right duration-200",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 flex justify-between items-center bg-white flex-shrink-0",children:[e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",children:[e.jsx(ia,{className:"h-5 w-5 text-zinc-600"}),S.id?s("events_create_booth_settings.text218"):s("events_create_booth_settings.text377"),s("events_create_booth_settings.text313"),S.id?` - ${S.type_name||S.type_code}`:""]}),e.jsx("button",{onClick:()=>K(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx(He,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[!S.id&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(M,{className:"text-sm text-red-500 font-medium",children:[s("events_create_booth_settings.text378")," *"]}),e.jsxs("span",{className:"text-sm text-gray-400",children:[(S.type_code||"").length,"/30"]})]}),e.jsx(B,{value:S.type_code||"",onChange:t=>{const n=t.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"").slice(0,30);X({...S,type_code:n})},placeholder:s("events_create_booth_settings.type_code_placeholder"),maxLength:30}),e.jsx("p",{className:"text-sm text-red-500 font-medium",children:s("events_create_booth_settings.type_code_hint")||"å
éå°å¯«è±æãæ¸åãåºç·ï¼æå¤ 30 åå
"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(M,{className:"text-sm text-gray-500 ",children:s("events_create_booth_settings.text313")}),e.jsxs("span",{className:"text-sm text-gray-400",children:[(S.type_name||"").length,"/50"]})]}),e.jsx(B,{value:S.type_name||"",onChange:t=>{const n=t.target.value.slice(0,50);X({...S,type_name:n})},placeholder:s("events_create_booth_settings.type_name_placeholder"),maxLength:50})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"text-sm text-gray-500 ",children:s("events_create_booth_settings.text315")}),e.jsx(B,{value:S.description||"",onChange:t=>X({...S,description:t.target.value}),placeholder:s("events_create_booth_settings.text387")})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{className:"text-sm text-gray-500 ",children:[s("events_create_booth_settings.text119")," (cm)"]}
22),e.jsx(B,{type:"number",min:0,value:S.width||"",onChange:t=>{const n=Number(t.target.value);X({...S,width:n>0?n:null})},placeholder:"300"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{className:"text-sm text-gray-500 ",children:[s("events_create_booth_settings.text120")," (cm)"]}),e.jsx(B,{type:"number",min:0,value:S.depth||"",onChange:t=>{const n=Number(t.target.value);X({...S,depth:n>0?n:null})},placeholder:"200"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{className:"text-sm text-gray-500 ",children:[s("events_create_booth_settings.text121")," (cm)"]}),e.jsx(B,{type:"number",min:0,value:S.height||"",onChange:t=>{const n=Number(t.target.value);X({...S,height:n>0?n:null})},placeholder:"250"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(M,{className:"text-sm text-gray-500 ",children:[s("events_create_booth_settings.display_size_label")," (px)"]}),e.jsx("div",{className:"flex gap-1",children:[40,60,80,100].map(t=>e.jsxs("button",{type:"button",onClick:()=>X({...S,display_width:t,display_height:t}),className:`px-2 py-0.5 text-xs rounded border transition-colors ${(S.display_width||60)===t&&(S.display_height||60)===t?"border-[#1c1c1a] bg-[#1c1c1a]/10 text-[#1c1c1a] font-medium":"border-gray-200 text-gray-500 hover:border-gray-300"}`,children:[t,"Ã",t]},t))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(M,{className:"text-xs text-gray-400",children:s("events_create_booth_settings.display_width_label")}),e.jsx(B,{type:"number",min:20,max:200,value:S.display_width||60,onChange:t=>X({...S,display_width:Math.max(20,Math.min(200,Number(t.target.value)||60))}),placeholder:"60"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(M,{className:"text-xs text-gray-400",children:s("events_create_booth_settings.display_height_label")}),e.jsx(B,{type:"number",min:20,max:200,value:S.display_height||60,onChange:t=>X({...S,display_height:Math.max(20,Math.min(200,Number(t.target.value)||60))}),placeholder:"60"})]})]}),e.jsx("p",{className:"text-sm text-gray-400",children:s("events_create_booth_settings.display_size_hint")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{className:"text-sm text-gray-500 ",children:[s("events_create_booth_settings.text122")," (W)"]}),e.jsx(B,{type:"number",min:0,className:"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",value:S.base_wattage||"",onChange:t=>{const n=Number(t.target.value);X({...S,base_wattage:n>=0?n:0})},placeholder:"500"}),e.jsxs("p",{className:"text-sm text-gray-400",children:[s("events_create_booth_settings.text388"),", ",s("events_create_booth_settings.text389")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{className:"text-sm text-red-500 font-medium",children:[s("events_create_booth_settings.default_price")," (TWD)"]}),e.jsx(B,{type:"number",className:"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",value:S.default_price||"",onChange:t=>X({...S,default_price:Number(t.target.value)||0}),placeholder:"0",min:"0"}),e.jsx("p",{className:"text-sm text-red-500",children:s("events_create_booth_settings.default_price_hint")})]})]}),e.jsxs("div",{className:"p-4 bg-gray-50 border-t border-gray-100 flex justify-end gap-3 flex-shrink-0",children:[e.jsx(D,{variant:"outline",onClick:()=>K(!1),children:s("events_create_booth_settings.cancel")}),e.jsx(D,{className:"bg-[#1c1c1a] text-white hover:bg-brand-dark",onClick:()=>Ka(S),children:S.id?s("events_create_booth_settings.update"):s("events_create_booth_settings.text390")})]})]})]}),e.jsx(kn,{open:Pa,onOpenChange:It,children:e.jsxs($n,{className:"max-w-4xl",children:[e.jsxs(Sn,{children:[e.jsxs(Cn,{className:"flex items-center gap-2",children:[e.jsx(Nt,{className:"h-5 w-5 text-amber-500"}),s("events_create_booth_settings.date_range_overlap")]}),e.jsx(zn,{children:s("events_create_booth_settings.date_range_overlap_description")})]}),dt&&e.jsx("div",{className:"my-4",children:e.jsx(Hn,{segments:dt.segments,boothTypes:N})}),e.jsxs(Mn,{children:[e.jsx(An,{onClick:()=>{It(!1),ss(null),as(null)},children:s("events_create_booth_settings.cancel")}),e.jsx(Dn,{className:"bg-[#1c1c1a] text-white hover:bg-brand-dark",onClick:Va,children:s("events_create_booth_settings.confirm_split")}
22)]})]})}),Da&&e.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",onClick:()=>Qt(!1),children:[e.jsx("div",{className:"absolute inset-0 bg-black/20"}),e.jsxs("aside",{className:"relative w-full max-w-md bg-white h-full overflow-y-auto animate-in slide-in-from-right duration-200",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"sticky top-0 bg-white border-b border-zinc-200 px-4 py-3 flex items-center justify-between z-10",children:[e.jsxs("h3",{className:"font-semibold text-sm text-zinc-700 flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-zinc-400"}),s("events_create_booth_settings.booth_type_history")||"æ·å²ç´é"]}),e.jsx("button",{onClick:()=>Qt(!1),className:"text-zinc-400 hover:text-zinc-600 p-1",children:e.jsx(He,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"p-4 space-y-3",children:As.length===0?e.jsx("div",{className:"text-center py-8 text-zinc-400 text-sm",children:s("events_create_booth_settings.no_deleted_booth_types")||"æ²æå·²åªé¤çæ¤ä½é¡å"}):As.map((t,n)=>e.jsxs("div",{className:"border border-zinc-200 rounded-md p-3 bg-zinc-50 opacity-80",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm text-zinc-500 line-through",children:t.type_name||t.type_code}),e.jsx("div",{className:"text-xs text-zinc-400 font-mono mt-0.5",children:t.type_code})]}),e.jsx("span",{className:"text-xs text-red-400 bg-red-50 px-1.5 py-0.5 rounded font-normal shrink-0",children:s("events_create_booth_settings.deleted_label")||"å·²åªé¤"})]}),e.jsxs("div",{className:"text-xs text-zinc-400 space-y-0.5",children:[e.jsxs("div",{children:[t.width||"â","Ã",t.depth||"â","Ã",t.height||"â"," cm · ",t.base_wattage||0," W"]}),t.deleted_at&&e.jsxs("div",{children:[s("events_create_booth_settings.booth_type_deleted_at")||"åªé¤æé",": ",ta(new Date(t.deleted_at),Z)]}),(t.updated_by_name||t.updated_by_email)&&e.jsxs("div",{children:[s("events_create_booth_settings.booth_type_deleted_by")||"åªé¤è
",": ",t.updated_by_name,t.updated_by_email?` (${t.updated_by_email})`:""]})]})]},t.id||`deleted-bt-${n}`))})]})]}),Ma&&e.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",onClick:()=>qt(!1),children:[e.jsx("div",{className:"absolute inset-0 bg-black/20"}),e.jsxs("aside",{className:"relative w-full max-w-md bg-white h-full overflow-y-auto animate-in slide-in-from-right duration-200",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"sticky top-0 bg-white border-b border-zinc-200 px-4 py-3 flex items-center justify-between z-10",children:[e.jsxs("h3",{className:"font-semibold text-sm text-zinc-700 flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-zinc-400"}),s("events_create_booth_settings.pricing_history_title")||"å®å¹æ·å²ç´é"]}),e.jsx("button",{onClick:()=>qt(!1),className:"text-zinc-400 hover:text-zinc-600 p-1",children:e.jsx(He,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"p-4 space-y-3",children:Kt.length===0?e.jsx("div",{className:"text-center py-8 text-zinc-400 text-sm",children:s("events_create_booth_settings.no_inactive_pricings")||"æ²æå·²åªé¤çå®å¹"}):Kt.map((t,n)=>e.jsxs("div",{className:"border border-zinc-200 rounded-md p-3 bg-zinc-50 opacity-80",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm text-zinc-500 line-through",children:t.name||`${s("events_create_booth_settings.text214")} ${n+1}`}),e.jsxs("div",{className:"text-xs font-mono text-zinc-400 mt-0.5",children:[t.start_date," ~ ",t.end_date]})]}),e.jsx("span",{className:"text-xs text-red-400 bg-red-50 px-1.5 py-0.5 rounded font-normal shrink-0",children:s("events_create_booth_settings.deleted_label")||"å·²åªé¤"})]}),t.deleted_at&&e.jsxs("div",{className:"text-xs text-zinc-400 mb-1",children:[s("events_create_booth_settings.pricing_deleted_at")||"åªé¤æé",": ",ta(new Date(t.deleted_at),Z)]}),t.target_areas&&t.target_areas.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:t.target_areas.map(a=>e.jsx("span",{className:"px-1.5 py-0.5 rounded-md text-xs bg-zinc-100 text-zinc-400 border border-zinc-200",children:a},a))}),e.jsx("div",{className:`grid gap-2 pt-2 border-t border-dashed border-zinc-200 ${N.length<=2,"grid-cols-2"}`,children:N.map(a=>e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs text-zinc-400 truncate",children:a.type_name||a.type_code}),e.jsxs("span",{className:"text-sm font-medium text-zinc-500",children:["$",new Intl.NumberFormat("en-US").format(t.prices[a.type_code]||0)]})]},a.type_code))}),t.updated_by&&e.jsx("div",{className:"mt-2 pt-2 border-t border-zinc-200 text-xs text-zinc-400",children:e.jsxs("span",{children:[s("events_create_booth_settings.pricing_deleted_by")||"åªé¤è
",": ",t.updated_by]})})]},t.id||`inactive-${n}`))})]})]})]})}function Hn({segments:Q,boothTypes:Ze}){const{language:Pe}=la(),pe=x.useCallback((j,Z)=>da(Pe,j,Z),[Pe]);if(!Q||Q.length===0)return null;const Ge=Q.reduce((j,Z)=>{const s=new Date(Z.start_date+"T00:00:00"),ee=new Date(Z.end_date+"T00:00:00");return j+Math.round((ee.getTime()-s.getTime())/(1e3*60*60*24))+1},0);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex rounded-md overflow-hidden border border-gray-200 h-8",children:Q.map((j,Z)=>{const s=new Date(j.start_date+"T00:00:00"),ee=new Date(j.end_date+"T00:00:00"),je=Math.round((ee.getTime()-s.getTime())/(1e3*60*60*24))+1,z=je/Ge*100;return e.jsxs("div",{className:`flex items-center justify-center text-xs font-medium ${j.source==="new"?"bg-amber-200 text-amber-800":"bg-gray-100 text-gray-600"} ${Z>0?"border-l border-gray-300":""}`,style:{width:`${z}%`},children:[je,pe("events_create_booth_settings.days_unit")]},Z)})}),e.jsx("div",{className:"space-y-2",children:Q.map((j,Z)=>{const s=new Date(j.start_date+"T00:00:00"),ee=new Date(j.end_date+"T00:00:00"),je=Math.round((ee.getTime()-s.getTime())/(1e3*60*60*24))+1;return e.jsxs("div",{className:`rounded-md border p-3 ${j.source==="new"?"bg-amber-50 border-amber-200":"bg-gray-50 border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[j.source==="new"&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-amber-200 text-amber-800",children:pe("events_create_booth_settings.new_label")}),j.source==="existing"&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-gray-200 text-gray-600",children:pe("events_create_booth_settings.original_label")}),e.jsx("span",{className:"font-semibold text-sm text-gray-900",children:j.name})]}),e.jsxs("span",{className:"text-xs text-gray-500",children:[je," ",pe("events_create_booth_settings.days_unit")]})]}),e.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[j.start_date," ~ ",j.end_date]}),j.target_areas&&j.target_areas.length>0&&e.jsxs("div",{className:"text-xs text-blue-600 mb-2",children:[pe("events_create_booth_settings.applicable_areas"),j.target_areas.join("ã")]}),e.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:Ze.map(z=>e.jsxs("div",{className:"text-sm text-gray-700",children:[z.type_name||z.type_code,":",e.jsxs("span",{className:"font-semibold ml-1",children:["$",(j.prices[z.type_code]||0).toLocaleStr
22ing()]})]},z.type_code))})]},Z)})})]})}function Ri(){return e.jsx(x.Suspense,{fallback:e.jsxs("div",{className:"min-h-screen flex flex-col bg-white",children:[e.jsx(ca,{title:"Booth Map Editor",backTo:"/my-events"}),e.jsx("main",{className:"flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-gray-500",children:"Loading..."})})]}),children:e.jsx(Un,{})})}export{Ri as default};
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.