1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7502],{92735:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},45675:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},82029:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]])},17689:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},35596:function(e,t,n){n.d(t,{Z:function(){return m}});var r=n(57437),a=n(2265),i=n(59717),s=n(81906),l=n(33728),d=n(57586),o=n(13100),c=n(93448),u=n(21652);let x=0;function m(e){let{isOpen:t,onClose:n,title:m,children:h,footer:p,className:f}=e,b=(0,i.o)(),g=(0,s.c)(0);(0,a.useEffect)(()=>{t&&g.set(0)},[t,g]);let v=(0,l.H)(g,[0,240],[1,0]),w=(0,a.useRef)(n),y=(0,a.useRef)(!1);(0,a.useEffect)(()=>{w.current=n},[n]),(0,a.useEffect)(()=>{if(!t)return;x++,document.body.style.overflow="hidden";let e=(0,u.UM)(),n=window.history.state||{};!e||y.current||n.isBottomSheet||(window.history.pushState({...n,isBottomSheet:!0},""),y.current=!0);let r=()=>{y.current&&(y.current=!1,w.current())};return window.addEventListener("popstate",r),()=>{window.removeEventListener("popstate",r),--x<=0&&(x=0,document.body.style.overflow="")}},[t]);let j=(0,a.useCallback)(()=>{y.current&&(y.current=!1,window.history.back()),n()},[n]),k=(0,a.useCallback)((e,t)=>{(t.velocity.y>500||t.offset.y>100)&&j()},[j]),N=(0,a.useRef)(null),z=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!t)return;let e=N.current;if(!e)return;let n=[],r=function(t){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!e||!e.contains(t))return;let r=e.getBoundingClientRect(),a=t.getBoundingClientRect(),i=a.top-r.top,s=Math.min(24,Math.max(12,(e.clientHeight-a.height)/2)),l=e.scrollTop+i-s;e.scrollTo({top:Math.max(0,l),behavior:n?"smooth":"auto"})},a=e=>{let t=e.target;t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||t.isContentEditable)&&(z.current=t,r(t,!1),n.push(setTimeout(()=>r(t,!0),120)),n.push(setTimeout(()=>r(t,!0),300)),n.push(setTimeout(()=>r(t,!0),500)))},i=()=>{z.current=null},s=()=>{z.current&&r(z.current,!0)};e.addEventListener("focusin",a),e.addEventListener("focusout",i);let l=window.visualViewport;return null==l||l.addEventListener("resize",s),()=>{n.forEach(clearTimeout),e.removeEventListener("focusin",a),e.removeEventListener("focusout",i),null==l||l.removeEventListener("resize",s)}},[t]),(0,r.jsx)(d.M,{children:t&&(0,r.jsxs)("div",{className:"md:hidden fixed inset-x-0 z-[100] flex items-end",role:"dialog","aria-modal":"true","aria-label":m,style:{top:"var(--vv-offset-top, 0px)",height:"var(--app-height)"},children:[(0,r.jsx)(o.E.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.22,ease:[.22,1,.36,1]},className:"absolute inset-0",children:(0,r.jsx)(o.E.div,{style:{opacity:v},onClick:j,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"})}),(0,r.jsxs)(o.E.div,{style:{y:g,maxHeight:"90%"},initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:30,stiffness:320,mass:.8},drag:"y",dragListener:!1,dragControls:b,dragConstraints:{top:0},dragElastic:{top:.12,bottom:.75},onDragEnd:k,role:"dialog","aria-modal":"true",className:(0,c.cn)("relative w-full bg-white dark:bg-[#18181b] border-t border-transparent dark:border-white/[0.08] rounded-t-2xl","flex flex-col overflow-hidden mobile-sheet-pad shadow-2xl",f),children:[(0,r.jsx)("div",{onPointerDown:e=>b.start(e),className:"flex justify-center pt-3 pb-2 shrink-0 cursor-grab active:cursor-grabbing touch-none select-none",children:(0,r.jsx)("div",{className:"w-9 h-1 rounded-full bg-zinc-300 dark:bg-zinc-700"})}),m&&(0,r.jsx)("div",{className:"px-4 pb-3 border-b border-zinc-200/40 dark:border-zinc-800/60 shrink-0",children:(0,r.jsx)("h3",{className:"text-[var(--mobile-font-h2)] font-semibold text-zinc-900 dark:text-zinc-100",children:m})}),(0,r.jsx)("div",{ref:N,className:"flex-1 overflow-y-auto overflow-x-hidden px-4 pt-3 pb-2 mobile-scroll mobile-sheet-scroll",children:h}),p&&(0,r.jsx)("div",{className:"shrink-0 px-4 pt-2.5 pb-1 border-t border-zinc-100 dark:border-zinc-800/80 bg-white/95 dark:bg-[#18181b]/95 backdrop-blur-md",children:p})]})]})})}},91455:function(e,t,n){n.d(t,{s:function(){return s}});var r=n(57437),a=n(2265),i=n(93448);function s(e){let{options:t,value:n,onChange:s,className:l,itemClassName:d,activeItemClassName:o,inactiveItemClassName:c,indicatorClassName:u,variant:x="pill",underlineThickness:m=2,disabled:h=!1,equalWidth:p=!1,"aria-label":f}=e,b=(0,a.useRef)(null),g=(0,a.useRef)({}),[v,w]=(0,a.useState)(null),[y,j]=(0,a.useState)(!1),k=t.map(e=>e.key).join("\0"),N=(0,a.useCallback)(()=>{let e=b.current,t=g.current[n];if(!e||!t||0===t.offsetWidth){w(e=>null===e?e:null);return}let r={left:t.offsetLeft,top:t.offsetTop,width:t.offsetWidth,height:t.offsetHeight};w(e=>e&&e.left===r.left&&e.top===r.top&&e.width===r.width&&e.height===r.height?e:r)},[n]);(0,a.useLayoutEffect)(()=>{N()},[N,k,x]),(0,a.useEffect)(()=>{if(!v||y)return;let e=requestAnimationFrame(()=>j(!0));return()=>cancelAnimationFrame(e)},[v,y]),(0,a.useEffect)(()=>{let e=b.current;if(!e||"undefined"==typeof ResizeObserver)return;let t=new ResizeObserver(()=>N());return t.observe(e),Object.values(g.current).forEach(e=>{e&&t.observe(e)}),()=>t.disconnect()},[N,k]),(0,a.useEffect)(()=>{let e=document.fonts;if(!(null==e?void 0:e.ready))return;let t=!1;return e.ready.then(()=>{t||N()}).catch(()=>{}),()=>{t=!0}},[N]);let z=!!v&&!h;return(0,r.jsxs)("div",{ref:b,role:"group","aria-label":f,className:(0,i.cn)("relative flex items-center",l),children:[(0,r.jsx)("div",{"aria-hidden":!0,className:(0,i.cn)("absolute left-0 top-0 pointer-events-none","pill"===x?"rounded-lg":"rounded-full",y&&"transition-[transform,width,opacity] duration-300 ease-out motion-reduce:transition-none",z?"opacity-100":"opacity-0",u),style:v?{transform:"translate3d(".concat(v.left,"px, ").concat("underline"===x?v.top+v.height-m:v.top,"px, 0)"),width:v.width,height:"underline"===x?m:v.height}:void 0}),t.map(e=>{let t=e.key===n;return(0,r.jsx)("button",{ref:t=>{g.current[e.key]=t},type:"button","aria-pressed":t,title:e.title,"aria-label":e.ariaLabel,disabled:h,onClick:()=>s(e.key),className:(0,i.cn)("relative z-10 flex items-center justify-center transition-colors duration-200 motion-reduce:transition-none",p&&"flex-1",d,t?o:c,e.className),children:e.label},e.key)})]})}},67502:function(e,t,n){n.r(t),n.d(t,{AttendanceCalendarView:function(){return eS},default:function(){return eI}});var r=n(57437),a=n(2265),i=n(92451),s=n(10407),l=n(30401),d=n(18930),o=n(99397),c=n(31047),u=n(82029),x=n(17689),m=n(79205);let h=(0,m.Z)("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);var p=n(93448),f=n(4908),b=n(83008),g=n(13376),v=n(27526),w=n(54696),y=n(67920),j=n(53834),k=n(98319),N=n(46173);let z=e=>{let{value:t,options:n,onChange:a,className:i}=e,s=null===t,l=e=>{t===e?a(null):a(e)};return(0,r.jsx)("div",{className:(0,p.cn)("flex gap-1.5 justify-center",i),children:n.map(e=>{let n=t===e,a=(0,N.on)(e);return(0,r.jsx)("button",{onClick:()=>l(e),className:(0,p.cn)("font-semibold transition-colors whitespace-nowrap border",s||n?"o
1pacity-100":"opacity-0 pointer-events-none absolute",n&&a?"w-full h-[28px] rounded-lg text-sm bg-transparent border-transparent text-[var(--ink)] dark:text-[var(--ink-dark)] hover:bg-black/[0.03] dark:hover:bg-white/10":"min-w-[52px] px-2.5 py-1 rounded-full text-xs bg-transparent text-zinc-500 dark:text-[#8E8E93] border-zinc-200 dark:border-white/10 hover:border-zinc-400 hover:text-zinc-900 dark:hover:border-white/25 dark:hover:text-white"),style:n&&a?{"--ink":a.fg,"--ink-dark":a.darkFg}:void 0,children:e},e)})})};var E=n(26710),C=n(91455);let D=e=>{let{value:t,studentId:n,onChange:i,onSelect:s,className:l}=e,{students:d}=(0,f.AF)(),[o,c]=(0,a.useState)(!1),[u,x]=(0,a.useState)(t),m=(0,a.useRef)(null);(0,a.useEffect)(()=>{x(t)},[t]),(0,a.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&c(!1)};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[]);let h=d.filter(e=>"ë´ì íê¸"===e.homeClassId),b=u.trim()?h.filter(e=>e.name.includes(u.trim())):h,g=e=>{x(e.name),s(e.id,e.name),c(!1)};return(0,r.jsxs)("div",{ref:m,className:"relative w-full",children:[(0,r.jsx)("input",{type:"text",value:u,onChange:e=>{let t=e.target.value;x(t),i(t),c(!0)},onFocus:()=>c(!0),placeholder:"ì´ë¦",className:(0,p.cn)("bg-transparent text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 w-full text-center transition-colors",n?"text-white":"text-amber-400 placeholder:text-amber-400/70",l)}),o&&b.length>0&&(0,r.jsx)("div",{className:"absolute top-full left-0 mt-2 bg-white dark:bg-[#1C1C1E] border border-zinc-200 dark:border-white/10 rounded-xl shadow-2xl z-[100] w-full max-h-[200px] overflow-y-auto py-1",children:b.map(e=>(0,r.jsxs)("button",{onClick:()=>g(e),className:(0,p.cn)("w-full px-3 py-2 text-left text-sm transition-colors flex items-center justify-between gap-2",n===e.id?"bg-zinc-100 dark:bg-white/10 text-zinc-900 dark:text-white":"text-zinc-600 dark:text-[#8E8E93] hover:bg-zinc-100 dark:hover:bg-white/5 hover:text-zinc-900 dark:hover:text-white"),children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsxs)("span",{className:"text-[10px] text-zinc-400 dark:text-[#5C5C5E]",children:[e.number,"ë²"]})]},e.id))})]})},S=e=>{let t=e.map(e=>N.OL.indexOf(e)).filter(e=>e>=0).sort((e,t)=>e-t);if(0===t.length)return"";let n=[];for(let e of t){let t=n[n.length-1];t&&e===t[t.length-1]+1?t.push(e):n.push([e])}let r=e=>e.match(/^(\d)êµì$/);return n.map(e=>{if(1===e.length)return N.OL[e[0]];let t=N.OL[e[0]],n=N.OL[e[e.length-1]],a=r(t),i=r(n);return a&&i?"".concat(a[1],"~").concat(i[1],"êµì"):"".concat(t,"~").concat(n)}).join(", ")},M=e=>{let{value:t,onChange:n,multi:i=!1,disabled:s=!1,className:l}=e,[d,o]=(0,a.useState)(!1),[c,u]=(0,a.useState)(""),x=(0,a.useRef)(null),m=t?t.split(",").filter(Boolean):[];(0,a.useEffect)(()=>{let e=e=>{x.current&&!x.current.contains(e.target)&&(o(!1),u(""))};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[]),(0,a.useEffect)(()=>{s&&(o(!1),u(""))},[s]);let h=c.trim()?N.OL.filter(e=>e.includes(c.trim())):N.OL,f=e=>{if(i){let t=m.includes(e)?m.filter(t=>t!==e):N.OL.filter(t=>t===e||m.includes(t));n(t.length>0?t.join(","):null)}else n(m.includes(e)?null:e),o(!1),u("")},b=d?c:S(m);return(0,r.jsxs)("div",{ref:x,className:"relative w-full",children:[(0,r.jsx)("input",{type:"text",value:b,onChange:e=>{u(e.target.value),o(!0)},onFocus:()=>!s&&o(!0),disabled:s,placeholder:"êµì",className:(0,p.cn)("bg-transparent text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 w-full text-center transition-colors",s?"text-[#5C5C5E] cursor-not-allowed":m.length>0?"text-white":"text-[#8E8E93] placeholder:text-[#5C5C5E]",l)}),d&&!s&&h.length>0&&(0,r.jsx)("div",{className:"absolute top-full left-0 mt-2 bg-white dark:bg-[#1C1C1E] border border-zinc-200 dark:border-white/10 rounded-xl shadow-2xl z-[100] w-full max-h-[200px] overflow-y-auto py-1",children:h.map(e=>{let t=m.includes(e);return(0,r.jsxs)("button",{onClick:()=>f(e),className:(0,p.cn)("w-full px-3 py-2 text-left text-sm transition-colors flex items-center justify-between gap-2",t?"bg-zinc-100 dark:bg-white/10 text-zinc-900 dark:text-white":"text-zinc-600 dark:text-[#8E8E93] hover:bg-zinc-100 dark:hover:bg-white/5 hover:text-zinc-900 dark:hover:text-white"),children:[(0,r.jsx)("span",{className:"font-medium",children:e}),i&&t&&(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:(0,r.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e)})})]})},I=e=>{let{isOpen:t,onClose:n,onSave:i,onDelete:s,initialDate:l,existingRecords:d=[],autoAddRow:o=!1}=e,[c,u]=(0,a.useState)([]),[x,m]=(0,a.useState)([]),[h,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>
1{if(t){if(m([]),d.length>0){let e=d.map(e=>{var t;return{id:e.id,recordId:e.id,studentName:e.studentName,studentId:e.studentId,reason:e.reason,type:e.type,period:null!==(t=e.period)&&void 0!==t?t:null,date:e.date,endDate:e.endDate,details:e.details}});o&&e.push({id:Date.now().toString(),studentName:"",studentId:null,reason:null,type:null,period:null,date:l,details:""}),u(e)}else u([{id:Date.now().toString(),studentName:"",studentId:null,reason:null,type:null,period:null,date:l,details:""}])}},[t,d,o,l]);let b=(e,t)=>{u(n=>n.map(n=>n.id===e?{...n,...t}:n))},g=e=>{if(c.length>1){let t=c.find(t=>t.id===e);(null==t?void 0:t.recordId)&&m(e=>[...e,t.recordId]),u(t=>t.filter(t=>t.id!==e))}},v=async()=>{let e=c.filter(e=>e.studentId&&e.reason&&e.type);if(0===e.length&&0===x.length)return;let t=[...x],r=e.map(e=>({id:e.recordId,studentId:e.studentId,studentName:e.studentName,reason:e.reason,type:e.type,period:e.period,date:e.date,endDate:e.endDate,details:e.details,submitted:!1}));for(let e of(n(),t.length>0&&await Promise.all(t.map(e=>s(e))),r))await i(e)};return((0,a.useEffect)(()=>{if(!t)return;let e=e=>{if("Escape"===e.key){n();return}if("Enter"===e.key){if(e.isComposing||229===e.keyCode)return;let t=e.target;if("BUTTON"===t.tagName||"button"===t.getAttribute("role"))return;v()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,n,v]),t)?(0,r.jsx)("div",{className:"modal-viewport z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:(0,r.jsxs)("div",{className:"w-full max-w-5xl bg-[#1C1C1E] border border-white/10 rounded-2xl shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:[(0,r.jsxs)("div",{className:"px-6 pt-5 pb-3 flex items-center justify-between",children:[(0,r.jsx)("button",{onClick:()=>{u(e=>[...e,{id:Date.now().toString(),studentName:"",studentId:null,reason:null,type:null,period:null,date:l,details:""}])},className:"px-3 py-2 text-sm font-medium text-[#8E8E93] hover:text-white hover:bg-white/10 rounded-lg transition-colors attendance-add-student-btn",id:"attendance-add-student-btn",children:"+ íì ì¶ê°"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:n,className:"px-3 py-2 text-xs font-medium text-[#8E8E93] hover:text-white hover:bg-white/10 rounded-lg transition-colors",children:"ì·¨ì"}),(0,r.jsx)("button",{onClick:v,disabled:c.every(e=>!e.studentId||!e.reason||!e.type)||h,className:"px-4 py-2 bg-white text-black rounded-xl text-xs font-bold hover:bg-white/90 disabled:opacity-50 disabled:cursor-not-allowed transition whitespace-nowrap attendance-modal-save-btn",children:h?"ì ì¥...":"ì ì¥"})]})]}),(0,r.jsx)("div",{className:"px-6 pb-7 space-y-3",children:c.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsxs)("div",{className:"w-[180px] space-y-1.5",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"íì ì´ë¦"}),(0,r.jsx)("div",{className:"relative h-[38px] p-2 bg-white/5 rounded-xl border border-white/5 focus-within:border-white/20 transition-colors flex items-center attendance-modal-input-wrapper",children:(0,r.jsx)(D,{value:e.studentName,studentId:e.studentId,onChange:t=>b(e.id,{studentName:t}),onSelect:(t,n)=>b(e.id,{studentId:t,studentName:n})})})]}),(0,r.jsxs)("div",{className:"space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"구ë¶"}),(0,r.jsx)("div",{className:"flex h-[38px] bg-white/5 p-1 rounded-xl border border-white/5 attendance-modal-pill-wrapper",children:["ì§ë³","ì¸ì ","미ì¸ì ","기í"].map(t=>{var n,a;let i=e.reason===t,s=!!e.reason;return(0,r.jsx)("button",{onClick:()=>b(e.id,{reason:i?null:t}),className:(0,p.cn)("rounded-lg text-xs font-semibold transition-all duration-500 ease-[cubic-bezier(0.32,0.72,0,1)] whitespace-nowrap overflow-hidden border",i?"flex-1 opacity-100 px-6 bg-transparent border-transparent text-[var(--ink)] dark:text-[var(--ink-dark)]":s?"w-0 max-w-0 p-0 opacity-0 margin-0 border-0":"text-[#8E8E93] border-transparent hover:text-white px-3 opacity-100 w-auto"),style:i?{"--ink":null===(n=(0,N.on)(t))||void 0===n?void 0:n.fg,"--ink-dark":null===(a=(0,N.on)(t))||void 0===a?void 0:a.darkFg}:{},children:t},t)})})]}),(0,r.jsxs)("div",{className:"space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"ì í"}),(0,r.jsx)("div",{className:"flex h-[38px] bg-white/5 p-1 rounded-xl border border-white/5 attendance-modal-pill-wrapper",children:["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"].map(t=>{var n,a;let i=e.type===t,s=!!e.type;return(0,r.jsx)("button",{onClick:()=>{var n;let r=i?null:t,a={type:r};
1"ê²°ì"===r?a.period=null:("ì§ê°"===r||"ì¡°í´"===r)&&(null===(n=e.period)||void 0===n?void 0:n.includes(","))&&(a.period=e.period.split(",")[0]),b(e.id,a)},className:(0,p.cn)("rounded-lg text-xs font-semibold transition-all duration-500 ease-[cubic-bezier(0.32,0.72,0,1)] whitespace-nowrap overflow-hidden border",i?"flex-1 opacity-100 px-6 bg-transparent border-transparent text-[var(--ink)] dark:text-[var(--ink-dark)]":s?"w-0 max-w-0 p-0 opacity-0 margin-0 border-0":"text-[#8E8E93] border-transparent hover:text-white px-3 opacity-100 w-auto"),style:i?{"--ink":null===(n=(0,N.on)(t))||void 0===n?void 0:n.fg,"--ink-dark":null===(a=(0,N.on)(t))||void 0===a?void 0:a.darkFg}:{},children:t},t)})})]}),(0,r.jsxs)("div",{className:"w-[100px] space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"êµì"}),(0,r.jsx)("div",{className:(0,p.cn)("relative h-[38px] p-2 bg-white/5 rounded-xl border border-white/5 transition-colors flex items-center attendance-modal-period-wrapper","ê²°ì"===e.type?"opacity-40":"focus-within:border-white/20"),children:(0,r.jsx)(M,{value:e.period,onChange:t=>b(e.id,{period:t}),multi:"ê²°ê³¼"===e.type,disabled:"ê²°ì"===e.type})})]}),(0,r.jsxs)("div",{className:"w-[160px] flex-1 space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"ë ì§"}),(0,r.jsx)("div",{className:"relative h-[38px] bg-white/5 rounded-xl border border-white/5 flex items-center px-2 attendance-modal-date-wrapper",children:(0,r.jsx)(E.h,{value:e.date,onChange:t=>b(e.id,{date:t}),endDate:e.endDate,onEndDateChange:t=>b(e.id,{endDate:t}),className:"px-0 py-0"})})]}),(0,r.jsxs)("div",{className:"w-[140px] flex-1 space-y-1.5",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"ì¬ì "}),(0,r.jsx)("input",{type:"text",value:e.details,onChange:t=>b(e.id,{details:t.target.value}),placeholder:"",className:"w-full h-[38px] px-3 bg-white/5 rounded-xl border border-white/5 text-sm text-white placeholder:text-[#5C5C5E] focus:outline-none focus:border-white/20 transition-colors attendance-modal-detail-input"})]}),(0,r.jsxs)("div",{className:"space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("div",{className:"h-[24px]"}),c.length>1&&(0,r.jsx)("button",{onClick:()=>g(e.id),className:"h-[38px] w-[38px] flex items-center justify-center text-[#8E8E93] hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",title:"ìì ",children:(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]})]},e.id))})]})}):null};var L=n(75368),A=n(32489),R=n(33245),F=n(92735);let T=(0,m.Z)("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]);var _=n(51817),Z=n(92934),O=n(49322);function U(){return"undefined"!=typeof document&&!!document.getElementById("__naemo_connector_installed__")}function B(){var e;if("undefined"==typeof document)return null;let t=document.getElementById("__naemo_connector_installed__");return null!==(e=null==t?void 0:t.content)&&void 0!==e?e:null}var P=n(34137);function V(e){let t=(null!=e?e:"").trim();return t?t.split(",").map(e=>
1e.trim()).filter(Boolean).join(", "):"1êµì"}function W(e){let[t,n,r]=e.split("-").map(Number),a=["ì¼","ì","í","ì","목","ê¸","í "][new Date(t,n-1,r).getDay()];return"".concat(n,"/").concat(r,"(").concat(a,")")}function q(e){let{isOpen:t,onClose:n,onSynced:i,defaultStart:s,defaultEnd:l}=e,[d,o]=(0,a.useState)("idle"),[c,u]=(0,a.useState)(null),[m,h]=(0,a.useState)([]),[p,f]=(0,a.useState)({total:0,processed:0,failed:0}),[b,g]=(0,a.useState)(null),[v,w]=(0,a.useState)(s),[y,j]=(0,a.useState)(l),[k,N]=(0,a.useState)("checking"),[z,C]=(0,a.useState)(!1),[D,S]=(0,a.useState)(!1),M=(0,a.useCallback)(async()=>{if(!U()){N("missing");return}N(await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1500;return new Promise(t=>{if(!U())return t(!1);let n=crypto.randomUUID(),r=setTimeout(()=>{window.removeEventListener("message",a),t(!1)},e),a=e=>{var i;let s=e.data;(null==s?void 0:s.target)==="naemo-saas"&&s.requestId===n&&(clearTimeout(r),window.removeEventListener("message",a),t(!!(null===(i=s.response)||void 0===i?void 0:i.type)&&"naemo:pong"===s.response.type))};window.addEventListener("message",a),window.postMessage({target:"naemo-connector",type:"naemo:ping",requestId:n},window.location.origin)})}()?"present":"inactive")},[]);(0,a.useEffect)(()=>{if(t){o("idle"),u(null),h([]),g(null),C(!1);try{let e=localStorage.getItem("naemo:neis-guide-seen");S(!e),e||localStorage.setItem("naemo:neis-guide-seen","1")}catch(e){S(!1)}M()}},[t,M]),(0,a.useEffect)(()=>{if(!t||"present"===k)return;let e=setInterval(M,1e3),n=()=>M();return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{clearInterval(e),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[t,k,M]),(0,P.j)(n,t);let I=async()=>{o("loading-pending"),u(null);try{let n=await fetch("/api/attendance/neis-sync/pending?startDate=".concat(v,"&endDate=").concat(y)),r=await n.json();if(!n.ok||!r.success){var e,t;if("PLAN_REQUIRED"===r.error)throw Error(null!==(e=r.message)&&void 0!==e?e:"íë¡ íëììë§ ì¬ì©í ì ììµëë¤.");throw Error(null!==(t=r.error)&&void 0!==t?t:"ë°ì´í°ë¥¼ ë¶ë¬ì¬ ì ììµëë¤.")}h(r.data),o("ready")}catch(e){u(e.message),o("error")}},q=async()=>{let e=Date.now();o("syncing"),u(null),f({total:m.length,processed:0,failed:0});try{let t=await new Promise((e,t)=>{let n;if(!U()){t(Error("naemo Connector íì¥ì´ ì¤ì¹ëì´ ìì§ ììµëë¤."));return}let r=crypto.randomUUID(),a=()=>{clearTimeout(n),n=setTimeout(()=>{s(),t(Error("NEIS ìëì
ë ¥ì´ ì¼ì ìê° ëì ì§íëì§ ìì ì¤ë¨íìµëë¤. NEIS íë©´(ë¡ê·¸ì¸/ì¸ì
ë§ë£ ë±)ì íì¸í ë¤ ë¤ì ìëí´ì£¼ì¸ì."))},12e4)},i=n=>{var i,l,d,o;let c=n.data;if((null==c?void 0:c.target)==="naemo-saas"){if(a(),c.push){let n=c.push;"naemo:sync-progress"===n.type&&f&&f(n.payload),"naemo:sync-complete"===n.type&&(s(),e(n.payload)),"naemo:sync-error"===n.type&&(s(),t(Error(null!==(d=null===(l=n.payload)||void 0===l?void 0:l.message)&&void 0!==d?d:"ë기í ì¤í¨")));return}if(c.requestId===r){if(c.error){s(),t(Error(c.error));return}if(c.response&&!1===c.response.ok){s(),t(Error(null!==(o=c.response.error)&&void 0!==o?o:"ë기í ì¤í¨"));return}(null===(i=c.response)||void 0===i?void 0:i.ok)&&c.response.result&&(s(),e(c.response.result))}}};function s(){clearTimeout(n),window.removeEventListener("message",i)}window.addEventListener("message",i),a(),window.postMessage({target:"naemo-connector",type:"naemo:sync-request",requestId:r,payload:{records:m}},window.location.origin)});g(t),t.completedIds.length>0&&(await fetch("/api/attendance/neis-sync/mark-submitted",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t.completedIds})}),null==i||i(t.completedIds));let n=(t.failures||[]).map(e=>{var t,n,r,a,i,s,l,d;let o=m.find(t=>t.id===e.id);return{recordId:e.id,studentName:null!==(t=null==o?void 0:o.studentName)&&void 0!==t?t:"ì ì ìì",studentNumber:null!==(n=null==o?void 0:o.studentNumber)&&void 0!==n?n:null,grade:null!==(r=null==o?void 0:o.grade)&&void 0!==r?r:null,classNum:null!==(a=null==o?void 0:o.classNum)&&void 0!==a?a:null,date:null!==(i=null==o?void 0:o.date)&&void 0!==i?i:"",type:null!==(s=null==o?void 0:o.type)&&void 0!==s?s:"",reason:null!==(l=null==o?void 0:o.reason)&&void 0!==l?l:"",period:null!==(d=null==o?void 0:o.period)&&void 0!==d?d:null,error:e.error}}),r=0===t.failed?"SUCCESS":0===t.processed?"FAILED":"PARTIAL";fetch("/api/attendance/neis-sync/log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:r,totalCount:t.total,successCount:t.processed,failCount:t.failed,durationMs:Date.now()-e,connectorVersion:B(),failures:n,errorMessage:t.failed>0?"".concat(t.failed,"ê±´ ì
ë ¥ ì¤í¨"):null})}).catch(e=>console.warn("[NeisSyncModal] ë¡ê·¸ ì ì¥ ì¤í¨:",e)),o("done")}catch(n){let t=Date.now()-e;u(n.message),o("error"),fetch("/api/attendance/neis-sync/log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"FAILED",totalCount:m.length,successCount:0,failCount:m.length,durationMs:t,connectorVersion:B(),errorMessage:(null==n?void 0:n.message)||"ë기í ì¤ ì¤ë¥ ë°ì",failures:[]})}).catch(e=>console.warn("[NeisSyncModal] ì¤í¨ ë¡ê·¸ ì ì¥ ì¤í¨:",e))}};return t?(0,r.jsx)("div",{className:"modal-viewport z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:(0,r.jsxs)("div",{className:"w-full max-w-2xl bg-[#1C1C1E] border border-white/10 rounded-2xl shadow-2xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 pt-5 pb-3",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-white",children:"NEIS ìëì
ë ¥ (ë² í)"}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("button",{onClick:()=>S(e=>!e),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-sm font-bold text-toss-blue hover:bg-toss-blue/10 transition-colors",title:"ì¬ì© ë°©ë² ìë´",children:[(0,r.jsx)(L.Z,{size:14}),D?"ìë´ì¬í ì 기":"ìë´ì¬í 보기"]}),(0,r.jsx)("button",{"aria-label":"ë«ê¸°",onClick:n,className:"p-1.5 text-[#8E8E93] hover:text-white hover:bg-white/10 rounded-lg transition-colors",children:(0,r.jsx)(A.Z,{size:18})})]})]}),(0,r.jsxs)("div",{className:"px-6 py-5 space-y-4",children:[D&&(0,r.jsx)("div",{className:"bg-white border border-zinc-300 rounded-xl overflow-hidden",children:(0,r.jsxs)("div",{className:"max-h-[320px] overflow-y-auto px-4 py-3.5 space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-semibold text-zinc-900 mb-2",children:"â ì¬ì© ë°©ë²"}),(0,r.jsxs)("ol",{className:"space-y-1.5 text-sm text-zinc-700 dark:text-zinc-300 leading-relaxed list-decimal list-inside marker:text-zinc-400",children:[(0,r.jsxs)("li",{children:["íì¥ íë¡ê·¸ë¨(",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"NEIS ì¶ê²° ìëì
ë ¥ by NAEMO"}),")ì ì¤íí©ëë¤."]}),(0,r.jsxs)("li",{children:["ë¤ë¥¸ íìì NEIS ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âíê¸ë´ì-ì¶ê²°ê´ë¦¬-ì¼ì¼ì¶ê²°ê´ë¦¬(ë´ìì©)â"})," íë©´ì ëì ëì¼ì¸ì."]}),(0,r.jsxs)("li",{children:["ìëì ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âëì ë¶ë¬ì¤ê¸°â"})," ë²í¼ì ë르ì¸ì."]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-semibold text-zinc-900 mb-2",children:"â ì¸ë¶ ì¬í"}),(0,r.jsxs)("div",{className:"space-y-3 text-sm text-zinc-700 dark:text-zinc-300 leading-relaxed",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"â "})," ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âì
ë ¥â"})," ì´ì ì²´í¬ëì§ ìì ì¶ê²°ë§ NEISì ë°ìëë©°, ì ìì ì¼ë¡ ë°ìëë©´ í´ë¹ 기ë¡ì ì²´í¬ë°ì¤ê° ìëì¼ë¡ ì²´í¬ë©ëë¤. (ì¤ë³µ ë°ì ë°©ì§)"]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"â¡"})," ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âêµìâ ì´"}),"ìì ì íí ê°ì¼ë¡ NEISì ì
ë ¥ë©ëë¤. êµì를 ì ííì§ ìì ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"ì§ê°\xb7ì¡°í´\xb7ê²°ê³¼"}),"ë NEISì 1êµì를 기ì¤ì¼ë¡ ì²´í¬ë©ëë¤. (ì§ê°ì 1êµì를 í¬í¨í ì´ì êµìë¤, ì¡°í´ë 1êµì를 í¬í¨í ì´í êµìë¤, ê²°ê³¼ë 1êµìë§)"]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"â¢"})," ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âì¬ì â ì´"}),"ì ì ì ë´ì©ì NEISì ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âì¬ì â"})," 칸ì ê·¸ëë¡ ì
ë ¥ë©ëë¤."]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(R.Z,{size:14,className:"text-zinc-700 dark:text-zinc-300 shrink-0 mt-0.5"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"text-zinc-700 dark:text-zinc-300",children:"기í ê²°ì"}),"ì ë°ëì ì¬ì 를 ì
ë ¥í´ì¼ í©ëë¤. (ì¬ì ê° ë¹ì´ìì ê²½ì°, ìë ì
ë ¥ì´ ì¤ë¨ë©ëë¤.)"]})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(R.Z,{size:14,className:"text-zinc-700 dark:text-zinc-300 shrink-0 mt-0.5"}),(0,r.jsx)("span",{children:"주ë§\xb7ê³µí´ì¼ì ì못 기ë¡ë ì¶ê²°ì´ ìì¼ë©´ ìë ì
ë ¥ì´ ì¤ë¨ë ì ììµëë¤."})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(R.Z,{size:14,className:"text-zinc-700 dark:text-zinc-300 shrink-0 mt-0.5"}),(0,r.jsxs)("span",{children:["íì¬ ë² í ë²ì ì¼ë¡ ì´ì ì¤ì
ëë¤. ì¤ë¥ë ììì¹ ëª»í ëìì´ ë°ìíë©´ ë²ê·¸ ì ê³ í´ì£¼ì¸ì.",(0,r.jsx)("br",{}),"ì¬ë¬ë¶ì í¼ëë°±ì´ ë ëì ìë¹ì¤ë¥¼ ë§ëëë¤."]})]})]})]})]})}),"missing"===k&&!z&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("a",{href:"https://chromewebstore.google.com/detail/dipgaekcpaobajidhnbjhohkpckkhlao?utm_source=item-share-cb",target:"_blank",rel:"noopener noreferrer",style:{color:"#ffffff"},className:"inline-flex items-center gap-1.5 px-4 py-2 bg-zinc-900 text-sm font-semibold rounded-xl hover:bg-zinc-800 transition-colors",onClick:()=>C(!0),children:[(0,r.jsx)(F.Z,{size:14}),"íì¥ íë¡ê·¸ë¨ ì¤ì¹"]}),(0,r.jsx)("div",{className:"text-xs text-zinc-600 dark:text-zinc-400",children:"íì¥íë¡ê·¸ë¨ì ì¤ì¹íê³ ì¤íí ë¤ ë¤ì ìëí´ì£¼ì¸ì."})]}),"missing"===k&&z&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-white border border-zinc-300 rounded-xl",children:[(0,r.jsx)(F.Z,{size:18,className:"text-zinc-500 shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"text-sm font-semibold text-zinc-900",children:"ì¤ì¹ê° ìë£ëìëì?"}),(0,r.jsx)("div",{className:"text-xs text-zinc-600 dark:text-zinc-400",children:"ì¤ì¹ í íì´ì§ë¥¼ ìë¡ê³ 침íë©´ ë°ë¡ ì¬ì©í ì ììµëë¤."}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),style:{color:"#ffffff"},className:"inline-flex items-center gap-1.5 px-4 py-2 bg-zinc-900 text-sm font-semibold rounded-xl hover:bg-zinc-800 transition-colors",children:"íì´ì§ ìë¡ê³ 침"})]})]}),"inactive"===k&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-white border border-zinc-300 rounded-xl",children:[(0,r.jsx)(T,{size:18,className:"text-amber-600 shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-sm font-semibold text-zinc-900",children:"NEIS ì¶ê²° ìëì
ë ¥ íì¥ íë¡ê·¸ë¨ì ì¤íí´ì£¼ì¸ì"}),(0,r.jsxs)("div",{className:"text-xs text-zinc-600 dark:text-zinc-400",children:["íì¥íë¡ê·¸ë¨ì´ ì¤ì¹ëì´ ìì§ë§ ì¤í ì¤ì´ ìëëë¤. ë¸ë¼ì°ì ì°ì¸¡ ìë¨ì íì¥íë¡ê·¸ë¨ ìì´ì½ì í´ë¦í´ íì±íí´ì£¼ì¸ì. ì¤ííë©´ ì´ íë©´ì´ ",(0,r.jsx)("span",{className:"font-semibold",children:"ìëì¼ë¡ ê°±ì "}),"ë©ëë¤. ë³íê° ìì¼ë©´ íì´ì§ë¥¼ ìë¡ê³ 침í´ì£¼ì¸ì."]})]})]}),"present"===k&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-emerald-600",children:[(0,r.jsx)(T,{size:14}),"íì¥íë¡ê·¸ë¨ ê°ì§ë¨"]}),"idle"===d&&(0,r.jsx)("div",{className:"space-y-3",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{onClick:()=>S(!1),children:[(0,r.jsx)("label",{className:"text-xs text-[#8E8E93] mb-1.5 block",children:"ììì¼"}),(0,r.jsx)("div",{className:"h-[38px] flex items-center bg-white/5 border border-white/5 rounded-xl px-1",children:(0,r.jsx)(E.h,{value:v,onCh
1ange:w})})]}),(0,r.jsxs)("div",{onClick:()=>S(!1),children:[(0,r.jsx)("label",{className:"text-xs text-[#8E8E93] mb-1.5 block",children:"ì¢
ë£ì¼"}),(0,r.jsx)("div",{className:"h-[38px] flex items-center bg-white/5 border border-white/5 rounded-xl px-1",children:(0,r.jsx)(E.h,{value:y,onChange:j})})]})]})}),"ready"===d&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"text-sm text-white",children:["ë기í ëì: ",(0,r.jsxs)("span",{className:"font-bold",children:[m.length,"ê±´"]}),(0,r.jsxs)("span",{className:"text-xs text-[#8E8E93] ml-2",children:[v," ~ ",y]})]}),0===m.length?(0,r.jsx)("div",{className:"text-xs text-[#8E8E93]",children:"ì´ ê¸°ê°ì NEISë¡ ë³´ë¼ ë¯¸ë기í ì¶ê²°ì´ ììµëë¤."}):(0,r.jsx)("div",{className:"rounded-xl border border-zinc-200 bg-white overflow-hidden",children:(0,r.jsx)("div",{className:"max-h-[300px] overflow-y-auto",children:(0,r.jsxs)("table",{className:"w-full text-xs",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-zinc-100 text-zinc-500 z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"text-left font-medium px-3 py-2 w-20",children:"ë ì§"}),(0,r.jsx)("th",{className:"text-left font-medium px-3 py-2",children:"ì´ë¦"}),(0,r.jsx)("th",{className:"text-left font-medium px-3 py-2",children:"ì¶ê²°"}),(0,r.jsx)("th",{className:"text-center font-medium px-3 py-2 w-20",children:"êµì"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-zinc-100 text-zinc-800 dark:text-zinc-200",children:m.map(e=>(0,r.jsxs)("tr",{title:e.details||void 0,children:[(0,r.jsx)("td",{className:"px-3 py-2 text-zinc-500 whitespace-nowrap",children:e.endDate&&e.endDate!==e.date?(0,r.jsxs)(r.Fragment,{children:[W(e.date),"~",(0,r.jsx)("br",{}),W(e.endDate)]}):W(e.date)}),(0,r.jsx)("td",{className:"px-3 py-2 font-medium text-zinc-900",children:e.studentName}),(0,r.jsxs)("td",{className:"px-3 py-2",children:[e.reason," ",e.type,e.details&&(0,r.jsxs)("span",{className:"text-zinc-400",children:[" \xb7 ",e.details]})]}),(0,r.jsx)("td",{className:"px-3 py-2 text-center",children:(0,r.jsx)("span",{className:"inline-block px-2 py-0.5 rounded-md bg-zinc-200 text-zinc-700 dark:text-zinc-300 font-medium whitespace-nowrap",children:V(e.period)})})]},e.id))})]})})})]}),"syncing"===d&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(_.Z,{size:18,className:"text-blue-400 animate-spin"}),(0,r.jsx)("div",{className:"text-sm text-white",children:"NEISì ì
ë ¥ ì¤..."})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("div",{className:"flex justify-between text-xs text-[#8E8E93]",children:[(0,r.jsxs)("span",{children:[p.processed," / ",p.total," ì²ë¦¬"]}),p.failed>0&&(0,r.jsxs)("span",{className:"text-red-400",children:[p.failed," ì¤í¨"]})]}),(0,r.jsx)("div",{className:"h-2 bg-white/5 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-blue-500 transition-all",style:{width:"".concat(p.total?p.processed/p.total*100:0,"%")}})})]})]}),"done"===d&&b&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(Z.Z,{size:18,className:"text-emerald-400"}),(0,r.jsx)("div",{className:"text-sm text-white font-semibold",children:"ìë£"})]}),(0,r.jsxs)("div",{className:"text-xs text-[#C7C7CC] space-y-1",children:[(0,r.jsxs)("div",{children:["ì±ê³µ: ",b.processed,"ê±´"]}),b.failed>0&&(0,r.jsxs)("div",{className:"text-red-400",children:["ì¤í¨: ",b.failed,"ê±´"]})]}),b.processed>0&&(0,r.jsx)("div",{className:"text-xs text-[#8E8E93] leading-relaxed",children:"ì ì ë°ìë 기ë¡ì ì¶ê²° ê´ë¦¬ íìì ì²´í¬ë°ì¤ê° ìëì¼ë¡ ì²´í¬ë©ëë¤."}),b.failures.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"text-xs text-white",children:["ì
ë ¥íì§ ëª»í 기ë¡: ",(0,r.jsxs)("span",{className:"font-bold text-red-400",children:[b.failures.length,"ê±´"]})]}),(0,r.jsx)("div",{className:"rounded-xl border border-red-200 bg-white overflow-hidden",children:(0,r.jsx)("div",{className:"max-h-44 overflow-y-auto divide-y divide-red-100",children:b.failures.map(e=>{let t=m.find(t=>
1t.id===e.id);return(0,r.jsxs)("div",{className:"px-3 py-2",children:[t?(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"text-zinc-500 whitespace-nowrap",children:W(t.date)}),(0,r.jsx)("span",{className:"font-semibold text-zinc-900",children:t.studentName}),(0,r.jsxs)("span",{className:"text-zinc-700 dark:text-zinc-300",children:[t.reason," ",t.type]}),(0,r.jsx)("span",{className:"ml-auto px-1.5 py-0.5 rounded-md bg-zinc-100 text-zinc-600 dark:text-zinc-400 font-medium whitespace-nowrap",children:V(t.period)})]}):(0,r.jsx)("div",{className:"text-xs font-semibold text-zinc-900",children:"ì ì ìë 기ë¡"}),(0,r.jsx)("div",{className:"text-[11px] text-red-500 mt-1",children:function(e){let t=null!=e?e:"";return/êµì.*ì
.*ìì|ì
.*ìì|ì¬ë¡¯/.test(t)?"NEIS íë©´ìì í´ë¹ êµì 칸ì ì°¾ì§ ëª»íìµëë¤.":/기í/.test(t)?"기í ì¬ì ë NEISìì ì§ì ì
ë ¥í´ì¼ í©ëë¤.":/íì.*ì|í.*ì|ì°¾.*못|ëª
ë¨/.test(t)?"NEIS ëª
ë¨ìì í´ë¹ íìì ì°¾ì§ ëª»íìµëë¤.":/주ë§|ê³µí´ì¼|í ìì¼|ì¼ìì¼/.test(t)?"주ë§\xb7ê³µí´ì¼ìë ì¶ê²°ì ì
ë ¥í ì ììµëë¤.":/ìê° ì´ê³¼|timeout|ìëµ/.test(t)?"NEIS ìëµì´ ì§ì°ëì´ ì
ë ¥íì§ ëª»íìµëë¤.":t.replace(/\s*\(?\s*cellindex\s*=\s*\d+\s*\)?/gi,"").trim()||"NEIS ì
ë ¥ì ì¤í¨íìµëë¤. NEIS íë©´ì íì¸í´ì£¼ì¸ì."}(e.error)})]},e.id)})})})]})]}),"error"===d&&c&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-500/10 border border-red-500/30 rounded-xl",children:[(0,r.jsx)(O.Z,{size:18,className:"text-red-400 shrink-0 mt-0.5"}),(0,r.jsx)("div",{className:"text-sm text-red-100",children:c})]}),(0,r.jsxs)("div",{className:"text-xs text-[#8E8E93] leading-relaxed px-1",children:["ìë ì
ë ¥ì´ ì¤ë¨ëë 주ì ìì¸: ",(0,r.jsx)("span",{className:"text-[#C7C7CC]",children:"기í ê²°ì"}),"(NEISìì ì§ì ì¬ì ì
ë ¥ íì), 주ë§\xb7ê³µí´ì¼ì ì못 기ë¡ë ì¶ê²°. ì í목ì íì¸ í ë¤ì ìëí´ì£¼ì¸ì."]})]})]}),(0,r.jsxs)("div",{className:"px-6 pb-5 pt-3 flex items-center justify-end gap-2",children:["idle"===d&&(0,r.jsxs)("button",{onClick:I,disabled:"missing"===k||"inactive"===k,style:{color:"#ffffff"},className:"neis-primary-btn flex items-center gap-2 px-4 py-2 bg-[#3b82f6] rounded-xl text-sm font-semibold disabled:opacity-40 disabled:cursor-not-allowed hover:bg-[#2f6fe0] transition-colors",children:[(0,r.jsx)(F.Z,{size:14}),"ëì ë¶ë¬ì¤ê¸°"]}),"ready"===d&&(0,r.jsx)("button",{onClick:()=>o("idle"),className:"px-4 py-2 bg-white/10 text-white rounded-xl text-sm hover:bg-white/15 transition-colors",children:"ë¤ë¡"}),"ready"===d&&m.length>0&&(0,r.jsxs)("button",{onClick:q,style:{color:"#ffffff"},className:"neis-primary-btn flex items-center gap-2 px-4 py-2 bg-[#3b82f6] rounded-xl text-sm font-semibold hover:bg-[#2f6fe0] transition-colors",children:[(0,r.jsx)(x.Z,{size:14}),"NEISì ìëì
ë ¥ ìì"]}),"ready"===d&&0===m.length&&(0,r.jsx)("button",{onClick:n,className:"px-4 py-2 bg-white/10 text-white rounded-xl text-sm hover:bg-white/15 transition-colors",children:"ë«ê¸°"}),("done"===d||"error"===d)&&(0,r.jsx)("button",{onClick:n,className:"px-4 py-2 bg-white/10 text-white rounded-xl text-sm hover:bg-white/15 transition-colors",children:"ë«ê¸°"})]})]})}):null}var Y=n(96214),H=n(33145),K=n(25450),X=n(54887),G=n(45675),J=n(73247),$=n(40875),Q=n(35
1596),ee=n(81906),et=n(22825),en=n(33728),er=n(13100),ea=n(92846);let ei={type:"spring",stiffness:520,damping:42,mass:.8};function es(e){let{isOpen:t,onOpenChange:n,onAction:i,onPress:s,actionLabel:l="ìì ",actionButtonClass:d="bg-red-500 hover:bg-red-600 text-white",actionIcon:o,divided:c=!1,actionWidth:u=76,children:x,className:m}=e,h=(0,ee.c)(0),f=(0,a.useRef)(null),b=(0,a.useRef)(!1),g=(0,a.useRef)(null),v=(0,a.useRef)(0),w=(0,a.useRef)(0),y=(0,a.useRef)(!1),j=(0,a.useCallback)(e=>{var t;null===(t=f.current)||void 0===t||t.stop(),f.current=(0,et.j)(h,e,ei)},[h]);(0,a.useEffect)(()=>{j(t?u:0),t||(y.current=!1)},[t,j,u]),(0,a.useEffect)(()=>()=>{var e;null===(e=f.current)||void 0===e||e.stop()},[]);let k=(0,en.H)(h,e=>"-".concat(e,"px")),N=(0,en.H)(h,[8,38],[0,1]),z=(0,en.H)(h,[8,.9*u,u,1.3*u],[.8,.95,1,1.15]);return(0,r.jsxs)("div",{className:(0,p.cn)("relative overflow-hidden bg-[#FBFBF9] dark:bg-zinc-950",m),children:[(0,r.jsxs)(er.E.button,{type:"button","aria-label":l,"aria-hidden":!t,tabIndex:t?0:-1,onClick:e=>{e.stopPropagation(),ea.MU.impact("medium"),i()},style:{width:u-8,opacity:N,scale:z},className:(0,p.cn)("absolute right-2 top-2 bottom-2 z-0","rounded-xl font-medium text-xs shadow-sm","flex flex-col items-center justify-center gap-1 cursor-pointer select-none","active:scale-95 transition-transform",d),children:[o,(0,r.jsx)("span",{className:"text-[11px] font-semibold",children:l})]}),(0,r.jsx)(er.E.div,{style:{x:k},onPanStart:()=>{var e;g.current=null,null===(e=f.current)||void 0===e||e.stop(),y.current=h.get()>=u},onPan:(e,t)=>{if(null===g.current){let{x:e,y:n}=t.offset;if(12>Math.abs(e)&&12>Math.abs(n))return;g.current=Math.abs(e)>Math.abs(n)?"x":"y",v.current=h.get(),w.current=e,b.current=!0}if("x"!==g.current)return;let n=v.current-(t.offset.x-w.current);if(n<=0){h.set(0),y.current=!1;return}n>=u&&!y.current?(y.current=!0,ea.MU.selection()):n<u&&y.current&&(y.current=!1),n<=u?h.set(n):h.set(u+(n-u)*.12)},onPanEnd:(e,r)=>{let a="x"===g.current;if(g.current=null,setTimeout(()=>{b.current=!1},0),!a)return;let i=h.get()>u/2||r.velocity.x<-450;j(i?u:0),i!==t&&(y.current||ea.MU.selection(),n(i))},onClick:()=>{if(!b.current){if(t){n(!1);return}s&&s()}},className:(0,p.cn)("relative z-10 w-full bg-white dark:bg-[#1C1C1E] transition-colors","touch-pan-y select-none",c&&"border-t border-zinc-100 dark:border-white/[0.06]"),children:x})]})}var el=n(52345);function ed(e){let{size:t=48,colorTheme:n="green",onComplete:i,className:s,triggerHaptic:l=!0}=e,d=(0,a.useRef)(i),o=(0,el.J)();(0,a.useEffect)(()=>{d.current=i},[i]),(0,a.useEffect)(()=>{let e=l?setTimeout(()=>{ea.MU.success()},o?0:200):null,t=setTimeout(()=>{var e;null===(e=d.current)||void 0===e||e.call(d)},o?0:650);return()=>{e&&clearTimeout(e),clearTimeout(t)}},[l,o]);let c="green"===n?"#10B981":"blue"===n?"#3182F6":"#FFFFFF";return(0,r.jsxs)("div",{className:(0,p.cn)("relative flex items-center justify-center select-none",s),style:{width:t,height:t},children:[(0,r.jsx)(er.E.div,{initial:!o&&{scale:.3,opacity:0}
1,animate:{scale:o?1:[.3,1.08,1],opacity:1},transition:o?{duration:0}:{duration:.32,ease:[.34,1.56,.64,1]},className:(0,p.cn)("absolute inset-0 rounded-full","green"===n?"bg-emerald-50 dark:bg-emerald-950/30":"blue"===n?"bg-blue-50 dark:bg-blue-950/30":"bg-white/10")}),(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"relative z-10",children:[(0,r.jsx)(er.E.circle,{cx:"24",cy:"24",r:"20",stroke:c,strokeWidth:"3.2",strokeLinecap:"round",initial:!o&&{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:o?{duration:0}:{duration:.32,ease:"easeOut"}}),(0,r.jsx)(er.E.path,{d:"M14.5 24.5L21 31L33.5 18",stroke:c,strokeWidth:"3.6",strokeLinecap:"round",strokeLinejoin:"round",initial:!o&&{pathLength:0},animate:{pathLength:1},transition:o?{pathLength:{duration:0}}:{pathLength:{delay:.12,duration:.26,ease:[.22,1,.36,1]}}})]})]})}function eo(e){let{isShaking:t,children:n,className:a}=e;return(0,r.jsx)("div",{className:(0,p.cn)(t&&"animate-subtle-shake",a),children:n})}let ec=[{value:"thisMonth",label:"ì´ë²ë¬"},{value:"lastMonth",label:"ì§ëë¬"},{value:"all",label:"ì ì²´"}],eu=["ì§ë³","ì¸ì ","미ì¸ì ","기í"],ex=["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"],em=e=>{let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)},eh=e=>new Date(e+"T00:00:00");function ep(e){let{isOpen:t,onOpenChange:n,onDelete:a,onPress:i,label:s,divided:l=!1,children:o}=e;return(0,r.jsx)(es,{isOpen:t,onOpenChange:n,onAction:a,onPress:i,actionLabel:"ìì ",actionButtonClass:"bg-red-500 hover:bg-red-600 text-white",actionIcon:(0,r.jsx)(d.Z,{size:16}),divided:l,actionWidth:76,children:(0,r.jsx)("div",{className:"flex items-center gap-2.5 px-3 py-2.5 bg-white dark:bg-zinc-900 active:bg-zinc-50 dark:active:bg-zinc-800 transition-colors cursor-pointer select-none",children:o})})}function ef(e){var t,n,i,s;let{students:l,records:d,onSaveRecord:u,onDeleteRecord:x}=e,[m,h]=(0,a.useState)("thisMonth"),[f,b]=(0,a.useState)(!1),[g,v]=(0,a.useState)(null),{isShaking:w,triggerShake:y}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{hapticOnShake:t=!0}=e,[n,r]=(0,a.useState)(!1),i=(0,a.useRef)(null),s=(0,a.useCallback)(()=>{i.current&&clearTimeout(i.current),t&&ea.MU.error(),r(!0),i.current=setTimeout(()=>{r(!1)},380)},[t]);return(0,a.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]),{isShaking:n,triggerShake:s,shakeClass:n?"animate-subtle-shake":""}}(),[j,k]=(0,a.useState)(!1),[z,C]=(0,a.useState)(null),[D,S]=(0,a.useState)(null),[M,I]=(0,a.useState)(null),[L,A]=(0,a.useState)(null),[R,F]=(0,a.useState)(null),[T,_]=(0,a.useState)(em(new Date)),[Z,O]=(0,a.useState)(""),[U,B]=(0,a.useState)(""),[P,V]=(0,a.useState)(!1),[W,q]=(0,a.useState)(!1),[Y,ee]=(0,a.useState)(""),[et,en]=(0,a.useState)(!1),er=(0,a.useRef)(null),ei=(0,a.useRef)(null),es=(0,a.useRef)(null),el=(0,a.useRef)(null),[ef,eb]=(0,a.useState)(null),eg=(0,a.useRef)(0),ev=()=>Date.now()-eg.current<350;(0,a.useEffect)(()=>{if(!et)return;let e=e=>{var t;let n=e.target;null!==(t=el.current)&&void 0!==t&&t.contains(n)||!ei.current||ei.current.contains(n)||en(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[et]),(0,a.useEffect)(()=>{var e,t;if(!et){eb(null);return}let n=()=>{let e=es.current;if(!e)return;let t=e.getBoundingClientRect(),n=window.visualViewport,r=n?Math.max(0,n.offsetTop):0,a=r+(n?n.height:window.innerHeight)-t.bottom-6-10,i=t.top-r-6-10,s=a<150&&i>a,l=Math.max(96,Math.min(320,s?i:a));eb({left:t.left,width:t.width,top:s?t.top-6-l:t.bottom+6,maxHeight:l})};n();let r=requestAnimationFrame(n);return window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),null===(e=window.visualViewport)||void 0===e||e.addEventListener("resize",n),null===(t=window.visualViewport)||void 0===t||t.addEventListener("scroll",n),()=>{var e,t;cancelAnimationFrame(r),window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n),null===(e=window.visualVie
1wport)||void 0===e||e.removeEventListener("resize",n),null===(t=window.visualViewport)||void 0===t||t.removeEventListener("scroll",n)}},[et]);let ew=null!==z,ey=(0,a.useMemo)(()=>{let e=[];return d.forEach(t=>{if(!t.endDate||t.date===t.endDate){e.push({...t,displayDate:t.date,uniqueKey:t.id});return}let n=eh(t.date),r=eh(t.endDate),a=new Date(n);for(;a<=r;){let n=a.getDay();if(0!==n&&6!==n){let n=em(a);e.push({...t,displayDate:n,uniqueKey:"".concat(t.id,"-").concat(n)})}a.setDate(a.getDate()+1)}}),e},[d]),ej=(0,a.useMemo)(()=>{if("all"===m)return null;let e=new Date,t=new Date(e.getFullYear(),e.getMonth()-("lastMonth"===m?1:0),1);return{year:t.getFullYear(),month:t.getMonth()}},[m]),ek=(0,a.useMemo)(()=>ej?ey.filter(e=>{let[t,n]=e.displayDate.split("-").map(Number);return t===ej.year&&n===ej.month+1}):ey,[ey,ej]);(0,a.useMemo)(()=>{let e={ê²°ì:0,ì§ê°:0,ì¡°í´:0,ê²°ê³¼:0};return ek.forEach(t=>{t.type&&t.type in e&&e[t.type]++}),e},[ek]);let eN=(0,a.useMemo)(()=>{let e=[...ek].sort((e,t)=>t.displayDate.localeCompare(e.displayDate)),t=[],n="";return e.forEach(e=>{if(e.displayDate!==n){n=e.displayDate;let[r,a,i]=e.displayDate.split("-").map(Number),s=new Date(r,a-1,i),l="".concat(a,"ì ").concat(i,"ì¼ ").concat(["ì¼","ì","í","ì","목","ê¸","í "][s.getDay()],"ìì¼");t.push({date:e.displayDate,label:l,records:[]})}t[t.length-1].records.push(e)}),t},[ek]),ez=e=>{if(!e)return"";let t=l.find(t=>t.id===e);return t?t.number:""},eE=e=>{let[,t,n]=e.split("-").map(Number);return"".concat(t,"/").concat(n)},eC=e=>{if(!e)return"";let t=e.split(",").map(e=>N.OL.indexOf(e)).filter(e=>e>=0).sort((e,t)=>e-t);if(0===t.length)return"";let n=[];for(let e of t){let t=n[n.length-1];t&&e===t[t.length-1]+1?t.push(e):n.push([e])}let r=e=>e.match(/^(\d)êµì$/);return n.map(e=>{if(1===e.length)return N.OL[e[0]];let t=N.OL[e[0]],n=N.OL[e[e.length-1]],a=r(t),i=r(n);return a&&i?"".concat(a[1],"~").concat(i[1],"êµì"):"".concat(t,"~").concat(n)}).join(", ")},eD=(0,a.useMemo)(()=>{if(!Y.trim())return l;let e=Y.trim().toLowerCase();return l.filter(t=>t.name.toLowerCase().includes(e)||String(t.number).includes(e))},[l,Y]),eS=l.find(e=>e.id===D),eM=e=>{if(ev())return;ea.MU.selection();let t=L===e?null:e;A(t),"ê²°ì"===t?F(null):("ì§ê°"===t||"ì¡°í´"===t)&&(null==R?void 0:R.includes(","))&&F(R.split(",")[0])},eI=e=>{if(ev())return;ea.MU.selection();let t=R?R.split(",").filter(Boolean):[];if("ê²°ê³¼"===L){let n=t.includes(e)?t.filter(t=>t!==e):N.OL.filter(n=>n===e||t.includes(n));F(n.length>0?n.join(","):null)}else F(t.includes(e)?null:e)},eL=e=>{var t;C(e.id),S(e.studentId),I(e.reason),A(e.type),F(null!==(t=e.period)&&void 0!==t?t:null),_(e.date),O(e.endDate||""),B(e.details),V(e.submitted),ee(""),en(!1),k(!1),b(!0)},eA=async()=>{if(!D||!L){y();return}let e=l.find(e=>e.id===D);if(!e)return;let t=Z&&Z>=T?Z:void 0;q(!0);try{var n;let r={id:z||"record-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,5)),studentId:D,studentName:e.name,reason:M,type:L,period:"ê²°ì"===L?null:R,date:T,endDate:t,details:U,submitted:P,createdAt:z&&(null===(n=d.find(e=>e.id===z))||void 0===n?void 0:n.createdAt)||new Date().toISOString()};await u(r),k(!0)}catch(e){y()}finally{q(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col h-full bg-[#FBFBF9] dark:bg-zinc-950",children:[(0,r.jsx)("div",{className:"px-4 pt-3 pb-2.5 shrink-0",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center gap-1.5",children:ec.map(e=>{let{value:t,label:n}=e;return(0,r.jsx)("button",{type:"button","aria-pressed":m===t,onClick:()=>{m!==t&&(ea.MU.selection(),v(null),h(t))},className:(0,K.Fk)(m===t),children:n},t)})}),(0,r.jsx)("span",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 font-medium tabular-nums",children:ek.length>0&&"ì´ ".concat(ek.length,"ê±´")})]})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-4 mobile-scroll-with-floating",children:0===eN.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,r.jsx)(H.default,{src:"/icons/empty-search.svg",alt:"",width:56,height:56,className:"w-14 h-14 object-contain mb-3.5",unoptimized:!0}),(0,r.jsx)("h3",{className:"text-zinc-900 dark:text-zinc-100 font-bold mb-1",children:ej?"".concat(ej.month+1,"ì 기ë¡ì´ ììµëë¤"):"ì¶ê²° 기ë¡ì´ ììµëë¤"}),(0,r.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400 text-[13px] break-keep",children:"ìë + ë²í¼ì¼ë¡ ì¶ê²°ì ë±ë¡í ì ììµëë¤."})]}):eN.map(e=>(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"text-[13px] font-semibold text-zinc-500 mb-1.5 px-1",children:e.label}),(0,r.jsx)("div",{className:"bg-white dark:bg-zinc-900 rounded-2xl shadow-sm border border-zinc-200/50 dark:border-zinc-800/50 overflow-hidden",children:e.records.map((e,t)=>{var n;return(0,r.jsxs)(ep,{divided:t>0,isOpen:g===e.uniqueKey,onOpenChange:t=>{v(t?e.uniqueKey:null)},onDelete:()=>{v(null),x(e.id)},onPress:()=>eL(e),label:"".concat(e.studentName," ").concat(null!==(n=e.type)&&void 0!==n?n:""," 기ë¡"),children:[(0,r.jsx)("span",{className:"text-[13px] text-zinc-400 dark:text-zinc-500 font-medium w-5 text-right shrink-0",children:ez(e.studentId)}),(0,r.jsx)("span",{className:"text-[14px] font-medium text-zinc-800 dark:text-zinc-100 min-w-0 truncate mr-1",children:e.studentName}),e.reason&&(0,r.jsx)("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-md shrink-0 bg-zinc-100 dark:bg-white/10 text-zinc-600 dark:text-zinc-300",children:e.reason}),e.type&&(0,r.jsx)("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-md shrink-0 bg-zinc-100 dark:bg-white/10 text-zinc-600 dark:text-zinc-300 -ml-1",children:e.type}),e.period&&"ê²°ì"!==e.type&&(0,r.jsx)("span",{className:"text-[11px] font-medium text-zinc-400 dark:text-zinc-500 shrink-0 -ml-0.5 truncate",children:eC(e.period)}),(0,r.jsx)("span",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 ml-auto shrink-0",children:e.endDate&&e.endDate!==e.date?"".concat(eE(e.date),"~").concat(eE(e.endDate)):eE(e.displayDate)}),(0,r.jsx)(G.Z,{size:12,className:"text-zinc-400 dark:text-zinc-500 shrink-0"})]},e.uniqueKey)})})]},e.date))}),(0,r.jsx)("button",{"aria-label":"ì¶ê°",onClick:()=>
1{C(null),S(null),I(null),A(null),F(null),_(em(new Date)),O(""),B(""),V(!1),ee(""),en(!1),k(!1),b(!0)},className:"fixed mobile-floating-bar right-5 w-12 h-12 rounded-full shadow-lg flex items-center justify-center bg-blue-600 active:bg-blue-700 active:scale-90 transition z-50 md:hidden",children:(0,r.jsx)(o.Z,{size:20,strokeWidth:2.5,color:"white"})}),(0,r.jsx)(Q.Z,{isOpen:f,onClose:()=>b(!1),title:ew?"ì¶ê²° ê¸°ë¡ ìì ":"ì¶ê²° ê¸°ë¡ ì¶ê°",footer:j?null:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[ew&&(0,r.jsx)("button",{type:"button",onClick:()=>{z&&(ea.MU.impact("medium"),v(null),x(z),b(!1))},className:"px-4 py-3 rounded-2xl text-[15px] font-semibold text-red-500 dark:text-red-400 bg-red-50 dark:bg-red-950/30 active:bg-red-100 dark:active:bg-red-950/50 transition-colors",children:"ìì "}),(0,r.jsx)("button",{type:"button",onClick:eA,disabled:W,className:(0,p.cn)("flex-1 py-3 rounded-2xl text-[15px] font-semibold transition active:scale-[0.98] shadow-sm flex items-center justify-center",D&&L?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-white dark:text-zinc-900":"bg-zinc-200 dark:bg-zinc-800 text-zinc-400 dark:text-zinc-500"),children:W?"ì ì¥ ì¤...":ew?"ìì ":"ì ì¥í기"})]}),children:j?(0,r.jsxs)("div",{className:"py-14 flex flex-col items-center justify-center gap-3",children:[(0,r.jsx)(ed,{size:56,colorTheme:"green",onComplete:()=>{k(!1),b(!1)}}),(0,r.jsx)("p",{className:"text-[15px] font-semibold text-zinc-800 dark:text-zinc-100 mt-2",children:ew?"ì¶ê²° 기ë¡ì´ ìì ëììµëë¤":"ì¶ê²° 기ë¡ì´ ì ì¥ëììµëë¤"})]}):(0,r.jsx)(eo,{isShaking:w,children:(0,r.jsxs)("div",{className:"space-y-5 px-0.5 pt-2 pb-28 overflow-x-hidden",children:[(0,r.jsxs)("div",{ref:ei,children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-2 block",children:"íì"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("div",{ref:es,className:(0,p.cn)("flex items-center gap-2 px-3 py-2.5 rounded-xl border bg-white dark:bg-zinc-800 text-[16px] transition-colors",et?"border-zinc-400 dark:border-zinc-500 ring-2 ring-zinc-200 dark:ring-zinc-700":"border-zinc-200 dark:border-zinc-700"),onClick:()=>{en(!0),setTimeout(()=>{var e;return null===(e=er.current)||void 0===e?void 0:e.focus()},50)},children:[(0,r.jsx)(J.Z,{size:15,className:"text-zinc-400 dark:text-zinc-500 shrink-0"}),D&&!et?(0,r.jsxs)("span",{className:"text-zinc-800 dark:text-zinc-100 font-medium truncate flex-1 min-w-0",children:[null==eS?void 0:eS.number," ",null==eS?void 0:eS.name]}):(0,r.jsx)("input",{ref:er,type:"text",value:Y,onChange:e=>{ee(e.target.value),en(!0)},onFocus:()=>en(!0),placeholder:"ì´ë¦ ëë ë²í¸ë¡ ê²ì",className:"flex-1 bg-transparent text-zinc-800 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none min-w-0"}),(0,r.jsx)($.Z,{size:15,className:(0,p.cn)("text-zinc-400 dark:text-zinc-500 shrink-0 transition-transform",et&&"rotate-180")})]}),et&&"undefined"!=typeof document&&(0,X.createPortal)((0,r.jsx)("div",{ref:el,className:"md:hidden fixed z-[200] rounded-xl border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 shadow-xl overflow-y-auto mobile-scroll",style:{left:null!==(t=null==ef?void 0:ef.left)&&void 0!==t?t:0,top:null!==(n=null==ef?void 0:ef.top)&&void 0!==n?n:0,width:null!==(i=null==ef?void 0:ef.width)&&void 0!==i?i:0,maxHeight:null!==(s=null==ef?void 0:ef.maxHeight)&&void 0!==s?s:0,visibility:ef?"visible":"hidden"},children:0===eD.length?(0,r.jsx)("div",{className:"px-3 py-3 text-[13px] text-zinc-400 dark:text-zinc-500 text-center",children:"ê²ì ê²°ê³¼ê° ììµëë¤"}):eD.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>{eg.current=Date.now(),S(e.id),ee(""),en(!1)},className:(0,p.cn)("w-full flex items-center gap-2.5 px-3 py-2.5 text-left transition-colors",D===e.id?"bg-zinc-100 dark:bg-zinc-700/60":"active:bg-zinc-50 dark:active:bg-zinc-700/30"),children:[(0,r.jsx)("span",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 font-medium w-5 text-right",children:e.number}),(0,r.jsx)("span",{className:"text-[14px] font-medium text-zinc-800 dark:text-zinc-100",children:e.name})]},e.id))}),document.body)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-2 block",children:"구ë¶"}),(0,r.jsx)("div",{className:"flex gap-1.5",children:eu.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>{ev()||(ea.MU.selection(),I(M===e?null:e))},className:(0,p.cn)("flex-1 py-2.5 rounded-2xl text-[14px] font-semibold transition shadow-sm active:scale-[0.95]",M===e?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900":"bg-white text-zinc-500 border border-zinc-200/60 dark:bg-zinc-800 dark:text-zinc-400 dark:border-zinc-700 active:bg-zinc-50 dark:active:bg-zinc-700"),children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-2 block",children:"ì í"}),(0,r.jsx)("div",{className:"flex gap-1.5",children:ex.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>eM(e),className:(0,p.cn)("flex-1 py-2.5 rounded-2xl text-[14px] font-semibold transition shadow-sm active:scale-[0.95]",L===e?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900":"bg-white text-zinc-500 border border-zinc-200/60 dark:bg-zinc-800 dark:text-zinc-400 dark:border-zinc-700 active:bg-zinc-50 dark:active:bg-zinc-700"),children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400",children:["êµì ",(0,r.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500 font-normal",children:"(ì í)"})]}),"ê²°ê³¼"===L&&(0,r.jsx)("span",{className:"text-[11px] text-zinc-400 dark:text-zinc-500",children:"ì¬ë¬ êµì ì í ê°ë¥"})]}),"ê²°ì"===L?(0,r.jsx)("p",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 px-1 py-1",children:"ê²°ìì êµì를 ì ííì§ ììµëë¤."}):(0,r.jsx)("div",{className:"grid grid-cols-3 gap-1.5",children:N.OL.map(e=>{let t=(R?R.split(","):[]).includes(e);return(0,r.jsx)("button",{type:"button",onClick:()=>eI(e),className:(0,p.cn)("py-2 rounded-2xl text-[13px] font-semibold transition shadow-sm active:scale-[0.95]",t?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900":"bg-white text-zinc-500 border border-zinc-200/60 dark:bg-zinc-800 dark:text-zinc-400 dark:border-zinc-700 active:bg-zinc-50 dark:active:bg-zinc-700"),children:e},e)})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-2 block",children:"ë ì§"}),(0,r.jsxs)("div",{className:"relative min-h-[46px] bg-white dark:bg-zinc-800 rounded-xl border border-zinc-200 dark:border-zinc-700 flex items-center px-3",children:[(0,r.jsx)(c.Z,{size:15,className:"text-zinc-400 dark:text-zinc-500 shrink-0 mr-1"}),(0,r.jsx)(E.h,{overlay:!0,value:T,onChange:e=>{_(e),Z&&Z<e&&O("")},endDate:Z||void 0,onEndDateChange:e=>O(e||""),className:"text-[15px] font-medium text-left w-full py-2.5 text-zinc-800 dark:text-zinc-100"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-2 block",children:"ì¬ì "}),(0,r.jsx)("input",{type:"text",value:U,onChange:e=>B(e.target.value),onFocus:e=>{let t=e.currentTarget;
1[100,300,500].forEach(e=>{setTimeout(()=>{t.scrollIntoView({block:"nearest",behavior:"smooth"})},e)})},placeholder:"ë´ì© ì
ë ¥ (ì í)",className:"w-full px-3 py-2.5 rounded-xl border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 text-[16px] text-zinc-800 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-300 dark:focus:ring-zinc-600"})]})]})})})]})}var eb=n(64954);let eg=e=>{let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)},ev=e=>new Date(e+"T00:00:00"),ew=()=>(0,p.RJ)(),ey=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=new Date(new Date().toLocaleString("en-US",{timeZone:"Asia/Seoul"})),n=t.getFullYear(),r=t.getMonth()+e,a=new Date(n,r,1),i=new Date(n,r+1,0);return{start:eg(a),end:eg(i),label:"".concat(a.getFullYear(),"ë
").concat(a.getMonth()+1,"ì")}},ej=e=>{let t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{start:eg(t),end:eg(n)}},ek=["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"],eN=["ì§ë³","미ì¸ì ","기í","ì¸ì "],ez=(e,t)=>{let n=t?e.indexOf(t):-1;return -1===n?e.length:n},eE=e=>{var t,n,r,a,i,s,l;return[null!==(t=e.studentId)&&void 0!==t?t:"",null!==(n=e.studentName)&&void 0!==n?n:"",e.date,null!==(r=e.endDate)&&void 0!==r?r:"",null!==(a=e.type)&&void 0!==a?a:"",null!==(i=e.reason)&&void 0!==i?i:"",String(null!==(s=e.period)&&void 0!==s?s:""),null!==(l=e.details)&&void 0!==l?l:"",e.submitted?"1":"0"].join("\x01")},eC=(e,t)=>{let n=ez(ek,e.type)-ez(ek,t.type);return 0!==n?n:ez(eN,e.reason)-ez(eN,t.reason)},eD=e=>{let t=ev(e.date),n=e.endDate?ev(e.endDate):t,r=[],a=new Date(t);for(;a<=n;){let t=a.getDay();0!==t&&6!==t&&r.push({...e,date:eg(a),endDate:void 0}),a.setDate(a.getDate()+1)}return r},eS=e=>{let{records:t,filter:n,onOpenModal:c,onMoveRecord:u,onDeleteRecord:x,onViewDateChange:m}=e,{status:h}=(0,v.kP)(),g=(0,w.Dv)(),j=(0,y.XC)(),{isLoaded:k}=(0,f.AF)(),N=(0,a.useRef)(!1);(0,a.useEffect)(()=>(N.current=!0,()=>{N.current=!1}),[]);let[z,E]=(0,a.useState)(null),[C,D]=(0,a.useState)(null),[S,M]=(0,a.useState)(()=>new Date);(0,a.useEffect)(()=>{if("thisMonth"===n)M(new Date);else if("lastMonth"===n){let e=new Date;e.setMonth(e.getMonth()-1),M(e)}},[n]),(0,a.useEffect)(()=>{null==m||m(S)},[S,m]);let I=S.getFullYear(),L=S.getMonth(),A=new Date(I,L,1).getDay(),R=new Date(I,L+1,0).getDate(),F=new Date;F.getFullYear()===I&&F.getMonth();let[T,_]=(0,a.useState)({}),Z="".concat(I,"-").concat(L),O=T[Z]||["","","","","",""];(0,a.useEffect)(()=>{(async()=>{if(!k||(await new Promise(e=>setTimeout(e,1e3)),!N.current||g))return;let e=await (0,b.X)("getAttendanceMemos",{},j);if(e.success&&e.data){let t={};for(let n of e.data){let e=n.id.lastIndexOf("-"),r=n.id.substring(0,e),a=parseInt(n.id.substring(e+1),10);t[r]||(t[r]=["","","","","",""]),t[r][a]=n.content}_(t)}})()},[j,g,k]);let U=async(e,t)=>{_(n=>{let r=[...n[Z]||["","","","","",""]];return r[e]=t,{...n,[Z]:r}}),await (0,b.X)("upsertAttendanceMemo",{weekKey:"".concat(Z,"-").concat(e),content:t},j)},B=(0,a.useMemo)(()=>{let e={};return t.forEach(t=>{let n=ev(t.date),r=t.endDate?ev(t.endDate):n,a=new Date(n);for(;a<=r;){let n=a.getDay();if(0!==n&&6!==n){let n=eg(a);e[n]||(e[n]=[]),e[n].push(t)}a.setDate(a.getDate()+1)}}),e},[t]),P=[.5,1,1,1,1,1,.5],V=P.reduce((e,t)=>e+t,0),W=e=>{let t=0;for(let n=0;n<e;n++)t+=P[n];return t/V*100},q=(e,t)=>{let n=0;for(let r=e;r<=t;r++)n+=P[r];return n/V*100},Y=(e,t)=>{let n=ev(e),r=ev(t),a=0,i=new Date(n);for(;i<=r;){let e=i.getDay();0!==e&&6!==e&&a++,i.setDate(i.getDate()+1)}return a},H=e=>0===e||6===e,K=(e,t)=>{if(e>=t)return!1;let n=ev(e),r=ev(t);r.setDate(r.getDate()-1);let a=new Date(n);for(;a<=r;){let e=a.getDay();if(0!==e&&6!==e)return!0;a.setDate(a.getDate()+1)}return!1},X=(e,t)=>{if(e<=t)return!1;let n=ev(t);n.setDate(n.getDate()+1);let r=ev(e),a=new Date(n);for(;a<=r;){let e=a.getDay();if(0!==e&&6!==e)return!0;a.setDate(a.getDate()+1)}return!1},G=e=>{let n=[];return t.forEach(t=>{if(!t.endDate||t.date===t.endDate)return;let r=t.date,a=t.endDate,i=e[0],s=e[6];if(r<=s&&a>=i){let l=K(r,i)||X(a,s),d=null;for(let i=0;i<7;i++){let s=e[i],o=s>=r&&s<=a,c=!H(i);if(o&&c)null===d&&(d=i);else if(null!==d){let e=i-1;(d!==e||l)&&n.push({record:t,startCol:d,endCol:e}),d=null}}if(null!==d){let i=d;for(let t=d;t<7;t++){let n=e[t],s=n>=r&&n<=a,l=!H(t);s&&l&&(i=t)}(d!==i||l)&&n.push({record:t,startCol:d,endCol:i})}}}),n},J=(0,a.useMemo)(()=>{let e=[],t=[],n=new Date(I,L,0).getDate();for(let e=0;e<A;e++)t.push({day:n-A+e+1,isCurrentMonth:!1});for(let n=1;n<=R;n++)t.push({day:n,isCurrentMonth:!0}),7===t.length&&(e.push(t),t=[]);if(t.length>0){let n=1;for(;t.length<7;)t.push({day:n++,isCurrentMonth:!1});e.push(t)}return e},[I,L,A,R]),$=(0,a.useMemo)(()=>J.map((e,t)=>{let n=e.map((e,n)=>{let{day:r,isCurrentMonth:a}=e,i=I,s=L;return!a&&(0===t||1===t&&r>20?(s=L-1)<0&&(s=11,i=I-1):(s=L+1)>11&&(s=0,i=I+1)),"".concat(i,"-").concat(String(s+1).padStart(2,"0"),"-").concat(String(r).padStart(2,"0"))}),r=G(n);return{week:e,weekIdx:t,weekDates:n,spanningRecords:r}}),[J,t]);return(0,r.jsxs)("div",{className:"flex flex-col h-full bg-[#09090b]",children:[(0,r.jsxs)("div",{className:"shrink-0 flex flex-col md:grid md:grid-cols-[6fr_4px_1fr]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-l border-r border-b border-white/5 bg-[#1C1C1E] rounded-t-xl",children:[(0,r.jsx)("button",{"aria-label":"ì´ì ë¬",onClick:()=>M(new Date(I,L-1,1)),className:"p-2 hover:bg-white/10 rounded-lg text-[#8E8E93] hover:text-white transition-colors",children:(0,r.jsx)(i.Z,{size:20})}),(0,r.jsxs)("div",{className:"text-lg font-bold text-white tracking-tight",children:[I,"ë
",L+1,"ì"]}),(0,r.jsx)("button",{"aria-label":"ë¤ì ë¬",onClick:()=>M(new Date(I,L+1,1)),className:"p-2 hover:bg-white/10 rounded-lg text-[#8E8E93] hover:text-white transition-colors",children:(0,r.jsx)(s.Z,{size:20})})]}),(0,r.jsx)("div",{className:"hidden md:block bg-[#09090b]"}),(0,r.jsx)("div",{className:"hidden md:flex items-center justify-center py-3 border-t border-l border-r border-white/5 rounded-t-xl bg-[#1C1C1E]",children:(0,r.jsx)("span",{className:"text-sm font-medium text-[#E0E0E0]",children:"ì¶ê²° ë©ëª¨"})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto custom-scrollbar",children:(0,r.jsxs)("div",{className:"min-w-[800px] h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"shrink-0 flex flex-col md:grid md:grid-cols-[6fr_4px_1fr]",children:[(0,r.jsx)("div",{className:"grid grid-cols-[minmax(0,0.5fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,0.5fr)]",children:["ì¼","ì","í","ì","목","ê¸","í "].map((e,t)=>(0,r.jsx)("div",{className:(0,p.cn)("text-center py-2 text-xs font-semibold uppercase tracking-wider border-r border-b border-white/5 bg-[#1C1C1E]",0===t&&"border-l border-white/5","text-[#8E8E93]"),children:e},e))}),(0,r.jsx)("div",{className:"hidden md:block bg-[#09090b]"}),(0,r.jsx)("div",{className:"hidden md:block bg-[#1C1C1E] border-r border-b border-l border-white/5"})]}),(0,r.jsx)("div",{className:"flex flex-col flex-1",children:$.map(e=>{let{week:t,weekIdx:n,weekDates:a,spanningRecords:i}=e,s=new Set(i.map(e=>e.record.id));return(0,r.jsxs)("div",{className:"flex flex-col md:grid md:grid-cols-[6fr_4px_1fr] flex-[1_0_auto] min-h-[100px] md:min-
1h-[140px]",children:[(0,r.jsxs)("div",{className:"relative grid grid-cols-[minmax(0,0.5fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,0.5fr)]",children:[i.map((e,t)=>{let{record:n,startCol:i,endCol:s}=e,o=Math.max(0,i),u=Math.min(6,s);if(o>u)return null;let m=K(n.date,a[0]),h=X(n.endDate||n.date,a[6]),f=m?0:8,b=C===n.id;return(0,r.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.setData("text/plain",n.id),e.dataTransfer.effectAllowed="move",e.target.style.opacity="0.5"},onDragEnd:e=>{e.target.style.opacity="1",D(null)},className:(0,p.cn)("absolute z-10 text-xs px-2 py-1 border border-white/5 text-[#E0E0E0] truncate transition-colors cursor-grab active:cursor-grabbing shadow-sm flex items-center group/attendance attendance-block select-none",b?"event-block-hover":"event-block-base",m?"rounded-l-none border-l-0":"rounded-l",h?"rounded-r-none border-r-0":"rounded-r"),style:{left:"calc(".concat(W(o),"% + ").concat(f,"px)"),width:"calc(".concat(q(o,u),"% - ").concat(f+(h?0:8),"px)"),top:"".concat(40+30*t,"px")},onMouseEnter:()=>D(n.id),onMouseLeave:()=>D(null),onClick:()=>c(n.date,!1),children:[n.submitted&&(0,r.jsx)(l.Z,{size:12,className:"text-green-400 mr-1.5 shrink-0",strokeWidth:3}),(0,r.jsx)("span",{className:"font-semibold text-white/90 mr-1.5",children:n.studentName}),(0,r.jsxs)("span",{className:"opacity-70",children:[n.reason," ",n.type]}),n.endDate&&(0,r.jsxs)("span",{className:"ml-1 opacity-50",children:[Y(n.date,n.endDate),"ì¼"]}),(0,r.jsx)("div",{className:"ml-auto flex items-center gap-1",children:(0,r.jsx)("button",{"aria-label":"ìì ",onClick:e=>{e.stopPropagation(),x(n.id)},className:"opacity-0 group-hover/attendance:opacity-100 p-0.5 rounded-md text-red-500/70 hover:text-red-500 transition",children:(0,r.jsx)(d.Z,{size:12})})})]},n.id)}),[0,1,2,3,4,5,6].map(e=>{let{day:m,isCurrentMonth:h}=t[e],f=a[e],b=H(e),g=b?[]:(B[f]||[]).filter(e=>!s.has(e.id)),v=h&&F.getFullYear()===I&&F.getMonth()===L&&m===F.getDate(),w=i.reduce((e,t,n)=>f>=t.record.date&&f<=(t.record.endDate||t.record.date)?Math.max(e,n):e,-1),y=-1!==w?(w+1)*30+8:0;return(0,r.jsxs)("div",{className:(0,p.cn)("relative p-2 border-r border-b border-white/5 bg-[#1C1C1E] group transition-colors",0===e&&"border-l border-white/5",0===e&&n===J.length-1&&"rounded-bl-xl",6===e&&n===J.length-1&&"rounded-br-xl",z===f&&"bg-white/10 ring-2 ring-white/20 ring-inset"),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",h&&z!==f&&E(f)},onDragLeave:()=>{E(null)},onDrop:e=>{e.preventDefault(),E(null);let t=e.dataTransfer.getData("text/plain");t&&h&&u(t,f)},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("span",{className:(0,p.cn)("text-sm font-medium w-6 h-6 flex items-center justify-center rounded-full",v&&"today-indicator",!h&&"opacity-30",v?"bg-[#df5252] text-white":0===e?"text-red-400":6===e?"text-blue-400":"text-[#E0E0E0]"),children:m}),h&&!b&&(0,r.jsx)("button",{"aria-label":"ì¶ê²° ê¸°ë¡ ì¶ê°",onClick:e=>{e.stopPropagation(),c(f,!0)},className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-white/10 rounded text-[#8E8E93] hover:text-white transition transform hover:scale-110 active:scale-95",children:(0,r.jsx)(o.Z,{size:14,strokeWidth:3})})]}),(0,r.jsx)("div",{className:"space-y-1",style:{marginTop:y>0?"".concat(y,"px"):void 0},children:g.map(e=>(0,r.jsxs)("div",{draggable:!0,onDragStart:t=>{t.dataTransfer.setData("text/plain",e.id),t.dataTransfer.effectAllowed="move",t.target.style.opacity="0.5"},onDragEnd:e=>{e.target.style.opacity="1"},onClick:()=>c(f,!1),className:(0,p.cn)("text-xs px-2 py-1 rounded bg-[#2C2C2E] border border-white/5 text-[#E0E0E0] truncate hover:bg-[#3A3A3C] transition-colors cursor-grab active:cursor-grabbing select-none shadow-sm flex items-center group/attendance attendance-block",!h&&"opacity-50"),children:[e.submitted&&(0,r.jsx)(l.Z,{size:12,className:"text-green-400 mr-1.5 shrink-0",strokeWidth:3}),(0,r.jsx)("span",{className:"font-semibold text-white/90 mr-1.5",children:e.studentName}),(0,r.jsxs)("span",{className:"opacity-70",children:[e.reason," ",e.type]}),(0,r.jsx)("div",{className:"ml-auto flex items-center gap-1",children:(0,r.jsx)("button",{"aria-label":"ìì ",onClick:t=>{t.stopPropagation(),x(e.id)},className:"opacity-0 group-hover/attendance:opacity-100 p-0.5 rounded-md text-red-500/70 hover:text-red-500 transition",children:(0,r.jsx)(d.Z,{size:12})})})]},e.id))})]},e)})]}),(0,r.jsx)("div",{className:"hidden md:block bg-[#09090b]"}),(0,r.jsx)("div",{className:(0,p.cn)("hidden md:block bg-[#1C1C1E] border-l border-r border-b border-white/5 p-2",n===J.length-1&&"rounded-b-xl"),children:(0,r.jsx)("textarea",{value:O[n]||"",onChange:e=>U(n,e.target.value),className:"w-full h-full bg-transparent text-sm text-[#E0E0E0] placeholder:text-[#5C5C5E] resize-none focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 leading-relaxed",placeholder:""})})]},n)})})]})})]})},eM=null;function eI(){let e;let t=(0,a.useMemo)(()=>Math.random().toString(36).slice(2,7),[]),n=(0,a.useRef)(!1);(0,a.useEffect)(()=>
1(n.current=!0,console.log("--- [AttendanceView:".concat(t,"] MOUNTED ---")),()=>{n.current=!1,console.log("--- [AttendanceView:".concat(t,"] UNMOUNTED ---")),eM===t&&(eM=null,console.log("[AttendanceView:".concat(t,"] Released global lock on unmount")))}),[t]);let i=(0,a.useRef)(!1),{students:s,isLoaded:l}=(0,f.AF)(),{showToast:m}=(0,k.p)(),N=(0,y.XC)(),{status:S}=(0,v.kP)(),L=(0,w.Dv)(),[A,R]=(0,a.useState)([]),[F,T]=(0,a.useState)("calendar"),[_,Z]=(0,a.useState)("calendar"===F?"all":"thisMonth"),[O,U]=(0,a.useState)(()=>new Date),[B,P]=(0,a.useState)("all"),[V,W]=(0,a.useState)(!1),[H,K]=(0,a.useState)(!1),[X,G]=(0,a.useState)(!1),[J,$]=(0,a.useState)(""),[Q,ee]=(0,a.useState)(!1),[et,en]=(0,a.useState)(!1),er=(0,a.useRef)([]),ea=(0,a.useRef)(new Map);(0,a.useEffect)(()=>{er.current=A},[A]),(0,a.useEffect)(()=>{"calendar"===F&&Z("all")},[F]);let ei=(0,a.useRef)({});(0,a.useRef)(new Set);let es=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(n.current){if(i.current){console.log("[AttendanceView:".concat(t,"] denied: local loadingRef is true"));return}if(eM&&eM!==t&&!e){console.log("[AttendanceView:".concat(t,"] denied: Global lock held by ").concat(eM));return}if(!l){console.log("[AttendanceView:".concat(t,"] denied: StudentContext not loaded"));return}if("loading"===S){console.log("[AttendanceView:".concat(t,"] denied: status is loading"));return}console.log("[AttendanceView:".concat(t,"] Triggering loadRecords:"),_),i.current=!0,eM=t,r&&en(!0);try{if(L){let e=await (0,Y.getGuestData)();if(n.current){let t=e.attendanceRecords||[];0===t.length&&(t=(await (0,Y.generateMockData)()).attendanceRecords||[],await (0,Y.saveGuestData)("attendanceRecords",t)),R(t),ea.current=new Map(t.map(e=>[e.id,e]))}return}let e="thisMonth"===_?ey(0):"lastMonth"===_?ey(-1):{...(()=>{let e=new Date,t=e.getFullYear(),n=2>e.getMonth()?t-1:t,r=new Date(n,2,1),a=new Date(n+1,2,0);return{start:eg(r),end:eg(a)}})()};console.log("[AttendanceView:".concat(t,"] calling server action getAttendanceRecords with:"),e);let a=await (0,b.X)("getAttendanceRecords",{startDate:e.start,endDate:e.end},N);if(console.log("[AttendanceView:".concat(t,"] server action result:"),a.success),!n.current)return;a.success&&a.data?(R(a.data),ea.current=new Map(a.data.map(e=>[e.id,e]))):(console.error("[AttendanceView:".concat(t,"] Load failed:"),a.error),r&&m("ì¶ê²° 기ë¡ì ë¶ë¬ì¤ëë° ì¤í¨íìµëë¤","error"))}catch(e){console.error("[AttendanceView:".concat(t,"] Load error:"),e)}finally{n.current&&(en(!1),i.current=!1),eM===t&&(eM=null)}}},[L,_,m,N,S,t,l]);(0,a.useEffect)(()=>{("authenticated"===S||L)&&l&&es()},[es,S,l,L]),(0,a.useEffect)(()=>{if(et){let e=setTimeout(()=>{n.current&&et&&(console.log("[AttendanceView:".concat(t,"] Safety net triggered: forcing loading to false after 15s")),en(!1),i.current=!1,eM===t&&(eM=null))},15e3);return()=>clearTimeout(e)}},[et,t]);let el=(0,a.useCallback)(async e=>{let t=e=>(er.current=e,e);R(n=>n.find(t=>t.id===e.id)?t(n.map(t=>t.id===e.id?e:t)):t([...n,e]));let n=()=>{let n=ea.current.get(e.id);R(r=>{let a=r.find(t=>t.id===e.id);return a&&eE(a)===eE(e)?t(n?r.map(t=>t.id===e.id?n:t):r.filter(t=>t.id!==e.id)):r})};if(L){let t;let n=(await (0,Y.getGuestData)()).attendanceRecords||[];return t=n.findIndex(t=>t.id===e.id)>=0?n.map(t=>t.id===e.id?e:t):[...n,e],await (0,Y.saveGuestData)("attendanceRecords",t),ea.current.set(e.id,e),!0}if(!e.studentId)return console.log("Skipping save - no studentId:",e.id),!1;console.log("Saving record:",e.id,"studentId:",e.studentId);try{var r;let t=s.find(t=>t.id===e.studentId),a=t?{name:t.name,number:t.number,grade:t.grade||1,homeClassId:t.homeClassId}:void 0;a||console.warn("Student details not found for:",e.studentId);let i=await (0,b.X)("upsertAttendanceRecord",{id:e.id&&e.id.startsWith("record-")?void 0:e.id,studentId:e.studentId,date:e.date,endDate:e.endDate,type:e.type,reason:e.reason,period:null!==(r=e.period)&&void 0!==r?r:null,details:e.details,submitted:e.submitted,studentDetails:a},N);if(console.log("Save result:",i.success?"SUCCESS":"FAILED",i.error||""),i.success&&i.data){i.audit&&(0,g.dp)(i.audit);let t=i.data.id||e.id,n={...e,id:t};return e.id!==t&&ea.current.delete(e.id),ea.current.set(t,n),e.id&&e.id.startsWith("record-")&&t!==e.id&&(R(t=>{let r=t.map(t=>
1t.id===e.id?n:t);return er.current=r,r}),delete ei.current[e.id]),!0}return console.error("Save failed:",i.error),m(i.error||"ì¶ê²°ì ì ì¥íì§ ëª»íìµëë¤. ë¤ì ìëí´ ì£¼ì¸ì.","error"),n(),!1}catch(e){return console.error("Save error:",e),m("ì¶ê²°ì ì ì¥íì§ ëª»íìµëë¤. ë¤ì ìëí´ ì£¼ì¸ì.","error"),n(),!1}},[s,L,N,m]),ed=(0,a.useRef)(void 0);ed.current=()=>{for(let e of Object.keys(ei.current)){clearTimeout(ei.current[e]),delete ei.current[e];let t=er.current.find(t=>t.id===e);t&&t.studentId&&el(t)}},(0,a.useEffect)(()=>{let e=()=>{var e;"hidden"===document.visibilityState&&(null===(e=ed.current)||void 0===e||e.call(ed))},t=()=>{var e;return null===(e=ed.current)||void 0===e?void 0:e.call(ed)};return document.addEventListener("visibilitychange",e),window.addEventListener("pagehide",t),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pagehide",t)}},[]);let eo=async(e,t)=>{if(L)return eh();let n=er.current.find(t=>t.id===e);if(!n){console.log("updateRecordFields: Record not found",e);return}let r={...n,...t};R(t=>{let n=t.map(t=>t.id===e?r:t);return er.current=n,n}),r.studentId&&(ei.current[e]&&clearTimeout(ei.current[e]),ei.current[e]=setTimeout(async()=>{await el(r)},500))},ec=(e,t,n)=>eo(e,{[t]:n}),eu=async(e,t,n)=>{if(L)return eh();if(!t)return;ei.current[e]&&(clearTimeout(ei.current[e]),delete ei.current[e]);let r=er.current.find(t=>t.id===e);if(!r){console.log("updateStudentInfo: Record not found",e);return}let a={...r,studentId:t,studentName:n};R(t=>{let n=t.map(t=>t.id===e?a:t);return er.current=n,n}),console.log("updateStudentInfo: Saving record immediately",a.id),await el(a)},ex=(0,a.useRef)([]);(0,a.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"KeyZ"===e.code&&!e.shiftKey){console.log("[Attendance:Undo] Shortcut detected. Stack size: ".concat(ex.current.length));let e=ex.current.pop();e?(console.log("Undoing deletion for attendance record:",e.id),el({...e,id:"record-".concat(Date.now())}).then(t=>{t?m("ìì ë ì¶ê²° 기ë¡ì 복구íìµëë¤.","success"):ex.current.push(e)})):console.log("[Attendance:Undo] No record to restore in stack")}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[el,m]);let em=async e=>{let t;if(R(n=>{t=n.find(t=>t.id===e),console.log("[Attendance:deleteRecord] ID: ".concat(e,", Found: ").concat(!!t)),t&&ex.current.push(t);let r=n.filter(t=>t.id!==e);return er.current=r,r}),L){let t=((await (0,Y.getGuestData)()).attendanceRecords||[]).filter(t=>t.id!==e);await (0,Y.saveGuestData)("attendanceRecords",t);return}e&&!e.startsWith("record-")&&await (0,b.X)("deleteAttendanceRecord",{id:e},N)},eh=(0,a.useCallback)(()=>(m("ìì íë©´ììë ìì í ì ììµëë¤.","info"),!0),[m]),ep=["ì§ë³","미ì¸ì ","기í","ì¸ì "],ek=["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"],eN=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];$(e),ee(t),K(!0)},[]),ez=(0,a.useCallback)(async(e,t)=>{if(L)return eh();let n=er.current.find(t=>t.id===e);if(!n)return;let r=ev(n.date),a=Math.round((ev(t).getTime()-r.getTime())/864e5),i={...n,date:t};if(n.endDate){let e=new Date(ev(n.endDate));e.setDate(e.getDate()+a),i.endDate=eg(e)}R(t=>{let n=t.map(t=>t.id===e?i:t);return er.current=n,n}),i.studentId&&(ei.current[e]&&clearTimeout(ei.current[e]),ei.current[e]=setTimeout(async()=>{await el(i)},500))},[L,eh,el]),eI=(0,a.useCallback)(async e=>{var t,n;if(!e.studentId)return;let r={id:e.id||"record-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,5)),studentId:e.studentId,studentName:e.studentName||"",reason:e.reason||null,type:e.type||null,period:null!==(t=e.period)&&void 0!==t?t:null,date:e.date||ew(),endDate:e.endDate,details:e.details||"",submitted:null!==(n=e.submitted)&&void 0!==n&&n,createdAt:e.createdAt||new Date().toISOString()};R(e=>{let t=e.find(e=>e.id===r.id)?e.map(e=>e.id===r.id?r:e):[...e,r];return er.current=t,t}),await el(r)},[el]),eL=(0,a.useCallback)(e=>{if(0===e.length)return;let t=new Set(e);for(let t of e)ei.current[t]&&(clearTimeout(ei.current[t]),delete ei.current[t]);R(e=>{let n=e.map(e=>t.has(e.id)?{...e,submitted:!0}:e);return er.current=n,n})},[]),eA=(0,a.useMemo)(()=>new Map(s.map(e=>[e.id,e])),[s]),eR=e=>e?eA.get(e):void 0,eF=(0,a.useMemo)(()=>[...A].filter(e=>"all"===B||e.type===B).sort((e,t)=>
1{var n,r;let a=t.date.localeCompare(e.date);if(0!==a)return a;let i=eR(e.studentId),s=eR(t.studentId),l=null!==(n=null==i?void 0:i.number)&&void 0!==n?n:999,d=null!==(r=null==s?void 0:s.number)&&void 0!==r?r:999;return l!==d?l-d:t.createdAt.localeCompare(e.createdAt)}),[A,B,eA]),eT=(0,a.useMemo)(()=>A.flatMap(eD),[A]),e_=e=>({total:e.length,absent:e.filter(e=>"ê²°ì"===e.type).length,late:e.filter(e=>"ì§ê°"===e.type).length,earlyLeave:e.filter(e=>"ì¡°í´"===e.type).length,missing:e.filter(e=>"ê²°ê³¼"===e.type).length}),eZ=(0,a.useMemo)(()=>e_(eT),[eT]),eO=(0,a.useMemo)(()=>{if("calendar"!==F)return eZ;let{start:e,end:t}=ej(O);return e_(eT.filter(n=>n.date>=e&&n.date<=t))},[F,eT,O,eZ]),eU=(0,a.useMemo)(()=>eF.flatMap(e=>{let t=eD(e);return t.map(n=>({...n,uniqueKey:1===t.length?e.id:"".concat(e.id,"-").concat(n.date)}))}).sort((e,t)=>{var n,r,a,i;if(V){let a=(null!==(n=e.studentName)&&void 0!==n?n:"").localeCompare(null!==(r=t.studentName)&&void 0!==r?r:"","ko");if(0!==a)return a;let i=e.date.localeCompare(t.date);if(0!==i)return i;let s=eC(e,t);return 0!==s?s:t.createdAt.localeCompare(e.createdAt)}let s=t.date.localeCompare(e.date);if(0!==s)return s;let l=eC(e,t);if(0!==l)return l;let d=eR(e.studentId),o=eR(t.studentId),c=null!==(a=null==d?void 0:d.number)&&void 0!==a?a:999,u=null!==(i=null==o?void 0:o.number)&&void 0!==i?i:999;return c!==u?c-u:t.createdAt.localeCompare(e.createdAt)}),[eF,V,eA]);return(0,r.jsxs)("div",{className:"h-full flex flex-col p-3 pt-1 gap-3 overflow-y-auto bg-[#fafaf9] dark:bg-[#09090b] relative",children:[(0,r.jsx)("div",{className:"md:hidden absolute inset-0 z-50 overflow-hidden bg-[#FBFBF9] dark:bg-zinc-950",children:(0,r.jsx)(ef,{students:L?s:s.filter(e=>"ë´ì íê¸"===e.homeClassId),records:A,onSaveRecord:el,onDeleteRecord:em})}),(et||"loading"===S&&!(0,w.YY)())&&(0,r.jsx)("div",{className:"absolute inset-0 z-[100] flex items-center justify-center bg-black/5 backdrop-blur-[1px] rounded-2xl",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3 bg-[#1C1C1E] p-6 rounded-2xl border border-white/10 shadow-2xl",children:[(0,r.jsx)(j.W,{size:32}),(0,r.jsx)("div",{className:"text-sm text-[#E0E0E0] font-medium animate-pulse",children:"ì¶ê²° ì 보를 ë¶ë¬ì¤ë ì¤..."})]})}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-y-2 shrink-0 relative",children:[(0,r.jsx)("div",{className:"flex items-center gap-1",children:(0,r.jsxs)("div",{className:"flex items-center p-1 bg-[#1C1C1E] rounded-xl border border-white/5 h-[42px]",children:[(0,r.jsx)(C.s,{value:F,onChange:T,"aria-label":"ì¶ê²° 보기 ë°©ì",className:"h-full",itemClassName:"px-3 h-full rounded-lg attendance-mode-toggle",activeItemClassName:"text-black dark:text-white",inactiveItemClassName:"text-[#8E8E93] hover:text-white",indicatorClassName:"bg-[#EEEEE8] dark:bg-[#333335] shadow-sm",options:[{key:"calendar",label:(0,r.jsx)(c.Z,{size:16}),title:"ë¬ë ¥ 보기",ariaLabel:"ë¬ë ¥ 보기"},{key:"table",label:(0,r.jsx)(u.Z,{size:16}),title:"í 보기",ariaLabel:"í 보기"}]}),(0,r.jsx)("div",{className:"w-px h-6 bg-white/10 mx-1"}),[{key:"all",label:"ì ì²´"},{key:"thisMonth",label:"ì´ë²ë¬"},{key:"lastMonth",label:"ì§ëë¬"}].map(e=>(0,r.jsx)("button",{onClick:()=>"calendar"!==F&&Z(e.key),disabled:"calendar"===F,className:(0,p.cn)("px-4 py-2 rounded-lg text-sm transition attendance-time-filter-btn whitespace-nowrap shrink-0","calendar"===F?"opacity-30 text-[#8E8E93]":_===e.key?"text-white font-bold":"text-[#8E8E93] font-medium hover:text-white"),children:e.label},e.key))]})}),("table"===F||"calendar"===F)&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-3 shrink-0",children:[(0,r.jsx)(C.s,{value:B,onChange:P,"aria-label":"ì¶ê²° ì í íí°",className:"gap-0.5 bg-[#1C1C1E] rounded-xl border border-white/5 p-1 h-[42px]",itemClassName:"gap-1.5 px-2.5 h-full rounded-lg",inactiveItemClassName:"hover:bg-white/5",indicatorClassName:"bg-[#EEEEE8] dark:bg-white/10 shadow-sm",options:[{key:"all",label:"ì ì²´",value:eO.total},{key:"ê²°ì",label:"ê²°ì",value:eO.absent},{key:"ì§ê°",label:"ì§ê°",value:eO.late},{key:"ì¡°í´",label:"ì¡°í´",value:eO.earlyLeave},{key:"ê²°ê³¼",label:"ê²°ê³¼",value:eO.missing}].map(e=>({key:e.key,label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:(0,p.cn)("text-xs font-medium whitespace-nowrap",B===e.ke
1y?"text-black dark:text-[#E0E0E0]":"text-[#E0E0E0]"),children:e.label}),(0,r.jsx)("span",{className:(0,p.cn)("text-sm font-bold tabular-nums",0===e.value?"text-zinc-400 dark:text-[#5C5C5E]":"text-zinc-900 dark:text-white"),children:e.value})]})}))}),(0,r.jsxs)("button",{onClick:()=>{L?window.dispatchEvent(new CustomEvent("open-login-modal")):G(!0)},className:"flex items-center gap-2 px-3 h-[42px] bg-[#1C1C1E] text-white border border-white/10 rounded-xl font-medium text-sm hover:bg-white/5 active:scale-[0.98] transition",title:"naemo ì¶ê²° ë°ì´í°ë¥¼ NEISì ìë ì
ë ¥",children:[(0,r.jsx)(x.Z,{size:14}),"NEIS ìëì
ë ¥"]}),(0,r.jsx)("button",{"aria-label":"ì¶ê²° ê¸°ë¡ ì¶ê°",onClick:"calendar"===F?()=>eN(ew(),!0):()=>{if(L)return eh();let e={id:"record-".concat(Date.now()),studentId:null,studentName:"",reason:null,type:null,date:ew(),details:"",submitted:!1,createdAt:new Date().toISOString()};R(t=>{let n=[e,...t];return er.current=n,n})},className:"flex items-center gap-2 px-4 h-[42px] bg-white text-black rounded-xl font-semibold text-sm hover:bg-white/90 active:scale-[0.98] transition shadow-lg shadow-white/5 attendance-table-add-btn",children:(0,r.jsx)(o.Z,{size:16,strokeWidth:2.5})})]})]}),(0,r.jsx)("div",{className:(0,p.cn)("flex-1","calendar"!==F&&"rounded-2xl bg-[#F8F8F5] dark:bg-[#1C1C1E] border border-zinc-200 dark:border-white/5 overflow-hidden"),children:"calendar"===F?(0,r.jsx)(eS,{records:eF,filter:_,onOpenModal:eN,onMoveRecord:ez,onDeleteRecord:em,onViewDateChange:U}):0!==A.length||et?(0,r.jsxs)("div",{className:"h-full overflow-y-auto custom-scrollbar",children:[(0,r.jsxs)("div",{className:"sticky top-0 grid grid-cols-[1fr_1fr_1fr_1fr_0.5fr_1fr_40px_40px] gap-4 px-5 py-3 bg-[#F8F8F5] dark:bg-[#1C1C1E] border-b border-zinc-200 dark:border-white/5 text-xs text-zinc-500 dark:text-[#8E8E93] font-medium uppercase tracking-wider text-center z-10",children:[(0,r.jsx)("div",{children:"ë ì§"}),(0,r.jsxs)("div",{className:"relative flex items-center justify-center",children:[(0,r.jsx)("span",{children:"ì´ë¦"}),(0,r.jsx)("button",{type:"button",onClick:()=>W(e=>!e),title:V?"ì´ë¦ ì¤ë¦ì°¨ì ì ë ¬ í´ì ":"ì´ë¦ ì¤ë¦ì°¨ì(ã±ã´ã·) ì ë ¬","aria-pressed":V,className:(0,p.cn)("absolute right-0 p-0.5 rounded transition-colors",V?"text-red-500 dark:text-red-400":"text-zinc-400 dark:text-[#6E6E73] hover:text-zinc-600 dark:hover:text-zinc-300"),children:(0,r.jsx)(h,{className:"w-3.5 h-3.5"})})]}),(0,r.jsx)("div",{children:"구ë¶"}),(0,r.jsx)("div",{children:"ì í"}),(0,r.jsx)("div",{children:"êµì"}),(0,r.jsx)("div",{children:"ì¬ì "}),(0,r.jsx)("div",{children:"ì
ë ¥"}),(0,r.jsx)("div",{})]}),(0,r.jsx)("div",{children:(e="",eU.map((t,n)=>{var a;let i=V?t.studentName:t.date,s=i!==e;return e=i,(0,r.jsxs)("div",{className:(0,p.cn)("grid grid-cols-[1fr_1fr_1fr_1fr_0.5fr_1fr_40px_40px] gap-4 px-5 py-2.5 items-center transition-colors group text-center","bg-[#f8f8f5] dark:bg-transparent border-t",0===n?"border-transparent":"border-zinc-100 dark:border-white/5"),children:[(0,r.jsx)("div",{className:(0,p.cn)("transition",!V&&!s&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:(0,r.jsx)(E.h,{value:t.date,onChange:e=>
1ec(t.id,"date",e),endDate:t.endDate,onEndDateChange:e=>ec(t.id,"endDate",e),className:"py-1"})}),(0,r.jsx)("div",{className:(0,p.cn)("h-[28px] flex items-center rounded-lg transition hover:bg-black/[0.03] dark:hover:bg-white/5 focus-within:bg-black/[0.03] dark:focus-within:bg-white/5",V&&!s&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:(0,r.jsx)(D,{value:t.studentName,studentId:t.studentId,onChange:e=>ec(t.id,"studentName",e),onSelect:(e,n)=>eu(t.id,e,n),className:"px-2 !text-zinc-900 dark:!text-white"})}),(0,r.jsx)(z,{value:t.reason,options:ep,onChange:e=>ec(t.id,"reason",e),className:"attendance-table-pill"}),(0,r.jsx)(z,{value:t.type,options:ek,onChange:e=>{var n;let r={type:e};"ê²°ì"===e?r.period=null:("ì§ê°"===e||"ì¡°í´"===e)&&(null===(n=t.period)||void 0===n?void 0:n.includes(","))&&(r.period=t.period.split(",")[0]),eo(t.id,r)},className:"attendance-table-pill"}),(0,r.jsx)("div",{className:(0,p.cn)("h-[28px] flex items-center rounded-lg transition-colors","ê²°ì"===t.type?"opacity-40":"hover:bg-black/[0.03] dark:hover:bg-white/5 focus-within:bg-black/[0.03] dark:focus-within:bg-white/5"),children:(0,r.jsx)(M,{value:null!==(a=t.period)&&void 0!==a?a:null,onChange:e=>ec(t.id,"period",e),multi:"ê²°ê³¼"===t.type,disabled:"ê²°ì"===t.type,className:(0,p.cn)("px-2 !text-zinc-900 dark:!text-white","placeholder:text-transparent group-hover:placeholder:text-zinc-400 focus:placeholder:text-zinc-400 dark:group-hover:placeholder:text-[#5C5C5E] dark:focus:placeholder:text-[#5C5C5E] attendance-cell-input")})}),(0,r.jsx)("input",{type:"text",value:t.details,onChange:e=>ec(t.id,"details",e.target.value),placeholder:"ë´ì© ì
ë ¥",className:"bg-transparent text-sm text-zinc-900 dark:text-white placeholder:text-transparent group-hover:placeholder:text-zinc-400 focus:placeholder:text-zinc-400 dark:group-hover:placeholder:text-[#5C5C5E] dark:focus:placeholder:text-[#5C5C5E] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 w-full px-2 py-1 rounded-lg hover:bg-black/[0.03] dark:hover:bg-white/5 focus:bg-black/[0.03] dark:focus:bg-white/5 transition-colors text-center attendance-detail-input attendance-cell-input"}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("input",{type:"checkbox",checked:t.submitted,onChange:e=>ec(t.id,"submitted",e.target.checked),className:"w-4 h-4 accent-[#3b82f6] cursor-pointer"})}),(0,r.jsx)("button",{"aria-label":"ìì ",onClick:()=>em(t.id),className:"opacity-0 group-hover:opacity-100 p-1.5 rounded-lg text-[#5C5C5E] hover:text-red-500 transition flex items-center justify-center",children:(0,r.jsx)(d.Z,{size:14})})]},t.uniqueKey)}))})]}):(0,r.jsx)("div",{className:"h-full flex items-center justify-center p-8",children:(0,r.jsx)(eb.Z,{size:"lg",title:"ì¶ê²° 기ë¡ì´ ììµëë¤",description:"'ì¶ê²° ì¶ê°' ë²í¼ì ëë¬ ì ì¶ê²° ë³ë ë´ìì ë±ë¡íì¸ì.",action:(0,r.jsxs)("button",{onClick:()=>eN(ew(),!0),className:"px-5 py-2.5 bg-zinc-900 hover:bg-black dark:bg-white dark:hover:bg-zinc-100 text-white dark:text-zinc-900 rounded-xl text-sm font-semibold transition-all shadow-sm active:scale-95 flex items-center gap-1.5",children:[(0,r.jsx)(o.Z,{size:16}),"ì¶ê²° ì¶ê°í기"]})})})}),H&&(0,r.jsx)(I,{isOpen:H,onClose:()=>K(!1),onSave:eI,onDelete:em,initialDate:J,existingRecords:J?A.filter(e=>e.date===J||e.endDate&&e.date<=J&&e.endDate>=J):[],autoAddRow:Q}),X&&(0,r.jsx)(q,{isOpen:X,onClose:()=>G(!1),onSynced:eL,defaultStart:ey(0).start,defaultEnd:ey(0).end})]})}},46173:function(e,t,n){n.d(t,{OL:function(){return r},on:function(){return d}});let r=["ì¡°í","1êµì","2êµì","3êµì","4êµì","5êµì","6êµì","7êµì","ì¢
ë¡"],a={fg:"#5B429E",darkFg:"#B29FEA"},i={ê²°ì:{fg:"#C40000",darkFg:"#FF5A5A"},ì¡°í´:a,ì§ê°:a,ê²°ê³¼:a},s={fg:"#52525B",darkFg:"#A1A1AA"},l={ì§ë³:s,ì¸ì :s,미ì¸ì :s,기í:s},d=e=>{var t;return null!==(t=i[e])&&void 0!==t?t:l[e]}},13376:function(e,t,n){n.d(t,{dp:function(){return a}});let r=[];function a(e){e&&(r.push(e),r.length>100&&r.shift())}},25450:function(e,t,n){n.d(t,{Fk:function(){return a}});var r=n(93448);function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return(0,r.cn)("inline-flex items-center justify-center h-8 px-3 rounded-full text-[13px] transition active:scale-[0.96]",e?"bg-white dark:bg-[#1C1C1E] text-zinc-900 dark:text-zinc-100 font-semibold border border-zinc-200/90 dark:border-white/[0.12] shadow-[0_1px_2px_rgba(0,0,0,0.04)]":"bg-zinc-100/80 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 font-medium border border-transparent",...n)}},52345:function(e,t,n){n.d(t,{J:function(){return s}});var r=n(47435),a=n(4662),i=n(2265);function s(){r.O.current||(0,a.Ad)();let[e]=(0,i.useState)(r.n.current);return e}}}]);
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.